<main id="main" class="main">
    <div class="pagetitle">
        <h1>Selamat Datang <?= $this->session->strNama; ?></h1>
        <nav>
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="index.html">Home</a></li>
                <li class="breadcrumb-item active">Stock Opname</li>
            </ol>
        </nav>
    </div>
    <script src="<?= base_url(); ?>assets/js/html5-qrcode.min.js"></script>
    <section class="section dashboard">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-body"><br>
                    <button onclick="tampildata()" style="float:left;margin: 2px;" type="button" id="btnview" class="btn btn-primary"><i class="bi bi-arrow-clockwise"></i>&nbsp;Refresh</button>
                    <button type="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>
                    <button onclick="unduh()" style="float:left;margin: 2px;" type="button" class="btn btn-success"><i class="bi bi-cloud-download"></i>&nbsp;Unduh</button>
                </div>
            </div>
        </div>
        <div class="row">
            <div id="tb_stok"></div>
        </div>
    </section>
</main>
<script src="<?= base_url(); ?>assets/js/scanner_kirim.js"></script>



<script>
    function tampildata() {
        document.getElementById("btnloading").style.display = "block";
        document.getElementById("btnview").style.display = "none";
        $.get("<?= base_url('Scan/tb_stock_opname'); ?>", function(data, status) {
            $("#tb_stok").html(data);
            document.getElementById("btnloading").style.display = "none";
            document.getElementById("btnview").style.display = "block";
        });
    }

    function tutup() {
        $('#html5-qrcode-button-camera-stop').click();
    }

    function unduh() {
        window.open("<?= base_url('Scan/tb_stock_opname_xls') ?>", "_self");
    }
</script>