]> _ Git - pmi.git/commitdiff
wip #5858 @14:00
authorsoufiane <soufiane@cubedesigners.com>
Wed, 19 Apr 2023 08:12:49 +0000 (10:12 +0200)
committersoufiane <soufiane@cubedesigners.com>
Wed, 19 Apr 2023 08:12:49 +0000 (10:12 +0200)
20 files changed:
app/Http/Controllers/Admin/SelectionCrudController.php
app/Http/Controllers/AjaxController.php
app/Http/Middleware/RedirectClientIfAuthenticated.php
app/Models/CommandPanierSchema.php
app/Models/Panier.php
app/Models/Product.php
app/Providers/AppServiceProvider.php
app/Templates/PaniersEnregistres.php [new file with mode: 0644]
resources/js/app.js
resources/styles/common/global.styl
resources/styles/components/cart.styl
resources/views/components/btn-delete.blade.php [new file with mode: 0644]
resources/views/components/cart-add.blade.php
resources/views/pages/cart.blade.php
resources/views/pages/paniers_enregistres.blade.php [new file with mode: 0644]
resources/views/pages/product-detail.blade.php
resources/views/partials/header.blade.php
resources/views/partials/nav-account.blade.php
resources/views/partials/product-link.blade.php
routes/web.php

index 88745be4533af2a50d7656bb00c514a81726f783..12b23ca5d65b0f882095103326dd02bc2016a864 100644 (file)
@@ -7,7 +7,7 @@ class SelectionCrudController extends \Cubist\Backpack\app\Magic\Controllers\Cub
     protected $_modelNamespace = 'App\Models\Panier';
     protected $_routeURL = 'selection';
     protected $_singular = 'Panier';
-    protected $_plural = 'Paniers';
+    protected $_plural = 'PaniersEnregistres';
     protected $_clonable = true;
     protected $_bulk = true;
     protected $_oneInstance= false;
index 4ae3f739036ace50fab2c0415b01ac34af52513a..9c712493558c089d3c8bfab4c7dd8d24072de60e 100644 (file)
@@ -21,6 +21,7 @@ use Illuminate\Support\Facades\Mail;
 use Illuminate\Support\Facades\Validator;
 use Illuminate\Support\Facades\Hash;
 use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Arr;
 
 class AjaxController extends CubistFrontController
 {
@@ -566,17 +567,106 @@ class AjaxController extends CubistFrontController
         return false;
     }
 
-    public function storepanier(Request $request) {
+    public function storecart(Request $request) {
         $validation = [
             'name' => 'required|string|max:255',
             'addresses' => 'required',
             'products' => 'required',
-            'userId' => 'required|numeric'
+            'user_id' => 'required|numeric'
         ];
         $data = $this->validation_form($request, $validation);
-        $panier = new Panier($data);
-        $panier->save();
 
-        return 'ok';
+        $lastCartId = $request->session()->get('last_selection');
+
+        //
+        $lastCartRefs = $lastCartId ? Panier::find($lastCartId)->getReferences() : [];
+        $currentCartRef = Panier::getRefs($data['products']);
+        $intersect = $lastCartRefs ? array_intersect($currentCartRef,$lastCartRefs) : [];
+
+        /**
+         *
+         */
+        $options = Product::getOptionsByProductsId($data['products']);
+
+        $opt = [];
+        $total = [];
+
+        foreach ($currentCartRef as $keyRefs => $refs) {
+            foreach (explode("/", $refs) as $key => $ref) {
+                $key -= 1;
+                if ($key > -1) {
+                    $opt_ = array_filter($options[$keyRefs][$key]["options"], function ($n) use ($ref) {
+                        return $n["ref"] === $ref;
+                    });
+                    $opt_ = array_values($opt_);
+                    $opt[$refs][] = $opt_[0]["sale_price"];
+                }
+            }
+
+            $quantity = intval($data['products'][$keyRefs]["quantity"]);
+            $basicSellingPrice = $data['products'][$keyRefs]["basic_selling_price"];
+
+            $totalOptionsPrice = $basicSellingPrice ? array_reduce($opt[$refs], function ($carry, $item) {
+                return $carry + $item;
+            }) : 0;
+
+            $basicPriceByProductId = $data['products'][$keyRefs]["basic_selling_price"];
+            $price = floatval(($basicPriceByProductId + $totalOptionsPrice) * $quantity);
+            $data['products'][$keyRefs]["price"] = $total[] = $price;
+        }
+
+        $ht = array_reduce($total, function($carry, $item) { return $carry + $item; });
+        $ht += ($total > 1000) ? 20 : 0;
+        $tva = $ht * 0.2;
+        $ttc = $ht + $tva;
+        $data['total'] = $ttc;
+
+        //
+        $data['addresses'] = json_encode($data['addresses']);
+        $data['products'] = json_encode($data['products']);
+
+        if(sizeof($lastCartRefs) !== sizeof($intersect) ||
+            (sizeof($lastCartRefs) === sizeof($intersect) && sizeof($currentCartRef) != sizeof($lastCartRefs)) ) {
+            $panier = Panier::firstOrCreate($data);
+            $panier->save();
+            // Save back to the session with the latest cart id
+            $id = $panier->getOriginal('id');
+            $request->session()->put('last_selection', $id);
+        } else {
+            Panier::where('id', $lastCartRefs)->update($data);
+        }
+
+        return __('Le panier a été enregistré avec succès !');
+    }
+
+    public function deleteSavedcart(Request $request) {
+        $request->validate([
+            'id' => 'required|numeric',
+        ]);
+        $id = $request->input('id');
+
+        $cart = Panier::find($id);
+
+        $cart->delete();
+    }
+
+    public function updateNameSavedcart(Request $request) {
+        $request->validate([
+            'id' => 'required|numeric',
+            'text' => 'required|max:255'
+        ]);
+        $id = $request->input('id');
+        $text = $request->input('text');
+
+        $cart = Panier::find($id);
+
+        $cart->name = $text;
+
+        $cart->save();
+    }
+
+    public function savedCartToCurrent(Request $request) {
+
+        //$this->cart()
     }
 }
