From 7561a8e8bacaab73829ed368642b7664fcb8b492 Mon Sep 17 00:00:00 2001 From: ludo Date: Sat, 9 Dec 2023 21:02:28 +0100 Subject: [PATCH] minor fixes --- .../Admin/Shop/CustomersDataTable.php | 8 + .../Admin/Shop/DeliveriesDataTable.php | 10 +- .../Admin/Shop/SaleChannelsDataTable.php | 3 +- .../Admin/Shop/CustomerAddressController.php | 2 +- .../Admin/Shop/CustomerController.php | 7 +- .../Admin/Shop/DeliveryController.php | 15 +- .../Admin/Shop/InvoiceController.php | 2 +- .../Admin/Shop/InvoicePaymentController.php | 2 +- .../Admin/Shop/PriceListController.php | 3 - .../Admin/Shop/ProducerController.php | 1 - .../Admin/Shop/TariffController.php | 3 - .../Admin/Shop/VariationController.php | 2 - .../Controllers/Shop/BasketController.php | 3 +- .../Controllers/Shop/CategoryController.php | 3 - .../Controllers/Shop/CustomerController.php | 5 +- app/Http/Controllers/Shop/OrderController.php | 4 +- app/Models/Shop/ArticleNature.php | 2 +- app/Models/Shop/Customer.php | 19 +- app/Models/Shop/CustomerDelivery.php | 8 +- app/Models/Shop/CustomerSaleChannel.php | 36 ++++ app/Models/Shop/Delivery.php | 5 + app/Models/Shop/SaleChannel.php | 15 ++ app/Repositories/Shop/ArticleNatures.php | 2 +- app/Repositories/Shop/Articles.php | 10 +- app/Repositories/Shop/Baskets.php | 6 +- .../Shop/CustomerSaleChannels.php | 21 ++ app/Repositories/Shop/Customers.php | 82 ++++--- app/Repositories/Shop/Deliveries.php | 7 + .../Shop/DeliveryTypeCalculations.php | 2 +- app/Repositories/Shop/InvoicePayments.php | 2 +- app/Repositories/Shop/Merchandises.php | 3 +- app/Repositories/Shop/Offers.php | 4 +- app/Repositories/Shop/Orders.php | 1 + app/Repositories/Shop/PriceLists.php | 3 +- app/Repositories/Shop/Shelves.php | 5 +- app/Repositories/Shop/Tariffs.php | 1 + app/Repositories/Shop/Variations.php | 2 +- app/Traits/Model/Basic.php | 1 + app/Traits/Model/Imageable.php | 2 +- composer.json | 6 +- resources/lang/fr/shop.php | 22 +- .../views/Admin/Shop/Articles/list.blade.php | 46 ++-- .../views/Admin/Shop/Customers/form.blade.php | 202 +++++++++--------- .../views/Admin/Shop/Customers/list.blade.php | 19 +- .../Shop/Customers/partials/filters.blade.php | 14 ++ .../Admin/Shop/Deliveries/list.blade.php | 38 ++-- .../Deliveries/partials/filters.blade.php | 15 +- .../Admin/Shop/InvoicePayments/form.blade.php | 15 +- .../views/Admin/Shop/Packages/list.blade.php | 25 ++- 49 files changed, 448 insertions(+), 266 deletions(-) create mode 100644 app/Models/Shop/CustomerSaleChannel.php create mode 100644 app/Repositories/Shop/CustomerSaleChannels.php create mode 100644 resources/views/Admin/Shop/Customers/partials/filters.blade.php diff --git a/app/Datatables/Admin/Shop/CustomersDataTable.php b/app/Datatables/Admin/Shop/CustomersDataTable.php index e5b3d7a1..4f7ae12b 100644 --- a/app/Datatables/Admin/Shop/CustomersDataTable.php +++ b/app/Datatables/Admin/Shop/CustomersDataTable.php @@ -13,10 +13,18 @@ class CustomersDataTable extends DataTable public function query(Customer $model) { $model = $model->with('addresses'); + $model = self::filterBySaleChannel($model); return $this->buildQuery($model); } + public static function filterBySaleChannel($model, $sale_channel_id = false) + { + $sale_channel_id = $sale_channel_id ? $sale_channel_id : self::isFilteredByField('sale_channel_id'); + + return $sale_channel_id ? $model->bySaleChannel($sale_channel_id) : $model; + } + protected function getColumns() { return [ diff --git a/app/Datatables/Admin/Shop/DeliveriesDataTable.php b/app/Datatables/Admin/Shop/DeliveriesDataTable.php index 3a232c98..e4ca357f 100644 --- a/app/Datatables/Admin/Shop/DeliveriesDataTable.php +++ b/app/Datatables/Admin/Shop/DeliveriesDataTable.php @@ -13,10 +13,18 @@ class DeliveriesDataTable extends DataTable public function query(Delivery $model) { $model = $model->with('sale_channel'); + $model = self::filterBySaleChannel($model); return $this->buildQuery($model); } + public static function filterBySaleChannel($model, $sale_channel_id = false) + { + $sale_channel_id = $sale_channel_id ? $sale_channel_id : self::isFilteredByField('sale_channel_id'); + + return $sale_channel_id ? $model->bySaleChannel($sale_channel_id) : $model; + } + public function modifier($datatables) { $datatables @@ -26,7 +34,7 @@ class DeliveriesDataTable extends DataTable 'on' => __('active'), 'off' => __('inactive'), 'meta' => 'data-id='.$delivery->id, - 'size' => 'sm', + 'size' => 'xs', ]); }) ->editColumn('is_public', function (Delivery $delivery) { diff --git a/app/Datatables/Admin/Shop/SaleChannelsDataTable.php b/app/Datatables/Admin/Shop/SaleChannelsDataTable.php index 0ccfdc81..1f142132 100644 --- a/app/Datatables/Admin/Shop/SaleChannelsDataTable.php +++ b/app/Datatables/Admin/Shop/SaleChannelsDataTable.php @@ -12,7 +12,7 @@ class SaleChannelsDataTable extends DataTable public function query(SaleChannel $model) { - $model = $model->withCount(['deliveries', 'tariffs']); + $model = $model->withCount(['customers', 'deliveries', 'tariffs']); return $this->buildQuery($model); } @@ -22,6 +22,7 @@ class SaleChannelsDataTable extends DataTable return [ Column::make('code')->title('Code abrégé')->width(100), Column::make('name')->title('Nom'), + Column::make('customers_count')->title('#Clients')->searchable(false)->class('text-right'), Column::make('deliveries_count')->title('#Distrib')->searchable(false)->class('text-right'), Column::make('tariffs_count')->title('#Tarifs')->searchable(false)->class('text-right'), $this->makeColumnButtons(), diff --git a/app/Http/Controllers/Admin/Shop/CustomerAddressController.php b/app/Http/Controllers/Admin/Shop/CustomerAddressController.php index 11ea7a62..43900b93 100644 --- a/app/Http/Controllers/Admin/Shop/CustomerAddressController.php +++ b/app/Http/Controllers/Admin/Shop/CustomerAddressController.php @@ -2,7 +2,7 @@ namespace App\Http\Controllers\Admin\Shop; -use App\Datatables\Shop\CustomerAddressesDataTable; +use App\Datatables\Admin\Shop\CustomerAddressesDataTable; use App\Repositories\Shop\CustomerAddresses; use Illuminate\Http\Request; diff --git a/app/Http/Controllers/Admin/Shop/CustomerController.php b/app/Http/Controllers/Admin/Shop/CustomerController.php index fb1ecb7e..02a8a3b4 100644 --- a/app/Http/Controllers/Admin/Shop/CustomerController.php +++ b/app/Http/Controllers/Admin/Shop/CustomerController.php @@ -5,21 +5,20 @@ namespace App\Http\Controllers\Admin\Shop; use App\Datatables\Admin\Shop\CustomerAddressesDataTable; use App\Datatables\Admin\Shop\CustomersDataTable; use App\Repositories\Shop\Customers; -use App\Repositories\Shop\Deliveries; use Illuminate\Http\Request; class CustomerController extends Controller { public function index(CustomersDataTable $dataTable) { - $data = []; + $data = Customers::init(); return $dataTable->render('Admin.Shop.Customers.list', $data); } public function create() { - $data['deliveries'] = Deliveries::getOptions(); + $data = Customers::init(); return view('Admin.Shop.Customers.create', $data); } @@ -40,8 +39,8 @@ class CustomerController extends Controller public function edit($id) { + $data = Customers::init(); $data['customer'] = Customers::edit($id); - $data['deliveries'] = Deliveries::getOptions(); $model = new CustomerAddressesDataTable(); $data['customer_addresses'] = $model->html(); diff --git a/app/Http/Controllers/Admin/Shop/DeliveryController.php b/app/Http/Controllers/Admin/Shop/DeliveryController.php index cd019d1c..1c4c3c01 100644 --- a/app/Http/Controllers/Admin/Shop/DeliveryController.php +++ b/app/Http/Controllers/Admin/Shop/DeliveryController.php @@ -4,21 +4,20 @@ namespace App\Http\Controllers\Admin\Shop; use App\Datatables\Admin\Shop\DeliveriesDataTable; use App\Repositories\Shop\Deliveries; -use App\Repositories\Shop\SaleChannels; use Illuminate\Http\Request; class DeliveryController extends Controller { public function index(DeliveriesDataTable $dataTable) { - return $dataTable->render('Admin.Shop.Deliveries.list'); + $data = Deliveries::init(); + + return $dataTable->render('Admin.Shop.Deliveries.list', $data); } public function create() { - $data = [ - 'sale_channels' => SaleChannels::getOptions(), - ]; + $data = Deliveries::init(); return view('Admin.Shop.Deliveries.create', $data); } @@ -41,10 +40,8 @@ class DeliveryController extends Controller public function edit($id) { - $data = [ - 'delivery' => Deliveries::get($id)->toArray(), - 'sale_channels' => SaleChannels::getOptions(), - ]; + $data = Deliveries::init(); + $data['delivery'] = Deliveries::getArray($id); return view('Admin.Shop.Deliveries.edit', $data); } diff --git a/app/Http/Controllers/Admin/Shop/InvoiceController.php b/app/Http/Controllers/Admin/Shop/InvoiceController.php index 15985678..b24ed766 100644 --- a/app/Http/Controllers/Admin/Shop/InvoiceController.php +++ b/app/Http/Controllers/Admin/Shop/InvoiceController.php @@ -2,8 +2,8 @@ namespace App\Http\Controllers\Admin\Shop; -use App\Datatables\Admin\Shop\InvoicesDataTable; use App\Datatables\Admin\Shop\InvoicePaymentsDataTable; +use App\Datatables\Admin\Shop\InvoicesDataTable; use App\Http\Controllers\Controller; use App\Repositories\Shop\Invoices; use Illuminate\Http\Request; diff --git a/app/Http/Controllers/Admin/Shop/InvoicePaymentController.php b/app/Http/Controllers/Admin/Shop/InvoicePaymentController.php index ac682c7b..3a1faf20 100644 --- a/app/Http/Controllers/Admin/Shop/InvoicePaymentController.php +++ b/app/Http/Controllers/Admin/Shop/InvoicePaymentController.php @@ -18,7 +18,7 @@ class InvoicePaymentController extends Controller { $data = InvoicePayments::init(); - return view('Admin.Shop.InvoicePayments.create' , $data); + return view('Admin.Shop.InvoicePayments.create', $data); } public function store(Request $request) diff --git a/app/Http/Controllers/Admin/Shop/PriceListController.php b/app/Http/Controllers/Admin/Shop/PriceListController.php index 94560702..1c596271 100644 --- a/app/Http/Controllers/Admin/Shop/PriceListController.php +++ b/app/Http/Controllers/Admin/Shop/PriceListController.php @@ -5,9 +5,6 @@ namespace App\Http\Controllers\Admin\Shop; use App\Datatables\Admin\Shop\PriceListsDataTable; use App\Http\Controllers\Controller; use App\Repositories\Shop\PriceLists; -use App\Repositories\Shop\SaleChannels; -use App\Repositories\Shop\Tariffs; -use App\Repositories\Shop\Taxes; use Illuminate\Http\Request; class PriceListController extends Controller diff --git a/app/Http/Controllers/Admin/Shop/ProducerController.php b/app/Http/Controllers/Admin/Shop/ProducerController.php index 22f667c1..5829966f 100644 --- a/app/Http/Controllers/Admin/Shop/ProducerController.php +++ b/app/Http/Controllers/Admin/Shop/ProducerController.php @@ -4,7 +4,6 @@ namespace App\Http\Controllers\Admin\Shop; use App\Datatables\Admin\Shop\ProducersDataTable; use App\Repositories\Shop\Producers; -use App\Repositories\Shop\TagGroups; use Illuminate\Http\Request; class ProducerController extends Controller diff --git a/app/Http/Controllers/Admin/Shop/TariffController.php b/app/Http/Controllers/Admin/Shop/TariffController.php index 2fcf89d3..f9c92c3e 100644 --- a/app/Http/Controllers/Admin/Shop/TariffController.php +++ b/app/Http/Controllers/Admin/Shop/TariffController.php @@ -2,11 +2,8 @@ namespace App\Http\Controllers\Admin\Shop; -use App\Datatables\Admin\Shop\PriceListsDataTable; use App\Datatables\Admin\Shop\TariffsDataTable; -use App\Repositories\Shop\SaleChannels; use App\Repositories\Shop\Tariffs; -use App\Repositories\Shop\TariffUnities; use Illuminate\Http\Request; class TariffController extends Controller diff --git a/app/Http/Controllers/Admin/Shop/VariationController.php b/app/Http/Controllers/Admin/Shop/VariationController.php index 05b67075..ccb8ca41 100644 --- a/app/Http/Controllers/Admin/Shop/VariationController.php +++ b/app/Http/Controllers/Admin/Shop/VariationController.php @@ -4,8 +4,6 @@ namespace App\Http\Controllers\Admin\Shop; use App\Datatables\Admin\Shop\VariationsDataTable; use App\Http\Requests\Admin\Shop\StoreVariationPost; -use App\Repositories\Shop\Packages; -use App\Repositories\Shop\Unities; use App\Repositories\Shop\Variations; use Illuminate\Http\Request; diff --git a/app/Http/Controllers/Shop/BasketController.php b/app/Http/Controllers/Shop/BasketController.php index 292cb7ea..90f69f99 100644 --- a/app/Http/Controllers/Shop/BasketController.php +++ b/app/Http/Controllers/Shop/BasketController.php @@ -5,7 +5,6 @@ namespace App\Http\Controllers\Shop; use App\Http\Controllers\Controller; use App\Repositories\Core\User\ShopCart; use App\Repositories\Shop\Baskets; -use App\Repositories\Shop\Customers; use App\Repositories\Shop\Offers; use App\Repositories\Shop\Orders; use App\Repositories\Users; @@ -66,7 +65,7 @@ class BasketController extends Controller public function getBasketTotal($deliveryId = false, $deliveryTypeId = false) { $data['basket'] = Baskets::getBasketTotal($deliveryId, $deliveryTypeId); - + return view('Shop.Baskets.partials.basketTotal', $data); } diff --git a/app/Http/Controllers/Shop/CategoryController.php b/app/Http/Controllers/Shop/CategoryController.php index 4c93ebd7..3ac9e12e 100644 --- a/app/Http/Controllers/Shop/CategoryController.php +++ b/app/Http/Controllers/Shop/CategoryController.php @@ -3,11 +3,8 @@ namespace App\Http\Controllers\Shop; use App\Http\Controllers\Controller; -use App\Repositories\Shop\ArticleNatures; -use App\Repositories\Shop\Articles; use App\Repositories\Shop\Categories; use App\Repositories\Shop\Shelves; -use App\Repositories\Shop\TagGroups; use Illuminate\Http\Request; class CategoryController extends Controller diff --git a/app/Http/Controllers/Shop/CustomerController.php b/app/Http/Controllers/Shop/CustomerController.php index 16803569..1a248a69 100644 --- a/app/Http/Controllers/Shop/CustomerController.php +++ b/app/Http/Controllers/Shop/CustomerController.php @@ -2,10 +2,9 @@ namespace App\Http\Controllers\Shop; -use Illuminate\Http\Request; use App\Http\Controllers\Controller; - use App\Repositories\Shop\Customers; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; class CustomerController extends Controller @@ -46,7 +45,7 @@ class CustomerController extends Controller dump($data); exit; $customer = Customers::storeFull($data); - + return response()->json(['error' => 0]); } } diff --git a/app/Http/Controllers/Shop/OrderController.php b/app/Http/Controllers/Shop/OrderController.php index 83f4b3b4..08faf57c 100644 --- a/app/Http/Controllers/Shop/OrderController.php +++ b/app/Http/Controllers/Shop/OrderController.php @@ -25,7 +25,7 @@ class OrderController extends Controller public function view($uuid) { $data['order'] = Orders::view($uuid); - + return view('Shop.Orders.view', $data); } @@ -67,7 +67,7 @@ class OrderController extends Controller if ($order) { if ($data['payment_type'] == '1') { return Paybox::makeAuthorizationRequest($data['basket']['total_shipped']); - // return redirect()->route('Shop.Payments.online'); + // return redirect()->route('Shop.Payments.online'); } else { return redirect()->route('Shop.Orders.confirmed'); } diff --git a/app/Models/Shop/ArticleNature.php b/app/Models/Shop/ArticleNature.php index 84f88548..6cfe4961 100644 --- a/app/Models/Shop/ArticleNature.php +++ b/app/Models/Shop/ArticleNature.php @@ -60,7 +60,7 @@ class ArticleNature extends Model implements HasMedia return $query->whereIn($this->table.'.id', $ids); } - public function registerMediaConversions(Media $media = null): void + public function registerMediaConversions(?Media $media = null): void { $this->addMediaConversion('thumb')->fit(Manipulations::FIT_MAX, 60, 32)->keepOriginalImageFormat()->nonQueued(); $this->addMediaConversion('normal')->fit(Manipulations::FIT_MAX, 360, 192)->keepOriginalImageFormat()->nonQueued(); diff --git a/app/Models/Shop/Customer.php b/app/Models/Shop/Customer.php index 38f06221..1ff9ffa4 100644 --- a/app/Models/Shop/Customer.php +++ b/app/Models/Shop/Customer.php @@ -21,7 +21,6 @@ class Customer extends Authenticatable protected $casts = ['email_verified_at' => 'datetime']; - public function delivery_addresses() { return $this->addresses()->byDelivery(); @@ -31,7 +30,6 @@ class Customer extends Authenticatable { return $this->addresses()->byInvoicing(); } - public function addresses() { @@ -43,11 +41,21 @@ class Customer extends Authenticatable return $this->hasMany(CustomerDelivery::class); } + public function customer_sale_channels() + { + return $this->hasMany(CustomerSaleChannel::class); + } + public function deliveries() { return $this->belongsToMany(Delivery::class, CustomerDelivery::class); } + public function sale_channels() + { + return $this->belongsToMany(SaleChannel::class, CustomerSaleChannel::class)->wherePivotNull('deleted_at'); + } + public function invoices() { return $this->hasMany(Invoice::class); @@ -58,6 +66,13 @@ class Customer extends Authenticatable return $this->hasMany(Order::class); } + public function scopeBySaleChannel($query, $saleChannelId) + { + return $query->whereHas('sale_channels', function ($query) use ($saleChannelId) { + return $query->byId($saleChannelId); + }); + } + public function sendEmailVerificationNotification() { if (config('boilerplate.auth.verify_email')) { diff --git a/app/Models/Shop/CustomerDelivery.php b/app/Models/Shop/CustomerDelivery.php index 9143c364..14a26287 100644 --- a/app/Models/Shop/CustomerDelivery.php +++ b/app/Models/Shop/CustomerDelivery.php @@ -20,13 +20,13 @@ class CustomerDelivery extends Model return $this->belongsTo(Delivery::class); } - public function scopeByCustomer($query, $customer_id) + public function scopeByCustomer($query, $customerId) { - return $query->where($this->table.'.customer_id', $customer_id); + return $query->where($this->table.'.customer_id', $customerId); } - public function scopeByDelivery($query, $customer_id) + public function scopeByDelivery($query, $deliveryId) { - return $query->where($this->table.'.delivery_id', $customer_id); + return $query->where($this->table.'.delivery_id', $deliveryId); } } diff --git a/app/Models/Shop/CustomerSaleChannel.php b/app/Models/Shop/CustomerSaleChannel.php new file mode 100644 index 00000000..9770b4d1 --- /dev/null +++ b/app/Models/Shop/CustomerSaleChannel.php @@ -0,0 +1,36 @@ +belongsTo(Customer::class); + } + + public function sale_channel() + { + return $this->belongsTo(SaleChannel::class); + } + + public function scopeByCustomer($query, $customerId) + { + return $query->where($this->table.'.customer_id', $customerId); + } + + public function scopeBySaleChannel($query, $saleChannelId) + { + return $query->where($this->table.'.sale_channel_id', $saleChannelId); + } +} diff --git a/app/Models/Shop/Delivery.php b/app/Models/Shop/Delivery.php index 914cbad6..30778e48 100644 --- a/app/Models/Shop/Delivery.php +++ b/app/Models/Shop/Delivery.php @@ -67,6 +67,11 @@ class Delivery extends Model return $query->where($this->table.'.at_house', 1); } + public function scopeBySaleChannel($query) + { + return $query->where($this->table.'.sale_channel_id', 1); + } + public function scopeManaged($query) { return $query->byPublic(0); diff --git a/app/Models/Shop/SaleChannel.php b/app/Models/Shop/SaleChannel.php index da3aae6b..6c27b818 100644 --- a/app/Models/Shop/SaleChannel.php +++ b/app/Models/Shop/SaleChannel.php @@ -10,6 +10,16 @@ class SaleChannel extends Model protected $table = 'shop_sale_channels'; + public function customer_sale_channels() + { + return $this->hasMany(CustomerSaleChannel::class); + } + + public function customers() + { + return $this->belongsToMany(Customer::class, CustomerSaleChannel::class)->wherePivotNull('deleted_at'); + } + public function deliveries() { return $this->hasMany(Delivery::class); @@ -29,4 +39,9 @@ class SaleChannel extends Model { return $query->where($this->table.'.code', $code); } + + public function scopeById($query, $id) + { + return $query->where($this->table.'.id', $id); + } } diff --git a/app/Repositories/Shop/ArticleNatures.php b/app/Repositories/Shop/ArticleNatures.php index d7a5b647..67e78cfc 100644 --- a/app/Repositories/Shop/ArticleNatures.php +++ b/app/Repositories/Shop/ArticleNatures.php @@ -29,7 +29,7 @@ class ArticleNatures public static function getIdBySlug($slug) { $model = self::getBySlug($slug); - + return $model ? $model->id : false; } diff --git a/app/Repositories/Shop/Articles.php b/app/Repositories/Shop/Articles.php index b3a53798..3b015de0 100644 --- a/app/Repositories/Shop/Articles.php +++ b/app/Repositories/Shop/Articles.php @@ -4,11 +4,11 @@ namespace App\Repositories\Shop; use App\Models\Shop\Article; use App\Models\Shop\Merchandise; -use App\Traits\Model\Basic; use App\Repositories\Botanic\Species; use App\Repositories\Botanic\Varieties; use App\Repositories\Core\Comments; use App\Repositories\Core\Tag; +use App\Traits\Model\Basic; use App\Traits\Repository\Imageable; use Illuminate\Support\Str; @@ -245,7 +245,7 @@ class Articles public static function getArticleNaturesOptionsWithOffers($options = false) { $ids = self::getArticleNaturesIdsWithOffers($options); - + } public static function getArticleNaturesWithOffers($options = false) @@ -342,7 +342,7 @@ class Articles switch ($product_type) { case 'App\Models\Botanic\Variety': $product = Varieties::get($product_id); - if (!$product) { + if (! $product) { break; } $data[] = [ @@ -358,7 +358,7 @@ class Articles break; case 'App\Models\Botanic\Specie': $product = Species::get($product_id); - if (!$product) { + if (! $product) { break; } $data[] = [ @@ -369,7 +369,7 @@ class Articles break; case 'App\Models\Shop\Merchandise': $product = Merchandises::get($product_id); - if (!$product) { + if (! $product) { break; } $data[] = [ diff --git a/app/Repositories/Shop/Baskets.php b/app/Repositories/Shop/Baskets.php index 9a7928c8..84506611 100644 --- a/app/Repositories/Shop/Baskets.php +++ b/app/Repositories/Shop/Baskets.php @@ -19,7 +19,7 @@ class Baskets public static function getBasketTotal($deliveryId = false, $deliveryTypeId = false) { $saleChannelId = Deliveries::getSaleChannelId($deliveryId); - + return self::getBasketSummary($saleChannelId, $deliveryTypeId); } @@ -41,7 +41,7 @@ class Baskets $totalWeight += $weight; } $shipping = DeliveryTypeCalculations::getPriceByDeliveryType($deliveryTypeId, $totalWeight); - + $data = [ 'detail' => $detail, 'total' => $total, @@ -84,7 +84,7 @@ class Baskets $weight = $offer->weight * $item->quantity; $totalWeight += $weight; } - + return $totalWeight; } diff --git a/app/Repositories/Shop/CustomerSaleChannels.php b/app/Repositories/Shop/CustomerSaleChannels.php new file mode 100644 index 00000000..35c4119b --- /dev/null +++ b/app/Repositories/Shop/CustomerSaleChannels.php @@ -0,0 +1,21 @@ +bySaleChannel($saleChannelId)->delete(); + } + + public static function getModel() + { + return CustomerSaleChannel::query(); + } +} diff --git a/app/Repositories/Shop/Customers.php b/app/Repositories/Shop/Customers.php index 78017600..6e9f73e5 100644 --- a/app/Repositories/Shop/Customers.php +++ b/app/Repositories/Shop/Customers.php @@ -14,6 +14,27 @@ class Customers { use Basic; + public static function init() + { + return [ + 'sale_channels' => SaleChannels::getOptions(), + ]; + } + + public static function getSaleChannelIds($customerId = false) + { + $channels = self::getSaleChannels($customerId); + + return $channels ? $channels->pluck('id')->toArray() : false; + } + + public static function getSaleChannels($customerId = false) + { + $customer = $customerId ? self::get($customerId) : self::getAuth(); + + return $customer ? $customer->sale_channels : SaleChannels::getDefault(); + } + public static function getSaleChannel() { return SaleChannels::getDefault(); @@ -60,7 +81,7 @@ class Customers $filename = self::makeAvatarFilename($customer); $name = $customer->first_name.' '.$customer->last_name; $avatar = new Avatar(); - + return $avatar->create($name) ->setBackground('#F2B90F') ->setForeground('#335012') @@ -129,22 +150,25 @@ class Customers public static function edit($id) { - $customer = self::get($id, ['delivery_addresses', 'invoice_addresses']); + $customer = self::get($id, ['delivery_addresses', 'invoice_addresses', 'sale_channels']); $data = $customer->toArray(); - $data['deliveries'] = $customer->deliveries->pluck('id')->toArray(); + $data['sale_channels'] = $customer->sale_channels->pluck('id')->toArray(); return $data; } public static function storeFull($data) { - $deliveries = $data['deliveries']; - $invoices = $data['invoices']; - unset($data['deliveries']); - unset($data['invoices']); + // $invoices = $data['invoices']; + $saleChannels = $data['sale_channels']; + // unset($data['invoices']); + unset($data['sale_channels']); $customer = self::store($data); - self::storeAddresses($customer, $deliveries); - self::storeAddresses($customer, $invoices); + if ($customer) { + // self::storeAddresses($customer->id, $deliveries); + // self::storeAddresses($customer->id, $invoices); + self::storeSaleChannels($customer->id, $saleChannels); + } return $customer->id; } @@ -163,31 +187,37 @@ class Customers return $customer->deliveries()->sync($deliveries); } - public static function storeAddresses($customer, $addresses) + public static function storeAddresses($customerId, $addresses) { foreach ($addresses as $address) { - $address['customer_id'] = $customer->id; + $address['customer_id'] = $customerId; CustomerAddresses::store($address); } } + public static function storeSaleChannels($customerId, $saleChannels) + { + $oldSaleChannels = self::getSaleChannelIds($customerId); + $deleteSaleChannels = array_diff($oldSaleChannels, $saleChannels); + $newSaleChannels = array_diff($saleChannels, $oldSaleChannels); + + $data = ['customer_id' => $customerId]; + foreach ($newSaleChannels as $saleChannelId) { + $data['sale_channel_id'] = $saleChannelId; + CustomerSaleChannels::store($data); + } + foreach ($deleteSaleChannels as $saleChannelId) { + CustomerSaleChannels::destroyByCustomerAndSaleChannel($customerId, $saleChannelId); + } + } + public static function create($data) { - return Customer::create([ - 'uuid' => Str::uuid(), - 'active' => true, - 'first_name' => $data['first_name'], - 'last_name' => $data['last_name'], - 'company' => $data['company'], - 'tva' => $data['tva'], - 'phone' => $data['phone'], - 'address' => $data['address'], - 'address2' => $data['address2'], - 'zipcode' => $data['zipcode'], - 'city' => $data['city'], - 'email' => $data['email'], - 'password' => bcrypt($data['password']), - ]); + $data['uuid'] = Str::uuid(); + $data['active'] = true; + $data['password'] = bcrypt($data['password']); + + return Customer::create($data); } public static function getStorage($filename = false) diff --git a/app/Repositories/Shop/Deliveries.php b/app/Repositories/Shop/Deliveries.php index 77e1ff9c..c063f621 100644 --- a/app/Repositories/Shop/Deliveries.php +++ b/app/Repositories/Shop/Deliveries.php @@ -9,6 +9,13 @@ class Deliveries { use Basic; + public static function init() + { + return [ + 'sale_channels' => SaleChannels::getOptions(), + ]; + } + public static function getSaleChannelId($deliveryId) { return $deliveryId ? Deliveries::getField($deliveryId, 'sale_channel_id') : SaleChannels::getDefaultID(); diff --git a/app/Repositories/Shop/DeliveryTypeCalculations.php b/app/Repositories/Shop/DeliveryTypeCalculations.php index 9a366a4e..887c51bb 100644 --- a/app/Repositories/Shop/DeliveryTypeCalculations.php +++ b/app/Repositories/Shop/DeliveryTypeCalculations.php @@ -12,7 +12,7 @@ class DeliveryTypeCalculations public static function getPriceByDeliveryType($deliveryTypeId, $weight) { $price = DeliveryTypeCalculation::byDeliveryType($deliveryTypeId)->byWeight($weight)->first(); - + return $price ? $price->price : false; } diff --git a/app/Repositories/Shop/InvoicePayments.php b/app/Repositories/Shop/InvoicePayments.php index 9d1d9e61..1b41a0b2 100644 --- a/app/Repositories/Shop/InvoicePayments.php +++ b/app/Repositories/Shop/InvoicePayments.php @@ -8,7 +8,7 @@ use App\Traits\Model\Basic; class InvoicePayments { use Basic; - + public static function init() { return [ diff --git a/app/Repositories/Shop/Merchandises.php b/app/Repositories/Shop/Merchandises.php index 062faac7..3cff5955 100644 --- a/app/Repositories/Shop/Merchandises.php +++ b/app/Repositories/Shop/Merchandises.php @@ -3,8 +3,8 @@ namespace App\Repositories\Shop; use App\Models\Shop\Merchandise; -use App\Traits\Model\Basic; use App\Repositories\Core\Tag; +use App\Traits\Model\Basic; use App\Traits\Repository\Imageable; class Merchandises @@ -68,7 +68,6 @@ class Merchandises return Tag::storeTags($merchandise, $tags); } - public static function getModel() { return Merchandise::query(); diff --git a/app/Repositories/Shop/Offers.php b/app/Repositories/Shop/Offers.php index 2cf7eb87..286589d6 100644 --- a/app/Repositories/Shop/Offers.php +++ b/app/Repositories/Shop/Offers.php @@ -3,7 +3,6 @@ namespace App\Repositories\Shop; use App\Models\Shop\Offer; -use App\Models\Shop\PriceList; use App\Traits\Model\Basic; class Offers @@ -30,6 +29,7 @@ class Offers { return Offer::with('variation')->byIds($ids)->get(); } + public static function getWithPricesByIds($ids, $saleChannelId = false) { $saleChannelId = $saleChannelId ? $saleChannelId : SaleChannels::getDefaultID(); @@ -69,7 +69,7 @@ class Offers $saleChannelId = $saleChannelId ? $saleChannelId : SaleChannels::getDefaultID(); $offer = Offer::withPriceBySaleChannelByQuantity($saleChannelId, $quantity)->find($id); $priceList = $offer->price_lists->first(); - + return $priceList ? $priceList->price_list_values->first() : false; } diff --git a/app/Repositories/Shop/Orders.php b/app/Repositories/Shop/Orders.php index 247a5353..359a0ed2 100644 --- a/app/Repositories/Shop/Orders.php +++ b/app/Repositories/Shop/Orders.php @@ -29,6 +29,7 @@ class Orders $data = $order->toArray(); $data['payment_type'] = InvoicePayments::getPaymentType($order->payment_type); $data['status'] = Orders::getStatus($order->status); + return $data; } diff --git a/app/Repositories/Shop/PriceLists.php b/app/Repositories/Shop/PriceLists.php index b67336b2..1f77e3bc 100644 --- a/app/Repositories/Shop/PriceLists.php +++ b/app/Repositories/Shop/PriceLists.php @@ -8,7 +8,7 @@ use App\Traits\Model\Basic; class PriceLists { use Basic; - + public static function init($tariffId = false) { return [ @@ -47,7 +47,6 @@ class PriceLists return PriceList::byTariff($id)->get(); } - public static function edit($id) { $price_list = self::getFull($id)->toArray(); diff --git a/app/Repositories/Shop/Shelves.php b/app/Repositories/Shop/Shelves.php index 245ef4ba..65792270 100644 --- a/app/Repositories/Shop/Shelves.php +++ b/app/Repositories/Shop/Shelves.php @@ -2,10 +2,6 @@ namespace App\Repositories\Shop; -use App\Models\Shop\Category; -use App\Repositories\Core\Categories as CategoryTrees; -use App\Repositories\Core\Tag; - class Shelves { public static function getOffersByCategoryAndNature($categoryId, $articleNatureId = false, $tags = [], $articleNature = false, $displayByRows = false) @@ -29,6 +25,7 @@ class Shelves $productType = ArticleNatures::getProductTypeBySlug($articleNature); $articleNatureId = ArticleNatures::getIdBySlug($articleNature); } + return [ 'category' => Categories::getFull($categoryId), 'breadcrumb' => Categories::getAncestorsByCategory($categoryId), diff --git a/app/Repositories/Shop/Tariffs.php b/app/Repositories/Shop/Tariffs.php index 499f072c..429e595f 100644 --- a/app/Repositories/Shop/Tariffs.php +++ b/app/Repositories/Shop/Tariffs.php @@ -23,6 +23,7 @@ class Tariffs ], ]; } + public static function autocomplete($str) { $data = Tariff::byAutocomplete($str)->orderBy('name')->limit(30)->get()->pluck('name', 'id'); diff --git a/app/Repositories/Shop/Variations.php b/app/Repositories/Shop/Variations.php index 78d13604..38ab7799 100644 --- a/app/Repositories/Shop/Variations.php +++ b/app/Repositories/Shop/Variations.php @@ -17,6 +17,7 @@ class Variations 'unities' => Unities::getOptions(), ]; } + public static function autocomplete($str) { $data = Variation::where('name', 'LIKE', "%${str}%")->orderBy('name')->limit(30)->get()->pluck('name', 'id'); @@ -57,7 +58,6 @@ class Variations return Packages::getName($data['package_id']).' '.$data['quantity'].' '.Unities::getName($data['unity_id']); } - public static function getFull($id) { return Variation::with(['package', 'unity'])->findOrFail($id); diff --git a/app/Traits/Model/Basic.php b/app/Traits/Model/Basic.php index bebcf580..1490d4e5 100644 --- a/app/Traits/Model/Basic.php +++ b/app/Traits/Model/Basic.php @@ -190,6 +190,7 @@ trait Basic if ($stopStamping) { $model->stopUserstamping(); } + return $model; } } diff --git a/app/Traits/Model/Imageable.php b/app/Traits/Model/Imageable.php index be0e26a5..f6ec69e3 100644 --- a/app/Traits/Model/Imageable.php +++ b/app/Traits/Model/Imageable.php @@ -20,7 +20,7 @@ trait Imageable return $this->hasOne(Media::class, 'model_id')->where('model_type', get_class($this))->latest(); } - public function registerMediaConversions(Media $media = null): void + public function registerMediaConversions(?Media $media = null): void { $watermark = public_path('img/watermark.png'); diff --git a/composer.json b/composer.json index 8832a326..0bb0b166 100644 --- a/composer.json +++ b/composer.json @@ -46,10 +46,9 @@ "kmlaravel/laravel-geographical-calculator": "^2.1", "knplabs/knp-snappy": "^1.2", "laracasts/utilities": "^3.0", - "laracraft-tech/laravel-date-scopes": "^1.1", + "laracraft-tech/laravel-date-scopes": "^2.0", "laravel/framework": "^9.0", "laravel/helpers": "^1.1", - "laravel/pint": "^1.10", "laravel/scout": "^9.1", "laravel/tinker": "^2.5", "laravel/ui": "^3.0", @@ -70,7 +69,7 @@ "proengsoft/laravel-jsvalidation": "^4.5", "protonemedia/laravel-cross-eloquent-search": "^3.0", "rahul900day/laravel-captcha": "^1.0", - "ralphjsmit/laravel-seo": "^1.0", + "ralphjsmit/laravel-seo": "^1.4", "reedware/laravel-relation-joins": "^3.0", "respect/validation": "^2.2", "rinvex/laravel-categories": "^6.0", @@ -114,6 +113,7 @@ "fossbarrow/laravel-phpcs": "dev-main", "kevincobain2000/laravel-erd": "^1.3", "kitloong/laravel-migrations-generator": "^6.0", + "laravel/pint": "^1.13", "mockery/mockery": "^1.4.2", "nunomaduro/collision": "^7.0", "nunomaduro/larastan": "^2.6", diff --git a/resources/lang/fr/shop.php b/resources/lang/fr/shop.php index 7fdd5d86..28837194 100644 --- a/resources/lang/fr/shop.php +++ b/resources/lang/fr/shop.php @@ -173,17 +173,17 @@ return [ 'confirmdelete' => 'Confirmez-vous la suppression de l\'offre ?', ], 'packages' => [ - 'title' => 'Déclinaisons', - 'name' => 'Déclinaison', - 'description' => 'Gérer les déclinaisons', - 'add' => 'Ajouter une déclinaison', - 'edit' => 'Editer une déclinaison', - 'del' => 'Effacer une déclinaison', - 'list' => 'Liste des déclinaisons', - 'successadd' => 'La déclinaison été correctement ajoutée', - 'successmod' => 'La déclinaison a été correctement modifiée', - 'successdel' => 'La déclinaison a été correctement effacée', - 'confirmdelete' => 'Confirmez-vous la suppression de la déclinaison ?', + 'title' => 'Packages', + 'name' => 'Package', + 'description' => 'Gérer les packages', + 'add' => 'Ajouter un package', + 'edit' => 'Editer un package', + 'del' => 'Effacer un package', + 'list' => 'Liste des packages', + 'successadd' => 'Le package été correctement ajouté', + 'successmod' => 'Le package a été correctement modifié', + 'successdel' => 'Le package a été correctement effacé', + 'confirmdelete' => 'Confirmez-vous la suppression du package ?', ], 'producers' => [ 'title' => 'Producteurs', diff --git a/resources/views/Admin/Shop/Articles/list.blade.php b/resources/views/Admin/Shop/Articles/list.blade.php index 9ac78d5a..efc3d1f9 100644 --- a/resources/views/Admin/Shop/Articles/list.blade.php +++ b/resources/views/Admin/Shop/Articles/list.blade.php @@ -1,35 +1,35 @@ @extends('layout.index', [ - 'title' => __('shop.articles.title'), - 'subtitle' => __('shop.articles.list'), - 'breadcrumb' => [__('shop.articles.title')] + 'title' => __('shop.articles.title'), + 'subtitle' => __('shop.articles.list'), + 'breadcrumb' => [__('shop.articles.title')], ]) @section('content') - @component('components.card') - @include('components.datatable', [ - 'route' => route('Admin.Shop.Articles.index'), - 'model' => 'articles', - 'with_filters' => true, - 'callback' => 'handleArticle()', - ]) - @component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-articles-filters']) - @include('Admin.Shop.Articles.partials.filters', ['model' => 'articles']) - @endcomponent - @endcomponent + + @include('components.datatable', [ + 'route' => route('Admin.Shop.Articles.index'), + 'model' => 'articles', + 'with_filters' => true, + 'callback' => 'handleArticle()', + ]) + @component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-articles-filters']) + @include('Admin.Shop.Articles.partials.filters', ['model' => 'articles']) + @endcomponent + @endsection @include('load.form.select2') @include('load.form.toggle') @push('js') - + $(document).ready(function() { + initSelect2(); + }); + @endpush diff --git a/resources/views/Admin/Shop/Customers/form.blade.php b/resources/views/Admin/Shop/Customers/form.blade.php index ecc8bf6a..2e31bcd2 100644 --- a/resources/views/Admin/Shop/Customers/form.blade.php +++ b/resources/views/Admin/Shop/Customers/form.blade.php @@ -1,121 +1,123 @@
-
-
-
- {{ Form::label('first_name', 'Prénom') }} - @include('components.form.input', [ - 'name' => 'first_name', - 'value' => $customer['first_name'] ?? null, - 'required' => true, - ]) +
+ +
+
+ @include('components.form.input', [ + 'name' => 'first_name', + 'value' => $customer['first_name'] ?? null, + 'required' => true, + 'label' => 'Prénom', + ]) +
+
+ @include('components.form.input', [ + 'name' => 'last_name', + 'value' => $customer['last_name'] ?? null, + 'required' => true, + 'label' => 'Nom', + ]) +
-
- {{ Form::label('last_name', 'Nom') }} - @include('components.form.input', [ - 'name' => 'last_name', - 'value' => $customer['last_name'] ?? null, - 'required' => true, - ]) +
+
+ @include('components.form.input', [ + 'name' => 'company', + 'value' => $customer['company'] ?? null, + 'label' => 'Société', + ]) +
-
-
-
- {{ Form::label('company', 'Société') }} - @include('components.form.input', [ - 'name' => 'company', - 'value' => $customer['company'] ?? null, - ]) +
+
+ @include('components.form.input', [ + 'name' => 'tva', + 'value' => $customer['tva'] ?? null, + 'label' => 'TVA', + ]) +
-
-
-
- {{ Form::label('tva', 'TVA') }} - @include('components.form.input', [ - 'name' => 'tva', - 'value' => $customer['tva'] ?? null, - ]) +
+
+ @include('components.form.input', [ + 'name' => 'email', + 'value' => $customer['email'] ?? null, + 'required' => true, + 'label' => 'Email', + ]) +
+
+ @include('components.form.input', [ + 'name' => 'phone', + 'value' => $customer['phone'] ?? null, + 'label' => 'Téléphone', + ]) +
-
-
-
- {{ Form::label('email', 'Email') }} - @include('components.form.input', [ - 'name' => 'email', - 'value' => $customer['email'] ?? null, - 'required' => true, - ]) -
-
- {{ Form::label('phone', 'Téléphone') }} - @include('components.form.input', [ - 'name' => 'phone', - 'value' => $customer['phone'] ?? null, - ]) -
-
-
-
- {{ Form::label('address', 'Adresse') }} - @include('components.form.input', [ - 'name' => 'address', - 'value' => $customer['address'] ?? null, - 'required' => true, - ]) +
+
+ @include('components.form.input', [ + 'name' => 'address', + 'value' => $customer['address'] ?? null, + 'required' => true, + 'label' => 'Adresse', + ]) +
-
-
-
- {{ Form::label('address2', 'Adresse complémentaire') }} - @include('components.form.input', [ - 'name' => 'address2', - 'value' => $customer['address2'] ?? null, - ]) +
+
+ @include('components.form.input', [ + 'name' => 'address2', + 'value' => $customer['address2'] ?? null, + 'label' => 'Adresse complémentaire', + ]) +
-
-
-
- {{ Form::label('zipcode', 'Code postal') }} - @include('components.form.input', [ - 'name' => 'zipcode', - 'value' => $customer['zipcode'] ?? null, - 'required' => true, - ]) +
+
+ @include('components.form.input', [ + 'name' => 'zipcode', + 'value' => $customer['zipcode'] ?? null, + 'required' => true, + 'label' => 'Code postal', + ]) +
+
+ @include('components.form.input', [ + 'name' => 'city', + 'value' => $customer['city'] ?? null, + 'required' => true, + 'label' => 'Ville', + ]) +
-
- {{ Form::label('city', 'Ville') }} - @include('components.form.input', [ - 'name' => 'city', - 'value' => $customer['city'] ?? null, - 'required' => true, - ]) -
-
-
-
- {{ Form::label('sale_delivery_id', __('shop.deliveries.name')) }} - @include('components.form.select', [ - 'name' => 'deliveries[]', - 'list' => $deliveries ?? [], - 'values' => $customer['deliveries'] ?? null, - 'with_empty' => '', - 'class' => 'select2', - 'multiple' => true, - ]) +
+
+ @include('components.form.select', [ + 'name' => 'sale_channels[]', + 'list' => $sale_channels ?? [], + 'values' => $customer['sale_channels'] ?? null, + 'with_empty' => '', + 'class' => 'select2', + 'multiple' => true, + 'label' => __('shop.sale_channels.name'), + ]) +
-
+
-
- @component('components.layout.box-collapse', ['title' => __('Adresses'), 'id' => 'form-customer-address']) +
+ @include('Admin.Shop.CustomerAddresses.list', ['dataTable' => $customer_addresses]) - @endcomponent +
-@include('components.save') + @include('load.form.save') @include('load.form.select2') diff --git a/resources/views/Admin/Shop/Customers/list.blade.php b/resources/views/Admin/Shop/Customers/list.blade.php index 8d3b9ce5..8e506ba8 100644 --- a/resources/views/Admin/Shop/Customers/list.blade.php +++ b/resources/views/Admin/Shop/Customers/list.blade.php @@ -1,11 +1,18 @@ @extends('layout.index', [ - 'title' => __('shop.customers.title'), - 'subtitle' => __('shop.customers.list'), - 'breadcrumb' => [__('shop.customers.title')] + 'title' => __('shop.customers.title'), + 'subtitle' => __('shop.customers.list'), + 'breadcrumb' => [__('shop.customers.title')], ]) @section('content') - @component('components.card') - @include('components.datatable', ['route' => route('Admin.Shop.Customers.index'), 'model' => 'customers']) - @endcomponent + + @include('components.datatable', [ + 'route' => route('Admin.Shop.Customers.index'), + 'model' => 'customers', + 'with_filters' => true, + ]) + + @include('Admin.Shop.Customers.partials.filters', ['model' => 'customers']) + + @endsection diff --git a/resources/views/Admin/Shop/Customers/partials/filters.blade.php b/resources/views/Admin/Shop/Customers/partials/filters.blade.php new file mode 100644 index 00000000..357a4420 --- /dev/null +++ b/resources/views/Admin/Shop/Customers/partials/filters.blade.php @@ -0,0 +1,14 @@ +
+
+ +
+ @include('components.form.select', [ + 'name' => 'sale_channel_id', + 'list' => $sale_channels ?? [], + 'value' => $filters['sale_channel_id'] ?? null, + 'with_empty' => '', + 'class' => 'select2', + ]) +
+
+
diff --git a/resources/views/Admin/Shop/Deliveries/list.blade.php b/resources/views/Admin/Shop/Deliveries/list.blade.php index 3870bdbd..23b98485 100644 --- a/resources/views/Admin/Shop/Deliveries/list.blade.php +++ b/resources/views/Admin/Shop/Deliveries/list.blade.php @@ -1,26 +1,34 @@ @extends('layout.index', [ - 'title' => __('shop.deliveries.title'), - 'subtitle' => __('shop.deliveries.list'), - 'breadcrumb' => [__('shop.deliveries.title')] + 'title' => __('shop.deliveries.title'), + 'subtitle' => __('shop.deliveries.list'), + 'breadcrumb' => [__('shop.deliveries.title')], ]) @section('content') - @component('components.card') - @include('components.datatable', ['route' => route('Admin.Shop.Deliveries.index'), 'model' => 'deliveries', 'callback' => 'handleDelivery();']) - @endcomponent + + @include('components.datatable', [ + 'route' => route('Admin.Shop.Deliveries.index'), + 'model' => 'deliveries', + 'with_filters' => true, + 'callback' => 'handleDelivery();', + ]) + @component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-deliveries-filters']) + @include('Admin.Shop.Deliveries.partials.filters', ['model' => 'deliveries']) + @endcomponent + @endsection @include('load.form.select2') @include('load.form.toggle') @push('js') - -@endpush \ No newline at end of file + $(document).ready(function() { + initSelect2(); + }); + +@endpush diff --git a/resources/views/Admin/Shop/Deliveries/partials/filters.blade.php b/resources/views/Admin/Shop/Deliveries/partials/filters.blade.php index efd72f51..357a4420 100644 --- a/resources/views/Admin/Shop/Deliveries/partials/filters.blade.php +++ b/resources/views/Admin/Shop/Deliveries/partials/filters.blade.php @@ -1,5 +1,14 @@
-
- -
+
+ +
+ @include('components.form.select', [ + 'name' => 'sale_channel_id', + 'list' => $sale_channels ?? [], + 'value' => $filters['sale_channel_id'] ?? null, + 'with_empty' => '', + 'class' => 'select2', + ]) +
+
diff --git a/resources/views/Admin/Shop/InvoicePayments/form.blade.php b/resources/views/Admin/Shop/InvoicePayments/form.blade.php index 66034806..b204386e 100644 --- a/resources/views/Admin/Shop/InvoicePayments/form.blade.php +++ b/resources/views/Admin/Shop/InvoicePayments/form.blade.php @@ -1,6 +1,13 @@ -
+
- @include('components.form.select', [ + @include('components.form.datepicker', [ + 'label' => 'Date', + 'name' => 'date', + 'value' => $invoice_payment['date'] ?? null, + ]) +
+
+ @include('components.form.select', [ 'label' => 'Règlement', 'name' => 'payment_type', 'list' => $payment_types ?? [], @@ -8,8 +15,10 @@ 'class' => 'select2', ])
+
+
- @include('components.form.input', [ + @include('components.form.inputs.money', [ 'label' => 'Montant', 'name' => 'amount', 'value' => $invoice_payment['amount'] ?? null, diff --git a/resources/views/Admin/Shop/Packages/list.blade.php b/resources/views/Admin/Shop/Packages/list.blade.php index 87b76a5d..525587b4 100644 --- a/resources/views/Admin/Shop/Packages/list.blade.php +++ b/resources/views/Admin/Shop/Packages/list.blade.php @@ -1,14 +1,21 @@ @extends('layout.index', [ - 'title' => __('shop.packages.title'), - 'subtitle' => __('shop.packages.list'), - 'breadcrumb' => [__('shop.packages.title')] + 'title' => __('shop.packages.title'), + 'subtitle' => __('shop.packages.list'), + 'breadcrumb' => [__('shop.packages.title')], ]) @section('content') - @component('components.card') - @include('components.datatable', ['route' => route('Admin.Shop.Packages.index'), 'model' => 'packages', 'with_filters' => true]) - @component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-packages-filters']) - @include('Admin.Shop.Packages.partials.filters') - @endcomponent - @endcomponent + + @include('components.datatable', [ + 'route' => route('Admin.Shop.Packages.index'), + 'model' => 'packages', + 'with_filters' => true, + ]) + @component('components.layout.modal', [ + 'title' => 'Filtres', + 'id' => 'modal-packages-filters', + ]) + @include('Admin.Shop.Packages.partials.filters') + @endcomponent + @endsection