diff --git a/app/Http/Livewire/Profile/Settings/ShippingAddress.php b/app/Http/Livewire/Profile/Settings/ShippingAddress.php new file mode 100644 index 000000000000..39ce3aec426e --- /dev/null +++ b/app/Http/Livewire/Profile/Settings/ShippingAddress.php @@ -0,0 +1,62 @@ + ['required'], + 'shipping_address2' => ['required'], + 'shipping_city' => ['required'], + 'shipping_state' => ['required'], + 'shipping_postal_code' => ['required'], + 'shipping_country_id' => ['required'], + ]; + + public function mount($countries) + { + $this->fill([ + 'profile' => auth()->user('contact')->client, + 'shipping_address1' => auth()->user('contact')->client->shipping_address1, + 'shipping_address2' => auth()->user('contact')->client->shipping_address2, + 'shipping_city' => auth()->user('contact')->client->shipping_city, + 'shipping_state' => auth()->user('contact')->client->shipping_state, + 'shipping_postal_code' => auth()->user('contact')->client->shipping_postal_code, + 'shipping_country_id' => auth()->user('contact')->client->shipping_country_id, + + 'countries' => $countries, + 'saved' => ctrans('texts.save'), + ]); + } + + public function render() + { + return render('profile.settings.shipping-address'); + } + + public function submit() + { + $data = $this->validate($this->rules); + + $this->profile + ->fill($data) + ->save(); + + $this->saved = ctrans('texts.saved_at', ['time' => now()->toTimeString()]); + } +} diff --git a/resources/views/portal/ninja2020/profile/index.blade.php b/resources/views/portal/ninja2020/profile/index.blade.php index 4197ac83f771..e2a715303c84 100644 --- a/resources/views/portal/ninja2020/profile/index.blade.php +++ b/resources/views/portal/ninja2020/profile/index.blade.php @@ -17,106 +17,5 @@ @livewire('profile.settings.personal-address', ['countries' => $countries]) -
- {{ ctrans('texts.enter_your_shipping_address') }} -
-+ {{ ctrans('texts.enter_your_shipping_address') }} +
+