@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-lg-8">
            <div class="card shadow-sm">
                <div class="card-header bg-dark text-white d-flex justify-content-between align-items-center">
                    <span>Crear Horario</span>
                    <a href="{{ route('admin_fit.entry_time.index') }}" class="btn btn-sm btn-secondary">
                     <i class="bi bi-chevron-left"></i>
                    Volver</a>
                </div>
                <div class="card-body bg-white">
                    @if ($errors->any())
                        <div class="alert alert-danger">
                            <ul class="mb-0">
                                @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    @endif

                    <form method="POST" action="{{ route('admin_fit.entry_time.store') }}">
                        @csrf

                        <div class="row g-3">
                            <div class="col-md-6">
                                <label for="entry_time" class="form-label">Hora Entrada</label>
                                <input type="time" id="entry_time" name="entry_time" class="form-control" value="{{ old('entry_time') }}" required>
                            </div>

                            <div class="col-md-6">
                                <label for="exit_time" class="form-label">Hora Salida</label>
                                <input type="time" id="exit_time" name="exit_time" class="form-control" value="{{ old('exit_time') }}" required>
                            </div>

                            <div class="col-md-12">
                                <label for="period" class="form-label">Periodo</label>
                                <select id="period" name="period" class="form-select" required>
                                    <option value="">Seleccione</option>
                                    <option value="AM" {{ old('period') == 'AM' ? 'selected' : '' }}>AM</option>
                                    <option value="PM" {{ old('period') == 'PM' ? 'selected' : '' }}>PM</option>
                                </select>
                            </div>

                            <div class="col-12">
                                <div class="form-check">
                                    <input class="form-check-input" type="checkbox" id="is_active" name="is_active" value="1" {{ old('is_active', 1) ? 'checked' : '' }}>
                                    <label class="form-check-label" for="is_active">Activo</label>
                                </div>
                            </div>
                        </div>

                        <div class="d-flex justify-content-end mt-4">
                            <button type="submit" class="btn btn-success">Guardar</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
