@extends('layouts.app')
@section('title', 'Master Bantuan Pemerintah')
@section('content')
    <div class="row">
        <div class="col-lg-12 d-flex align-items-stretch">
            <div class="card w-100">
                <div class="card-body p-4">
                    <div class="d-flex align-items-stretch">
                        <h5 class="card-title fw-semibold mb-4">Master Bantuan Pemerintah</h5>
                    </div>
                    <div class="table-responsive">
                        <table class="table table-responsive table-bordered text-nowrap mb-0 align-middle">
                            <thead class="text-dark fs-4">
                                <tr>
                                    <th class="border-bottom-0" width="65px">
                                        <h6 class="fw-semibold mb-0 text-center">#</h6>
                                    </th>
                                    <th class="border-bottom-0" style="max-width: 100px;">
                                        <h6 class="fw-semibold mb-0">Kode Master</h6>
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                @forelse ($data as $_data)
                                    <tr>
                                        <td class="border-bottom-0 text-center">
                                            <span
                                                class="fw-normal mb-0">{{ ($data->currentPage() - 1) * $data->perPage() + $loop->index + 1 }}</span>
                                        </td>
                                        <td class="border-bottom-0" style="max-width: 100px;">
                                            <span
                                                class="fw-normal mb-1 badge text-bg-light">{{ $_data->keterangan }}</span>
                                        </td>
                                    </tr>
                                @empty
                                    <div class="alert alert-danger">
                                        Data master belum Tersedia.
                                    </div>
                                @endforelse
                            </tbody>
                        </table>
                        {{-- Pagination --}}
                        <div class="d-flex justify-content-center">
                            {!! $data->links('includes.custom-pagination') !!}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    @if (Session::has('datas-message'))
        <script>
            Swal.fire({
                text: "{{ Session::get('datas-message')['msg'] }}",
                icon: "{{ Session::get('datas-message')['type'] }}",
                timer: 2500
            });
        </script>
    @endif
@stop
