CluPilotCloud/resources/views/livewire/admin/edit-customer.blade.php

76 lines
4.2 KiB
PHP

<div class="p-6">
<h2 class="text-lg font-semibold text-ink">{{ __('edit_customer.title') }}</h2>
<p class="mt-1 max-w-[60ch] text-sm text-muted">{{ __('edit_customer.subtitle') }}</p>
<form wire:submit="save" class="mt-5 space-y-4">
<div class="grid gap-4 sm:grid-cols-2">
<x-ui.input name="name" wire:model="name" :label="__('edit_customer.name')" />
<x-ui.input name="contactName" wire:model="contactName" :label="__('edit_customer.contact')" />
</div>
<div class="grid gap-4 sm:grid-cols-2">
<div>
<x-ui.input name="email" type="email" wire:model="email" :label="__('edit_customer.email')" />
{{-- Said before it is done, not after: the address is the portal
login and the key everything matching by address uses. --}}
<p class="mt-1.5 text-xs text-muted">{{ __('edit_customer.email_hint') }}</p>
</div>
<x-ui.input name="phone" wire:model="phone" :label="__('edit_customer.phone')" />
</div>
<div class="grid gap-4 sm:grid-cols-2">
<div>
<label class="text-sm font-medium text-body" for="customerType">{{ __('edit_customer.type') }}</label>
<select id="customerType" wire:model="customerType"
class="mt-1.5 w-full rounded-md border border-line-strong bg-surface px-3 py-2 text-sm text-body">
{{-- No "nobody asked" option: once somebody has answered, the
answer stands until it is replaced by the other one. An
empty selection here leaves the record as it was, and the
hint says which that is. --}}
<option value="">{{ __('edit_customer.type_keep') }}</option>
@foreach ($types as $type)
<option value="{{ $type }}">{{ __('customer_detail.type_'.$type) }}</option>
@endforeach
</select>
<p class="mt-1.5 text-xs text-muted">{{ __('edit_customer.type_hint') }}</p>
</div>
<div>
<x-ui.input name="vatId" wire:model="vatId" :label="__('edit_customer.vat_id')" placeholder="ATU12345678" />
<p class="mt-1.5 text-xs text-muted">{{ __('edit_customer.vat_hint') }}</p>
</div>
</div>
<div>
<label for="billingAddress" class="block text-sm font-medium text-body">{{ __('edit_customer.address') }}</label>
<textarea id="billingAddress" rows="4" wire:model="billingAddress"
class="mt-1.5 block w-full rounded border border-line bg-surface px-3.5 py-2.5 text-sm text-ink"></textarea>
@error('billingAddress')<p class="mt-1.5 text-xs text-danger">{{ $message }}</p>@enderror
</div>
<div class="max-w-56">
<label class="text-sm font-medium text-body" for="locale">{{ __('edit_customer.locale') }}</label>
<select id="locale" wire:model="locale"
class="mt-1.5 w-full rounded-md border border-line-strong bg-surface px-3 py-2 text-sm text-body">
<option value="">{{ __('edit_customer.locale_default') }}</option>
@foreach ($locales as $code)
<option value="{{ $code }}">{{ __('edit_customer.locale_'.$code) }}</option>
@endforeach
</select>
{{-- What it actually decides: the language of the mail they get. --}}
<p class="mt-1.5 text-xs text-muted">{{ __('edit_customer.locale_hint') }}</p>
</div>
<div class="flex flex-wrap gap-2 border-t border-line pt-4">
<x-ui.button type="submit" variant="primary" wire:loading.attr="disabled" wire:target="save">
{{ __('edit_customer.save') }}
</x-ui.button>
{{-- Livewire.dispatch, not Alpine's: the modal listens for a Livewire
event of that name, and the Alpine form silently does nothing. --}}
<x-ui.button variant="secondary" x-on:click="Livewire.dispatch('closeModal')">
{{ __('edit_customer.cancel') }}
</x-ui.button>
</div>
</form>
</div>