<!-- Main content -->
<div class="content-wrapper">

    <!-- Inner content -->
    <div class="content-inner">

        <!-- card card-header -->
        <div class="card card-header mb-2">

            <?php
            if ($_SESSION["user_profile"] == "ROOT") { ?>

                <div class="row border-bottom pb-2">
                    <div class="col-xl-9 col-lg-9 col-md-6">
                        <h4 class="page-title fw-bold mb-0"><?= $translate["tax_receipt"]; ?></h4>
                    </div>

                    <div class="col-xl-3 col-lg-3 col-md-6 btn-group">
                        <button class="btn btn-indigo text-uppercase btnAddNew" type="button"> <i class="ph-plus me-1"></i> <?= $translate["new_tax_receipt"]; ?></button>
                    </div>
                </div>
            <?php } else { ?>

                <div class="row border-bottom pb-2">
                    <div class="col-xl-9 col-lg-9 col-md-6">
                        <h4 class="page-title fw-bold mb-0"><?= $translate["tax_receipt"]; ?></h4>
                    </div>

                    <div class="col-xl-3 col-lg-3 col-md-6">
                        <div class="btn-group d-flex">
                            <button type="button" class="btn btn-warning text-uppercase btnSearch"><i class="ph-magnifying-glass me-1"></i> <?= $translate["search"]; ?></button>
                        </div>
                    </div>
                </div>

            <?php } ?>

            <div class="row mt-3">

                <?php
                if ($_SESSION["user_profile"] == "ROOT") { ?>

                    <div class="col-lg-3 col-md-6 col-sm-12 mb-2">
                        <label class="form-label fw-medium text-uppercase"><?= $translate["enterprise"]; ?></label>
                        <div class="input-group">
                            <span class="input-group-text"><i class="ph ph-building-office"></i></span>
                            <select class="form-control form-control-lg select2" id="ent_id_value" onchange="listDataToDatatable(this.value);" data-width="1%">
                                <?php

                                $sql = "SELECT ent_id,ent_name FROM tb_enterprises WHERE ent_contract_status = 'Enabled' ORDER BY ent_name ASC;";
                                $answer = executePDOFetchAll($sql, "");

                                foreach ($answer as $key => $value) {
                                    echo "<option value='{$value['ent_id']}' > {$value['ent_name']}</option>";
                                }

                                ?>
                            </select>
                        </div>
                    </div>

                    <div class="col-lg-2 col-md-6 col-sm-12 mb-2">
                        <label class="form-label fw-medium text-uppercase">&nbsp;</label>
                        <div class="btn-group d-flex">
                            <button type="button" class="btn btn-warning text-uppercase btnSearch"><i class="ph-magnifying-glass me-1"></i> <?= $translate["search"]; ?></button>
                        </div>
                    </div>

                <?php } else { ?>
                    <input type="hidden" id="ent_id_value" value="<?= $_SESSION["user_ent_id"]; ?>">
                <?php }
                ?>

            </div>

        </div>
        <!-- /card card-header -->

        <!-- Card layout -->
        <div class="card card-header mt-1">

            <table class="table table-sm tax-receipt-table">
                <thead>
                    <tr class="table-dark text-uppercase">
                        <th>#</th>
                        <th><?= $translate["type"]; ?></th>
                        <th><?= $translate["description"]; ?></th>
                        <th><?= $translate["available"]; ?></th>
                        <th><?= $translate["used"]; ?></th>
                        <th><?= $translate["status"]; ?></th>
                        <th><?= $translate["options"]; ?></th>
                    </tr>
                </thead>
            </table>

        </div>
        <!-- /Card layout -->

    </div>
    <!-- /inner content -->

</div>
<!-- /main content -->



<!-- Add / Edit modal -->
<!-- <div id="enterprise-modal" class="modal" data-bs-keyboard="false" data-bs-backdrop="static" tabindex="-1"> -->
<div id="myModalAddTaxReceipt" class="modal" tabindex="-1">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title span-modal-title"></h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>

            <form action="" id="frmAddTaxReceipt" autocomplete="off" method="POST">

                <input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">

                <div class="modal-body">

                    <div class="row">

                        <input type="hidden" name="fis_rec_id" id="fis_rec_id">
                        <input type="hidden" name="fis_rec_ent_id" id="fis_rec_ent_id">

                        <div class="col-lg-12 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["type"]; ?> <span class="text-danger fs-15px">*</span></label>
                            <input type="text" class="form-control form-control-lg" name="fis_rec_type" id="fis_rec_type" required autocomplete="off" placeholder="eg. B01">
                        </div>

                        <div class="col-lg-12 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["name"]; ?> <span class="text-danger fs-15px">*</span></label>
                            <input type="text" class="form-control form-control-lg" name="fis_rec_description" id="fis_rec_description" required autocomplete="off" placeholder="<?= $translate["name"]; ?>">
                        </div>

                    </div>

                </div>
            </form>

            <div class="modal-footer">
                <button type="button" class="btn btn-indigo text-uppercase btnSave"><i class="ph-floppy-disk-back me-1"></i> <?= $translate["save"]; ?></button>
                <button type="button" class="btn btn-indigo text-uppercase btnEdit"><i class="ph-floppy-disk-back me-1"></i> <?= $translate["save"]; ?></button>
                <button type="button" class="btn btn-light text-uppercase" data-bs-dismiss="modal"><i class="mi-close me-1"></i> <?= $translate["close"]; ?></button>
            </div>
        </div>
    </div>
