<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">

    <title>Ellia Cellular</title>
    <meta content="" name="description">
    <meta content="" name="keywords">

    <!-- Favicons -->
    <link href="{{ asset('assets/img/favicon.png') }}" rel="icon">
    <link href="{{ asset('assets/img/apple-touch-icon.png') }}" rel="apple-touch-icon">

    <!-- Google Fonts -->
    <link href="https://fonts.gstatic.com" rel="preconnect">
    <link
        href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i"
        rel="stylesheet">

    <!-- Tambahkan ini di bagian <head> atau sebelum penutup </body> -->
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>


    <!-- Vendor CSS Files -->
    <link href="{{ asset('assets/vendor/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
    <link href="{{ asset('assets/vendor/bootstrap-icons/bootstrap-icons.css') }}" rel="stylesheet">
    <link href="{{ asset('assets/vendor/boxicons/css/boxicons.min.css') }}" rel="stylesheet">
    <link href="{{ asset('assets/vendor/quill/quill.snow.css') }}" rel="stylesheet">
    <link href="{{ asset('assets/vendor/quill/quill.bubble.css') }}" rel="stylesheet">
    <link href="{{ asset('assets/vendor/remixicon/remixicon.css') }}" rel="stylesheet">
    <link href="{{ asset('assets/vendor/simple-datatables/style.css') }}" rel="stylesheet">

    <!-- Template Main CSS File -->
    <link href="{{ asset('assets/css/style.css') }}" rel="stylesheet">
</head>

<body>

    <!-- ======= Header ======= -->
    @include('header')
    <!-- ======= Sidebar ======= -->
    @include('sidebar')

    <main id="main" class="main">
        <div class="pagetitle">
            <h1>Peringkat Brand Terlaris</h1>
            <nav>
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{route('dashboard')}}">Home</a></li>
                    <li class="breadcrumb-item">Data Mining</li>
                    <li class="breadcrumb-item">Peringkat Brand Terlaris</li>
                </ol>
            </nav>
        </div><!-- End Page Title -->

        <div class="alert alert-info alert-dismissible fade show" role="alert">
            <strong>Keterangan:</strong>
            <ol class="mb-0 ps-3">
                <li>Klik tombol Ambil Peringkat Brand untuk menampilkan Peringkat Brand Terlaris yang diambil dari Hasil Prediksi total penjualan setiap brand.</li>
                <li>Klik tombol Reset Peringkat Brand untuk menghapus Peringkat Brand Terlaris yang sudah ditampilkan.</li>
                <li>Pilih Bulan berfungsi untuk menampilkan Peringkat Brand Terlaris dari bulan yang ingin ditampilkan.</li>
                <li>Dari prediksi peringkat yang ditampilkan pemilik toko dapat melakukan manajemen stok pada peringkat 1 hingga 3</li>
            </ol>
            {{-- <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> --}}
        </div>

        <section class="section">
            <div class="row">
                <div class="col-lg-12">
                    <div class="card">
                        <div class="card-body">
                            <h5 class="card-title">Peringkat Brand Terlaris</h5>
                            <div class="mb-1 d-flex align-items-center">
                                <form method="GET" action="{{ route('peringkat.index') }}" class="mb-3">
                                    <label for="bulan" class="form-label">Pilih Bulan:</label>
                                    <select name="bulan" id="bulan" class="form-select w-auto d-inline"
                                        onchange="this.form.submit()">
                                        @foreach ($bulanOptions as $id => $namaBulan)
                                            <option value="{{ $id }}"
                                                {{ $bulanDipilih == $id ? 'selected' : '' }}>
                                                {{ $namaBulan }}
                                            </option>
                                        @endforeach
                                    </select>
                                </form>

                            </div>
                            <div class="d-flex justify-content-end align-items-center mb-3 gap-2">
                                <form action="{{ route('peringkat.reset') }}" method="POST">
                                    @csrf
                                    <button type="submit" class="btn btn-danger">
                                        Reset Peringkat Brand
                                    </button>
                                </form>
                                <form action="{{ route('peringkat.proses') }}" method="POST">
                                    @csrf
                                    <button type="submit" class="btn btn-success" {{ $hasData ? 'disabled' : '' }}>
                                        Ambil Peringkat Brand
                                    </button>
                                </form>
                            </div>
                            <table class="table table-striped table-bordered text-center" id="peringkatTable">
                                <thead class="text-center">
                                    <tr>
                                        <th>PERINGKAT</th>
                                        <th>BRAND</th>
                                        <th>TOTAL HASIL PREDIKSI</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse ($peringkat as $item)
                                        <tr>
                                            <td>{{ $item->peringkat }}</td>
                                            <td>{{ strtoupper($item->brand_nama) }}</td>
                                            <td>{{ $item->total }}</td>
                                        </tr>
                                    @empty
                                        <tr>
                                            <td colspan="3">Belum ada peringkat yang tersedia.</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main><!-- End #main -->





    <!-- ======= Footer ======= -->
    @include('footer')

    <a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i
            class="bi bi-arrow-up-short"></i></a>

    <!-- Vendor JS Files -->
    <script src="{{ asset('assets/vendor/apexcharts/apexcharts.min.js') }}"></script>
    <script src="{{ asset('assets/vendor/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
    <script src="{{ asset('assets/vendor/chart.js/chart.umd.js') }}"></script>
    <script src="{{ asset('assets/vendor/echarts/echarts.min.js') }}"></script>
    <script src="{{ asset('assets/vendor/quill/quill.js') }}"></script>
    <script src="{{ asset('assets/vendor/simple-datatables/simple-datatables.js') }}"></script>
    <script src="{{ asset('assets/vendor/tinymce/tinymce.min.js') }}"></script>
    <script src="{{ asset('assets/vendor/php-email-form/validate.js') }}"></script>

    <!-- Template Main JS File -->
    <script src="{{ asset('assets/js/main.js') }}"></script>


</body>

</html>
