<div class="description">
    <p>
        {{ __("account.settings.information.subtitle") }}
    </p>
</div>

<form id="send-verification" method="post" action="{{ route('verification.send') }}">
    @csrf
</form>

<form method="post" action="{{ route('account.info.store') }}" class="settings">
    @csrf
    @method('patch')

    <div class="input-row input-row--1-1">
        <div class="input-cell">
            <x-input.text-label :label="__('account.first_name')" id="firstname" name="firstname" type="text" :value="old('firstname', $user->firstname)" required autofocus autocomplete="name" />
            <x-input.error :messages="$errors->get('firstname')" />
        </div>
        <div class="input-cell">
            <x-input.text-label :label="__('account.last_name')" id="lastname" name="lastname" type="text" :value="old('lastname', $user->lastname)" required autofocus autocomplete="name" />
            <x-input.error :messages="$errors->get('lastname')" />
        </div>
    </div>

    <div class="input-row input-row--1-1">
        <div class="input-cell">
            <x-input.text-label :label="__('account.email_address')" id="email" name="email" type="text" :value="old('email', $user->email)" required autofocus autocomplete="username" />
            <x-input.error class="mt-2" :messages="$errors->get('email')" />

            @if ($user instanceof \Illuminate\Contracts\Auth\MustVerifyEmail && ! $user->hasVerifiedEmail())
                <div>
                    <p class="text-sm mt-2 text-gray-800">
                        {{ __('Your email address is unverified.') }}

                        <button form="send-verification" class="underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
                            {{ __('Click here to re-send the verification email.') }}
                        </button>
                    </p>

                    @if (session('status') === 'verification-link-sent')
                        <p class="mt-2 font-medium text-sm text-green-600">
                            {{ __('A new verification link has been sent to your email address.') }}
                        </p>
                    @endif
                </div>
            @endif
        </div>
        <div class="input-cell">
            <x-input.label for="phone" :value="__('account.phone')" />
            <x-input.text id="phone" name="phone" type="text" :value="old('phone', $user->phone ?? '')" />
            <x-input.error :messages="$errors->get('phone')" />
        </div>
    </div>

    <div class="input-row input-row--actions input-row--start sticky-bottom">
        <x-button variant="primary" type="submit">{{ __('common.save_changes') }}</x-button>
        <x-button type="anchor" variant="tertiary" href="{{ route('account.info') }}">{{ __('common.cancel') }}</x-button>

        @if (session('status') === 'account-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>
