@extends('layouts.app')
@section('title', 'Nouveau compte')
@section('content')
<h3 class="mb-4">Creer un compte admin ou coursier</h3>

<div class="card p-4" style="max-width:600px;">
    <form method="POST" action="{{ route('admin.users.store') }}">
        @csrf
        <div class="mb-3">
            <label class="form-label">Nom complet</label>
            <input type="text" name="name" class="form-control" value="{{ old('name') }}" required>
        </div>
        <div class="mb-3">
            <label class="form-label">Role</label>
            <select name="role" class="form-select" required>
                <option value="courier">Coursier</option>
                <option value="admin">Administrateur</option>
            </select>
        </div>
        <div class="mb-3">
            <label class="form-label">Telephone</label>
            <input type="text" name="phone" class="form-control" value="{{ old('phone') }}">
        </div>
        <div class="mb-3">
            <label class="form-label">Email (identifiant de connexion)</label>
            <input type="email" name="email" class="form-control" value="{{ old('email') }}" required>
        </div>
        <div class="mb-3">
            <label class="form-label">Mot de passe initial</label>
            <input type="text" name="password" class="form-control" required minlength="8">
        </div>
        <button class="btn btn-primary">Creer le compte</button>
        <a href="{{ route('admin.users.index') }}" class="btn btn-link">Annuler</a>
    </form>
</div>
@endsection
