@extends('employee.layouts.app')
@section('title', 'Manajemen Jurusan | Career Development and Consultation (CDC)')
@push('styles')
    <link href="{{ asset('assets/employee/plugins/custom/datatables/datatables.bundle.css') }}" rel="stylesheet"
        type="text/css" />
@endpush
@section('navigation')
    <h1 class="my-1 d-flex align-items-center text-dark fw-bolder fs-3">Jurusan
        <span class="mx-2 border-gray-200 h-20px border-start ms-3"></span>
        <small class="my-1 text-muted fs-7 fw-bold ms-1">Manajemen Jurusan</small>
    </h1>
@endsection
@section('content')
    <div class="card">
        <div class="pt-4 border card-body">
            <table class="table align-middle table-row-dashed fs-6 gy-5" id="myTable">
                <thead>
                    <th class="max-w-5px">Nomor</th>
                    <th class="max-w-50px">Kode</th>
                    <th class="min-w-160px">Jurusan</th>
                    <th class="min-w-100px">Pengaturan</th>
                </thead>
                <tbody class="text-gray-600 fw-bold">
                    @foreach ($departments as $index => $department)
                        <tr>
                            <td>{{ $index + 1 }}</td>
                            <td>{{ $department->department_code }}</td>
                            <td>{{ ucfirst($department->department_name) }}</td>
                            <td>
                                <div class="d-flex">
                                    <a href="{{ route('departments.edit', $department->id) }}"
                                        class="btn btn-light btn-active-light-primary btn-sm">Perbarui
                                    </a>
                                    <form action="{{ route('departments.delete', $department->id) }}" method="POST">
                                        @csrf
                                        @method('delete')
                                        <a onclick="event.preventDefault(); this.closest('form').submit();"
                                            class="mx-2 btn btn-light btn-active-light-primary btn-sm">Hapus</a>
                                    </form>
                                </div>
                            </td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
    </div>
@endsection
@push('scripts')
    <script src="{{ asset('assets/employee/plugins/custom/datatables/datatables.bundle.js') }}"></script>
    <script src="{{ asset('assets/employee/plugins/custom/datatables/table.js') }}"></script>
@endpush
