<x-app-layout>
    <x-ui.page-header title="Nouvelle filiale" description="Créer une filiale et son compte d'accès" />
    <x-alert />

    <div class="card p-6 max-w-2xl">
        <form method="POST" action="{{ route('admin.filiales.store') }}" class="space-y-5">
            @csrf
            <div class="grid grid-cols-1 md:grid-cols-2 gap-5">
                <div>
                    <label class="block text-sm font-medium text-slate-700 mb-1">Nom *</label>
                    <input type="text" name="name" value="{{ old('name') }}" class="input-modern" required>
                </div>
                <div>
                    <label class="block text-sm font-medium text-slate-700 mb-1">Code *</label>
                    <input type="text" name="code" value="{{ old('code') }}" class="input-modern uppercase" required placeholder="ex:01,02,03,04,05,06,07,08,09,10">
                </div>
                <div>
                    <label class="block text-sm font-medium text-slate-700 mb-1">Adresse</label>
                    <input type="text" name="address" value="{{ old('address') }}" class="input-modern">
                </div>
                <div>
                    <label class="block text-sm font-medium text-slate-700 mb-1">Téléphone</label>
                    <input type="text" name="phone" value="{{ old('phone') }}" class="input-modern">
                </div>
            </div>

            <hr class="border-slate-100">
            <h3 class="font-semibold text-slate-800">Compte utilisateur</h3>
            <div class="grid grid-cols-1 md:grid-cols-2 gap-5">
                <div class="md:col-span-2">
                    <label class="block text-sm font-medium text-slate-700 mb-1">Nom complet *</label>
                    <input type="text" name="user_name" value="{{ old('user_name') }}" class="input-modern" required>
                </div>
                <div>
                    <label class="block text-sm font-medium text-slate-700 mb-1">Email *</label>
                    <input type="email" name="user_email" value="{{ old('user_email') }}" class="input-modern" required>
                </div>
                <div>
                    <label class="block text-sm font-medium text-slate-700 mb-1">Mot de passe *</label>
                    <input type="password" name="user_password" class="input-modern" required>
                </div>
                <div class="md:col-span-2">
                    <label class="block text-sm font-medium text-slate-700 mb-1">Confirmer le mot de passe *</label>
                    <input type="password" name="user_password_confirmation" class="input-modern" required>
                </div>
            </div>

            <div class="flex gap-3 pt-2">
                <button type="submit" class="btn-primary">Créer la filiale</button>
                <a href="{{ route('admin.filiales.index') }}" class="btn-secondary">Annuler</a>
            </div>
        </form>
    </div>
</x-app-layout>
