@extends('partials.layout')

@section('title','Crear tanque')
@section('subtitle','Agregar un nuevo registro en tanques')

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

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

        <div style="display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px">
            <div style="grid-column:1/-1">
                <label style="display:block;font-weight:700;margin-bottom:6px">Nombre de tanque</label>
                <input type="text" name="nombre" value="{{ old('nombre') }}" placeholder="Ej: Tanque 1" required
                       style="width:100%;padding:10px;border:1px solid #e2e8f0;border-radius:10px">
            </div>


            <div style="grid-column:1/-1">
                <label style="display:block;font-weight:700;margin-bottom:6px">Tipo combustible</label>
                <select name="id_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('id_tipo_combustible')==$t->id_tipo_combustible?'selected':'' }}>
                            {{ $t->nombre }}
                        </option>
                    @endforeach
                </select>
            </div>

            <div>
                <label style="display:block;font-weight:700;margin-bottom:6px">Capacidad</label>
                <input type="number" step="any" name="capacidad" value="{{ old('capacidad') }}" 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">Stock actual</label>
                <input type="number" step="any" name="stock_actual" value="{{ old('stock_actual') }}" required
                       style="width:100%;padding:10px;border:1px solid #e2e8f0;border-radius:10px">
            </div>
        </div>

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

