@extends('layout.layout-pertek')

@php
    $script= '<script src="' . asset('assets/js/homeOneChart.js') . '"></script>';
@endphp

@section('content')

<!-- PERTEK Content -->
        <div class="row gy-4 mb-4">
            <!-- Total Pengajuan -->
            <div class="col-xl-3 col-lg-6 col-sm-6">
                <div class="card shadow-none border bg-gradient-start-1 h-100">
                    <div class="card-body p-20">
                        <div class="d-flex align-items-center justify-content-between">
                            <div>
                                <span class="badge text-bg-primary">PERTEK</span>
                                <p class="fw-medium text-primary-light mb-1">Total Pengajuan</p>
                                <h4 class="mb-1 fw-bold text-primary-600">1,250</h4>
                                <span class="text-sm text-secondary-light">+12% dari bulan lalu</span>
                            </div>
                            <div class="w-50-px h-50-px bg-yellow rounded-circle d-flex justify-content-center align-items-center">
                                <x-lucide-equal class="text-white w-32-px h-32-px mb-0"/>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Izin Disetujui -->
            <div class="col-xl-3 col-lg-6 col-sm-6">
                <div class="card shadow-none border bg-gradient-start-2 h-100">
                    <div class="card-body p-20">
                        <div class="d-flex align-items-center justify-content-between">
                            <div>
                                 <span class="badge text-bg-primary">PERTEK</span>
                                <p class="fw-medium text-primary-light mb-1">Izin Disetujui</p>
                                <h4 class="mb-1 fw-bold text-success-main">850</h4>
                                <span class="badge bg-success-subtle text-success-main">+8.2%</span>
                            </div>
                            <div class="w-50-px h-50-px bg-green rounded-circle d-flex justify-content-center align-items-center">
                                <x-lucide-circle-check class="text-white w-32-px h-32-px mb-0"/>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Izin Proses -->
            <div class="col-xl-3 col-lg-6 col-sm-6">
                <div class="card shadow-none border bg-gradient-start-3 h-100">
                    <div class="card-body p-20">
                        <div class="d-flex align-items-center justify-content-between">
                            <div>
                                 <span class="badge text-bg-primary">PERTEK</span>
                                <p class="fw-medium text-primary-light mb-1">Dalam Proses</p>
                                <h4 class="mb-1 fw-bold text-info-main">200</h4>
                                <span class="text-sm text-secondary-light">sedang ditinjau</span>
                            </div>
                            <div class="w-50-px h-50-px bg-info rounded-circle d-flex justify-content-center align-items-center">
                                <x-lucide-refresh-cw class="text-white w-32-px h-32-px mb-0"/>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Izin Ditolak -->
            <div class="col-xl-3 col-lg-6 col-sm-6">
                <div class="card shadow-none border bg-gradient-start-4 h-100">
                    <div class="card-body p-20">
                        <div class="d-flex align-items-center justify-content-between">
                            <div>
                                 <span class="badge text-bg-primary">PERTEK</span>
                                <p class="fw-medium text-primary-light mb-1">Izin Ditolak</p>
                                <h4 class="mb-1 fw-bold text-danger-main">150</h4>
                                <span class="text-sm text-secondary-light">perlu perbaikan</span>
                            </div>
                            <div class="w-50-px h-50-px bg-red rounded-circle d-flex justify-content-center align-items-center">
                                <x-lucide-circle-x class="text-white w-32-px h-32-px mb-0"/>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Top 5 Izin Tercepat Table -->
        <div class="row gy-4 mt-4">
            <div class="col-6">
                <div class="card shadow-none border h-100">
                    <div class="card-body p-24">
                         <span class="badge text-bg-primary">PERTEK</span>
                        <h6 class="mb-3 fw-semibold">Top 5 Izin Tercepat</h6>
                        <div class="table-responsive">
                            <table class="table table-sm mb-0">
                                <thead>
                                    <tr>
                                        <th scope="col" class="text-sm">No</th>
                                        <th scope="col" class="text-sm">Nama Izin</th>
                                        <th scope="col" class="text-sm">Total Izin</th>
                                        <th scope="col" class="text-sm d-none d-lg-table-cell">Waktu Rata-Rata (Pemohon)</th>
                                        <th scope="col" class="text-sm d-none d-lg-table-cell">Waktu Rata-Rata (Petugas)</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td>1</td>
                                        <td class="text-sm">SERTIFIKAT LAIK OPERASI - PEMENUHAN BAKU MUTU EMISI</td>
                                        <td class="text-sm">125</td>
                                        <td class="text-sm d-none d-lg-table-cell">58 Jam 29 Menit</td>
                                        <td class="text-sm d-none d-lg-table-cell">19 Jam 12 Menit</td>
                                    </tr>
                                    <tr>
                                        <td>2</td>
                                        <td class="text-sm">PERSETUJUAN TEKNIS - PEMENUHAN BAKU MUTU AIR LIMBAH (PEMANFAATAN)</td>
                                        <td class="text-sm">89</td>
                                        <td class="text-sm d-none d-lg-table-cell">36 Jam 0 Menit</td>
                                        <td class="text-sm d-none d-lg-table-cell">26 Jam 24 Menit</td>
                                    </tr>
                                    <tr>
                                        <td>3</td>
                                        <td class="text-sm">SERTIFIKAT LAIK OPERASI - PEMENUHAN BAKU MUTU AIR LIMBAH (PEMBUANGAN)</td>
                                        <td class="text-sm">156</td>
                                        <td class="text-sm d-none d-lg-table-cell">43 Jam 12 Menit</td>
                                        <td class="text-sm d-none d-lg-table-cell">31 Jam 12 Menit</td>
                                    </tr>
                                    <tr>
                                        <td>4</td>
                                        <td class="text-sm">PERSETUJUAN TEKNIS - PEMENUHAN BAKU MUTU AIR LIMBAH (PEMBUANGAN)</td>
                                        <td class="text-sm">73</td>
                                        <td class="text-sm d-none d-lg-table-cell">50 Jam 24 Menit</td>
                                        <td class="text-sm d-none d-lg-table-cell">38 Jam 24 Menit</td>
                                    </tr>
                                    <tr>
                                        <td>5</td>
                                        <td class="text-sm">SERTIFIKAT LAIK OPERASI - PEMENUHAN BAKU MUTU AIR LIMBAH (PEMANFAATAN)</td>
                                        <td class="text-sm">92</td>
                                        <td class="text-sm d-none d-lg-table-cell">55 Jam 12 Menit</td>
                                        <td class="text-sm d-none d-lg-table-cell">45 Jam 36 Menit</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>

            <div class="col-6">
                <div class="card shadow-none border h-100">
                    <div class="card-body p-24">
                         <span class="badge text-bg-primary mb-12">PERTEK</span>
                        <h6 class="mb-3 fw-semibold">Top 5 Izin Terakhir Terbit</h6>
                        <div class="table-responsive">
                            <table class="table table-sm mb-0">
                                <thead>
                                    <tr>
                                        <th scope="col" class="text-sm">No</th>
                                        <th scope="col" class="text-sm">Nama Izin</th>
                                        <th scope="col" class="text-sm">Pemohon</th>
                                        <th scope="col" class="text-sm d-none d-lg-table-cell">Tanggal Terbit</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td>1</td>
                                        <td class="text-sm">SERTIFIKAT LAIK OPERASI - PEMENUHAN BAKU MUTU EMISI</td>
                                        <td class="text-sm">PT. MAJU BERSAMA</td>
                                        <td class="text-sm d-none d-lg-table-cell">15 Des 2024</td>
                                    </tr>
                                    <tr>
                                        <td>2</td>
                                        <td class="text-sm">PERSETUJUAN TEKNIS - PEMENUHAN BAKU MUTU AIR LIMBAH</td>
                                        <td class="text-sm">CV. KARYA MANDIRI</td>
                                        <td class="text-sm d-none d-lg-table-cell">14 Des 2024</td>
                                    </tr>
                                    <tr>
                                        <td>3</td>
                                        <td class="text-sm">SERTIFIKAT LAIK OPERASI - PEMENUHAN BAKU MUTU AIR LIMBAH</td>
                                        <td class="text-sm">PT. INDUSTRI SEJAHTERA</td>
                                        <td class="text-sm d-none d-lg-table-cell">13 Des 2024</td>
                                    </tr>
                                    <tr>
                                        <td>4</td>
                                        <td class="text-sm">PERSETUJUAN TEKNIS - PEMENUHAN BAKU MUTU AIR LIMBAH</td>
                                        <td class="text-sm">PT. TEKNOLOGI MODERN</td>
                                        <td class="text-sm d-none d-lg-table-cell">12 Des 2024</td>
                                    </tr>
                                    <tr>
                                        <td>5</td>
                                        <td class="text-sm">SERTIFIKAT LAIK OPERASI - PEMENUHAN BAKU MUTU EMISI</td>
                                        <td class="text-sm">CV. BERKAH JAYA</td>
                                        <td class="text-sm d-none d-lg-table-cell">11 Des 2024</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="row gy-4 mt-1">
            <div class="col-xxl-6 col-xl-12">
                <div class="card h-100">
                    <div class="card-body">
                        <div class="d-flex flex-wrap align-items-center justify-content-between">
                            <div class="d-flex align-items-center gap-2">
                                <h6 class="text-lg mb-0">Grafik Trend Pengajuan Pertek/SLO</h6>
                                <span class="badge text-bg-primary">PERTEK</span>
                            </div>
                            <select class="form-select bg-base form-select-sm w-auto">
                                <option>Yearly</option>
                                <option>Monthly</option>
                                <option>Weekly</option>
                                <option>Today</option>
                            </select>
                        </div>
                        <div class="d-flex flex-wrap align-items-center gap-2 mt-8">
                            <h6 class="mb-0">1,450</h6>
                            <span class="text-sm fw-semibold rounded-pill bg-success-focus text-success-main border br-success px-8 py-4 line-height-1 d-flex align-items-center gap-1">
                                15% <iconify-icon icon="bxs:up-arrow" class="text-xs"></iconify-icon>
                            </span>
                            <span class="text-xs fw-medium">+ 125 Pengajuan/Bulan</span>
                        </div>
                        <div id="chart-pertek" class="pt-28 apexcharts-tooltip-style-1"></div>
                    </div>
                </div>
            </div>

            <div class="col-xxl-6">
                <div class="card h-100">
                    <div class="card-body">
                        <div class="d-flex align-items-center flex-wrap gap-2 justify-content-between">
                            <div class="d-flex align-items-center gap-2">
                                <h6 class="mb-2 fw-bold text-lg mb-0">Grafik Trend Distribusi Jenis Izin</h6>
                                <span class="badge text-bg-primary">PERTEK</span>
                            </div>
                            <select class="form-select form-select-sm w-auto bg-base border text-secondary-light">
                                <option>Today</option>
                                <option>Weekly</option>
                                <option>Monthly</option>
                                <option>Yearly</option>
                            </select>
                        </div>
                        <ul class="d-flex flex-wrap align-items-center mt-3 gap-3">
                            <li class="d-flex align-items-center gap-2">
                                <span class="w-12-px h-12-px rounded-circle bg-primary-600"></span>
                                <span class="text-secondary-light text-sm fw-semibold">Usaha Perdagangan & Jasa</span>
                            </li>
                            <li class="d-flex align-items-center gap-2">
                                <span class="w-12-px h-12-px rounded-circle bg-yellow"></span>
                                <span class="text-secondary-light text-sm fw-semibold">Property</span>
                            </li>
                            <li class="d-flex align-items-center gap-2">
                                <span class="w-12-px h-12-px rounded-circle bg-success-main"></span>
                                <span class="text-secondary-light text-sm fw-semibold">Manufaktur</span>
                            </li>
                            <li class="d-flex align-items-center gap-2">
                                <span class="w-12-px h-12-px rounded-circle bg-danger-400"></span>
                                <span class="text-secondary-light text-sm fw-semibold">Lainnya</span>
                            </li>
                        </ul>

                        <div class="mt-40">
                            <div id="paymentStatusChart-pertek" class="margin-16-minus"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

@endsection

@push('css')
<style>
/* Card improvements */
.card {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafb 100%);
    border: 1px solid rgba(0, 0, 0, 0.03);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}
</style>
@endpush

@push('scripts')
<script>
document.addEventListener('DOMContentLoaded', function() {
    // Any scripts needed for the charts
});
</script>
@endpush