index fb9e042ccd7d85d148842f1febe241e4c992f37a..ed3c1c3834444ff5c27ba3187d93e63dca5f24fa 100644 (file)
@@ -18,9 +18,7 @@ class RedirectClientIfAuthenticated
     {
         if (($request->path() === "se-connecter") && Auth::guard('web-clients')->check()) {
             return redirect('/');
-        }
-
-        if (($request->path() === "mon-compte") && !Auth::guard('web-clients')->check()) {
+        }elseif($request->path() !== "se-connecter" && !Auth::guard('web-clients')->check()) {
             return redirect('/se-connecter');
         }
 
index 8299a22abdc297a4a10cc06acbef70b58e406da4..de235d60e50a0c79c4263bdb2502bd3cca60accb 100644 (file)
@@ -24,6 +24,10 @@ class CommandPanierSchema extends CubistMagicAbstractModel
             'label' => 'Produits',
             'type' => 'Text',
             'column' => true
+        ],
+        [
+            'name' => 'total',
+            'type' => 'Text'
         ]
     ];
 }
index 80d1dc14798bf858aeb80e24d4b77a8d4facc690..76658ba8ec8582e9c9906ac7c8ea0207fa893574 100644 (file)
@@ -8,7 +8,7 @@ class Panier extends CommandPanierSchema
 
     protected $_options = ['name' => 'selection',
         'singular' => 'Panier',
-        'plural' => 'Paniers'];
+        'plural' => 'PaniersEnregistres'];
 
     public function setFields()
     {
@@ -24,4 +24,25 @@ class Panier extends CommandPanierSchema
             $this->addField($fields);
         }
     }
+
+    public static function getRefs($products) {
+        $refs = array_map(function ($n) {
+            return $n["ref"] ?? $n["reference"];
+        }, $products);
+
+        return $refs;
+    }
+
+    public function getReferences(){
+        $panier = $this->toArray();
+        $products = json_decode($panier['products'], true);
+
+        $refs = self::getRefs($products);
+
+        return $refs;
+    }
+
+    public static function getAllCart() {
+        return Panier::all()->toArray();
+    }
 }
index c5f05f230dc531a84dd33537240795c83a8873df..bde024d0f522b2c2481439768503867fc36de3a8 100644 (file)
@@ -480,14 +480,46 @@ class Product extends CubistMagicPageModel
             $cart_items = session('cart_items', []);
             self::$_cart_data = [];
 
