<x-app-layout>

    @include('tindak-lanjut.pindah-sekolah.create')
    @include('tindak-lanjut.pindah-sekolah.edit')
    @include('tindak-lanjut.pindah-sekolah.delete')

    <x-slot name="header">
        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
            {{ __('DATA PINDAH SEKOLAH') }}
        </h2>
    </x-slot>

    <div class="py-12">
        <div class="max-w-4xlxl mx-auto sm:px-6 lg:px-8">
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                <div class="p-6 text-gray-900 flex justify-between items-center">
                    @hasrole('Admin|GuruBK')
                        <button type="button" class="btn btn-outline-warning mb-4" data-bs-toggle="modal"
                            data-bs-target="#tambahModal">TAMBAH DATA</button>
                    @endhasrole
                </div>
                <x-table :tableId="'myTable_' . uniqid()">
                    <x-slot name="header">
                        <tr class="bg-gray-400 text-center">
                            <th>NO.</th>
                            <th>NIS</th>
                            <th>NAMA SISWA</th>
                            <th>KELAS</th>
                            <th>ANGKATAN</th>
                            <th>HARI, TANGGAL</th>
                            <th>KETERANGAN</th>
                            <th>SEKOLAH TUJUAN</th>
                            <th>AKSI</th>
                        </tr>
                    </x-slot>

                    @php $num = 1; @endphp
                    @foreach ($pindahsekolah as $data)
                        <tr class="text-center">
                            <td>{{ $num++ }}</td>
                            <td>{{ $data->siswa->nis }}</td>
                            <td>{{ $data->siswa->nama_siswa }}</td>
                            <td>{{ $data->siswa->kelas }}</td>
                            <td>{{ $data->siswa->tahun_pelajaran }}</td>
                            <td>{{ $data->hari }}, {{ $data->tanggal }}</td>
                            <td>{{ $data->keterangan }}</td>
                            <td>{{ $data->tujuan }}</td>
                            <td>
                                <button tag="a" type="button" class="btn btn-outline-warning"
                                    data-bs-toggle="modal" data-bs-target="#exampleModal_{{ $data->id_pindah_sekolah }}"><i
                                        class="fa-solid fa-pen-to-square"></i></button>
                                <button type="button" class="btn btn-outline-danger" data-bs-toggle="modal"
                                    data-bs-target="#hapusModal_{{ $data->id_pindah_sekolah }}"><i
                                        class="fa-solid fa-trash-can"></i></button>
                                <a class="btn btn-outline-primary" href="{{ route('tindak-lanjut.pindah-sekolah.print', $data->id_pindah_sekolah) }}"
                                    target="_blank">
                                    <i class="fa-solid fa-print"></i>
                                </a>
                            </td>
                        </tr>
                    @endforeach
                </x-table>
            </div>
        </div>
    </div>
</x-app-layout>
