$remember = $request->remember_me ? true : false;
+
if (Auth::guard('web-clients')->attempt($data, $remember)) {
$request->session()->regenerate();
return Auth::guard('web-clients')->user();
- }else{
+ } else {
return false;
}
}
return $data;
}
+
+ public function update(Request $request) {
+ $clientId = Auth::guard('web-clients')->user()->id;
+ $client = Client::find($clientId);
+ $client->lastname = $request->lastname;
+ $client->firstname = $request->firstname;
+ $client->save();
+ }
+
+ public function getaddress() {
+ $clientAddress = Auth::guard('web-clients')->user()->address;
+ return $clientAddress;
+ }
}
use Cubist\Backpack\app\Magic\Models\Locale;
use Cubist\Backpack\app\Magic\Models\Settings;
use Cubist\Backpack\Facades\App;
-use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Http\Request;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Auth;
{
public function logout(Request $request): RedirectResponse
{
+ Auth::guard('web-clients')->user()->setRememberToken('');
Auth::guard('web-clients')->logout();
$request->session()->invalidate();
'label' => 'Password',
'type' => 'Text']);
- $this->addField(['name' => 'name',
+ $this->addField(['name' => 'lastname',
'label' => 'Nom',
'type' => 'Text',
'column' => true,
'tab' => 'Informations client']);
+ $this->addField(['name' => 'phone',
+ 'label' => 'Téléphone',
+ 'type' => 'text',
+ 'column' => true,
+ 'tab' => 'Informations client'
+ ]);
+
$this->addField(['name' => 'firstname',
'label' => 'Prénom',
'type' => 'Text',
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" width="17.5" height="18.833" viewBox="0 0 17.5 18.833">
+ <g id="Groupe_152" data-name="Groupe 152" transform="translate(-0.25 0.25)">
+ <line id="Ligne_176" data-name="Ligne 176" x2="16" transform="translate(1 4.5)" fill="none" stroke="#f81e60" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
+ <path id="Tracé_220" data-name="Tracé 220" d="M2.5,3.5h12v12a1.333,1.333,0,0,1-1.333,1.333H3.833A1.333,1.333,0,0,1,2.5,15.5Z" transform="translate(0.5 1)" fill="none" stroke="#f81e60" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
+ <path id="Tracé_221" data-name="Tracé 221" d="M4.5,4.5V3.833a3.333,3.333,0,1,1,6.667,0V4.5" transform="translate(1.167)" fill="none" stroke="#f81e60" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
+ <line id="Ligne_177" data-name="Ligne 177" y2="7.333" transform="translate(7 7.167)" fill="none" stroke="#f81e60" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
+ <line id="Ligne_178" data-name="Ligne 178" y2="7.333" transform="translate(11 7.167)" fill="none" stroke="#f81e60" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
+ </g>
+</svg>
window.eventBus = new Vue();
import PortalVue from 'portal-vue';
+import Ar from "../../public/vendor/adminlte/bower_components/moment/src/locale/ar";
Vue.use(PortalVue);
emailExist: false,
validateEmail: false,
address_choice: true,
- validateRegister: false
+ validateRegister: false,
+ tab: 'infos',
+ address: [{}]
},
beforeMount() {
this.items = JSON.parse(this.$el.dataset.cartItems);
+ this.getAddress()
},
mounted() {
}
}
})
+ },
+ activeTab(tab){
+ this.tab = tab
+ },
+ getAddress(){
+ let root = this
+
+ axios.post('/ajax/getaddress')
+ .then(function (response) {
+ //
+ root.address = response.data
+ })
+ .catch(function (error) {
+
+ })
+ },
+ addAddressToForm(){
+ this.address.push({})
+ },
+ update(id){
+ let root = this,
+ form = document.getElementById(id),
+ data = new FormData(form)
+
+ axios.post('/ajax/update', data)
+ .then(function (response) {
+ //
+ root.removeErrors()
+ form.reset()
+
+ window.scrollTo({
+ top: 0,
+ behavior: "smooth"
+ })
+ root.validateRegister = true
+ })
+ .catch(function (error) {
+
+ })
}
}
// VueJS styling to hide elements until they're ready
[v-cloak]
visibility: hidden
+ display: none
--- /dev/null
+<form class="form-portal mb-12" @submit.prevent="update('address')">
+ <div class="form-group mb-12">
+ <div class="fields grid">
+ <label class="form-input text-navy">
+ {{ __('Donner un nom à cette adresse') }}<span>*</span>
+ <input class="py-3 mt-3" type="text" required="required" name="name" />
+ </label>
+ <label class="form-input text-navy">
+ {{ __('Société') }}<span>*</span>
+ <input class="py-3 mt-3" type="text" required="required" name="company" />
+ </label>
+ <label class="form-input half text-navy">
+ {{ __('Nom') }}<span>*</span>
+ <input class="py-3 mt-3" type="text" required="required" name="lastname" />
+ </label>
+ <label class="form-input half text-navy">
+ {{ __('Prénom') }}<span>*</span>
+ <input class="py-3 mt-3" type="text" required="required" name="firstname" />
+ </label>
+ <label class="form-input text-navy">
+ {{ __('Adresse de facturation') }}<span>*</span>
+ <textarea class="py-3 mt-3" required="required" name="address[billing][address]">
+ </textarea>
+ </label>
+ <label class="form-input half text-navy">
+ {{ __('Code postal') }}<span>*</span>
+ <input class="py-3 mt-3" type="text" required="required" name="address[billing][zipcode]" />
+ </label>
+ <label class="form-input half text-navy">
+ {{ __('Ville') }}<span>*</span>
+ <input class="py-3 mt-3" type="text" required="required" name="address[billing][city]" />
+ </label>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="label-checkbox flex">
+ <input type="checkbox" v-model="address_choice" checked name="same-address" class="w-4 h-4" />
+ <span class="ml-4">{{ __('Adresse de facturation par défaut') }}</span>
+ </label>
+ <label class="label-checkbox flex mb-6">
+ <input type="checkbox" v-model="address_choice" checked name="same-address" class="w-4 h-4" />
+ <span class="ml-4">{{ __('Adresse de livraison par défaut') }}</span>
+ </label>
+ </div>
+ <div class="form-footer flex flex-wrap-reverse justify-between items-center">
+ <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>
+<button class="flex items-center" @click="deleteAddress(key)">
+ @svg('icon-trash')
+ <span class="ml-3">Supprimer cette adresse</span>
+</button>
</form>
</div>
</div>
- <div class="signin-form hidden" :ref="(signin) => signin.classList.remove('hidden')" v-if="emailExist">
+ <div class="signin-form" v-cloak v-if="emailExist">
<div class="ajax-form flex flex-col max-w-half">
<div class="form-info text-navy mb-10">
<h1 class="text-4xl m-0">Se connecter</h1>
<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' ">
- @svg('icon-eye')
- </span>
+ <span v-if="type === 'password' ">
+ @svg('icon-eye')
+ </span>
<span v-else>
- @svg('icon-eye-hidden')
- </span>
+ @svg('icon-eye-hidden')
+ </span>
</button>
</div>
</label>
</form>
</div>
</div>
- <div class="signup-form hidden" :ref="(signup) => signup.classList.remove('hidden')" v-if="!emailExist && validateEmail">
+ <div class="signup-form" v-cloak v-if="!emailExist && validateEmail">
<div class="ajax-form flex flex-col max-w-half">
<div class="form-info text-navy mb-10">
<h1 class="text-4xl m-0">Créer un compte</h1>
'navy': '#152F4E',
'navy-dark': '#0C213A',
'red': '#F81E60',
+ 'light-b': '#D5D7DF',
'grey': {
'100': '#F7F8FC',
'200': '#EEF1F8',
},
maxWidth: {
'half': '768px', // Half a full-width content area
+ 'half-form': '552px',
'text': '480px' // Or 30rem?
},
padding: {