+            $cart_items_id = array_map(function($n){ return $n['id']; }, $cart_items);
+
+
             if (count($cart_items) > 0) {
+                $productsSellingBasicPrice = self::whereIn('id', $cart_items_id)
+                    ->select('id','basic_selling_price')
+                    ->get()
+                    ->toArray();
+
+                foreach ($cart_items as $key => &$values) {
+                    $id = $values["id"];
+                    $getCartItem = array_values(array_filter($productsSellingBasicPrice, function($n) use($id) { return $n['id'] === $id; }));
+                    $values["basic_selling_price"] = floatval($getCartItem[0]["basic_selling_price"]) ?? 0;
+                }
+
                 self::$_cart_data = $cart_items;
             }
         }
-
         return self::$_cart_data;
     }
 
+    public function getOptions() {
+        return json_decode($this['json'], true);
+    }
+
+    public static function getOptionsByProductsId($products) {
+        $options = Product::whereIn('id', array_column($products, 'id'))
+            ->select('id','json')
+            ->get()
+            ->groupBy('id')
+            ->map(function ($group) {
+                return $group->pluck('json')->toArray();
+            })
+            ->toArray();
+
+        return array_map(function($n) use($options) {
+            return json_decode($options[$n['id']][0],true);
+            }, $products
+        );
+    }
 
     public static function getFilteredProducts($product_type, $filter_values = [])
     {
index b5cf4652d7c10e8291b9636e4ece4c0cb259955d..be654ed08d1217ca0bf43a6182104fdacee5b5b5 100644 (file)
@@ -59,6 +59,7 @@ class AppServiceProvider extends ServiceProvider
             BladeX::component('components.news-item'); // <news-item :item="$newsItem"> ... </news-item>
             BladeX::component('components.address-form'); // <address-form> ... </address-form>
             BladeX::component('components.modal-confirm'); // <modal-confirm> ... </modal-confirm>
+            BladeX::component('components.btn-delete'); // <btn-delete> ... </btn-delete>
         } catch (\Exception $e) {
 
         }
