update home to shipping address
This commit is contained in:
@@ -50,11 +50,11 @@ class AccountController extends Controller
|
|||||||
'email' => ['required', 'email', 'unique:users,email,' . $user->id],
|
'email' => ['required', 'email', 'unique:users,email,' . $user->id],
|
||||||
'phone' => 'required',
|
'phone' => 'required',
|
||||||
|
|
||||||
'home_address' => 'required_with:home_city,home_postcode,home_country,home_state',
|
'shipping_address' => 'required_with:shipping_city,shipping_postcode,shipping_country,shipping_state',
|
||||||
'home_city' => 'required_with:home_address,home_postcode,home_country,home_state',
|
'shipping_city' => 'required_with:shipping_address,shipping_postcode,shipping_country,shipping_state',
|
||||||
'home_postcode' => 'required_with:home_address,home_city,home_country,home_state',
|
'shipping_postcode' => 'required_with:shipping_address,shipping_city,shipping_country,shipping_state',
|
||||||
'home_country' => 'required_with:home_address,home_city,home_postcode,home_state',
|
'shipping_country' => 'required_with:shipping_address,shipping_city,shipping_postcode,shipping_state',
|
||||||
'home_state' => 'required_with:home_address,home_city,home_postcode,home_country',
|
'shipping_state' => 'required_with:shipping_address,shipping_city,shipping_postcode,shipping_country',
|
||||||
|
|
||||||
'billing_address' => 'required_with:billing_city,billing_postcode,billing_country,billing_state',
|
'billing_address' => 'required_with:billing_city,billing_postcode,billing_country,billing_state',
|
||||||
'billing_city' => 'required_with:billing_address,billing_postcode,billing_country,billing_state',
|
'billing_city' => 'required_with:billing_address,billing_postcode,billing_country,billing_state',
|
||||||
@@ -68,11 +68,11 @@ class AccountController extends Controller
|
|||||||
'email.email' => __('validation.custom_messages.email_invalid'),
|
'email.email' => __('validation.custom_messages.email_invalid'),
|
||||||
'phone.required' => __('validation.custom_messages.phone_required'),
|
'phone.required' => __('validation.custom_messages.phone_required'),
|
||||||
|
|
||||||
'home_address.required' => __('validation.custom_messages.home_address_required'),
|
'shipping_address.required' => __('validation.custom_messages.shipping_address_required'),
|
||||||
'home_city.required' => __('validation.custom_messages.home_city_required'),
|
'shipping_city.required' => __('validation.custom_messages.shipping_city_required'),
|
||||||
'home_postcode.required' => __('validation.custom_messages.home_postcode_required'),
|
'shipping_postcode.required' => __('validation.custom_messages.shipping_postcode_required'),
|
||||||
'home_country.required' => __('validation.custom_messages.home_country_required'),
|
'shipping_country.required' => __('validation.custom_messages.shipping_country_required'),
|
||||||
'home_state.required' => __('validation.custom_messages.home_state_required'),
|
'shipping_state.required' => __('validation.custom_messages.shipping_state_required'),
|
||||||
|
|
||||||
'billing_address.required' => __('validation.custom_messages.billing_address_required'),
|
'billing_address.required' => __('validation.custom_messages.billing_address_required'),
|
||||||
'billing_city.required' => __('validation.custom_messages.billing_city_required'),
|
'billing_city.required' => __('validation.custom_messages.billing_city_required'),
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ class UserController extends Controller
|
|||||||
'email' => 'email|unique:users',
|
'email' => 'email|unique:users',
|
||||||
'phone' => '',
|
'phone' => '',
|
||||||
|
|
||||||
'home_address' => 'required_with:home_city,home_postcode,home_country,home_state',
|
'shipping_address' => 'required_with:shipping_city,shipping_postcode,shipping_country,shipping_state',
|
||||||
'home_city' => 'required_with:home_address,home_postcode,home_country,home_state',
|
'shipping_city' => 'required_with:shipping_address,shipping_postcode,shipping_country,shipping_state',
|
||||||
'home_postcode' => 'required_with:home_address,home_city,home_country,home_state',
|
'shipping_postcode' => 'required_with:shipping_address,shipping_city,shipping_country,shipping_state',
|
||||||
'home_country' => 'required_with:home_address,home_city,home_postcode,home_state',
|
'shipping_country' => 'required_with:shipping_address,shipping_city,shipping_postcode,shipping_state',
|
||||||
'home_state' => 'required_with:home_address,home_city,home_postcode,home_country',
|
'shipping_state' => 'required_with:shipping_address,shipping_city,shipping_postcode,shipping_country',
|
||||||
|
|
||||||
'billing_address' => 'required_with:billing_city,billing_postcode,billing_country,billing_state',
|
'billing_address' => 'required_with:billing_city,billing_postcode,billing_country,billing_state',
|
||||||
'billing_city' => 'required_with:billing_address,billing_postcode,billing_country,billing_state',
|
'billing_city' => 'required_with:billing_address,billing_postcode,billing_country,billing_state',
|
||||||
@@ -67,11 +67,11 @@ class UserController extends Controller
|
|||||||
'email.email' => __('validation.custom_messages.email_invalid'),
|
'email.email' => __('validation.custom_messages.email_invalid'),
|
||||||
'phone.required' => __('validation.custom_messages.phone_required'),
|
'phone.required' => __('validation.custom_messages.phone_required'),
|
||||||
|
|
||||||
'home_address.required' => __('validation.custom_messages.home_address_required'),
|
'shipping_address.required' => __('validation.custom_messages.shipping_address_required'),
|
||||||
'home_city.required' => __('validation.custom_messages.home_city_required'),
|
'shipping_city.required' => __('validation.custom_messages.shipping_city_required'),
|
||||||
'home_postcode.required' => __('validation.custom_messages.home_postcode_required'),
|
'shipping_postcode.required' => __('validation.custom_messages.shipping_postcode_required'),
|
||||||
'home_country.required' => __('validation.custom_messages.home_country_required'),
|
'shipping_country.required' => __('validation.custom_messages.shipping_country_required'),
|
||||||
'home_state.required' => __('validation.custom_messages.home_state_required'),
|
'shipping_state.required' => __('validation.custom_messages.shipping_state_required'),
|
||||||
|
|
||||||
'billing_address.required' => __('validation.custom_messages.billing_address_required'),
|
'billing_address.required' => __('validation.custom_messages.billing_address_required'),
|
||||||
'billing_city.required' => __('validation.custom_messages.billing_city_required'),
|
'billing_city.required' => __('validation.custom_messages.billing_city_required'),
|
||||||
@@ -107,11 +107,11 @@ class UserController extends Controller
|
|||||||
'email' => ['email', Rule::unique('users')->ignore($user->id)],
|
'email' => ['email', Rule::unique('users')->ignore($user->id)],
|
||||||
'phone' => '',
|
'phone' => '',
|
||||||
|
|
||||||
'home_address' => 'required_with:home_city,home_postcode,home_country,home_state',
|
'shipping_address' => 'required_with:shipping_city,shipping_postcode,shipping_country,shipping_state',
|
||||||
'home_city' => 'required_with:home_address,home_postcode,home_country,home_state',
|
'shipping_city' => 'required_with:shipping_address,shipping_postcode,shipping_country,shipping_state',
|
||||||
'home_postcode' => 'required_with:home_address,home_city,home_country,home_state',
|
'shipping_postcode' => 'required_with:shipping_address,shipping_city,shipping_country,shipping_state',
|
||||||
'home_country' => 'required_with:home_address,home_city,home_postcode,home_state',
|
'shipping_country' => 'required_with:shipping_address,shipping_city,shipping_postcode,shipping_state',
|
||||||
'home_state' => 'required_with:home_address,home_city,home_postcode,home_country',
|
'shipping_state' => 'required_with:shipping_address,shipping_city,shipping_postcode,shipping_country',
|
||||||
|
|
||||||
'billing_address' => 'required_with:billing_city,billing_postcode,billing_country,billing_state',
|
'billing_address' => 'required_with:billing_city,billing_postcode,billing_country,billing_state',
|
||||||
'billing_city' => 'required_with:billing_address,billing_postcode,billing_country,billing_state',
|
'billing_city' => 'required_with:billing_address,billing_postcode,billing_country,billing_state',
|
||||||
@@ -125,11 +125,11 @@ class UserController extends Controller
|
|||||||
'email.email' => __('validation.custom_messages.email_invalid'),
|
'email.email' => __('validation.custom_messages.email_invalid'),
|
||||||
'phone.required' => __('validation.custom_messages.phone_required'),
|
'phone.required' => __('validation.custom_messages.phone_required'),
|
||||||
|
|
||||||
'home_address.required' => __('validation.custom_messages.home_address_required'),
|
'shipping_address.required' => __('validation.custom_messages.shipping_address_required'),
|
||||||
'home_city.required' => __('validation.custom_messages.home_city_required'),
|
'shipping_city.required' => __('validation.custom_messages.shipping_city_required'),
|
||||||
'home_postcode.required' => __('validation.custom_messages.home_postcode_required'),
|
'shipping_postcode.required' => __('validation.custom_messages.shipping_postcode_required'),
|
||||||
'home_country.required' => __('validation.custom_messages.home_country_required'),
|
'shipping_country.required' => __('validation.custom_messages.shipping_country_required'),
|
||||||
'home_state.required' => __('validation.custom_messages.home_state_required'),
|
'shipping_state.required' => __('validation.custom_messages.shipping_state_required'),
|
||||||
|
|
||||||
'billing_address.required' => __('validation.custom_messages.billing_address_required'),
|
'billing_address.required' => __('validation.custom_messages.billing_address_required'),
|
||||||
'billing_city.required' => __('validation.custom_messages.billing_city_required'),
|
'billing_city.required' => __('validation.custom_messages.billing_city_required'),
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
'surname',
|
'surname',
|
||||||
'email',
|
'email',
|
||||||
'phone',
|
'phone',
|
||||||
'home_address',
|
'shipping_address',
|
||||||
'home_address2',
|
'shipping_address2',
|
||||||
'home_city',
|
'shipping_city',
|
||||||
'home_postcode',
|
'shipping_postcode',
|
||||||
'home_state',
|
'shipping_state',
|
||||||
'home_country',
|
'shipping_country',
|
||||||
'billing_address',
|
'billing_address',
|
||||||
'billing_address2',
|
'billing_address2',
|
||||||
'billing_city',
|
'billing_city',
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ class UserFactory extends Factory
|
|||||||
'email_verified_at' => now(),
|
'email_verified_at' => now(),
|
||||||
'remember_token' => Str::random(10),
|
'remember_token' => Str::random(10),
|
||||||
|
|
||||||
'home_address' => fake()->streetAddress(),
|
'shipping_address' => fake()->streetAddress(),
|
||||||
'home_city' => fake()->city(),
|
'shipping_city' => fake()->city(),
|
||||||
'home_state' => '',
|
'shipping_state' => '',
|
||||||
'home_postcode' => fake()->postcode(),
|
'shipping_postcode' => fake()->postcode(),
|
||||||
'home_country' => fake()->country(),
|
'shipping_country' => fake()->country(),
|
||||||
|
|
||||||
'billing_address' => fake()->streetAddress(),
|
'billing_address' => fake()->streetAddress(),
|
||||||
'billing_city' => fake()->city(),
|
'billing_city' => fake()->city(),
|
||||||
|
|||||||
@@ -29,21 +29,21 @@ let SM = {
|
|||||||
copyContent().then(() => { /* empty */});
|
copyContent().then(() => { /* empty */});
|
||||||
},
|
},
|
||||||
|
|
||||||
updateBillingAddress: () => {
|
updateShippingAddress: () => {
|
||||||
const checkboxElement = document.querySelector('input[name="billing_same_home"]');
|
const checkboxElement = document.querySelector('input[name="shipping_same_billing"]');
|
||||||
|
|
||||||
if (checkboxElement) {
|
if (checkboxElement) {
|
||||||
const itemNames = ['address', 'address2', 'city', 'state', 'postcode', 'country'];
|
const itemNames = ['address', 'address2', 'city', 'state', 'postcode', 'country'];
|
||||||
|
|
||||||
if (checkboxElement.checked) {
|
if (checkboxElement.checked) {
|
||||||
itemNames.forEach((itemName) => {
|
itemNames.forEach((itemName) => {
|
||||||
const element = document.querySelector(`input[name="billing_${itemName}"]`);
|
const element = document.querySelector(`input[name="shipping_${itemName}"]`);
|
||||||
element.value = document.querySelector(`input[name="home_${itemName}"]`).value;
|
element.value = document.querySelector(`input[name="billing_${itemName}"]`).value;
|
||||||
element.setAttribute('readonly', 'true');
|
element.setAttribute('readonly', 'true');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
itemNames.forEach((itemName) => {
|
itemNames.forEach((itemName) => {
|
||||||
const element = document.querySelector(`input[name="billing_${itemName}"]`);
|
const element = document.querySelector(`input[name="shipping_${itemName}"]`);
|
||||||
element.removeAttribute('readonly');
|
element.removeAttribute('readonly');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -347,6 +347,6 @@ let SM = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
SM.updateBillingAddress();
|
SM.updateShippingAddress();
|
||||||
SM.updateAllThumbnails();
|
SM.updateAllThumbnails();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ return [
|
|||||||
'surname_required' => 'A surname is required',
|
'surname_required' => 'A surname is required',
|
||||||
'phone_required' => 'A phone number is required',
|
'phone_required' => 'A phone number is required',
|
||||||
|
|
||||||
'home_address_required' => 'A home address is required',
|
'shipping_address_required' => 'A shipping address is required',
|
||||||
'home_city_required' => 'A home city is required',
|
'shipping_city_required' => 'A shipping city is required',
|
||||||
'home_postcode_required' => 'A home postcode is required',
|
'shipping_postcode_required' => 'A shipping postcode is required',
|
||||||
'home_country_required' => 'A home country is required',
|
'shipping_country_required' => 'A shipping country is required',
|
||||||
'home_state_required' => 'A home state is required',
|
'shipping_state_required' => 'A shipping state is required',
|
||||||
|
|
||||||
'billing_address_required' => 'A billing address is required',
|
'billing_address_required' => 'A billing address is required',
|
||||||
'billing_city_required' => 'A billing city is required',
|
'billing_city_required' => 'A billing city is required',
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
@php
|
@php
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
$billing_same_home = $user->home_address === $user->billing_address
|
$shipping_same_billing = $user->shipping_address === $user->billing_address
|
||||||
&& $user->home_address2 === $user->billing_address2
|
&& $user->shipping_address2 === $user->billing_address2
|
||||||
&& $user->home_city === $user->billing_city
|
&& $user->shipping_city === $user->billing_city
|
||||||
&& $user->home_state === $user->billing_state
|
&& $user->shipping_state === $user->billing_state
|
||||||
&& $user->home_postcode === $user->billing_postcode
|
&& $user->shipping_postcode === $user->billing_postcode
|
||||||
&& $user->home_country === $user->billing_country;
|
&& $user->shipping_country === $user->billing_country;
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<x-layout>
|
<x-layout>
|
||||||
<x-mast>Account Settings</x-mast>
|
<x-mast>Account Settings</x-mast>
|
||||||
<x-container>
|
<x-container>
|
||||||
<form method="POST" action="{{ route('account.update') }}" x-data x-on:submit.prevent="SM.updateBillingAddress(); $el.submit()">
|
<form method="POST" action="{{ route('account.update') }}" x-data x-on:submit.prevent="SM.updateShippingAddress(); $el.submit()">
|
||||||
@csrf
|
@csrf
|
||||||
<h3 class="text-lg font-bold mt-4 mb-3">Contact Information</h3>
|
<h3 class="text-lg font-bold mt-4 mb-3">Contact Information</h3>
|
||||||
<div class="flex flex-col sm:gap-8 sm:flex-row">
|
<div class="flex flex-col sm:gap-8 sm:flex-row">
|
||||||
@@ -46,43 +46,43 @@ $billing_same_home = $user->home_address === $user->billing_address
|
|||||||
<section x-data="{ open: true }">
|
<section x-data="{ open: true }">
|
||||||
<a href="#" class="flex items-center" @click.prevent="open = !open">
|
<a href="#" class="flex items-center" @click.prevent="open = !open">
|
||||||
<i :class="{'transform': !open, '-rotate-90': !open, 'translate-y-0.5': true}" class="fa-solid fa-angle-down text-lg transition-transform mr-2"></i>
|
<i :class="{'transform': !open, '-rotate-90': !open, 'translate-y-0.5': true}" class="fa-solid fa-angle-down text-lg transition-transform mr-2"></i>
|
||||||
<h3 class="text-lg font-bold mt-4 mb-3">Home Address</h3>
|
<h3 class="text-lg font-bold mt-4 mb-3">Billing Address</h3>
|
||||||
</a>
|
</a>
|
||||||
<div x-show="open">
|
<div x-show="open">
|
||||||
<x-ui.input label="Address" name="home_address" value="{{ $user->home_address }}" />
|
<x-ui.input label="Address" name="billing_address" value="{{ $user->billing_address }}" />
|
||||||
<x-ui.input label="Address 2" name="home_address2" value="{{ $user->home_address2 }}" />
|
<x-ui.input label="Address 2" name="billing_address2" value="{{ $user->billing_address2 }}" />
|
||||||
<x-ui.input label="City" name="home_city" value="{{ $user->home_city }}" />
|
<x-ui.input label="City" name="billing_city" value="{{ $user->billing_city }}" />
|
||||||
<div class="flex flex-col sm:gap-8 sm:flex-row">
|
<div class="flex flex-col sm:gap-8 sm:flex-row">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<x-ui.input label="State" name="home_state" value="{{ $user->home_state }}" />
|
<x-ui.input label="State" name="billing_state" value="{{ $user->billing_state }}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<x-ui.input label="Postcode" name="home_postcode" value="{{ $user->home_postcode }}" />
|
<x-ui.input label="Postcode" name="billing_postcode" value="{{ $user->billing_postcode }}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<x-ui.input label="Country" name="home_country" value="{{ $user->home_country }}" />
|
<x-ui.input label="Country" name="billing_country" value="{{ $user->billing_country }}" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section x-data="{ open: true }">
|
<section x-data="{ open: true }">
|
||||||
<a href="#" class="flex items-center" @click.prevent="open = !open">
|
<a href="#" class="flex items-center" @click.prevent="open = !open">
|
||||||
<i :class="{'transform': !open, '-rotate-90': !open, 'translate-y-0.5': true}" class="fa-solid fa-angle-down text-lg transition-transform mr-2"></i>
|
<i :class="{'transform': !open, '-rotate-90': !open, 'translate-y-0.5': true}" class="fa-solid fa-angle-down text-lg transition-transform mr-2"></i>
|
||||||
<h3 class="text-lg font-bold mt-4 mb-3">Billing Address</h3>
|
<h3 class="text-lg font-bold mt-4 mb-3">Shipping Address</h3>
|
||||||
</a>
|
</a>
|
||||||
<div x-show="open">
|
<div x-show="open">
|
||||||
<x-ui.checkbox label="Same as home address" name="billing_same_home" checked="{{ $billing_same_home }}" x-data x-on:click="SM.updateBillingAddress" />
|
<x-ui.checkbox label="Same as billing address" name="shipping_same_billing" checked="{{ $shipping_same_billing }}" x-data x-on:click="SM.updateShippingAddress" />
|
||||||
<x-ui.input label="Address" name="billing_address" value="{{ $user->billing_address }}" readonly="{{ $billing_same_home }}" />
|
<x-ui.input label="Address" name="shipping_address" value="{{ $user->shipping_address }}" readonly="{{ $shipping_same_billing }}" />
|
||||||
<x-ui.input label="Address 2" name="billing_address2" value="{{ $user->billing_address2 }}" readonly="{{ $billing_same_home }}" />
|
<x-ui.input label="Address 2" name="shipping_address2" value="{{ $user->shipping_address2 }}" readonly="{{ $shipping_same_billing }}" />
|
||||||
<x-ui.input label="City" name="billing_city" value="{{ $user->billing_city }}" readonly="{{ $billing_same_home }}" />
|
<x-ui.input label="City" name="shipping_city" value="{{ $user->shipping_city }}" readonly="{{ $shipping_same_billing }}" />
|
||||||
<div class="flex flex-col sm:gap-8 sm:flex-row">
|
<div class="flex flex-col sm:gap-8 sm:flex-row">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<x-ui.input label="State" name="billing_state" value="{{ $user->billing_state }}" readonly="{{ $billing_same_home }}" />
|
<x-ui.input label="State" name="shipping_state" value="{{ $user->shipping_state }}" readonly="{{ $shipping_same_billing }}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<x-ui.input label="Postcode" name="billing_postcode" value="{{ $user->billing_postcode }}" readonly="{{ $billing_same_home }}" />
|
<x-ui.input label="Postcode" name="shipping_postcode" value="{{ $user->shipping_postcode }}" readonly="{{ $shipping_same_billing }}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<x-ui.input label="Country" name="billing_country" value="{{ $user->billing_country }}" readonly="{{ $billing_same_home }}" />
|
<x-ui.input label="Country" name="shipping_country" value="{{ $user->shipping_country }}" readonly="{{ $shipping_same_billing }}" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<x-mast backRoute="admin.user.index" backTitle="Users">Create User</x-mast>
|
<x-mast backRoute="admin.user.index" backTitle="Users">Create User</x-mast>
|
||||||
|
|
||||||
<x-container>
|
<x-container>
|
||||||
<form method="POST" action="{{ route('admin.user.store') }}" x-data x-on:submit.prevent="SM.updateBillingAddress(); $el.submit()">
|
<form method="POST" action="{{ route('admin.user.store') }}" x-data x-on:submit.prevent="SM.updateShippingAddress(); $el.submit()">
|
||||||
@csrf
|
@csrf
|
||||||
<h3 class="text-lg font-bold mt-4 mb-3">Contact Information</h3>
|
<h3 class="text-lg font-bold mt-4 mb-3">Contact Information</h3>
|
||||||
<div class="flex gap-8">
|
<div class="flex gap-8">
|
||||||
@@ -22,34 +22,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section x-data="{ open: true }">
|
|
||||||
<a href="#" class="flex items-center" @click.prevent="open = !open">
|
|
||||||
<i :class="{'transform': !open, '-rotate-90': !open, 'translate-y-0.5': true}" class="fa-solid fa-angle-down text-lg transition-transform mr-2"></i>
|
|
||||||
<h3 class="text-lg font-bold mt-4 mb-3">Home Address</h3>
|
|
||||||
</a>
|
|
||||||
<div x-show="open">
|
|
||||||
<x-ui.input label="Address" name="home_address" />
|
|
||||||
<x-ui.input label="Address 2" name="home_address2" />
|
|
||||||
<x-ui.input label="City" name="home_city" />
|
|
||||||
<div class="flex gap-8">
|
|
||||||
<div class="flex-1">
|
|
||||||
<x-ui.input label="State" name="home_state" />
|
|
||||||
</div>
|
|
||||||
<div class="flex-1">
|
|
||||||
<x-ui.input label="Postcode" name="home_postcode" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<x-ui.input label="Country" name="home_country" />
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section x-data="{ open: true }">
|
<section x-data="{ open: true }">
|
||||||
<a href="#" class="flex items-center" @click.prevent="open = !open">
|
<a href="#" class="flex items-center" @click.prevent="open = !open">
|
||||||
<i :class="{'transform': !open, '-rotate-90': !open, 'translate-y-0.5': true}" class="fa-solid fa-angle-down text-lg transition-transform mr-2"></i>
|
<i :class="{'transform': !open, '-rotate-90': !open, 'translate-y-0.5': true}" class="fa-solid fa-angle-down text-lg transition-transform mr-2"></i>
|
||||||
<h3 class="text-lg font-bold mt-4 mb-3">Billing Address</h3>
|
<h3 class="text-lg font-bold mt-4 mb-3">Billing Address</h3>
|
||||||
</a>
|
</a>
|
||||||
<div x-show="open">
|
<div x-show="open">
|
||||||
<x-ui.checkbox label="Same as home address" name="billing_same_home" checked="true" x-data x-on:click="SM.updateBillingAddress" />
|
|
||||||
<x-ui.input label="Address" name="billing_address" />
|
<x-ui.input label="Address" name="billing_address" />
|
||||||
<x-ui.input label="Address 2" name="billing_address2" />
|
<x-ui.input label="Address 2" name="billing_address2" />
|
||||||
<x-ui.input label="City" name="billing_city" />
|
<x-ui.input label="City" name="billing_city" />
|
||||||
@@ -65,6 +43,28 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section x-data="{ open: true }">
|
||||||
|
<a href="#" class="flex items-center" @click.prevent="open = !open">
|
||||||
|
<i :class="{'transform': !open, '-rotate-90': !open, 'translate-y-0.5': true}" class="fa-solid fa-angle-down text-lg transition-transform mr-2"></i>
|
||||||
|
<h3 class="text-lg font-bold mt-4 mb-3">Shipping Address</h3>
|
||||||
|
</a>
|
||||||
|
<div x-show="open">
|
||||||
|
<x-ui.checkbox label="Same as billing address" name="shipping_same_billing" checked="true" x-data x-on:click="SM.updateShippingAddress" />
|
||||||
|
<x-ui.input label="Address" name="shipping_address" />
|
||||||
|
<x-ui.input label="Address 2" name="shipping_address2" />
|
||||||
|
<x-ui.input label="City" name="shipping_city" />
|
||||||
|
<div class="flex gap-8">
|
||||||
|
<div class="flex-1">
|
||||||
|
<x-ui.input label="State" name="shipping_state" />
|
||||||
|
</div>
|
||||||
|
<div class="flex-1">
|
||||||
|
<x-ui.input label="Postcode" name="shipping_postcode" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<x-ui.input label="Country" name="shipping_country" />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<div class="flex justify-end mt-8">
|
<div class="flex justify-end mt-8">
|
||||||
<x-ui.button type="submit">Create</x-ui.button>
|
<x-ui.button type="submit">Create</x-ui.button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
@props(['user'])
|
@props(['user'])
|
||||||
|
|
||||||
@php
|
@php
|
||||||
$billing_same_home = $user->home_address === $user->billing_address
|
$shipping_same_billing = $user->shipping_address === $user->billing_address
|
||||||
&& $user->home_address2 === $user->billing_address2
|
&& $user->shipping_address2 === $user->billing_address2
|
||||||
&& $user->home_city === $user->billing_city
|
&& $user->shipping_city === $user->billing_city
|
||||||
&& $user->home_state === $user->billing_state
|
&& $user->shipping_state === $user->billing_state
|
||||||
&& $user->home_postcode === $user->billing_postcode
|
&& $user->shipping_postcode === $user->billing_postcode
|
||||||
&& $user->home_country === $user->billing_country;
|
&& $user->shipping_country === $user->billing_country;
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<x-layout>
|
<x-layout>
|
||||||
<x-mast backRoute="admin.user.index" backTitle="Users">Edit User</x-mast>
|
<x-mast backRoute="admin.user.index" backTitle="Users">Edit User</x-mast>
|
||||||
|
|
||||||
<x-container>
|
<x-container>
|
||||||
<form method="POST" action="{{ route('admin.user.update', $user) }}" x-data x-on:submit.prevent="SM.updateBillingAddress(); $el.submit()">
|
<form method="POST" action="{{ route('admin.user.update', $user) }}" x-data x-on:submit.prevent="SM.updateShippingAddress(); $el.submit()">
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
@csrf
|
@csrf
|
||||||
<h3 class="text-lg font-bold mt-4 mb-3">Contact Information</h3>
|
<h3 class="text-lg font-bold mt-4 mb-3">Contact Information</h3>
|
||||||
@@ -51,18 +51,18 @@
|
|||||||
<h3 class="text-lg font-bold mt-4 mb-3">Home Address</h3>
|
<h3 class="text-lg font-bold mt-4 mb-3">Home Address</h3>
|
||||||
</a>
|
</a>
|
||||||
<div x-show="open">
|
<div x-show="open">
|
||||||
<x-ui.input label="Address" name="home_address" value="{{ $user->home_address }}" />
|
<x-ui.input label="Address" name="billing_address" value="{{ $user->billing_address }}" />
|
||||||
<x-ui.input label="Address 2" name="home_address2" value="{{ $user->home_address2 }}" />
|
<x-ui.input label="Address 2" name="billing_address2" value="{{ $user->billing_address2 }}" />
|
||||||
<x-ui.input label="City" name="home_city" value="{{ $user->home_city }}" />
|
<x-ui.input label="City" name="billing_city" value="{{ $user->billing_city }}" />
|
||||||
<div class="flex gap-8">
|
<div class="flex gap-8">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<x-ui.input label="State" name="home_state" value="{{ $user->home_state }}" />
|
<x-ui.input label="State" name="billing_state" value="{{ $user->billing_state }}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<x-ui.input label="Postcode" name="home_postcode" value="{{ $user->home_postcode }}" />
|
<x-ui.input label="Postcode" name="billing_postcode" value="{{ $user->billing_postcode }}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<x-ui.input label="Country" name="home_country" value="{{ $user->home_country }}" />
|
<x-ui.input label="Country" name="billing_country" value="{{ $user->billing_country }}" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -72,19 +72,19 @@
|
|||||||
<h3 class="text-lg font-bold mt-4 mb-3">Billing Address</h3>
|
<h3 class="text-lg font-bold mt-4 mb-3">Billing Address</h3>
|
||||||
</a>
|
</a>
|
||||||
<div x-show="open">
|
<div x-show="open">
|
||||||
<x-ui.checkbox label="Same as home address" name="billing_same_home" checked="{{ $billing_same_home }}" x-data x-on:click="SM.updateBillingAddress" />
|
<x-ui.checkbox label="Same as billing address" name="shipping_same_billing" checked="{{ $shipping_same_billing }}" x-data x-on:click="SM.updateShippingAddress" />
|
||||||
<x-ui.input label="Address" name="billing_address" value="{{ $user->billing_address }}" readonly="{{ $billing_same_home }}" />
|
<x-ui.input label="Address" name="shipping_address" value="{{ $user->shipping_address }}" readonly="{{ $shipping_same_billing }}" />
|
||||||
<x-ui.input label="Address 2" name="billing_address2" value="{{ $user->billing_address2 }}" readonly="{{ $billing_same_home }}" />
|
<x-ui.input label="Address 2" name="shipping_address2" value="{{ $user->shipping_address2 }}" readonly="{{ $shipping_same_billing }}" />
|
||||||
<x-ui.input label="City" name="billing_city" value="{{ $user->billing_city }}" readonly="{{ $billing_same_home }}" />
|
<x-ui.input label="City" name="shipping_city" value="{{ $user->shipping_city }}" readonly="{{ $shipping_same_billing }}" />
|
||||||
<div class="flex gap-8">
|
<div class="flex gap-8">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<x-ui.input label="State" name="billing_state" value="{{ $user->billing_state }}" readonly="{{ $billing_same_home }}" />
|
<x-ui.input label="State" name="shipping_state" value="{{ $user->shipping_state }}" readonly="{{ $shipping_same_billing }}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<x-ui.input label="Postcode" name="billing_postcode" value="{{ $user->billing_postcode }}" readonly="{{ $billing_same_home }}" />
|
<x-ui.input label="Postcode" name="shipping_postcode" value="{{ $user->shipping_postcode }}" readonly="{{ $shipping_same_billing }}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<x-ui.input label="Country" name="billing_country" value="{{ $user->billing_country }}" readonly="{{ $billing_same_home }}" />
|
<x-ui.input label="Country" name="shipping_country" value="{{ $user->shipping_country }}" readonly="{{ $shipping_same_billing }}" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user