From e6b15e2438d567ad4c5c3b1239516719f7f69994 Mon Sep 17 00:00:00 2001 From: ludo Date: Tue, 17 Oct 2023 17:20:30 +0200 Subject: [PATCH] fix on customer auth, fix filters on shelves, refactor for article_nature, add slug --- .../Admin/Shop/ArticleNaturesDataTable.php | 2 +- .../Admin/Shop/ArticleNatureController.php | 9 +- .../Admin/Shop/MerchandiseController.php | 2 +- .../Controllers/Shop/CategoryController.php | 12 +- .../Controllers/Shop/CustomerController.php | 14 +- app/Http/Controllers/Shop/OrderController.php | 1 + app/Models/Shop/ArticleNature.php | 5 + app/Models/Shop/Customer.php | 10 + app/Repositories/Shop/ArticleNatures.php | 44 +- app/Repositories/Shop/Articles.php | 6 + app/Repositories/Shop/Customers.php | 9 +- app/Repositories/Shop/TagGroups.php | 3 +- app/Traits/Model/Basic.php | 60 +- app/Traits/Model/Imageable.php | 26 +- ...023_09_18_144437_create_sessions_table.php | 35 + ...3458_modify_shop_article_natures_table.php | 15 + .../Admin/Shop/ArticleNatures/form.blade.php | 11 +- .../Admin/Shop/Dashboard/index.blade.php | 2 +- .../views/Admin/Shop/Offers/form.blade.php | 2 + .../Shop/Articles/partials/article.blade.php | 2 +- .../partials/article_botanic.blade.php | 41 +- .../partials/article_merchandise.blade.php | 29 +- resources/views/Shop/Orders/order.blade.php | 41 +- .../Shop/Orders/partials/addresses.blade.php | 9 +- .../Shop/Orders/partials/deliveries.blade.php | 11 +- .../Shelves/partials/category_add.blade.php | 21 +- resources/views/Shop/Shelves/shelve.blade.php | 20 +- .../views/Shop/Tags/partials/filter.blade.php | 9 +- .../Shop/_partials/display_filters.blade.php | 14 +- .../vendor/boilerplate/mix-manifest.json | 917 ++++++++++++++++++ 30 files changed, 1205 insertions(+), 177 deletions(-) create mode 100644 database/migrations/2023_09_18_144437_create_sessions_table.php create mode 100644 database/migrations/2023_10_17_153458_modify_shop_article_natures_table.php create mode 100644 resources/views/vendor/boilerplate/mix-manifest.json diff --git a/app/Datatables/Admin/Shop/ArticleNaturesDataTable.php b/app/Datatables/Admin/Shop/ArticleNaturesDataTable.php index 9a4c6daa..edc6efc9 100644 --- a/app/Datatables/Admin/Shop/ArticleNaturesDataTable.php +++ b/app/Datatables/Admin/Shop/ArticleNaturesDataTable.php @@ -25,7 +25,7 @@ class ArticleNaturesDataTable extends DataTable { $datatables ->editColumn('icon', function (ArticleNature $nature) { - $logo = Medias::getImage($nature, 'thumb'); + $logo = Medias::getImage($nature, 'normal', 'icon'); return $logo ? "" : ''; }) diff --git a/app/Http/Controllers/Admin/Shop/ArticleNatureController.php b/app/Http/Controllers/Admin/Shop/ArticleNatureController.php index f00844dd..406d20c0 100644 --- a/app/Http/Controllers/Admin/Shop/ArticleNatureController.php +++ b/app/Http/Controllers/Admin/Shop/ArticleNatureController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Admin\Shop; use App\Datatables\Admin\Shop\ArticleNaturesDataTable; use App\Repositories\Shop\ArticleNatures; use Illuminate\Http\Request; +use Illuminate\Support\Str; class ArticleNatureController extends Controller { @@ -20,8 +21,11 @@ class ArticleNatureController extends Controller public function store(Request $request) { + $data = $request->all(); + $data['slug'] = Str::slug($data['name'], '-'); $articleNature = ArticleNatures::store($request->all()); - ArticleNatures::storeIcon($articleNature, $request->file('icon')); + ArticleNatures::storeIcon($articleNature, $request->file('icon'), 'icon'); + ArticleNatures::storeIcon($articleNature, $request->file('icon_selection'), 'icon_selection'); return redirect()->route('Admin.Shop.ArticleNatures.index'); } @@ -41,7 +45,8 @@ class ArticleNatureController extends Controller 'article_nature' => ArticleNatures::get($id), 'product_types' => ArticleNatures::getProductTypes(), ]; - $data['article_nature']['icon'] = ArticleNatures::getIcon($id); + $data['article_nature']['icon'] = ArticleNatures::getIcon($id, 'normal', 'icon'); + $data['article_nature']['icon_selection'] = ArticleNatures::getIcon($id, 'normal', 'icon_selection'); return view('Admin.Shop.ArticleNatures.edit', $data); } diff --git a/app/Http/Controllers/Admin/Shop/MerchandiseController.php b/app/Http/Controllers/Admin/Shop/MerchandiseController.php index e5c68274..0c0e0081 100644 --- a/app/Http/Controllers/Admin/Shop/MerchandiseController.php +++ b/app/Http/Controllers/Admin/Shop/MerchandiseController.php @@ -2,7 +2,7 @@ namespace App\Http\Controllers\Admin\Shop; -use App\Datatables\Shop\MerchandisesDataTable; +use App\Datatables\Admin\Shop\MerchandisesDataTable; use App\Repositories\Shop\Merchandises; use App\Repositories\Shop\Producers; use App\Repositories\Shop\TagGroups; diff --git a/app/Http/Controllers/Shop/CategoryController.php b/app/Http/Controllers/Shop/CategoryController.php index 020eb2ee..35520bfb 100644 --- a/app/Http/Controllers/Shop/CategoryController.php +++ b/app/Http/Controllers/Shop/CategoryController.php @@ -19,25 +19,17 @@ class CategoryController extends Controller public function show(Request $request, $categoryId, $articleNatureId = false) { - $productTypes = Articles::getProductTypesWithOffers([ - 'category_id' => $categoryId, - ]); - $articleNatures = Articles::getArticleNaturesWithOffers([ 'category_id' => $categoryId, ]); if ($articleNatureId) { $productType = ArticleNatures::getProductType($articleNatureId); - dump($productType); - exit; } else { $articleNature = $request->input('article_nature'); if (! $articleNature) { - if (count($articleNatures) === 1) { + if (count($articleNatures)) { $articleNature = $articleNatures[0]; - } else { - $articleNature = 'semences'; } } $productType = ArticleNatures::getProductTypeBySlug($articleNature); @@ -61,7 +53,7 @@ class CategoryController extends Controller 'tags' => TagGroups::getWithTagsAndCountOffers($categoryId), ]; - // dump($data); + dump($data); // exit; return view('Shop.Shelves.shelve', $data); } diff --git a/app/Http/Controllers/Shop/CustomerController.php b/app/Http/Controllers/Shop/CustomerController.php index d16e9b87..d23be811 100644 --- a/app/Http/Controllers/Shop/CustomerController.php +++ b/app/Http/Controllers/Shop/CustomerController.php @@ -11,9 +11,7 @@ class CustomerController extends Controller { public function profile($id = false) { - $data = Customers::editProfile($id); - - return view('Shop.Customers.profile', $data); + return view('Shop.Customers.profile', Customers::editProfile($id)); } public function modalProfile($id = false) @@ -25,16 +23,14 @@ class CustomerController extends Controller public function edit() { - $id = Auth::id(); - $data['customer'] = Customers::get($id, 'addresses')->toArray(); - - return view('Shop.Customers.edit', $data); + return view('Shop.Customers.edit', [ + 'customer' => Customers::getArray(Auth::id(), 'addresses'), + ]); } public function storeProfileAjax(Request $request) { - $data = $request->all(); - $customer = Customers::store($data); + $customer = Customers::store($request->all()); return response()->json(['error' => 0]); } diff --git a/app/Http/Controllers/Shop/OrderController.php b/app/Http/Controllers/Shop/OrderController.php index da3ab0f2..eeaaa4b0 100644 --- a/app/Http/Controllers/Shop/OrderController.php +++ b/app/Http/Controllers/Shop/OrderController.php @@ -37,6 +37,7 @@ class OrderController extends Controller { if (ShopCart::count()) { $customer = Customers::getWithAddresses(); + $data = [ 'customer' => $customer ? $customer->toArray() : false, 'basket' => ShopCart::getSummary(), diff --git a/app/Models/Shop/ArticleNature.php b/app/Models/Shop/ArticleNature.php index d3479088..84f88548 100644 --- a/app/Models/Shop/ArticleNature.php +++ b/app/Models/Shop/ArticleNature.php @@ -35,6 +35,11 @@ class ArticleNature extends Model implements HasMedia return $query->where($this->table.'.id', $id); } + public function scopeBySlug($query, $slug) + { + return $query->where($this->table.'.slug', $slug); + } + public function scopeByBotanic($query) { return $query->ByProductType(1); diff --git a/app/Models/Shop/Customer.php b/app/Models/Shop/Customer.php index 82addf10..a3450a23 100644 --- a/app/Models/Shop/Customer.php +++ b/app/Models/Shop/Customer.php @@ -28,6 +28,16 @@ class Customer extends Authenticatable return $this->hasMany(CustomerAddress::class); } + public function invoicing_addresses(): HasMany + { + return $this->addresses()->where('type', 2); + } + + public function delivery_addresses(): HasMany + { + return $this->addresses()->where('type', 1); + } + public function customer_deliveries(): HasMany { return $this->hasMany(CustomerDelivery::class); diff --git a/app/Repositories/Shop/ArticleNatures.php b/app/Repositories/Shop/ArticleNatures.php index 0f908a32..e74f42b4 100644 --- a/app/Repositories/Shop/ArticleNatures.php +++ b/app/Repositories/Shop/ArticleNatures.php @@ -26,44 +26,21 @@ class ArticleNatures public static function getIdBySlug($slug) { - switch ($slug) { - case 'semences': - $id = 1; - break; - case 'plants': - $id = 2; - break; - case 'legumes': - $id = 3; - break; - case 'marchandises': - $id = 4; - break; - default: - $id = 1; - break; - } + $model = self::getBySlug($slug); + + return $model ? $model->id : false; + } - return $id; + public static function getBySlug($slug) + { + return ArticleNature::bySlug($slug)->first(); } public static function getProductTypeBySlug($slug) { - switch ($slug) { - case 'semences': - case 'plants': - case 'legumes': - $productType = 'botanic'; - break; - case 'marchandises': - $productType = 'merchandise'; - break; - default: - $productType = 'botanic'; - break; - } + $id = self::getIdBySlug($slug); - return $productType; + return $id ? self::getProductType($id) : false; } public static function storeIcon($nature, $file, $collection = 'images') @@ -75,7 +52,8 @@ class ArticleNatures public static function getProductType($id) { - $type = self::get($id)->product_type ?? false; + $model = self::get($id); + $type = $model ? $model->product_type : false; return $type ? self::getProductTypes()[$type] : false; } diff --git a/app/Repositories/Shop/Articles.php b/app/Repositories/Shop/Articles.php index 02d6fa06..bc0d4f1e 100644 --- a/app/Repositories/Shop/Articles.php +++ b/app/Repositories/Shop/Articles.php @@ -246,6 +246,12 @@ class Articles return $data; } + public static function getArticleNaturesOptionsWithOffers($options = false) + { + $ids = self::getArticleNaturesIdsWithOffers($options); + + } + public static function getArticleNaturesWithOffers($options = false) { return ArticleNatures::getNamesByIds(self::getArticleNaturesIdsWithOffers($options)); diff --git a/app/Repositories/Shop/Customers.php b/app/Repositories/Shop/Customers.php index 125b8af5..68c0f308 100644 --- a/app/Repositories/Shop/Customers.php +++ b/app/Repositories/Shop/Customers.php @@ -84,7 +84,7 @@ class Customers public static function getWithAddresses($id = false) { - return self::get($id, 'addresses'); + return self::get($id, ['invoicing_addresses', 'delivery_addresses']); } public static function getName($id = false) @@ -99,6 +99,13 @@ class Customers return self::guard()->user(); } + public static function get($id, $relations = false, $relationsCount = false) + { + $id = $id ? $id : self::getId(); + + return self::getModelRelations($relations, $relationsCount)->find($id); + } + public static function getId() { return self::guard()->id(); diff --git a/app/Repositories/Shop/TagGroups.php b/app/Repositories/Shop/TagGroups.php index 61bb3ab0..d0b09dc1 100644 --- a/app/Repositories/Shop/TagGroups.php +++ b/app/Repositories/Shop/TagGroups.php @@ -15,13 +15,14 @@ class TagGroups public static function getWithTagsAndCountOffers($category_id = false) { + $data = []; $tags = Tag::withCountArticlesByCategory($category_id)->get()->toArray(); $tag_groups = TagGroup::pluck('name', 'id')->toArray(); foreach ($tags as $tag) { - $data[$tag['tag_group_id']]['name'] = $tag_groups[$tag['tag_group_id']]; if (! $tag['articles_count']) { continue; } + $data[$tag['tag_group_id']]['name'] = $tag_groups[$tag['tag_group_id']]; $data[$tag['tag_group_id']]['tags'][] = [ 'id' => $tag['id'], 'name' => $tag['name'], diff --git a/app/Traits/Model/Basic.php b/app/Traits/Model/Basic.php index 940815d1..a5acda32 100644 --- a/app/Traits/Model/Basic.php +++ b/app/Traits/Model/Basic.php @@ -82,30 +82,37 @@ trait Basic return self::get($id)->toArray(); } - public static function store($data) + public static function store($data, $stopStamping = false) { - return $data['id'] ?? false ? self::update($data) : self::create($data); + return $data['id'] ?? false ? self::update($data, false, $stopStamping) : self::create($data, $stopStamping); } - public static function create($data) + public static function create($data, $stopStamping = false) { - return self::getModel()->create($data); + return self::getModel($stopStamping)->create($data); } - public static function update($data, $id = false) + public static function update($data, $id = false, $stopStamping = false) { $id = $id ? $id : $data['id']; $model = self::get($id); + if ($stopStamping) { + $model->stopUserstamping(); + } $model->update($data); return $model; } - public static function destroy($id) + public static function destroy($id, $force = false) { $model = self::get($id); - return $model ? $model->delete() : false; + if ($model) { + return $force ? $model->forceDelete() : $model->delete(); + } + + return false; } public static function count() @@ -125,20 +132,39 @@ trait Basic return $model ? $model->delete() : false; } - public static function get($id, $relations = false, $relationscount = false) + public static function getArray($id, $relations = false, $relationsCount = false) { - return self::getModelRelations($relations, $relationscount)->find($id); + $model = self::get($id, $relations, $relationsCount); + + return $model ? $model->toArray() : false; } - public static function getAll($relations = false, $relationscount = false) + public static function get($id, $relations = false, $relationsCount = false) { - return self::getModelRelations($relations, $relationscount)->get(); + return self::getModelRelations($relations, $relationsCount)->find($id); } - public static function getModelRelations($relations = false, $relationscount = false) + public static function getWithTrashed($id, $relations = false, $relationsCount = false) + { + return self::getModelRelations($relations, $relationsCount)->withTrashed()->find($id); + } + + public static function getAll($relations = false, $relationsCount = false) + { + return self::getModelRelations($relations, $relationsCount)->get(); + } + + public static function getRevisions($id) + { + $model = self::get($id, ['revisions.user'])->toArray(); + + return collect($model['revisions'])->sortBy('created_at')->reverse()->toArray(); + } + + public static function getModelRelations($relations = false, $relationsCount = false) { $model = $relations ? self::getModelWithRelations($relations) : false; - $model = $relationscount ? self::getModelWithCountRelations($relationscount, $model) : $model; + $model = $relationsCount ? self::getModelWithCountRelations($relationsCount, $model) : $model; return $model ? $model : self::getModel(); } @@ -153,8 +179,12 @@ trait Basic return is_object($model) ? $model->withCount($relations) : self::getModel()->withCount($relations); } - public static function getModel(): Model + public static function getModel($stopStamping = false): Model { - return new Model(); + $model = new Model(); + if ($stopStamping) { + $model->stopUserstamping(); + } + return $model; } } diff --git a/app/Traits/Model/Imageable.php b/app/Traits/Model/Imageable.php index 6911bb76..be0e26a5 100644 --- a/app/Traits/Model/Imageable.php +++ b/app/Traits/Model/Imageable.php @@ -22,10 +22,28 @@ trait Imageable public function registerMediaConversions(Media $media = null): void { - $this->addMediaConversion('thumb')->fit(Manipulations::FIT_CROP, 32, 32); - $this->addMediaConversion('mini')->fit(Manipulations::FIT_CROP, 96, 96); - $this->addMediaConversion('preview')->fit(Manipulations::FIT_CROP, 160, 160); - $this->addMediaConversion('normal')->fit(Manipulations::FIT_CROP, 480, 480); + $watermark = public_path('img/watermark.png'); + + $this->addMediaConversion('thumb')->fit(Manipulations::FIT_CROP, 32, 32) + ->watermark($watermark) + ->watermarkHeight(100, Manipulations::UNIT_PERCENT) + ->watermarkWidth(100, Manipulations::UNIT_PERCENT) + ->watermarkFit(Manipulations::FIT_FILL); + $this->addMediaConversion('mini')->fit(Manipulations::FIT_CROP, 96, 96) + ->watermark($watermark) + ->watermarkHeight(100, Manipulations::UNIT_PERCENT) + ->watermarkWidth(100, Manipulations::UNIT_PERCENT) + ->watermarkFit(Manipulations::FIT_FILL); + $this->addMediaConversion('preview')->fit(Manipulations::FIT_CROP, 160, 160) + ->watermark($watermark) + ->watermarkHeight(100, Manipulations::UNIT_PERCENT) + ->watermarkWidth(100, Manipulations::UNIT_PERCENT) + ->watermarkFit(Manipulations::FIT_FILL); + $this->addMediaConversion('normal')->fit(Manipulations::FIT_CROP, 480, 480) + ->watermark($watermark) + ->watermarkHeight(100, Manipulations::UNIT_PERCENT) + ->watermarkWidth(100, Manipulations::UNIT_PERCENT) + ->watermarkFit(Manipulations::FIT_FILL); // $this->addMediaConversion('zoom')->fit(Manipulations::FIT_CROP, 1200, 1200)->withResponsiveImages(); } } diff --git a/database/migrations/2023_09_18_144437_create_sessions_table.php b/database/migrations/2023_09_18_144437_create_sessions_table.php new file mode 100644 index 00000000..06c3e450 --- /dev/null +++ b/database/migrations/2023_09_18_144437_create_sessions_table.php @@ -0,0 +1,35 @@ +string('id')->primary(); + $table->foreignId('user_id')->nullable()->index(); + $table->string('ip_address', 45)->nullable(); + $table->text('user_agent')->nullable(); + $table->longText('payload'); + $table->integer('last_activity')->index(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('sessions'); + } +}; diff --git a/database/migrations/2023_10_17_153458_modify_shop_article_natures_table.php b/database/migrations/2023_10_17_153458_modify_shop_article_natures_table.php new file mode 100644 index 00000000..b0c00618 --- /dev/null +++ b/database/migrations/2023_10_17_153458_modify_shop_article_natures_table.php @@ -0,0 +1,15 @@ +string('slug', 50)->after('name')->nullable(); + }); + } +}; diff --git a/resources/views/Admin/Shop/ArticleNatures/form.blade.php b/resources/views/Admin/Shop/ArticleNatures/form.blade.php index 76d79c3a..d1de5068 100644 --- a/resources/views/Admin/Shop/ArticleNatures/form.blade.php +++ b/resources/views/Admin/Shop/ArticleNatures/form.blade.php @@ -32,7 +32,7 @@ -
+
@include('components.widgets.imgUpload', [ 'name' => 'icon', @@ -41,6 +41,15 @@ ])
+
+ + @include('components.widgets.imgUpload', [ + 'name' => 'icon_selection', + 'id_name' => 'icon_selection', + 'file' => $article_nature['icon_selection'] ?? false, + ]) + +
diff --git a/resources/views/Admin/Shop/Dashboard/index.blade.php b/resources/views/Admin/Shop/Dashboard/index.blade.php index 734cd5d9..0a7fe50c 100644 --- a/resources/views/Admin/Shop/Dashboard/index.blade.php +++ b/resources/views/Admin/Shop/Dashboard/index.blade.php @@ -6,7 +6,7 @@ @section('content') -
+
diff --git a/resources/views/Admin/Shop/Offers/form.blade.php b/resources/views/Admin/Shop/Offers/form.blade.php index 360c2955..8e7c239f 100644 --- a/resources/views/Admin/Shop/Offers/form.blade.php +++ b/resources/views/Admin/Shop/Offers/form.blade.php @@ -10,6 +10,7 @@ 'with_empty' => '', 'class' => 'select2 select_article', 'label' => 'Article', + 'required' => true, ])
@@ -44,6 +45,7 @@ 'name' => 'weight', 'value' => $offer['weight'] ?? null, 'label' => 'Poids en g', + 'required' => true, ]) diff --git a/resources/views/Shop/Articles/partials/article.blade.php b/resources/views/Shop/Articles/partials/article.blade.php index 31e7c5ad..235be644 100644 --- a/resources/views/Shop/Articles/partials/article.blade.php +++ b/resources/views/Shop/Articles/partials/article.blade.php @@ -6,7 +6,7 @@ src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" alt="{{ $product_name }}">