diff --git a/app/Templates/PaniersEnregistres.php b/app/Templates/PaniersEnregistres.php
new file mode 100644 (file)
index 0000000..1f21efb
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+
+namespace App\Templates;
+
+
+class PaniersEnregistres extends Base
+{
+    public function getName()
+    {
+        return 'Paniers enregistrés';
+    }
+
+    public function init()
+    {
+        parent::init();
+    }
+}
index 7ab386178ed77e957cdf7370647ff1f677ec40db..1c18c89952638775ccf4c87e85c9151fddcc0a61 100644 (file)
@@ -80,7 +80,9 @@ const app = new Vue({
         price: '',
         ref: '',
         statusConfig: false,
-        statusText: ''
+        statusText: '',
+        //
+        nameSaved: {}
     },
 
     beforeMount() {
@@ -92,7 +94,7 @@ const app = new Vue({
     mounted() {
         eventBus.$on('add-item', data => {
             data.action = 'add';
-            data.ref = this.ref;
+            data.ref = this.ref ?? data.ref;
             data.price = this.price;
             this.saveCart(data);
         });
@@ -260,6 +262,19 @@ const app = new Vue({
                 }
             }
         },
+        animateDelete(el, parent = null) {
+            el.animate([
+                    { opacity: 1 },
+                    { opacity: 0 }
+                ],
+                {
+                    duration: 1000
+                }
+            );
+            setTimeout(() => {
+                parent ? el.parentElement.remove() : el.remove()
+            }, 1000)
+        },
         checkEmailExist() {
             let root = this,
                 data = {
@@ -422,17 +437,7 @@ const app = new Vue({
                     if(response.data)
                         root.addresses = response.data
 
-                    form_.animate([
-                            { opacity: 1 },
-                            { opacity: 0 }
-                        ],
-                        {
-                            duration: 1000
-                        }
-                    );
-                    setTimeout(() => {
-                        form_.parentElement.remove()
-                    }, 1000)
+                    root.animateDelete(form_, true)
                 })
                 .catch(function (error) {
                 }
@@ -472,22 +477,62 @@ const app = new Vue({
         /**
          *
          */
-        storePanier() {
+        storeCart() {
             let root = this,
                 data = {
                     name: "Panier du "+document.querySelector('[name="now"]').dataset.content,
-                    userId: this.user.id,
+                    user_id: this.user.id,
                     addresses: this.addresses,
                     products: this.items
                 }
 
-            axios.post('/ajax/storepanier', data)
+            axios.post('/ajax/storecart', data)
                 .then(function (response) {
                     console.log(response)
                 })
                 .catch(function (error) {
                     console.log(error)
                 })
+        },
+        toggleName(event) {
+            const   id = event.target.dataset.input,
+                    editText = event.target.dataset.edittext,
+                    defaultText = event.target.dataset.defaulttext,
+                    el = document.getElementById('cart-name-'+id)
+
+            if(el.value.length > 0)
+                var state = el.classList.toggle("readonly")
+
+            if(!state) {
+                el.focus()
+                el.removeAttribute('readonly')
+                event.target.innerText = editText
+            } else {
+                axios.post('/ajax/updateNameSavedcart', {id: id, text: el.value})
+                .then(function (response) {
+                    event.target.innerText = defaultText
+                    el.setAttribute('readonly', 'readonly')
+                })
+                .catch(function (error) {
+                })
+            }
+        },
+        removeSavedCart(event) {
+            const   id = event.target.dataset.id ?? event.target.parentElement.dataset.id,
+                    el = document.getElementById('cart-saved-'+id),
+                    root = this
+
+            axios.post('/ajax/deleteSavedcart', {id: id})
+                .then(function (response) {
+                    root.animateDelete(el)
+                })
+                .catch(function (error) {
+                })
+        },
+        savedCartToCurrent() {
+            const data = {
+
+            }
         }
     },
     /**
@@ -568,10 +613,13 @@ $(document).on('click', 'button.cart-add', function () {
     $(this).addClass('btn-no-hover').addClass('bg-navy');
     $(this).find('.add').addClass('hidden');
     $(this).find('.added').removeClass('hidden').addClass('inline-flex');
-    var id = parseInt($(this).attr('data-product-id'));
+    var id = parseInt($(this).attr('data-product-id')),
+        ref = $(this).attr('data-ref')
+
     eventBus.$emit('add-item', {
         id: id,
         quantity: 1,
+        ref: ref
     });
 
     clearTimeout(time);
index cc8e266262230c6f99a1784c3c17a97b224b9f50..c9187e8c01abb4a03e23d849309367c3cb6fc287 100644 (file)
@@ -6,7 +6,7 @@
 body
   min-width: 320px
 
-p:not(:last-child)
+p:not(:last-child):not(.no-m)
   margin-bottom: 1.5em
 
 // Layout containers
index 71ed0b5c99716ab417cab5c3a4eadc8872c8a837..72189585ca9109057a3a7278f3783cdd2f7d49ae 100644 (file)
 
   +below(850px)
     grid-fallback(1)
+
+//
+.cartsave
+  &:not(:last-child)
+    margin-bottom: 24px
+  &-name
+    padding: 46px 0 26px
+    input
+      padding: 10px
+      width: 100%
+      max-width: 100%
+      &.readonly
+        background: none
+        cursor: default
+        outline: none
+        padding: 0
+
+  &-products
+    padding: 24px 0
+    border-top: 1px solid theme('colors.light-b')
+    border-bottom: 1px solid theme('colors.light-b')
+
+    .grid:not(:last-child)
+      margin-bottom: 24px
+
+  &-grid
+    grid-template-columns: 96px 1fr !important
+
+  &-footer
+    padding: 48px 0
+
+  .product
+    &-thumbnail
+      height: 96px
diff --git a/resources/views/components/btn-delete.blade.php b/resources/views/components/btn-delete.blade.php
new file mode 100644 (file)
index 0000000..2fd9de4
--- /dev/null
@@ -0,0 +1,4 @@
+<button class="flex items-center" data-id="{{ $id }}" @click="removeSavedCart">
+    @svg('icon-trash')
+    <span class="ml-3">{{ $slot }}</span>
+</button>
index ec5c83e10f4cf68bb85d4fbf456423dba8a63d46..985fc045297af9bba36d4bd84d8dada07902d279 100644 (file)
@@ -1,4 +1,4 @@
-<button data-product-id="{{ $id }}" class="btn cart-add" :class="{ 'pointer-events-none bg-grey-disabled' : (!isNaN(price) && !statusConfig) || (price && !user) }">
+<button data-ref="{{ $reference }}" data-product-id="{{ $id }}" class="btn cart-add" :class="{ 'pointer-events-none bg-grey-disabled' : (!isNaN(price) && !statusConfig) || (price && !user) }">
         <span class="btn-text relative">
             <span class="add">
                 @if(isset($price))
index 9a716d323a438847d2d4b13e19f686703165a745..1aba191f0502aa552c2df3d05b4f63de11ddc641 100644 (file)
@@ -13,7 +13,8 @@
                 {{-- Nested divs to allow grey backgrounds of columns to match the height of their content instead of total height --}}
                 <div>
                     <cart :items='items' :sendevents="false" class="bg-grey-100 p-1v pb-0 overflow-hidden"></cart>
-                    <div class="bg-grey-100 p-1v pt-0">
+
+                    <div class="bg-grey-100 p-1v pt-0" v-cloak v-if="cartItemCount === cartItemHasPriceCount">
                         <div class="cart-shipping-fees text-navy">
                             {{ __('Frais de ports') }} : <span v-cloak>@{{ total > 1000 ? '20€' : '0€' }}</span>
                         </div>
                             <p class="text-2xl text-navy">{{ __('Total TTC') }} : <span v-cloak>@{{ totalTTC }}</span></p>
                         </div>
                     </div>
-                    <button class="cart-valid-command btn btn-custom xs:w-full">
+                    <button class="cart-valid-command btn btn-custom xs:w-full" v-cloak v-if="cartItemCount === cartItemHasPriceCount">
                         {{ __('Valider la commande') }}
                     </button>
 
                     <div class="cart-links">
-                        <a href="#">{{ __('Obtenir un devis officiel') }}</a><br>
-                        <a href="#" @click.prevent="storePanier()">{{ __('Enregistrer ce panier') }}</a>
+                        <a href="#" v-cloak v-if="cartItemCount === cartItemHasPriceCount">{{ __('Obtenir un devis officiel') }}</a><br>
+                        <a href="#" @click.prevent="storeCart()">{{ __('Enregistrer ce panier') }}</a>
                     </div>
 
-                    <div class="text-sm">
+                    <div class="text-sm" v-cloak v-if="cartItemCount === cartItemHasPriceCount">
                         En nous transmettant votre demande, vous acceptez que PM Instrumentation traite vos données
                         personnelles dans le but de vous offrir un service de qualité. Pour plus d’information sur la
                         protection de vos données à caractère personnel, vous pouvez consulter la page
diff --git a/resources/views/pages/paniers_enregistres.blade.php b/resources/views/pages/paniers_enregistres.blade.php
new file mode 100644 (file)
index 0000000..1762641
--- /dev/null
@@ -0,0 +1,79 @@
+@extends('layouts/app')
+
+@section('content')
+    <full-width padding="pb-3v">
+        <content>
+            <text-block :title="$page->title" title-tag="h1" />
+
+            @foreach(\App\Models\Panier::getAllCart() as $cart)
+                <div id="cart-saved-{{ $cart['id'] }}" class="cartsave bg-grey-200 pr-2v pl-2v">
+                    <div class="cartsave-name">
+                        <div>
+                            <textarea id="cart-name-{{ $cart['id'] }}" class="readonly" value="{{ $cart['name'] }}" readonly />
+                        </div>
+                        <a href="#" data-input="{{ $cart['id'] }}" class="inline-block animated-underline" data-defaulttext="{{ __('Editer le nom du panier') }}" data-edittext="{{ __('Sauvegarder le nom du panier') }}" @click.prevent.self="toggleName">
+                            {{ __('Editer le nom du panier') }}
+                        </a>
+                    </div>
+                    <div class="cartsave-products">
+                        @foreach(json_decode($cart['products'], true) as $key => $product)
+                            <grid gap="md" class="sm:grid-cols-1 cartsave-grid">
+                                <div class="product-thumbnail bg-center bg-contain bg-no-repeat" style='background-image : url("{{ $product['image'] }}")'>
+                                </div>
+                                <div class="product-infos flex justify-between items-center">
+                                    <div>
+                                        <p class="no-m">{{ $product['ref'] }}</p>
+                                        <p class="no-m text-navy">{{ $product['name'] }}</p>
+                                        @isset($product['basic_selling_price'])
+                                            @if(floatval($product['basic_selling_price']))
+                                                <p class="no-m">{{ __('Prix unitaire') }} <span class="text-navy">{{
+                                                    $product['basic_selling_price'] }} € HT</span>
+                                                </p>
+                                            @endif
+                                        @endisset
+                                        <p class="no-m">{{ __('Quantité') }} : <span class="text-navy">{{$product['quantity']}}</span></p>
+                                    </div>
+                                    <div class="product-price">
+                                        @if(floatval($product['price']))
+                                            <p class="no-m">{{ $product['price'] }}€ HT</p>
+                                        @else
+                                            <p class="text-navy">
+                                                N/A
+                                                <span
+                                                    data-tooltip="{{__('Prix sur devis.')}}"
+                                                    class="font-display text-lg inline-block align-middle rounded-full border-grey-dark border-2 h-8 w-8 text-center ml-3">?</span>
+                                            </p>
+                                        @endif
+                                    </div>
+                                </div>
+                            </grid>
+                        @endforeach
+                    </div>
+                    <div class="cartsave-footer <?php echo $cart['total'] ? 'pt-6' : 'pt-12' ?>">
+                        @isset($cart['total'])
+                            <div class="text-right pb-6">
+                                <p class="no-m">{{ __('Montant Total') }}</p>
+                                <p class="no-m">{{ $cart['total'] }}€ HT</p>
+                            </div>
+                        @endisset
+                        <div class="flex justify-between items-center">
+                            <button class="flex items-center" data-id="{{ $cart['id'] }}" @click.stop="removeSavedCart">
+                                @svg('icon-trash')
+                                <span class="ml-3">{{ __('Supprimer ce panier') }}</span>
+                            </button>
+
+                            <div class="flex items-center">
+                                <a href="" class="animated-underline mr-10 xs:mr-0">{{ __('Modifier ce panier') }}</a>
+                                @isset($cart['total'])
+                                    <a href="" class="btn">{{ __('Passer commande') }}</a>
+                                @else
+                                    <a href="" class="btn">{{ __('Demander un devis') }}</a>
+                                @endisset
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            @endforeach
+        </content>
+    </full-width>
+@endsection
index 6a6e203a432c5a4d5eb2f8425b442a9854326f2b..81d395d907833fbbc41b1cfb02e38860f6a342ca 100644 (file)
@@ -91,7 +91,7 @@
                 @endauth
 
                 @if(config('features.quote'))
-                    <cart-add :id="$product->id" :price="$product->basic_selling_price"></cart-add>
+                    <cart-add :id="$product->id" :reference="$product->reference" :price="$product->basic_selling_price"></cart-add>
                     <span
                         data-tooltip="{{__('Ajoutez un ou plusieurs produits à votre sélection, ajustez les quantités et obtenez un devis.')}}"
                         class="font-display text-lg inline-block align-middle rounded-full border-grey-dark border-2 h-8 w-8 text-center ml-6">?</span>
index f7042f79e92a41bf05cf09bb649efce62a6ccad6..d70cdb02224dcefa2b29656c31db2feb2ce42146 100644 (file)
@@ -79,7 +79,7 @@
                     </link-button>
                     <div class="text-center">
                         <a href="" class="animated-underline mt-5 inline-block w-100">{{ __('Obtenir un devis officiel') }}</a><br>
-                        <a href="" class="animated-underline mt-5 inline-block">{{ __('Enregistrer ce panier') }}</a>
+                        <a href="" class="animated-underline mt-5 inline-block" @click.prevent="storeCart()">{{ __('Enregistrer ce panier') }}</a>
                     </div>
                 </div>
             </div>
index 1684789d5cbcf30280484413566dcffd07ee2dda..265ae9d752dc354de7a4c183e84a7ff584318d34 100644 (file)
@@ -18,7 +18,7 @@
             </a>
         </li>
         <li class="{{ Request::is('panier-enregistré') ? "active" : '' }}">
-            <a href="">
+            <a href="/paniers-enregistres">
                 <span>{{ __('Panier enregistrés') }}</span>
             </a>
         </li>
index 1514af35fd90a034da4ce50b96bb946b2b2ef086..d0c0029921a2c6d5b4a2c0bfcf199df92ddcefdd 100644 (file)
@@ -20,7 +20,7 @@
             {{$product->get('name')}}
         </div>
         @if(config('features.quote'))
-            <cart-add :id="$product->id"></cart-add>
+            <cart-add :id="$product->id" :reference="$product->reference"></cart-add>
         @endif
         <div class="links mt-4">
             <div class="link">
index 13090641b1a2e6d745742790e85e93871620d0b5..d0fe4d9da69ed3769662af2db66ff1c4f2fbe358 100644 (file)
@@ -4,7 +4,7 @@ Route::get('/deconnexion', 'ClientController@logout');
 //add specific name to be simple to add active class
 //add middleware to secure this specific page
 Route::any('{page}', 'PageController@catchall')->where(
-    ['page' => '\b(se-connecter|mon-compte)\b']
+    ['page' => '\b(se-connecter|mon-compte|paniers-enregistres)\b']
 )->name('client')->middleware('client');
 
 Route::any('{page}/{subs?}',  'PageController@catchall')