]> _ Git - pmi.git/commitdiff
wip #5790 @2:00
authorsoufiane <soufiane@cubedesigners.com>
Mon, 20 Mar 2023 17:01:42 +0000 (18:01 +0100)
committersoufiane <soufiane@cubedesigners.com>
Mon, 20 Mar 2023 17:01:42 +0000 (18:01 +0100)
app/Http/Controllers/MyAccountController.php [new file with mode: 0644]
app/Http/Middleware/RedirectClientIfAuthenticated.php
app/Providers/AppServiceProvider.php
public/images/icon-white-add.svg [new file with mode: 0644]
resources/styles/components/my-account.styl [new file with mode: 0644]
resources/styles/components/signin.styl
resources/views/pages/my_account.blade.php [new file with mode: 0644]

diff --git a/app/Http/Controllers/MyAccountController.php b/app/Http/Controllers/MyAccountController.php
new file mode 100644 (file)
index 0000000..e62bbd4
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+
+
+namespace App\Http\Controllers;
+
+use Cubist\Backpack\app\Http\Controllers\CubistFrontController;
+use Illuminate\Http\Request;
+
+class MyAccountController extends CubistFrontController
+{
+    public function view(Request $request)
+    {
+        return view('pages.myaccount');
+    }
+}
index 3e11903bf9d5744dfc186539448ed56543f18d0e..ff7ca77e005dae7d30087a3324bad3d36f9a8b42 100644 (file)
@@ -16,10 +16,14 @@ class RedirectClientIfAuthenticated
      */
     public function handle($request, Closure $next)
     {
-        if ($request->is('se-connecter') && Auth::guard('web-clients')->check()) {
+        if (($request->is('se-connecter')) && Auth::guard('web-clients')->check()) {
             return redirect('/');
         }
 
+        if (($request->is('mon-compte')) && !Auth::guard('web-clients')->check()) {
+            return redirect('/se-connecter');
+        }
+
         return $next($request);
     }
 }
index f7f34cfeaea909d30c00b350d76e15bdcf0675d4..a8fd24b0683f4256339c81402d992c3697afdf0d 100644 (file)
@@ -57,6 +57,7 @@ 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>
         } catch (\Exception $e) {
 
         }
diff --git a/public/images/icon-white-add.svg b/public/images/icon-white-add.svg
new file mode 100644 (file)
index 0000000..5161d96
--- /dev/null
@@ -0,0 +1,9 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="19.5" height="19.5" viewBox="0 0 19.5 19.5">
+  <g id="Groupe_154" data-name="Groupe 154" transform="translate(0.25 0.25)">
+    <circle id="Ellipse_26" data-name="Ellipse 26" cx="9" cy="9" r="9" transform="translate(0.5 0.5)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
+    <g id="Groupe_153" data-name="Groupe 153" transform="translate(5.346 5.346)">
+      <line id="Ligne_179" data-name="Ligne 179" y2="8.308" transform="translate(4.154)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
+      <line id="Ligne_180" data-name="Ligne 180" x2="8.308" transform="translate(0 4.154)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
+    </g>
+  </g>
+</svg>
diff --git a/resources/styles/components/my-account.styl b/resources/styles/components/my-account.styl
new file mode 100644 (file)
index 0000000..ae9790d
--- /dev/null
@@ -0,0 +1,63 @@
+.account
+  &-nav
+    li
+      position: relative
+      padding-bottom: 21px
+
+      &:not(:last-child)
+        margin-right: 44px
+
+      &:hover,&.active
+        color: theme('colors.primary')
+
+      &.active:before
+        display: block
+
+      &:before
+        content: ''
+        display: none
+        position: absolute
+        bottom: 0
+        left: 0
+        width: 100%
+        height: 4px
+        background-color: currentColor
+
+  &-container-content
+    padding: 46px 96px
+
+  &-address
+    form
+      label:first-child
+        padding-top: 0 !important
+
+  form
+    label
+      padding-top: 24px !important
+      &.label-checkbox
+        display: flex !important
+
+    [type="checkbox"]
+      width: 16px !important
+      height: 24px
+      margin: 0
+      border: 0
+      display: grid
+      place-content: center
+      padding: 0
+      position: relative
+
+      &:before
+        content: ""
+        width: 16px
+        height: 16px
+        background-color: #F7F8FC
+        border: 1px solid #EEF1F7
+        border-radius: 2px
+      &:checked:before
+        content: ""
+        border-color: #0EAADA
+        background-color: #0EAADA
+        background-image: url(/images/icon-checked.svg)
+        background-repeat: no-repeat
+        background-position: center
index 5c6e1f31a6003b5339d753a8183a327ed5707bf4..36afbc02896cd64a90df848ac7fe5c6a1fc08647 100644 (file)
@@ -40,4 +40,3 @@
 
   .line-up
     border-top: 1px solid #D5D7DF
