<x-header />

<div class="container py-5">
    @if(Route::is('login'))
    <div class="card shadow p-4 mx-auto" style="max-width: 400px;">
        <h2 class="text-center mb-5 fw-bold">Вход</h2>
        <form action="{{ route('authuser') }}" method="post">
            @csrf
            <div class="mb-3">
                <input type="text" name="login" placeholder="Логин" class="form-control" value="{{ old('login') }}">
                @error('login')
                <div class="alert alert-danger mt-1">{{ $message }}</div>
                @enderror
            </div>
            <div class="mb-3">
                <input type="password" name="password" placeholder="Пароль" class="form-control">
                @error('password')
                <div class="alert alert-danger mt-1">{{ $message }}</div>
                @enderror
            </div>
            <div class="d-grid">
                <input type="submit" class="btn btn-primary" value="Войти">
            </div>
        </form>
        <div class="mt-3 text-center">
            <a href="{{Route('register')}}">У меня нет аккаунта</a>
        </div>
    </div>

    @elseif(Route::is('register'))
    <div class="card shadow p-4 mx-auto" style="max-width: 400px;">
        <h2 class="text-center mb-5 fw-bold">Регистрация</h2>
        <form action="{{ route('createuser') }}" method="post" enctype="multipart/form-data">
            @csrf
            <div class="mb-3">
                <input type="text" name="fio" placeholder="ФИО" class="form-control" value="{{ old('fio') }}">
                @error("fio")
                <div class="alert alert-danger mt-1">{{ $message }}</div>
                @enderror
            </div>
            <div class="mb-3">
                <input type="text" name="login" placeholder="Логин" class="form-control" value="{{ old('login') }}">
                @error("login")
                <div class="alert alert-danger mt-1">{{ $message }}</div>
                @enderror
            </div>
            <div class="mb-3">
                <input type="text" name="email" placeholder="Почта" class="form-control" value="{{ old('email') }}">
                @error("email")
                <div class="alert alert-danger mt-1">{{ $message }}</div>
                @enderror
            </div>
            <div class="mb-3">
                <input type="text" placeholder="+7 (___) ___-__-__" maxlength="18" name="number" id="number" class="form-control" value="{{ old('number') }}">
                @error('number')
                <div class="alert alert-danger mt-1">{{ $message }}</div>
                @enderror
            </div>
            <div class="mb-3">
                <input type="password" name="password" placeholder="Пароль" class="form-control">
                @error("password")
                <div class="alert alert-danger mt-1">{{ $message }}</div>
                @enderror
            </div>
            <div class="d-grid">
                <input type="submit" class="btn btn-primary" value="Войти">
            </div>
        </form>
        <div class="mt-3 text-center">
            <a href="{{Route('login')}}">У меня есть аккаунт</a>
        </div>
    </div>
    @endif
</div>

<x-footer />

<x-scripts />
