@extends('layouts.app')

@section('title', 'Mapping KCD - Admin Dinas')

@section('content')
<div class="container-fluid">
    <!-- Page Header -->
    <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
            <h1 class="h3 mb-0">Mapping KCD</h1>
            <p class="text-muted small mt-1">Kelola penugasan KCD ke pengawas</p>
        </div>
        <a href="{{ route('admin-dinas.pengawas') }}" class="btn btn-outline-secondary">
            <i class="bi bi-arrow-left"></i> Kembali
        </a>
    </div>

    <!-- Filter & Search -->
    <div class="row mb-4">
        <div class="col-md-4">
            <div class="input-group">
                <span class="input-group-text bg-white border-end-0">
                    <i class="bi bi-search"></i>
                </span>
                <input type="text" class="form-control border-start-0" placeholder="Cari pengawas...">
            </div>
        </div>
        <div class="col-md-4">
            <select class="form-select">
                <option value="">-- Filter Status --</option>
                <option value="sudah">Sudah Mapping</option>
                <option value="belum">Belum Mapping</option>
            </select>
        </div>
        <div class="col-md-4 text-end">
            <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#mappingModal">
                <i class="bi bi-plus-circle"></i> Tambah Mapping
            </button>
        </div>
    </div>

    <!-- Mapping Table -->
    <div class="card">
        <div class="card-header">
            <h5 class="mb-0">Daftar Penugasan KCD</h5>
        </div>
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-hover">
                    <thead class="table-light">
                        <tr>
                            <th style="width: 25%;">Pengawas</th>
                            <th style="width: 25%;">KCD</th>
                            <th style="width: 15%;">Tanggal Mulai</th>
                            <th style="width: 15%;">Tanggal Selesai</th>
                            <th style="width: 10%;">Status</th>
                            <th style="width: 10%;">Aksi</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>
                                <div class="d-flex align-items-center">
                                    <div class="avatar avatar-sm bg-primary text-white rounded-circle me-2 d-flex align-items-center justify-content-center" style="width: 36px; height: 36px;">
                                        <strong>AB</strong>
                                    </div>
                                    <div>
                                        <strong>Ahmad Bambang</strong>
                                        <br>
                                        <small class="text-muted">ahmad@dinas.go.id</small>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <strong>KCD 01</strong>
                                <br>
                                <small class="text-muted">Kec. Pusat</small>
                            </td>
                            <td>01-01-2025</td>
                            <td>31-12-2025</td>
                            <td><span class="badge bg-success">Aktif</span></td>
                            <td>
                                <button class="btn btn-sm btn-outline-primary" title="Edit">
                                    <i class="bi bi-pencil"></i>
                                </button>
                                <button class="btn btn-sm btn-outline-danger" title="Hapus">
                                    <i class="bi bi-trash"></i>
                                </button>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="d-flex align-items-center">
                                    <div class="avatar avatar-sm bg-success text-white rounded-circle me-2 d-flex align-items-center justify-content-center" style="width: 36px; height: 36px;">
                                        <strong>SM</strong>
                                    </div>
                                    <div>
                                        <strong>Siti Maryam</strong>
                                        <br>
                                        <small class="text-muted">siti@dinas.go.id</small>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <strong>KCD 02</strong>
                                <br>
                                <small class="text-muted">Kec. Timur</small>
                            </td>
                            <td>01-01-2025</td>
                            <td>31-12-2025</td>
                            <td><span class="badge bg-success">Aktif</span></td>
                            <td>
                                <button class="btn btn-sm btn-outline-primary" title="Edit">
                                    <i class="bi bi-pencil"></i>
                                </button>
                                <button class="btn btn-sm btn-outline-danger" title="Hapus">
                                    <i class="bi bi-trash"></i>
                                </button>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="d-flex align-items-center">
                                    <div class="avatar avatar-sm bg-warning text-white rounded-circle me-2 d-flex align-items-center justify-content-center" style="width: 36px; height: 36px;">
                                        <strong>WJ</strong>
                                    </div>
                                    <div>
                                        <strong>Wawan Jaya</strong>
                                        <br>
                                        <small class="text-muted">wawan@dinas.go.id</small>
                                    </div>
                                </div>
                            </td>
                            <td>
                                <strong>KCD 03</strong>
                                <br>
                                <small class="text-muted">Kec. Barat</small>
                            </td>
                            <td>01-01-2025</td>
                            <td>31-12-2025</td>
                            <td><span class="badge bg-success">Aktif</span></td>
                            <td>
                                <button class="btn btn-sm btn-outline-primary" title="Edit">
                                    <i class="bi bi-pencil"></i>
                                </button>
                                <button class="btn btn-sm btn-outline-danger" title="Hapus">
                                    <i class="bi bi-trash"></i>
                                </button>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <nav aria-label="Pagination">
                <ul class="pagination justify-content-center mt-4">
                    <li class="page-item disabled"><a class="page-link" href="#">Previous</a></li>
                    <li class="page-item active"><a class="page-link" href="#">1</a></li>
                    <li class="page-item"><a class="page-link" href="#">2</a></li>
                    <li class="page-item"><a class="page-link" href="#">Next</a></li>
                </ul>
            </nav>
        </div>
    </div>
</div>

<!-- Mapping Modal -->
<div class="modal fade" id="mappingModal" tabindex="-1">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header border-bottom">
                <h5 class="modal-title">Tambah Mapping KCD</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>
            <div class="modal-body">
                <form id="mappingForm">
                    <div class="mb-3">
                        <label class="form-label">Pengawas <span class="text-danger">*</span></label>
                        <select class="form-select" required>
                            <option value="">-- Pilih Pengawas --</option>
                            <option value="1">Ahmad Bambang</option>
                            <option value="2">Siti Maryam</option>
                            <option value="3">Rudi Hartono</option>
                        </select>
                    </div>
                    <div class="mb-3">
                        <label class="form-label">KCD <span class="text-danger">*</span></label>
                        <select class="form-select" required>
                            <option value="">-- Pilih KCD --</option>
                            <option value="1">KCD 01 - Kec. Pusat</option>
                            <option value="2">KCD 02 - Kec. Timur</option>
                            <option value="3">KCD 03 - Kec. Barat</option>
                        </select>
                    </div>
                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <label class="form-label">Tanggal Mulai <span class="text-danger">*</span></label>
                            <input type="date" class="form-control" required>
                        </div>
                        <div class="col-md-6 mb-3">
                            <label class="form-label">Tanggal Selesai</label>
                            <input type="date" class="form-control">
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer border-top">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
                <button type="button" class="btn btn-primary">Simpan Mapping</button>
            </div>
        </div>
    </div>
</div>
@endsection
