<x-header />

<div class="container py-5">
    <div class="card shadow p-4 mx-auto" style="max-width: 600px;">
        <h3 class="text-center mb-4 fw-bold">Отправить заявку</h3>
        <form action="{{ route('addapply') }}" method="POST">
            @csrf
            <div class="form-check mb-3">
                <input class="form-check-input" type="checkbox" id="checkbox" name="checkbox">
                <label class="form-check-label" for="checkbox">
                    Нужна другая услуга
                </label>
            </div>

            <div class="mb-3">
                <select name="category_id" id="category_id" class="form-select">
                    <option value="">Выберите категорию</option>
                    @foreach($categories as $category)
                    <option value="{{ $category->id }}">{{ $category->name }}</option>
                    @endforeach
                </select>
                @error('category_id')
                <div class="alert alert-danger mt-1">{{ $message }}</div>
                @enderror
            </div>

            <div class="mb-3" id="customcategorybox" style="display: none;">
                <textarea name="customcategory" id="customcategory" rows="3" placeholder="Опишите необходимую услугу" class="form-control"></textarea>
                @error('customcategory')
                <div class="alert alert-danger mt-1">{{ $message }}</div>
                @enderror
            </div>

            <div class="mb-3">
                <input type="text" name="name" id="name" placeholder="Введите ваше имя" class="form-control" value="{{ old('name') }}">
                @error('name')
                <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="email" name="email" id="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" name="address" id="address" placeholder="Введите адрес" class="form-control" value="{{ old('address') }}">
                @error('address')
                <div class="alert alert-danger mt-1">{{ $message }}</div>
                @enderror
            </div>

            <div class="mb-3">
                <input type="date" name="date" id="date" class="form-control" value="{{ old('date') }}">
                @error('date')
                <div class="alert alert-danger mt-1">{{ $message }}</div>
                @enderror
            </div>

            <div class="mb-3">
                <input type="time" name="time" id="time" class="form-control" value="{{ old('time') }}">
                @error('time')
                <div class="alert alert-danger mt-1">{{ $message }}</div>
                @enderror
            </div>

            <div class="form-check mb-3">
                <input class="form-check-input" type="radio" name="paymethod" id="payment_cash" value="Наличные">
                <label class="form-check-label" for="payment_cash">
                    Наличные
                </label>
            </div>
            <div class="form-check mb-3">
                <input class="form-check-input" type="radio" checked="checked" name="paymethod" id="payment_card" value="Банковская карта">
                <label class="form-check-label" for="payment_card">
                    Банковская карта
                </label>
            </div>
            @error('paymethod')
            <div class="alert alert-danger mt-1">{{ $message }}</div>
            @enderror

            <div class="d-grid">
                <input type="submit" class="btn btn-primary" value="Отправить">
            </div>
        </form>
    </div>
</div>

<x-footer />
<x-scripts />
</body>

</html>