]> _ Git - pmi.git/commitdiff
wip #5780 @6:30 Gestion des erreurs, correctifs js/css, refactorisation
authorsoufiane <soufiane@cubedesigners.com>
Mon, 27 Mar 2023 09:00:30 +0000 (11:00 +0200)
committersoufiane <soufiane@cubedesigners.com>
Mon, 27 Mar 2023 09:00:30 +0000 (11:00 +0200)
19 files changed:
app/Http/Controllers/AjaxController.php
app/Http/Controllers/SignInController.php
app/Http/Middleware/RedirectClientIfAuthenticated.php
app/Models/Client.php
app/Providers/AppServiceProvider.php
app/Providers/RouteServiceProvider.php
app/SubForms/Address.php
resources/js/app.js
resources/styles/components/modal-confirm.styl
resources/styles/components/my-account.styl
resources/styles/components/signin.styl
resources/views/components/address-form.blade.php
resources/views/components/modal-confirm.blade.php [new file with mode: 0644]
resources/views/pages/my_account.blade.php
resources/views/pages/sign_in.blade.php
resources/views/partials/header.blade.php
resources/views/partials/modal-confirm.blade.php [deleted file]
resources/views/partials/nav-account.blade.php
routes/web.php

index 00b5e655e6bf6a56530ccf4b3ce7287975229955..637ade44c1290b3a942fb2fc32167fa2e28ca852 100644 (file)
@@ -385,23 +385,25 @@ class AjaxController extends CubistFrontController
             }elseif(in_array($key,['phone'])){
                 $validation[$key] = 'required|numeric';
             }elseif ($key === "actually_password"){
-                $validation[$key] = 'required|missing|current_password';
+                $validation[$key] = 'required';
             }elseif ($key === "password"){
                 $validation[$key] = 'required|confirmed|min:8';
             }
         }
 
         $data = $this->validation_form($request, $validation);
-
-        $data['password'] = Hash::make($data['password']);
-        /*$password = $data['actually_password'];
-        $actuallyPassword = Auth::guard('web-clients')->user()->password;*/
         $email = Auth::guard('web-clients')->user()->email;
 
-        /*if (!Hash::check($password,$actuallyPassword)) {
-            throw ValidationException::withMessages(['password' => __('Le mot de passe est incorrect')]);
+        if($request->password) {
+            $data['password'] = Hash::make($data['password']);
+            $password = $data['actually_password'];
+            $actuallyPassword = Auth::guard('web-clients')->user()->password;
+
+            if (!Hash::check($password, $actuallyPassword)) {
+                throw ValidationException::withMessages(['password' => __('Le mot de passe est incorrect')]);
+            }
+            unset($data['actually_password']);
         }
-        unset($data['actually_password']);*/
 
         $client = Client::where('email',$email)->update($data);
     }
@@ -443,7 +445,6 @@ class AjaxController extends CubistFrontController
         }
 
 
-
         if(isset($request->address['delivery_address'])){
             foreach ($addressToArray as $key => &$value){
                 $value->delivery_address = "0";
@@ -490,6 +491,17 @@ class AjaxController extends CubistFrontController
     }
 
     public function getuser() {
-        return Auth::guard('web-clients')->user();
+        $user = Auth::guard('web-clients')->user();
+        $addressToArray = json_decode($user->address);
+        $checkBillingAddress = array_filter($addressToArray, function($n) { return $n->billing_address; });
+        $checkDeliveryAddress = array_filter($addressToArray, function($n) { return $n->delivery_address; });
+
+        $data = [
+            'user' => $user,
+            'address_billing' => key($checkBillingAddress) ?? "0",
+            'address_delivery' => key($checkDeliveryAddress) ?? "0"
+        ];
+
+        return $data;
     }
 }
