@extends('layouts/contentNavbarLayout')

@section('title', 'Tables - Tutor')

@section('content')
<h4 class="fw-bold py-3 mb-4">
    <span class="text-muted fw-light">Tables Tutor</span>
</h4>

<!-- Responsive Table -->
<div class="card">
    <div class="d-flex align-items-center justify-content-between">
        <h3 class="card-header">Tutor</h3>
    </div>
    <div class="mx-3 text-start">
        <a href="{{ route('tutor.create') }}">
            <button type="submit" class="btn btn-sm btn-primary">
                <i class='bx bx-plus'></i>
                Add
            </button>
        </a>
        <div class="btn-group">
            <button type="button" class="btn btn-sm btn-primary dropdown-toggle" data-bs-toggle="dropdown"
                aria-expanded="false">Export</button>
            <ul class="dropdown-menu">
                <li><a class="dropdown-item" href="{{route('tutor.export')}}?output=excel">Excel</a></li>
                <li><a class="dropdown-item" href="{{route('tutor.export')}}?output=pdf">PDF</a></li>
            </ul>
        </div>
    </div>
    <div class="table-responsive text-nowrap p-3">
        <table class="table" id="table">
            <thead>
                <tr class="text-nowrap">
                    <th>No</th>
                    <th>Nama</th>
                    <th>NIK</th>
                    <th>Alamat</th>
                    <th>Foto</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                @foreach ($tutor as $record)
                    <tr>
                        <th scope="row">{{$loop->index + 1}}</th>
                        <td>{{$record->nama}}</td>
                        <td>{{$record->nik}}</td>
                        <td>{{$record->alamat}}</td>
                        <td><a href="/images/tutor/{{$record->foto}}">Lihat</a></td>
                        <td>
                            <div class="btn-group" role="group" aria-label="Actions">
                                <a href="{{route('tutor.edit', $record->id)}}" class="btn btn-blue"><i
                                        class="bx bx-edit-alt"></i> Edit</a>
                                <form action="{{route('tutor.delete', $record->id)}}" method="POST">
                                    @csrf
                                    @method("DELETE")
                                    <button type="submit" class="btn btn-white"
                                        onclick="return confirm('Apakah Kamu Yakin?')">
                                        </i class="bx bx-trash"> Delete
                                    </button>
                                </form>
                            </div>
                        </td>
                    </tr>
                @endforeach
            </tbody>
        </table>
    </div>
</div>
<!--/ Responsive Table -->
@endsection