kithkin/resources/views/profile/partials/addresses-form.blade.php

154 lines
7.8 KiB
PHP

<section>
<header class="mb-4">
<h2 class="text-lg font-medium text-gray-900">
{{ __('Addresses') }}
</h2>
<p class="mt-1 text-sm text-gray-600">
{{ __('Manage your Home and Billing addresses.') }}
</p>
</header>
<form method="post" action="{{ route('profile.addresses.save') }}" class="space-y-8">
@csrf
@method('patch')
{{-- home address --}}
<div class="space-y-4">
<h3 class="text-md font-semibold text-gray-800">{{ __('Home Address') }}</h3>
<div>
<x-input-label for="home_label" :value="__('Label')" />
<x-text-input id="home_label" name="home[label]" type="text" class="mt-1 block w-full"
:value="old('home.label', $home->label ?? 'Home')" />
<x-input-error class="mt-2" :messages="$errors->get('home.label')" />
</div>
<div>
<x-input-label for="home_line1" :value="__('Address line 1')" />
<x-text-input id="home_line1" name="home[line1]" type="text" class="mt-1 block w-full"
:value="old('home.line1', $home->line1 ?? '')" />
<x-input-error class="mt-2" :messages="$errors->get('home.line1')" />
</div>
<div>
<x-input-label for="home_line2" :value="__('Address line 2')" />
<x-text-input id="home_line2" name="home[line2]" type="text" class="mt-1 block w-full"
:value="old('home.line2', $home->line2 ?? '')" />
<x-input-error class="mt-2" :messages="$errors->get('home.line2')" />
</div>
<div class="grid grid-cols-1 sm:grid-cols-3 gap-4">
<div>
<x-input-label for="home_city" :value="__('City')" />
<x-text-input id="home_city" name="home[city]" type="text" class="mt-1 block w-full"
:value="old('home.city', $home->city ?? '')" />
<x-input-error class="mt-2" :messages="$errors->get('home.city')" />
</div>
<div>
<x-input-label for="home_state" :value="__('State/Region')" />
<x-text-input id="home_state" name="home[state]" type="text" class="mt-1 block w-full"
:value="old('home.state', $home->state ?? '')" />
<x-input-error class="mt-2" :messages="$errors->get('home.state')" />
</div>
<div>
<x-input-label for="home_postal" :value="__('Postal code')" />
<x-text-input id="home_postal" name="home[postal]" type="text" class="mt-1 block w-full"
:value="old('home.postal', $home->postal ?? '')" />
<x-input-error class="mt-2" :messages="$errors->get('home.postal')" />
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<x-input-label for="home_country" :value="__('Country')" />
<x-text-input id="home_country" name="home[country]" type="text" class="mt-1 block w-full"
:value="old('home.country', $home->country ?? '')" />
<x-input-error class="mt-2" :messages="$errors->get('home.country')" />
</div>
<div>
<x-input-label for="home_phone" :value="__('Phone')" />
<x-text-input id="home_phone" name="home[phone]" type="text" class="mt-1 block w-full"
:value="old('home.phone', $home->phone ?? '')" />
<x-input-error class="mt-2" :messages="$errors->get('home.phone')" />
</div>
</div>
</div>
{{-- billing address --}}
<div class="space-y-4">
<h3 class="text-md font-semibold text-gray-800">{{ __('Billing Address') }}</h3>
<div>
<x-input-label for="bill_label" :value="__('Label')" />
<x-text-input id="bill_label" name="billing[label]" type="text" class="mt-1 block w-full"
:value="old('billing.label', $billing->label ?? 'Billing')" />
<x-input-error class="mt-2" :messages="$errors->get('billing.label')" />
</div>
<div>
<x-input-label for="bill_line1" :value="__('Address line 1')" />
<x-text-input id="bill_line1" name="billing[line1]" type="text" class="mt-1 block w-full"
:value="old('billing.line1', $billing->line1 ?? '')" />
<x-input-error class="mt-2" :messages="$errors->get('billing.line1')" />
</div>
<div>
<x-input-label for="bill_line2" :value="__('Address line 2')" />
<x-text-input id="bill_line2" name="billing[line2]" type="text" class="mt-1 block w-full"
:value="old('billing.line2', $billing->line2 ?? '')" />
<x-input-error class="mt-2" :messages="$errors->get('billing.line2')" />
</div>
<div class="grid grid-cols-1 sm:grid-cols-3 gap-4">
<div>
<x-input-label for="bill_city" :value="__('City')" />
<x-text-input id="bill_city" name="billing[city]" type="text" class="mt-1 block w-full"
:value="old('billing.city', $billing->city ?? '')" />
<x-input-error class="mt-2" :messages="$errors->get('billing.city')" />
</div>
<div>
<x-input-label for="bill_state" :value="__('State/Region')" />
<x-text-input id="bill_state" name="billing[state]" type="text" class="mt-1 block w-full"
:value="old('billing.state', $billing->state ?? '')" />
<x-input-error class="mt-2" :messages="$errors->get('billing.state')" />
</div>
<div>
<x-input-label for="bill_postal" :value="__('Postal code')" />
<x-text-input id="bill_postal" name="billing[postal]" type="text" class="mt-1 block w-full"
:value="old('billing.postal', $billing->postal ?? '')" />
<x-input-error class="mt-2" :messages="$errors->get('billing.postal')" />
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<x-input-label for="bill_country" :value="__('Country')" />
<x-text-input id="bill_country" name="billing[country]" type="text" class="mt-1 block w-full"
:value="old('billing.country', $billing->country ?? '')" />
<x-input-error class="mt-2" :messages="$errors->get('billing.country')" />
</div>
<div>
<x-input-label for="bill_phone" :value="__('Phone')" />
<x-text-input id="bill_phone" name="billing[phone]" type="text" class="mt-1 block w-full"
:value="old('billing.phone', $billing->phone ?? '')" />
<x-input-error class="mt-2" :messages="$errors->get('billing.phone')" />
</div>
</div>
</div>
<div class="flex items-center gap-4">
<x-primary-button>{{ __('Save Addresses') }}</x-primary-button>
@if (session('status') === 'addresses-updated')
<p
x-data="{ show: true }"
x-show="show"
x-transition
x-init="setTimeout(() => show = false, 2000)"
class="text-sm text-gray-600"
>{{ __('Saved.') }}</p>
@endif
</div>
</form>
</section>