index b4bcd69e84661de38418683fff6b0b31178ed1a3..546d9506cb1de49838b8157ceb7f3cf1a9947152 100644 (file)
@@ -12,6 +12,6 @@ class SignInController extends CubistFrontController
 {
     public function view(Request $request)
     {
-        return view('pages.signin');
+        return view('pages.sign_in');
     }
 }
index ff7ca77e005dae7d30087a3324bad3d36f9a8b42..fb9e042ccd7d85d148842f1febe241e4c992f37a 100644 (file)
@@ -16,11 +16,11 @@ class RedirectClientIfAuthenticated
      */
     public function handle($request, Closure $next)
     {
-        if (($request->is('se-connecter')) && Auth::guard('web-clients')->check()) {
+        if (($request->path() === "se-connecter") && Auth::guard('web-clients')->check()) {
             return redirect('/');
         }
 
-        if (($request->is('mon-compte')) && !Auth::guard('web-clients')->check()) {
+        if (($request->path() === "mon-compte") && !Auth::guard('web-clients')->check()) {
             return redirect('/se-connecter');
         }
 
index 084e1afd691d38434e8e7b2e0b21de619a4979de..d22cb1d2c54273b739e31dbbd6de46f0b5b462e4 100644 (file)
@@ -24,7 +24,7 @@ class Client extends CubistMagicAbstractModel
 
         $this->addField(['name' => 'password',
             'label' => 'Password',
-            'type' => 'Text']);
+            'type' => 'Hidden']);
 
         $this->addField(['name' => 'lastname',
             'label' => 'Nom',
@@ -70,7 +70,8 @@ class Client extends CubistMagicAbstractModel
             'type' => 'BunchOfFieldsMultiple',
             'bunch' => 'App\SubForms\Address',
             'column' => true,
-            'tab' => 'Informations client'
+            'tab' => 'Informations client',
+            'edit_label' => 'Éditer « %city »'
         ]);
 
         $this->addField(['name' => 'status',
index a8fd24b0683f4256339c81402d992c3697afdf0d..b5cf4652d7c10e8291b9636e4ece4c0cb259955d 100644 (file)
@@ -57,7 +57,8 @@ class AppServiceProvider extends ServiceProvider
             BladeX::component('components.cart-add')->tag('cart-add'); // <cart-add id="1234"> ... </cart-add>
             BladeX::component('components.news-grid'); // <news-grid :items="$news"> ... </news-grid>
             BladeX::component('components.news-item'); // <news-item :item="$newsItem"> ... </news-item>
-            BladeX::component('components.address-form'); // <news-item :item="$newsItem"> ... </news-item>
+            BladeX::component('components.address-form'); // <address-form> ... </address-form>
+            BladeX::component('components.modal-confirm'); // <modal-confirm> ... </modal-confirm>
         } catch (\Exception $e) {
 
         }
index 5ea48d39d4f95bf767d324893c80b17432bc9d34..f6a9e36008a8ce4f2a9497f8fa3de5d487a32609 100644 (file)
@@ -38,7 +38,6 @@ class RouteServiceProvider extends ServiceProvider
         $this->mapApiRoutes();
 
         $this->mapWebRoutes();
-
         //
     }
 
index 38deba37f98d5c7025b929a90673325a50917de4..24c6d1b3135d7a916811a5678541747ea6a9b35e 100644 (file)
@@ -9,66 +9,51 @@ class Address extends SubForm {
     {
         parent::init();
 
-        $this->addField([
-            'name' => 'id',
-            'label' => 'Id',
-            'type' => 'Integer',
-            'attributes' => [
-                'disabled' => 'disabled'
-            ]
-        ]);
-
         $this->addField([
             'name' => 'name',
             'label' => "Nom de l'adresse",
-            'type' => 'Text',
-            'tab' => 'Nom'
+            'type' => 'Text'
         ]);
 
         $this->addField([
             'name' => 'address',
             'label' => "Adresse",
-            'type' => 'Textarea',
-            'tab' => 'Adresse'
+            'type' => 'Textarea'
         ]);
 
         $this->addField([
             'name' => 'lastname',
             'label' => "Nom",
-            'type' => 'Text',
-            'tab' => 'Nom'
+            'type' => 'Text'
         ]);
 
         $this->addField([
             'name' => 'firstname',
             'label' => "Prénom",
-            'type' => 'Text',
-            'tab' => 'Prénom'
+            'type' => 'Text'
         ]);
 
         $this->addField([
             'name' => 'zipcode',
             'label' => "Code postal",
-            'type' => 'Number',
-            'tab' => 'Code postal'
+            'type' => 'Number'
         ]);
 
         $this->addField([
             'name' => 'city',
-            'label' => "Titre",
-            'type' => 'Text',
-            'tab' => 'Ville'
+            'label' => "Ville",
+            'type' => 'Text'
         ]);
 
         $this->addField([
             'name' => 'billing_address',
-            'label' => "Adresse de facturation",
+            'label' => "Adresse de facturation par défaut",
             'type' => 'Checkbox',
         ]);
 
         $this->addField([
             'name' => 'delivery_address',
-            'label' => "Adresse de livraison",
+            'label' => "Adresse de livraison par défaut",
             'type' => 'Checkbox',
         ]);
     }
index 3dc5338f853b491e9ed66b7bf6702780fe7f13b0..2fd2d3a3dca4e22cf4a9dff2e72eb29c010f89f3 100644 (file)
@@ -60,13 +60,17 @@ const app = new Vue({
     data: {
         items: {}, // Populated from data attribute on root element so we can pass data from PHP
         savingCart: false,
-        type: 'password',
+        type: {
+            'pw': 'password',
+            'new_pw': 'password',
+            'confirm': 'password'
+        },
         email_signin: '',
         password_signin: '',
         emailExist: false,
         validateEmail: false,
         address_choice: true,
-        validateRegister: false,
+        validateForm: false,
         tab: 'infos',
         addresses: [{}],
         errorsForm: {},
@@ -100,10 +104,6 @@ const app = new Vue({
         });
     },
 
-    updated(){
-        //console.log(this.selected)
-    },
-
     computed: {
         cartItemCount() {
             // Todo: See if this should count just number of items or make a sum of all quantities? What is more useful? The sum of quantities can be found using map/reduce functions but this needs to be adapted for the object structure using Object.keys as the source.
@@ -160,20 +160,19 @@ const app = new Vue({
         closeCart() {
             document.body.classList.remove('cart-open');
         },
-        //next code is for login and register form
-        toggleType() {
-            this.type = this.type === "password" ? "text" : "password"
+        //next code is for login and account page
+        toggleType(el) {
+            this.type[el] = this.type[el] === "password" ? "text" : "password"
         },
         removeErrors() {
-            let errorMessage = document.querySelectorAll('.form-error'),
+            let errors = document.querySelector('.form-errors'),
                 errorInput = document.querySelectorAll('.error')
 
-            for (var i = 0; i < errorMessage.length; i++) {
-                errorMessage[i].remove();
-            }
-            for (var i = 0; i < errorInput.length; i++) {
-                errorInput[i].classList.remove('error');
-            }
+            if(errors)
+                errors.remove()
+                for (var i = 0; i < errorInput.length; i++) {
+                    errorInput[i].classList.remove('error');
+                }
         },
         checkEmailExist() {
             let root = this,
@@ -193,6 +192,29 @@ const app = new Vue({
                     console.log('error', error)
                 })
         },
+        errorHandling(data, root){
+            if (data.response) {
+                let errors = data.response.data.errors
+                root.errorsForm = errors
+
+                root.removeErrors()
+
+                for (let k in errors) {
+                    if(k.indexOf('.')){
+                        let keys = k.split('.')
+                        for(let i = 0; i < keys.length; i++){
+                            if(i !== 0){
+                                k += '['+keys[i]+']'
+                            }else{
+                                k = keys[i]
+                            }
+                        }
+                    }
+                    let el = document.querySelector('[name*="' + k + '"]')
+                    el.classList.add('error')
+                }
+            }
+        },
         signin() {
             let root = this,
                 form = document.getElementById('signin-form'),
@@ -216,15 +238,15 @@ const app = new Vue({
                     }
                 })
                 .catch(function (error) {
-                    console.log(error)
+                    root.errorHandling(error, root)
                 })
         },
-        async  signup() {
+        signup() {
             let root = this,
                 form = document.getElementById('signup-form'),
                 data = new FormData(form)
 
-            await axios.post('/ajax/signup', data)
+            axios.post('/ajax/signup', data)
                 .then(function (response) {
                     //
                     root.removeErrors()
@@ -234,62 +256,61 @@ const app = new Vue({
                         top: 0,
                         behavior: "smooth"
                     })
-                    root.validateRegister = true
+                    root.validateForm = true
                     root.email_signin = ''
                     root.errorsForm = {}
                 })
                 .catch(function (error) {
-                    if (error.response) {
-                        let errors = error.response.data.errors
-                        root.errorsForm = errors
-
-                        root.removeErrors()
-
-                        for (let k in errors) {
-                            if(k.indexOf('.')){
-                                let keys = k.split('.')
-                                for(let i = 0; i < keys.length; i++){
-                                    if(i !== 0){
-                                        k += '['+keys[i]+']'
-                                    }else{
-                                        k = keys[i]
-                                    }
-                                }
-                            }
-                            let el = document.querySelector('[name*="' + k + '"]')
-                            el.classList.add('error')
-                        }
-                    }
+                    root.errorHandling(error, root)
                 })
         },
         activeTab(tab){
             this.tab = tab
+            this.errorsForm = {}
             this.resetUrlAccount()
+            this.removeErrors()
         },
         getUser(){
             let root = this
             axios.post('/ajax/getuser')
                 .then(function (response) {
                     //
-                    root.user = response.data
-                    root.addresses = JSON.parse(response.data.address)
+                    root.user = response.data['user']
+                    root.addresses = JSON.parse(root.user.address)
 
-                    let indexBillingAddress = root.addresses.filter(address => address.billing_address === "1")[0]['id'];
-                    let indexDeliveryAddress = root.addresses.filter(address => address.delivery_address === "1")[0]['id'];
-
-                    root.default_billing_address = 'billing'+indexBillingAddress
-                    root.default_delivery_address = 'delivery'+indexDeliveryAddress
+                    root.default_billing_address = 'billing'+response.data['address_billing']
+                    root.default_delivery_address = 'delivery'+response.data['address_delivery']
                 })
                 .catch(function (error) {
 
                 })
         },
-        addAddressToForm(){
+        addAddressToForm(event){
             let newAddress = {
                 'billing_address': '0',
                 'delivery_address': '0'
             }
+
             this.addresses.push(newAddress)
+
+            //disabled click at most once
+            let target = event.target
+            target.setAttribute('disabled', 'disabled')
+
+            setTimeout(function (){
+
+                let forms = document.querySelector('.form-portal').parentElement.parentElement.lastChild
+                let top = forms.offsetTop - 60;
+
+                window.scrollTo({
+                    top: top,
+                    behavior: "smooth"
+                })
+
+                //enabled click after scroll is happened
+                target.removeAttribute('disabled')
+
+            }, 150)
         },
         update(id){
             let root = this,
@@ -300,11 +321,11 @@ const app = new Vue({
                 .then(function (response) {
                     //
                     root.removeErrors()
-                    root.validateRegister = true
+                    root.validateForm = true
                     root.form[id] = response.data
                 })
                 .catch(function (error) {
-
+                    root.errorHandling(error, root)
                 })
         },
         updateAddress(id){
@@ -316,10 +337,10 @@ const app = new Vue({
                 .then(function (response) {
                     //
                     root.removeErrors()
-                    root.validateRegister = true
+                    root.validateForm = true
                 })
                 .catch(function (error) {
-
+                    root.errorHandling(error, root)
                 })
         },
         deleteAddress(index, form){
@@ -349,9 +370,27 @@ const app = new Vue({
                 })
 
         }
+    },
+    directives: {
+        'close-outside': {
+            twoWay: true,
+            bind(el, binding, vnode) {
+                const vm = vnode.context;
+                Window.event = (e) => {
+                    if (!el.contains(e.target) || e.key === "Escape") {
+                        vm.validateForm = false
+                    }
+                }
+                document.body.addEventListener('click', Window.event)
+                document.body.addEventListener('keydown', Window.event)
+            },
+            unbind: function () {
+                document.body.removeEventListener('click', Window.event)
+                document.body.removeEventListener('keydown', Window.event)
+            },
+        }
     }
 
-
 });
 
 
@@ -371,6 +410,15 @@ document.addEventListener('DOMContentLoaded', function () {
     }
 });
 
+/**
+ * The following block of code is used for to close "modal confirm update/register"
+ * with escape key of keyboard or by clicking outside the modal
+ */
+
+/**
+ * end of block
+ */
+
 document.addEventListener('scroll', function () {
     checkScroll();
 }, {passive: true});
index 58fae710f40f89773716424df780c9a4727466bf..917a523bde8ef458326d5aca82085f1d6ab12d43 100644 (file)
@@ -7,8 +7,9 @@
   width: 100%
   height: 100vh
   padding: 0 25px
-  z-index: 99
-  top: -120px
+  z-index: 999
+  //top: -120px
+  top: -var(--header-height)
   &-text
     width: 100%
     max-width: 744px
index f723dd0864fd18426fc0a7cf6f315dfbf762b18d..f2d424ce68b2b268c52a1413029a555413db0c46 100644 (file)
@@ -44,7 +44,7 @@
       &.label-checkbox
         display: flex !important
 
-    [type="checkbox"]
+    [type="radio"]
       width: 16px !important
       height: 24px
       margin: 0
index d5e55cd4c53ab60f056b3d900d4e69d5995f9f59..117a6987f1fc0eb3699bb8dad8ae014c838066f6 100644 (file)
@@ -43,7 +43,7 @@
   .line-up
     border-top: 1px solid #D5D7DF
 
-[class*="-form-errors"]
+[class*="form-errors"]
   padding: 20px
   background: rgba(248,30,96,.21)
   li
index 0eda80496b9580f2897d4b3bb82e86999ee7a7ff..07633ab4d45d0d8043ed840f3f75be66043b26e6 100644 (file)
@@ -1,4 +1,11 @@
 <form :id="'update-address-'+key" class="form-portal max-w-half-form" @submit.prevent="updateAddress('update-address-'+key)">
+    <div class="form-errors mb-10" v-if="Object.keys(errorsForm).length > 0">
+        <ul class="list-disc list-inside text-red">
+            <li class="leading-5" v-for="(errorName,errorKey) in errorsForm" :key="errorKey">
+                @{{ errorName[0] }}
+            </li>
+        </ul>
+    </div>
     <div class="form-group mb-12">
         <div class="fields grid">
             <label class="form-input text-navy">
     </div>
     <div class="form-group">
         <label class="label-checkbox flex">
-            <input type="checkbox" :checked="default_billing_address !== 'billing'+key ? false : true" class="w-4 h-4" name="address[billing_address]" @click="default_billing_address = 'billing'+key" />
+            <input type="radio" :checked="default_billing_address !== 'billing'+key ? false : true" class="w-4 h-4" name="address[billing_address]" @click="default_billing_address = 'billing'+key" />
             <span class="ml-4">{{ __('Adresse de facturation par défaut') }}</span>
         </label>
         <label class="label-checkbox flex mb-6">
-            <input type="checkbox" :checked="default_delivery_address !== 'delivery'+key ? false : true" class="w-4 h-4" name="address[delivery_address]" @click="default_delivery_address = 'delivery'+key" />
+            <input type="radio" :checked="default_delivery_address !== 'delivery'+key ? false : true" class="w-4 h-4" name="address[delivery_address]" @click="default_delivery_address = 'delivery'+key" />
             <span class="ml-4">{{ __('Adresse de livraison par défaut') }}</span>
         </label>
     </div>
@@ -56,4 +63,3 @@
         <span class="ml-3">Supprimer cette adresse</span>
     </button>
 </form>
-
diff --git a/resources/views/components/modal-confirm.blade.php b/resources/views/components/modal-confirm.blade.php
new file mode 100644 (file)
index 0000000..8517ca5
--- /dev/null
@@ -0,0 +1,8 @@
+<div class="modal-confirm fixed top-0 left-0 flex items-center" v-cloak v-if="validateForm">
+    <div class="modal-confirm-text relative text-2xl bg-white p-24 text-center mx-auto" v-close-outside>
+        <button class="modal-confirm-close absolute" @click.prevent="validateForm = false">
+            @svg('icon-close-thin', 'w-4')
+        </button>
+        {{ $slot }}
+    </div>
+</div>
index e8cb493905c5783b7f79c461652172cfeee177fd..55b070c06fcc8f14910c0b1d3bd0543832774b23 100644 (file)
                         <div class="ajax-form flex flex-col pt-12">
                             <h2 class="text-2xl m-0">{{ __('Mes coordonnées') }}</h2>
                             <form id="update-details" class="form-portal max-w-half-form" @submit.prevent="update('update-details')">
+                                <div class="form-errors my-10" v-if="Object.keys(errorsForm).length > 0">
+                                    <ul class="list-disc list-inside text-red">
+                                        <li class="leading-5" v-for="(errorName,errorKey) in errorsForm" :key="errorKey">
+                                            @{{ errorName[0] }}
+                                        </li>
+                                    </ul>
+                                </div>
                                 <div class="form-group fields grid">
                                     <label class="form-input half text-navy">
                                         {{ __('Nom') }}<span>*</span>
@@ -66,7 +73,7 @@
                     <div id="account-address" class="account-address" v-cloak v-if="tab === 'address'">
                         <div class="account-address-header flex items-center justify-between border-b border-b-light-b relative">
                             <h2 class="text-2xl m-0">{{ __('Mes adresses') }}</h2>
-                            <button class="btn btn-custom xs:w-full flex items-center absolute right-0" @click.prevent="addAddressToForm()">
+                            <button class="btn btn-custom xs:w-full flex items-center absolute right-0" @click.prevent="addAddressToForm">
                                 <span class="pr-2">{{ __('Ajouter une adresse') }}</span>
                                 @svg('icon-white-add')
                             </button>
                         <div class="pb-12 border-b border-b-light-b">
                             <h2 class="text-2xl m-0">{{ __('Modifier mon mot de passe') }}</h2>
                         </div>
+                        <div class="signup-form-errors mb-10" v-if="Object.keys(errorsForm).length > 0">
+                            <ul class="list-disc list-inside text-red">
+                                <li class="leading-5" v-for="(errorName,errorKey) in errorsForm" :key="errorKey">
+                                    @{{ errorName[0] }}
+                                </li>
+                            </ul>
+                        </div>
                         <div class="ajax-form flex flex-col pt-12">
                             <form id="update-password" class="form-portal max-w-half-form" @submit.prevent="update('update-password')">
                                 <div class="form-group fields grid">
                                     <label class="form-input text-navy">
                                         {{ __('Mot de passe actuel') }}<span>*</span>
                                         <div class="relative">
-                                            <input class="py-3 mt-3" :type="type" required="required" name="actually_password" />
-                                            <button class="btn-show-pwd bg-white w-12" @click.prevent="toggleType">
-                                                <span v-if="type === 'password' ">
+                                            <input class="py-3 mt-3" :type="type['pw']" required="required" name="actually_password" />
+                                            <button class="btn-show-pwd bg-white w-12" @click.prevent="toggleType('pw')">
+                                                <span v-if="type['pw'] === 'password' ">
                                                     @svg('icon-eye')
                                                 </span>
                                                 <span v-else>
                                     <label class="form-input text-navy">
                                         {{ __('Nouveau mot de passe') }}<span>*</span>
                                         <div class="relative">
-                                            <input class="py-3 mt-3" :type="type" required="required" name="password" />
-                                            <button class="btn-show-pwd bg-white w-12" @click.prevent="toggleType">
-                                                <span v-if="type === 'password' ">
+                                            <input class="py-3 mt-3" :type="type['new_pw']" required="required" name="password" />
+                                            <button class="btn-show-pwd bg-white w-12" @click.prevent="toggleType('new_pw')">
+                                                <span v-if="type['new_pw'] === 'password' ">
                                                     @svg('icon-eye')
                                                 </span>
                                                 <span v-else>
                                     <label class="form-input text-navy">
                                         {{ __('Confirmer le nouveau mot de passe') }}<span>*</span>
                                         <div class="relative">
-                                            <input class="py-3 mt-3" :type="type" required="required" name="password_confirmation" />
-                                            <button class="btn-show-pwd bg-white w-12" @click.prevent="toggleType">
-                                                <span v-if="type === 'password' ">
+                                            <input class="py-3 mt-3" :type="type['confirm']" required="required" name="password_confirmation" />
+                                            <button class="btn-show-pwd bg-white w-12" @click.prevent="toggleType('confirm')">
+                                                <span v-if="type['confirm'] === 'password' ">
                                                     @svg('icon-eye')
                                                 </span>
                                                 <span v-else>
             </div>
         </content>
     </full-width>
+    <modal-confirm>
+        <p>{{ __('Vos informations ont été mises à jour avec succès !') }}</p>
+    </modal-confirm>
 @endsection
index 0dd163635a9100035934c64aa9030ec8d88cfe6d..17d8bdfd0eaa909281220c838aaec519c6e0afa8 100644 (file)
                 <div class="form-info text-navy mb-10">
                     <h1 class="text-4xl m-0">Se connecter</h1>
                 </div>
+
                 <form id="signin-form" class="form-portal" @submit.prevent="signin">
+                    <div class="form-errors mb-10" v-if="Object.keys(errorsForm).length > 0">
+                        <ul class="list-disc list-inside text-red">
+                            <li class="leading-5" v-for="(errorName,errorKey) in errorsForm" :key="errorKey">
+                                @{{ errorName[0] }}
+                            </li>
+                        </ul>
+                    </div>
                     @csrf
                     <div class="form-group mb-6">
                         <label class="form-input text-navy">
@@ -40,9 +48,9 @@
                         <label class="form-input text-navy">
                             {{ __('Mot de passe') }}<span>*</span>
                             <div class="relative">
-                                <input class="py-3 mt-3" :type="type" required="required" name="password" />
-                                <button class="btn-show-pwd bg-white w-12" @click.prevent="toggleType">
-                                    <span v-if="type === 'password' ">
+                                <input class="py-3 mt-3" :type="type['pw']" name="password" />
+                                <button class="btn-show-pwd bg-white w-12" @click.prevent="toggleType('pw')">
+                                    <span v-if="type['pw'] === 'password' ">
                                         @svg('icon-eye')
                                     </span>
                                     <span v-else>
@@ -77,6 +85,7 @@
                 <div class="form-info text-navy mb-10">
                     <h1 class="text-4xl m-0">{{ __("Créer un compte") }}</h1>
                 </div>
+
                 <div class="signup-form-errors mb-10" v-if="Object.keys(errorsForm).length > 0">
                     <ul class="list-disc list-inside text-red">
                         <li class="leading-5" v-for="(errorName,errorKey) in errorsForm" :key="errorKey">
@@ -84,6 +93,7 @@
                         </li>
                     </ul>
                 </div>
+
                 <form id="signup-form" class="form-portal" @submit.prevent="signup()">
                     @csrf
                     <div class="form-group mb-6">
             </div>
         </div>
     </div>
-    @include('partials.modal-confirm')
+    <modal-confirm>
+        <p class="mb-4">{{ __('Nous avons bien reçu votre demande d’inscription') }}.</p>
+        <p>{{ __('Vous recevrez un mail de confirmation une fois votre compte validé') }}.</p>
+    </modal-confirm>
 @endsection
index 811deae1c855d52c6c23e8170f4519abe8748b78..f986bb83cb138a67da9fb9f741c4b4cb66d6a59b 100644 (file)
 
         </nav>
 
-
         <ul class="account-header">
-            <li>
-                <a href="{{ $nav->getHrefByName('signin') }}"
+            <li class="{{ Route::currentRouteName() === "client" ? "active" : '' }}">
+                <a href="{{ Auth::guard('web-clients')->check() ? $nav->getHrefByName('Mon compte') : $nav->getHrefByName('signin') }}"
                    class="text-right flex items-center cursor-pointer text-white hover:text-primary"
                 >
                     @include('partials.account')
diff --git a/resources/views/partials/modal-confirm.blade.php b/resources/views/partials/modal-confirm.blade.php
deleted file mode 100644 (file)
index 0f404a3..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<div class="modal-confirm absolute left-0 hidden" :ref="(modalconfirm) => modalconfirm.classList.remove('hidden')" v-if="validateRegister">
-    <div class="modal-confirm-text relative text-2xl bg-white p-24 text-center mx-auto">
-        <button class="modal-confirm-close absolute" @click.prevent="validateRegister = false">
-            @svg('icon-close-thin', 'w-4')
-        </button>
-        <p class="mb-4">Nous avons bien reçu votre demande d’inscription.</p>
-        <p>Vous recevrez un mail de confirmation une fois votre compte validé.</p>
-    </div>
-</div>
index 529185c904a470f1ff5c3b8afde2ac15ac837837..935e3d15b415dbca4506273c11a9f5377536536a 100644 (file)
@@ -1,23 +1,23 @@
 @auth('web-clients')
     <ul class="account-header-list">
-        <li>
+        <li class="{{ Request::is('mon-compte') ? "active" : '' }}">
             <a href="/mon-compte">
                 <span>{{ __('Mon compte') }}</span>
             </a>
             <ul>
-                <li>
+                <li :class="{ active : tab === 'address' }">
                     <a href="/mon-compte#address" @click.stop="tab = 'address'">
                         <span>{{ __('Mes adresses') }}</span>
                     </a>
                 </li>
             </ul>
         </li>
-        <li>
+        <li class="{{ Request::is('mes-commandes') ? "active" : '' }}">
             <a href="">
                 <span>{{ __('Mes commandes') }}</span>
             </a>
         </li>
-        <li>
+        <li class="{{ Request::is('panier-enregistré') ? "active" : '' }}">
             <a href="">
                 <span>{{ __('Panier enregistrés') }}</span>
             </a>
index e1a381ba00d75aa863ac14269c7116c186172e62..13090641b1a2e6d745742790e85e93871620d0b5 100644 (file)
@@ -1,7 +1,11 @@
 <?php
-
 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']
+)->name('client')->middleware('client');
+
 Route::any('{page}/{subs?}',  'PageController@catchall')
-    ->where(['page' => '^(((?=(?!admin))(?=(?!\/)).))*$', 'subs' => '.*'])
-    ->middleware('client');
+    ->where(['page' => '^(((?=(?!admin))(?=(?!\/)).))*$', 'subs' => '.*']);