-

{!! $article['description'] !!}

+

{!! Str::limit($article['description'], 500) !!}

diff --git a/resources/views/Shop/Articles/partials/article_botanic.blade.php b/resources/views/Shop/Articles/partials/article_botanic.blade.php index 0dc73a56..358990d4 100644 --- a/resources/views/Shop/Articles/partials/article_botanic.blade.php +++ b/resources/views/Shop/Articles/partials/article_botanic.blade.php @@ -1,38 +1,19 @@ @if ($article_nature ?? false)
- @if ($article_nature == 'semences') - Semences
- - {{ $article['semences']['variation'] ?? null }} - - @endif - @if ($article_nature == 'plants') - Plants
- - {{ $article['plants']['variation'] ?? null }} - - @endif + {{ $article_nature }}
+ + {{ $article[$article_nature]['variation'] ?? null }} +
- @if ($article_nature == 'semences') - - @if ($article['semences'] ?? false) - {{ $article['semences']['price'] ?? null }} € - @else - - - @endif -
- @endif - @if ($article_nature == 'plants') - - @if ($article['plants'] ?? false) - {{ $article['plants']['price'] }} € - @else - - - @endif -
- @endif + + @if ($article[$article_nature] ?? false) + {{ $article[$article_nature]['price'] ?? null }} € + @else + - + @endif +
@endif \ No newline at end of file diff --git a/resources/views/Shop/Articles/partials/article_merchandise.blade.php b/resources/views/Shop/Articles/partials/article_merchandise.blade.php index 78a02176..125035cc 100644 --- a/resources/views/Shop/Articles/partials/article_merchandise.blade.php +++ b/resources/views/Shop/Articles/partials/article_merchandise.blade.php @@ -1,12 +1,19 @@ -
-
- - @if ($article['merchandises'] ?? false) - {{ $article['merchandises']['price'] ?? null }} € - @else - - - @endif -
- Marchandise +@if ($article_nature ?? false) +
+
+ {{ $article_nature }}
+ + {{ $article[$article_nature]['variation'] ?? null }} + +
+
+ + @if ($article[$article_nature] ?? false) + {{ $article[$article_nature]['price'] ?? null }} € + @else + - + @endif +
+
-
\ No newline at end of file +@endif \ No newline at end of file diff --git a/resources/views/Shop/Orders/order.blade.php b/resources/views/Shop/Orders/order.blade.php index c0276c0b..78778060 100644 --- a/resources/views/Shop/Orders/order.blade.php +++ b/resources/views/Shop/Orders/order.blade.php @@ -18,25 +18,30 @@ @include('Shop.auth.partials.register') + @else + {{ Form::open(['route' => 'Shop.Orders.store', 'id' => 'order-form', 'autocomplete' => 'off']) }} + +
+ + @include('Shop.Orders.partials.addresses', ['addresses' => $customer['invoicing_addresses'] ?? false]) + + + + @include('Shop.Orders.partials.deliveries') + + + + @include('Shop.Orders.partials.addresses', ['addresses' => $customer['delivery_addresses'] ?? false]) + + + + @include('Shop.Orders.partials.payments') + +
+ + {!! Form::close() !!} + @endif - - {{ Form::open(['route' => 'Shop.Orders.store', 'id' => 'order-form', 'autocomplete' => 'off']) }} - -
- - @include('Shop.Orders.partials.addresses', ['addresses' => $customer['addresses'] ?? false]) - - - - @include('Shop.Orders.partials.deliveries') - - - - @include('Shop.Orders.partials.payments') - -
- - {!! Form::close() !!}
@if ($basket['count']) diff --git a/resources/views/Shop/Orders/partials/addresses.blade.php b/resources/views/Shop/Orders/partials/addresses.blade.php index 278f3b19..14b8a2fc 100644 --- a/resources/views/Shop/Orders/partials/addresses.blade.php +++ b/resources/views/Shop/Orders/partials/addresses.blade.php @@ -2,7 +2,12 @@ @foreach ($addresses ?? [] as $address)
- + @include('components.form.radios.icheck', [ + 'name' => 'address_id', + 'val' => $address['id'], + 'id' => 'address_' . $address['id'], + 'value' => (count($addresses) === 1) ? $address['id'] : false, + ])
{{ $address['name'] }}
@@ -14,4 +19,4 @@
@endforeach -@endif \ No newline at end of file +@endif \ No newline at end of file diff --git a/resources/views/Shop/Orders/partials/deliveries.blade.php b/resources/views/Shop/Orders/partials/deliveries.blade.php index b9de5081..3ab9c5e0 100644 --- a/resources/views/Shop/Orders/partials/deliveries.blade.php +++ b/resources/views/Shop/Orders/partials/deliveries.blade.php @@ -1,7 +1,12 @@ @foreach ($deliveries as $delivery)
- + @include('components.form.radios.icheck', [ + 'name' => 'delivery_id', + 'val' => $delivery['id'], + 'id' => 'delivery_' . $delivery['id'], + 'class' => $delivery['at_house'] ? 'at_house' : '', + ])
{{ $delivery['name'] }} - Tarif appliqué {{ $delivery['sale_channel']['name'] }}
@@ -12,4 +17,6 @@ Si vous voulez laisser un message à propos de votre commande, merci de bien vouloir le renseigner dans le champs ci-contre - \ No newline at end of file +@include('components.form.textarea', [ + 'name' => 'content', +]) diff --git a/resources/views/Shop/Shelves/partials/category_add.blade.php b/resources/views/Shop/Shelves/partials/category_add.blade.php index 37c7dcaa..ef935dbc 100644 --- a/resources/views/Shop/Shelves/partials/category_add.blade.php +++ b/resources/views/Shop/Shelves/partials/category_add.blade.php @@ -1,15 +1,12 @@ -
- @foreach ($article_natures as $nature) -
-
-
- -
-
{{ $nature }}
-
-
- @endforeach -
+@foreach ($article_natures as $nature) +
+ @if ($article_nature == $nature) + + @else + + @endif +
+@endforeach @push('js')