From: soufiane Date: Mon, 20 Mar 2023 17:01:21 +0000 (+0100) Subject: wip #5791 @5:00 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=4181206696ae12f26bb9512376656a3aa6ebf510;p=pmi.git wip #5791 @5:00 --- diff --git a/app/Http/Controllers/AjaxController.php b/app/Http/Controllers/AjaxController.php index d742492..3006a8b 100644 --- a/app/Http/Controllers/AjaxController.php +++ b/app/Http/Controllers/AjaxController.php @@ -313,10 +313,11 @@ class AjaxController extends CubistFrontController $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; } } @@ -355,4 +356,17 @@ class AjaxController extends CubistFrontController 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; + } } diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index 6cc305a..7b2fdd9 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -6,7 +6,6 @@ use Cubist\Backpack\app\Magic\Models\CMSPage; 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; @@ -17,6 +16,7 @@ class ClientController extends CubistPageController { public function logout(Request $request): RedirectResponse { + Auth::guard('web-clients')->user()->setRememberToken(''); Auth::guard('web-clients')->logout(); $request->session()->invalidate(); diff --git a/app/Models/Client.php b/app/Models/Client.php index 52c3c3b..084e1af 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -26,12 +26,19 @@ class Client extends CubistMagicAbstractModel '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', diff --git a/public/images/icon-trash.svg b/public/images/icon-trash.svg new file mode 100644 index 0000000..de1d333 --- /dev/null +++ b/public/images/icon-trash.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/resources/js/app.js b/resources/js/app.js index ab39614..d7c0ea3 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -31,6 +31,7 @@ window.Vue = require('vue'); window.eventBus = new Vue(); import PortalVue from 'portal-vue'; +import Ar from "../../public/vendor/adminlte/bower_components/moment/src/locale/ar"; Vue.use(PortalVue); @@ -63,11 +64,14 @@ const app = new Vue({ 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() { @@ -224,6 +228,45 @@ const app = new Vue({ } } }) + }, + 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) { + + }) } } diff --git a/resources/styles/common/global.styl b/resources/styles/common/global.styl index f22a69a..cc8e266 100644 --- a/resources/styles/common/global.styl +++ b/resources/styles/common/global.styl @@ -67,3 +67,4 @@ $overlap-amount = 10vw // VueJS styling to hide elements until they're ready [v-cloak] visibility: hidden + display: none diff --git a/resources/views/components/address-form.blade.php b/resources/views/components/address-form.blade.php new file mode 100644 index 0000000..4cf51fc --- /dev/null +++ b/resources/views/components/address-form.blade.php @@ -0,0 +1,57 @@ +
+
+
+ + + + + + + +
+
+
+ + +
+ +
+ diff --git a/resources/views/pages/sign_in.blade.php b/resources/views/pages/sign_in.blade.php index 0edef20..9450f80 100644 --- a/resources/views/pages/sign_in.blade.php +++ b/resources/views/pages/sign_in.blade.php @@ -23,7 +23,7 @@ -