update home to shipping address
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
@php
|
||||
$user = auth()->user();
|
||||
|
||||
$billing_same_home = $user->home_address === $user->billing_address
|
||||
&& $user->home_address2 === $user->billing_address2
|
||||
&& $user->home_city === $user->billing_city
|
||||
&& $user->home_state === $user->billing_state
|
||||
&& $user->home_postcode === $user->billing_postcode
|
||||
&& $user->home_country === $user->billing_country;
|
||||
$shipping_same_billing = $user->shipping_address === $user->billing_address
|
||||
&& $user->shipping_address2 === $user->billing_address2
|
||||
&& $user->shipping_city === $user->billing_city
|
||||
&& $user->shipping_state === $user->billing_state
|
||||
&& $user->shipping_postcode === $user->billing_postcode
|
||||
&& $user->shipping_country === $user->billing_country;
|
||||
@endphp
|
||||
|
||||
<x-layout>
|
||||
<x-mast>Account Settings</x-mast>
|
||||
<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
|
||||
<h3 class="text-lg font-bold mt-4 mb-3">Contact Information</h3>
|
||||
<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 }">
|
||||
<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>
|
||||
<h3 class="text-lg font-bold mt-4 mb-3">Billing Address</h3>
|
||||
</a>
|
||||
<div x-show="open">
|
||||
<x-ui.input label="Address" name="home_address" value="{{ $user->home_address }}" />
|
||||
<x-ui.input label="Address 2" name="home_address2" value="{{ $user->home_address2 }}" />
|
||||
<x-ui.input label="City" name="home_city" value="{{ $user->home_city }}" />
|
||||
<x-ui.input label="Address" name="billing_address" value="{{ $user->billing_address }}" />
|
||||
<x-ui.input label="Address 2" name="billing_address2" value="{{ $user->billing_address2 }}" />
|
||||
<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-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 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>
|
||||
<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>
|
||||
</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">Billing Address</h3>
|
||||
<h3 class="text-lg font-bold mt-4 mb-3">Shipping Address</h3>
|
||||
</a>
|
||||
<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.input label="Address" name="billing_address" value="{{ $user->billing_address }}" readonly="{{ $billing_same_home }}" />
|
||||
<x-ui.input label="Address 2" name="billing_address2" value="{{ $user->billing_address2 }}" readonly="{{ $billing_same_home }}" />
|
||||
<x-ui.input label="City" name="billing_city" value="{{ $user->billing_city }}" readonly="{{ $billing_same_home }}" />
|
||||
<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="shipping_address" value="{{ $user->shipping_address }}" readonly="{{ $shipping_same_billing }}" />
|
||||
<x-ui.input label="Address 2" name="shipping_address2" value="{{ $user->shipping_address2 }}" readonly="{{ $shipping_same_billing }}" />
|
||||
<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-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 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>
|
||||
<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>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user