-
diff --git a/resources/views/pages/my_account.blade.php b/resources/views/pages/my_account.blade.php
new file mode 100644 (file)
index 0000000..5e0180b
--- /dev/null
@@ -0,0 +1,88 @@
+@extends('layouts.app')
+
+@php
+ $client = Auth::guard('web-clients')->user();
+@endphp
+
+@section('content')
+    <full-width padding="pb-3v">
+        <content>
+            <div class="account">
+                <text-block :title="$page->title" title-tag="h1" />
+
+                <ul class="account-nav flex items-center pl-2v">
+                    <li @click="tab = 'infos'; activeTab('infos')" class="text-lg cursor-pointer" :class="{ active: tab === 'infos' }">{{ __('Mes coordonnées') }}</li>
+                    <li @click="tab = 'address'; activeTab('address')" class="text-lg cursor-pointer" :class="{ active: tab === 'address' }">{{ __('Mes adresses') }}</li>
+                    <li @click="tab = 'pw'; activeTab('pw')" class="text-lg cursor-pointer" :class="{ active: tab === 'pw' }">{{ __('Modifier mon mot de passe') }}</li>
+                </ul>
+
+                <div class="account-container-content bg-grey-200">
+                    <div id="account-infos" v-if="tab === 'infos'">
+                        <div class="pb-12 border-b border-b-light-b">
+                            <h2 class="text-2xl m-0">{{ $client->company }}</h2>
+                            <p>
+                                N° TVA : {{ $client->vat }}<br>
+                                SIREN : {{ $client->siren }}
+                            </p>
+                            <a href="">{{ __('Signaler une modification') }}</a>
+                        </div>
+                        <div class="ajax-form flex flex-col max-w-half-form pt-12">
+                            <h2 class="text-2xl m-0">{{ __('Mes coordonnées') }}</h2>
+                            <form id="update-details" class="form-portal" @submit.prevent="update('update-details')">
+                                <div class="form-group fields grid">
+                                    <label class="form-input half text-navy">
+                                        {{ __('Nom') }}<span>*</span>
+                                        <input class="py-3 mt-3" type="text" value="{{ $client->lastname }}" required="required" name="lastname" />
+                                    </label>
+                                    <label class="form-input half text-navy">
+                                        {{ __('Prénom') }}<span>*</span>
+                                        <input class="py-3 mt-3" type="text" value="{{ $client->firstname }}" required="required" name="firstname" />
+                                    </label>
+                                </div>
+                                <div class="form-group">
+                                    <label class="form-input half text-navy">
+                                        {{ __('Adresse email') }}<span>*</span>
+                                        <input class="py-3 mt-3" type="email" value="" required="required" name="email" />
+                                    </label>
+                                </div>
+                                <div class="form-group">
+                                    <label class="form-input half text-navy">
+                                        {{ __('Téléphone') }}<span></span>
+                                        <input class="py-3 mt-3" type="text" value="{{ $client->phone }}" required="required" name="password" />
+                                    </label>
+                                </div>
+                                <div class="form-footer flex flex-wrap-reverse justify-between items-center mt-12">
+                                    <span class="form-required-legend inline-block my-4 mr-3 text-grey-dark xs:self-start xs:mt-5">
+                                        *{{ __('Champs obligatoires')}}
+                                    </span>
+                                    <button id="checkemail" class="form-submit-button btn btn-custom xs:w-full">
+                                        {{ __('Enregistrer les modifications') }}
+                                    </button>
+                                </div>
+                            </form>
+                        </div>
+                    </div>
+
+                    <div id="account-address" class="account-address" v-cloak v-if="tab === 'address'">
+                        <div class="flex items-center justify-between pb-8 border-b border-b-light-b">
+                            <h2 class="text-2xl m-0">{{ __('Mes adresses') }}</h2>
+                            <button class="btn btn-custom xs:w-full flex items-center" @click.prevent="addAddressToForm()">
+                                <span class="pr-2">{{ __('Ajouter une adresse') }}</span>
+                                @svg('icon-white-add')
+                            </button>
+                        </div>
+                        <div class="ajax-form flex flex-col max-w-half-form pt-8" v-for="add in address">
+                            <address-form />
+                        </div>
+                    </div>
+
+                    <div id="account-pw" v-cloak v-if="tab === 'pw'">
+                        <div>
+
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </content>
+    </full-width>
+@endsection