<x-guru-layout>
    <x-slot name="header">
        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
            {{ __('Jadwal Mata Pelajaran') }}
        </h2>
    </x-slot>

    <div class="py-12">
        <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                <div class="p-6">

        <h2 class="text-xl font-bold text-primary mb-4">Daftar Jadwal</h2>
        {{-- <a href="{{ route('guru.jadwals.create') }}" class="btn-primary">Tambah Jadwal</a> --}}
        @if(session('success'))
            <div class="alert-success mb-4">{{ session('success') }}</div>
        @endif
        <div class="overflow-x-auto">
            <table class="table w-full border rounded-lg overflow-hidden">
                <thead>
                    <tr class="table-header">
                        <th class="px-3 py-2">No</th>
                        <th class="px-3 py-2">Kelas</th>
                        <th class="px-3 py-2">Hari</th>
                        <th class="px-3 py-2">Jam</th>
                        <th class="px-3 py-2">Mata Pelajaran</th>
                        <!-- <th class="px-3 py-2">Action</th> -->
                    </tr>
                </thead>
                <tbody>
                    @foreach($jadwals as $i => $jadwal)
                    <tr class="table-row">
                        <td class="px-3 py-2">{{ $i+1 }}</td>
                        <td class="px-3 py-2">{{ $jadwal->kelas ? $jadwal->kelas->nama_kelas : '-' }}</td>
                        <td class="px-3 py-2">{{ $jadwal->hari }}</td>
                        <td class="px-3 py-2">{{ $jadwal->jam_pelajaran }}</td>
                        <td class="px-3 py-2">{{ $jadwal->mataPelajaran ? $jadwal->mataPelajaran->nama_mapel : '-' }}</td>
                        <!-- <td class="px-3 py-2 space-x-1">
                            {{-- <a href="{{ route('guru.jadwals.edit', $jadwal) }}" class="btn-accent btn-sm">Edit</a> --}}
                            {{-- <form action="{{ route('guru.jadwals.destroy', $jadwal) }}" method="POST" style="display:inline-block">
                                @csrf
                                @method('DELETE')
                                <button type="submit" class="btn-primary btn-sm" onclick="return confirm('Yakin hapus?')">Delete</button>
                            </form> --}}
                        </td> -->
                    </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
    </div>
</x-guru-layout>