@extends('partials.layout')

@section('title','Turnos')
@section('subtitle','Listado y mantenimiento de turnos')
@section('back')
    <a class="btn" href="{{ route('turnos.create') }}">+ Agregar turno</a>
@endsection

@section('content')
    <table>
        <thead>
            <tr>
                <th>ID</th>
                <th>Turnos</th>
                <th>Acciones</th>
            </tr>
        </thead>
        <tbody>
        @foreach($items as $item)
            <tr>
                <td>{{ $item->id_turno }}</td>
                <td>{{ $item->turnos }}</td>
                <td>
                    <div style="display:flex;gap:8px;flex-wrap:wrap">
                        <a class="btn" href="{{ route('turnos.edit',$item->id_turno) }}">Editar</a>
                        <form method="POST" action="{{ route('turnos.destroy',$item->id_turno) }}" onsubmit="return confirm('¿Eliminar este turno?')">
                            @csrf
                            @method('DELETE')
                            <button class="btn danger" type="submit">Eliminar</button>
                        </form>
                    </div>
                </td>
            </tr>
        @endforeach
        </tbody>
    </table>
@endsection

