<main id="main" class="main">

    <div class="pagetitle">
        <h1>Laporan Penerimaan FG</h1>
        <nav>
            <ol class="breadcrumb">

            </ol>
        </nav>
    </div><!-- End Page Title -->

    <section class="section">
        <div class="row">
            <div class="col-lg-12">

                <div class="card">
                    <div class="card-body">
                        <br>
                        <!-- Table with stripped rows -->
                        <div class="datatable-wrapper datatable-loading no-footer sortable searchable fixed-columns">
                            <div class="row g-3">
                                <div class="col-md-1">
                                    <label class="form-label">Mulai</label>
                                </div>
                                <div class="col-md-3">
                                    <input type="date" class="form-control" id="mulai" value="<?= date('Y-m-d'); ?>">
                                </div>
                                <div class="col-md-1">
                                    <label class="form-label">Hingga</label>
                                </div>
                                <div class="col-md-3">
                                    <input type="date" class="form-control" id="hingga" value="<?= date('Y-m-d'); ?>">
                                </div>
                                <div class="col-md-2">
                                    <button class="btn btn-primary" id="btnview" onclick="tampildata()"><i class='bi bi-search'></i>&nbsp;Lihat FG</button>
                                    <button style="display:none;float:right;margin: 2px;" id="btnloading" class="btn btn-primary" type="button" disabled="">
                                        <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
                                        Loading...
                                    </button>
                                </div>
                            </div>
                            <br>
                            <div class="datatable-container">
                                <div id="tbfglist"></div>
                            </div>
                        </div>
                        <!-- End Table with stripped rows -->

                    </div>
                </div>

            </div>
        </div>
    </section>

</main>

<script src="assets/libs/js/jquery-3.6.0.min.js"></script>
<script>
    function tampildata() {
        var mulai = $("#mulai").val();
        var hingga = $("#hingga").val();
        document.getElementById("btnloading").style.display = "block";
        document.getElementById("btnview").style.display = "none";
        $.get("tb_lotfg_gudang.php?mulai=" + mulai + "&hingga=" + hingga, function(data, status) {
            $("#tbfglist").html(data);
            document.getElementById("btnloading").style.display = "none";
            document.getElementById("btnview").style.display = "block";
        });
    }
</script>