@extends('partials.layout')

@section('title', 'Nuevo Precio')
@section('subtitle', 'Registrar precios para un nuevo día')

@section('back')
    <a class="btn" href="{{ route('precios_dia.index') }}">← Volver</a>
@endsection

@section('content')
    <form method="POST" action="{{ route('precios_dia.store') }}">
        @csrf

        <div style="display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px">
            <div>
                <label style="display:block;font-weight:700;margin-bottom:6px">Fecha</label>
                <input name="fecha" type="date" value="{{ old('fecha', date('Y-m-d')) }}" required style="width:100%;padding:10px;border:1px solid #e2e8f0;border-radius:10px">
            </div>

            <div>
                <label style="display:block;font-weight:700;margin-bottom:6px">Tipo de Combustible</label>
                <select name="tipo_combustible" required style="width:100%;padding:10px;border:1px solid #e2e8f0;border-radius:10px">
                    <option value="">-- Seleccione --</option>
                    @foreach($tipos as $t)
                        <option value="{{ $t->id_tipo_combustible }}" {{ old('tipo_combustible') == $t->id_tipo_combustible ? 'selected' : '' }}>
                            {{ $t->nombre }}
                        </option>
                    @endforeach
                </select>
            </div>

            <div>
                <label style="display:block;font-weight:700;margin-bottom:6px">Precio Turno Mañana</label>
                <input name="precio_turno_manana" type="number" step="0.01" value="{{ old('precio_turno_manana') }}" required style="width:100%;padding:10px;border:1px solid #e2e8f0;border-radius:10px">
            </div>

            <div>
                <label style="display:block;font-weight:700;margin-bottom:6px">Precio Turno Tarde</label>
                <input name="precio_turno_tarde" type="number" step="0.01" value="{{ old('precio_turno_tarde') }}" required style="width:100%;padding:10px;border:1px solid #e2e8f0;border-radius:10px">
            </div>

            <div>
                <label style="display:block;font-weight:700;margin-bottom:6px">Precio Turno Noche</label>
                <input name="precio_turno_noche" type="number" step="0.01" value="{{ old('precio_turno_noche') }}" required style="width:100%;padding:10px;border:1px solid #e2e8f0;border-radius:10px">
            </div>

            <div style="display:flex;align-items:center;gap:8px;margin-top:24px">
                <input name="i_estado" type="checkbox" value="1" checked style="width:20px;height:20px;cursor:pointer">
                <label style="font-weight:700">Activo</label>
            </div>
        </div>

        <div style="margin-top:20px;display:flex;gap:10px">
            <button class="btn primary" type="submit">Guardar</button>
            <a class="btn" href="{{ route('precios_dia.index') }}">Cancelar</a>
        </div>
    </form>
@endsection