</div>
<!-- /Add / Edit modal -->

<!-- Add / Edit modal -->
<!-- <div id="enterprise-modal" class="modal" data-bs-keyboard="false" data-bs-backdrop="static" tabindex="-1"> -->
<div id="myModalNewTaxReceiptRequest" class="modal" tabindex="-1">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title"><?= $translate["add_request"]; ?></h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>

            <form action="" id="frmNewTaxReceiptRequest" autocomplete="off" method="POST">

                <input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">

                <div class="modal-body">

                    <div class="row">

                        <input type="hidden" name="fiscal_entry_fis_rec_id" id="fiscal_entry_fis_rec_id">
                        <input type="hidden" name="fiscal_entry_ent_id" id="fiscal_entry_ent_id">
                        <input type="hidden" name="fiscal_entry_type" id="fiscal_entry_type">
                        <input type="hidden" name="fiscal_entry_description" id="fiscal_entry_description">

                        <div class="col-lg-12 mt-2 mb-4 border-bottom">
                            <span class=" fw-bold pb-2 text-uppercase" id="fis_rec_description_stock"></span>
                        </div>

                        <div class="col-lg-12 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["from"]; ?></label>
                            <input type="number" min="0" class="form-control form-control-lg" name="fiscal_entry_from" id="fiscal_entry_from" value="0">
                        </div>

                        <div class="col-lg-12 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["to"]; ?></label>
                            <input type="number" min="1" class="form-control form-control-lg" name="fiscal_entry_to" id="fiscal_entry_to" value="1">
                        </div>

                        <div class="col-lg-12 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["approved_quantity"]; ?></label>
                            <input type="number" min="1" class="form-control form-control-lg bg-light" name="fiscal_entry_approved" id="fiscal_entry_approved" required readonly autocomplete="off" style="cursor: not-allowed;">
                        </div>

                        <div class="col-lg-12 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["due_date"]; ?></label>
                            <div class="input-group">
                                <span class="input-group-text"><i class="ph-calendar"></i></span>
                                <input type="text" class="form-control form-control-lg datepicker-from-year" name="fiscal_entry_expire_date" id="fiscal_entry_expire_date">
                            </div>
                        </div>

                    </div>

                </div>
            </form>

            <div class="modal-footer">
                <button type="button" class="btn btn-indigo text-uppercase btnSaveNewTaxReceiptRequest"><i class="ph-floppy-disk-back me-1"></i> <?= $translate["save"]; ?></button>
                <button type="button" class="btn btn-light text-uppercase" data-bs-dismiss="modal"><i class="mi-close me-1"></i> <?= $translate["close"]; ?></button>
            </div>
        </div>
    </div>
</div>
<!-- /Add / Edit modal -->

<!-- Add / Edit  modal -->
<!-- <div id="enterprise-modal" class="modal" data-bs-keyboard="false" data-bs-backdrop="static" tabindex="-1"> -->
<div id="taxReceiptRequestHistoryModal" class="modal" tabindex="-1">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title"><?= $translate["history"]; ?></h5>
                <button type=" button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>
            <div class="modal-body">
                <table class="table table-sm tax-receipt-request-history-table">
                    <thead>
                        <tr class="table-dark text-uppercase">
                            <th>#</th>
                            <th><?= $translate["type"]; ?></th>
                            <th><?= $translate["from"]; ?></th>
                            <th><?= $translate["to"]; ?></th>
                            <th><?= $translate["approved_quantity"]; ?></th>
                            <th><?= $translate["due_date"]; ?></th>
                        </tr>
                    </thead>
                </table>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="mi-close me-1"></i> <?= $translate["close"]; ?></button>
            </div>
        </div>
    </div>
</div>
<!-- /Add / Edit modal -->



<script src="scripts/tax-receipt.js?v=<?= md5(time()) ?>"></script>