<x-guest-layout>

    <div class="container mt-5">
        <form method="POST" action="{{ route('register') }}">
            @csrf

            <!-- Name -->
            <div class="mb-3">
                <label for="name" class="form-label">{{ __('Name') }}</label>
                <input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name"
                    value="{{ old('name') }}" required autofocus autocomplete="name">
                @error('name')
                    <div class="invalid-feedback">
                        {{ $message }}
                    </div>
                @enderror
            </div>

            <!-- Email cognome -->
            <div class="mb-3">
                <label for="cognome" class="form-label">{{ __('Cognome') }}</label>
                <input id="cognome" type="text" class="form-control @error('cognome') is-invalid @enderror"
                    name="surname" value="{{ old('surname') }}" required autocomplete="surname">
                @error('surname')
                    <div class="invalid-feedback">
                        {{ $message }}
                    </div>
                @enderror
            </div>


            <!-- Email Address -->
            <div class="mb-3">
                <label for="email" class="form-label">{{ __('Codice fiscale') }}</label>
                <input id="codice_fiscale" type="text"
                    class="form-control @error('codice_fiscale') is-invalid @enderror" name="codice_fiscale"
                    value="{{ old('codice_fiscale') }}" required autocomplete="codice_fiscale">
                @error('codice_fiscale')
                    <div class="invalid-feedback">
                        {{ $message }}
                    </div>
                @enderror
            </div>


            <!-- Email Address -->
            <div class="mb-3">
                <label for="email" class="form-label">{{ __('Telefono') }}</label>
                <input id="telefono" type="text" class="form-control @error('telefono') is-invalid @enderror"
                    name="telefono" value="{{ old('telefono') }}" required autocomplete="telefono">
                @error('telefono')
                    <div class="invalid-feedback">
                        {{ $message }}
                    </div>
                @enderror
            </div>

            <!-- Email Address -->
            <div class="mb-3">
                <label for="email" class="form-label">{{ __('Email') }}</label>
                <input id="email" type="email" class="form-control @error('email') is-invalid @enderror"
                    name="email" value="{{ old('email') }}" required autocomplete="username">
                @error('email')
                    <div class="invalid-feedback">
                        {{ $message }}
                    </div>
                @enderror
            </div>

            <!-- Email Address -->
            <div class="mb-3">
                <select id="azienda" type="text" class="form-control @error('azienda') is-invalid @enderror"
                    name="azienda" value="{{ old('azienda') }}" required autocomplete="azienda">
                    <option value="">Seleziona un'azienda</option>
                    @foreach ($aziende as $azienda)
                        <option value="{{ $azienda->id }}">{{ $azienda->nome }}</option>
                    @endforeach

                </select>
                @error('azienda')
                    <div class="invalid-feedback">
                        {{ $message }}
                    </div>
                @enderror
            </div>

            <!-- Password -->
            <div class="mb-3">
                <label for="password" class="form-label">{{ __('Password') }}</label>
                <input id="password" type="password" class="form-control @error('password') is-invalid @enderror"
                    name="password" required autocomplete="new-password">
                @error('password')
                    <div class="invalid-feedback">
                        {{ $message }}
                    </div>
                @enderror
            </div>

            <!-- Confirm Password -->
            <div class="mb-3">
                <label for="password_confirmation" class="form-label">{{ __('Confirm Password') }}</label>
                <input id="password_confirmation" type="password"
                    class="form-control @error('password_confirmation') is-invalid @enderror"
                    name="password_confirmation" required autocomplete="new-password">
                @error('password_confirmation')
                    <div class="invalid-feedback">
                        {{ $message }}
                    </div>
                @enderror
            </div>

            <!-- Buttons -->
            <div class="d-flex justify-content-between align-items-center mt-4">
                <a class="btn btn-link" href="{{ route('login') }}">
                    {{ __('Already registered?') }}
                </a>

                <button type="submit" class="btn btn-primary">
                    {{ __('Register') }}
                </button>
            </div>
        </form>
    </div>
</x-guest-layout>
