<!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>Data Testing</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">Data Testing</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>Data Testing merupakan data yang diambil dari Sampel Data pada 4 bulan akhir sesuai bulan yang telah ditentukan pada pengambilan Sampel Data.</li>
                <li>Data 1 hingga Data 3 merupakan data yang diambil dari Sampel Data bulan ke 8 minggu ke 2 hingga minggu ke 4.</li>
                <li>Target merupakan data yang diambil dari Sampel Data bulan ke 9 minggu ke 1.</li>
                <li>Klik tombol Ambil Data Testing untuk mengambil dan menampilkan Data Testing yang diambil dari Sampel Data.</li>
                <li>Klik tombol Reset Data Testing untuk menghapus Data Testing yang ada atau sudah diambil.</li>
                <li>Pilih Brand berfungsi untuk menampilkan data testing dari brand yang ingin ditampilkan.</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">Data Testing</h5>
                            <div class="mb-1 d-flex align-items-center">
                                <form method="GET" action="{{ route('testing.index') }}" class="mb-3">
                                    <label for="entriesPerBrand" class="form-label">Pilih Brand:</label>
                                    <select name="brand" id="entriesPerBrand" class="form-select w-auto d-inline"
                                        onchange="this.form.submit()">
                                        @foreach ($brands as $b)
                                            <option value="{{ $b->id }}"
                                                {{ $brand == $b->id ? 'selected' : '' }}>
                                                {{ $b->nama_brand }}
                                            </option>
                                        @endforeach
                                    </select>
                                </form>

                            </div>
                            <div class="d-flex justify-content-end align-items-center mb-3 gap-2">
                                {{-- Tombol Reset Data Testing --}}
                                <form action="{{ route('testing.reset') }}" method="POST">
                                    @csrf
                                    <button type="submit" class="btn btn-danger">
                                        Reset Data Testing
                                    </button>
                                </form>

                                {{-- Tombol Ambil Data Testing --}}
                                <form action="{{ route('testing.generate') }}" method="POST">
                                    @csrf
                                    <button type="submit" class="btn btn-success" {{ $hasData ? 'disabled' : '' }}>
                                        Ambil Data Testing
                                    </button>
                                </form>
                            </div>
                            <table class="table table-striped table-bordered" id="testingTable">
                                <thead>
                                    <tr>
                                        <th>No</th>
                                        <th>Data 1</th>
                                        <th>Data 2</th>
                                        <th>Data 3</th>
                                        <th>Target</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse($testings as $testing)
                                        <tr>
                                            <td>{{ $testing->no }}</td>
                                            <td>{{ $testing->data_1 }}</td>
                                            <td>{{ $testing->data_2 }}</td>
                                            <td>{{ $testing->data_3 }}</td>
                                            <td>{{ $testing->target }}</td>
                                        </tr>
                                    @empty
                                        <tr>
                                            <td colspan="5" class="text-center">Belum ada data yang tersedia.</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main><!-- End #main -->

    <!-- Modal Tambah-->
    {{-- <div class="modal fade" id="tambahProduct" tabindex="-1" aria-labelledby="modaltambahproductLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="modalTambahProductLabel">Tambah Data Produk</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <form action="{{ route('product.store') }}" method="POST" enctype="multipart/form-data">
                        @csrf
                        <div class="mb-3">
                            <label for="nama_produk" class="form-label">Nama Produk</label>
                            <input type="text" class="form-control" id="nama_produk" name="nama_produk" required>
                        </div>
                        <div class="mb-3">
                            <label for="brand_id" class="form-label">Brand</label>
                            <select class="form-select" id="brand_id" name="brand_id" required>
                                <option value="" disabled selected>Pilih Brand</option>
                                @foreach ($brand as $b)
                                    <option value="{{ $b->id }}">{{ $b->nama_brand }}</option>
                                @endforeach
                            </select>
                        </div>
                        
                        <div class="mb-3">
                            <label for="category_id" class="form-label">Kategori</label>
                            <select class="form-select" id="category_id" name="category_id" required>
                                <option value="" disabled selected>Pilih Kategori</option>
                                @foreach ($category as $c)
                                    <option value="{{ $c->id }}">{{ $c->nama_kategori }}</option>
                                @endforeach
                            </select>
                        </div>
                        
                        <div class="mb-3">
                            <label for="harga" class="form-label">Harga Produk</label>
                            <input type="text" class="form-control" id="harga" name="harga" required>
                        </div>
                        <div class="mb-3">
                            <label for="stok" class="form-label">Stok Produk</label>
                            <input type="text" class="form-control" id="stok" name="stok" required>
                        </div>
                        <div class="mb-3">
                            <label for="image" class="form-label">Foto Produk</label>
                            <input type="file" class="form-control" id="image" name="image"
                                accept="image/*">
                        </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Tutup</button>
                    <button type="submit" class="btn btn-primary">Simpan Data</button>
                </div>
                </form>
            </div>
        </div>
    </div> --}}




    <!-- ======= 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>

    <style>
        #sampleTable th,
        #sampleTable td {
            text-align: center;
            vertical-align: middle;
        }
    </style>


</body>

</html>
