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

    <div class="pagetitle">
        <h1>Laporan Final Check</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-4">
                                    <button style="float:left;margin: 2px;" class="btn btn-primary" id="btnview" onclick="tampildata()"><i class='bi bi-search'></i>&nbsp;Lihat LPBJ</button>
                                    <button style="display:none;float:left;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="tblpbj"></div>
                            </div>
                        </div>
                        <!-- End Table with stripped rows -->
                    </div>
                </div>
            </div>
        </div>
    </section>
</main>

<script>
    function tampildata() {
        var mulai = $("#mulai").val();
        var hingga = $("#hingga").val();
        $.get("<?= base_url('Lpbj/tb_laporan_lpbj?mulai='); ?>" + mulai + "&hingga=" + hingga, function(data, status) {
            $("#tblpbj").html(data);
        });
    }

    function preview_lpbj(kd, id) {
        window.open("<?= base_url('Lpbj/preview_lpbj?lpbj=') ?>" + kd + "&id=" + id, "_blank");
    }

    function view_lpbj(kd) {
        window.open("<?= base_url('Lpbj/lpbj_add?lpbj=') ?>" + kd, "_self");
    }
</script>