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

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

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

            <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["branches_list"]; ?></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_branch"]; ?></button>
                </div>
            </div>

            <div class="row mt-4">

                <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();" 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-3 col-md-6 col-sm-12 mb-2">
                    <label class="form-label fw-medium text-uppercase"><?= $translate["status"]; ?></label>
                    <div class="input-group">
                        <select class="form-control form-control-lg select2 searchStatus" data-minimum-results-for-search="Infinity">
                            <option value="Enabled" selected><?= $translate["enabled"]; ?></option>
                            <option value="Disabled"><?= $translate["disabled"]; ?></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>

            </div>

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

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

            <table class="table table-sm table-hover branches-table">
                <thead>
                    <tr class="table-dark text-uppercase">
                        <th>#</th>
                        <th><?= $translate["name"]; ?></th>
                        <th><?= $translate["category"]; ?></th>
                        <th><?= $translate["festive_mode"]; ?></th>
                        <th><?= $translate["cashback"]; ?></th>
                        <th><?= $translate["usd_online_menu"]; ?></th>
                        <th><?= $translate["menu_access"]; ?></th>
                        <th><?= $translate["show"]; ?></th>
                        <th><?= $translate["status"]; ?></th>
                        <th><?= $translate["menu"]; ?></th>
                        <th><?= $translate["options"]; ?></th>
                    </tr>
                </thead>
                <tbody>
                </tbody>
            </table>

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

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

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



<!-- Add / Edit Branch modal -->
<!-- <div id="enterprise-modal" class="modal" data-bs-keyboard="false" data-bs-backdrop="static" tabindex="-1"> -->
<div id="branch-modal" class="modal" tabindex="-1">
    <div class="modal-dialog modal-xl">
        <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="frmBranch" autocomplete="off" enctype="multipart/form-data" method="POST">

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

                <div class="modal-body">

                    <div class="row">

                        <input type="hidden" name="requested" value="admin">
                        <input type="hidden" name="pos_ent_id" id="pos_ent_id">
                        <input type="hidden" name="pos_id" id="pos_id">

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

                        <div class="col-lg-4 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["business_category"]; ?></label>
                            <select class="form-control form-control-lg select2" data-minimum-results-for-search="Infinity" name="pos_business_category" id="pos_business_category">
                                <option value="Restaurant" selected><?= $translate['restaurant'] ?></option>
                                <option value="Nightclub"><?= $translate['night_club'] ?></option>
                                <option value="Others"><?= $translate['others_sales_inventory'] ?></option>
                            </select>
                        </div>

                        <div class="col-lg-12 mt-3 mb-3 border-bottom text-center">
                            <label class="fs-base fw-bold pb-2 text-uppercase"><?= $translate["address_and_contact"]; ?></label>
                        </div>

                        <div class="col-lg-8 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["address"]; ?> <span class="text-danger">*</span></label>
                            <div class="input-group">
                                <span class="input-group-text"><i class="ph-map-pin"></i></span>
                                <input type="text" class="form-control form-control-lg" name="pos_address" id="pos_address" required autocomplete="off" placeholder="<?= $translate["address"]; ?>">
                            </div>
                        </div>

                        <div class=" col-lg-4 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["city"]; ?></label>
                            <input type="text" class="form-control form-control-lg" name="pos_city" id="pos_city" required autocomplete="off" placeholder="<?= $translate["city"]; ?>">
                        </div>

                        <div class=" col-lg-4 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["province_state"]; ?></label>
                            <input type="text" class="form-control form-control-lg" name="pos_state" id="pos_state" required autocomplete="off" placeholder="<?= $translate["province_state"]; ?>">
                        </div>

                        <div class=" col-lg-4 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["zip_code"]; ?></label>
                            <input type="text" class="form-control form-control-lg" name="pos_zip_code" id="pos_zip_code" required autocomplete="off" placeholder="<?= $translate["zip_code"]; ?>">
                        </div>

                        <div class=" col-lg-4 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["country"]; ?></label>
                            <select class="form-control form-control-lg select2" data-minimum-results-for-search="Infinity" name="pos_country" id="pos_country">
                                <?php

                                $sql = "SELECT country_code,country_name FROM tb_countries ORDER BY country_id ASC;";
                                $answer = executePDOFetchAll($sql, "");

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

                                ?>
                            </select>
                        </div>

                        <div class=" col-lg-4 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["timezone"]; ?></label>
                            <select class="form-control form-control-lg select2" data-minimum-results-for-search="Infinity" name="pos_time_zone" id="pos_time_zone">
                                <?php

                                $sql = "SELECT timezone_name FROM tb_timezones ORDER BY timezone_id ASC;";
                                $answer = executePDOFetchAll($sql, "");

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

                                ?>
                            </select>
                        </div>

                        <div class="col-lg-4 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["phone"]; ?> <span class="text-danger">*</span></label>
                            <div class="input-group">
                                <input type="tel" class="form-control form-control-lg intelli-phone" name="pos_phone" id="pos_phone" required autocomplete="off">
                            </div>
                        </div>

                        <div class="col-lg-4 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["phone"]; ?> 2</label>
                            <div class="input-group">
                                <input type="tel" class="form-control form-control-lg intelli-phone-2" name="pos_phone2" id="pos_phone2" required autocomplete="off">
                            </div>
                        </div>

                        <div class="col-lg-12 mt-3 mb-3 border-bottom text-center">
                            <label class="fs-base fw-bold pb-2 text-uppercase"><?= $translate["settings"]; ?></label>
                        </div>

                        <div class=" col-lg-4 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["defualt_currency"]; ?></label>
                            <select class="form-control form-control-lg select2" data-minimum-results-for-search="Infinity" name="pos_currency" id="pos_currency">
                                <?php

                                $sql = "SELECT currency_code,currency_name FROM tb_currencies ORDER BY currency_id ASC;";
                                $answer = executePDOFetchAll($sql, "");

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

                                ?>
                            </select>
                        </div>

                        <div class=" col-lg-4 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["branch_language"]; ?></label>
                            <select class="form-control form-control-lg select2" data-minimum-results-for-search="Infinity" name="pos_lang" id="pos_lang">
                                <option value="en" selected><?= $translate["english"]; ?></option>
                                <option value="es"><?= $translate["spanish"]; ?></option>
                                <option value="fr"><?= $translate["french"]; ?></option>
                            </select>
                        </div>

                        <div class="col-lg-4 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["usd_currency_change_rate"]; ?></label>
                            <div class="input-group">
                                <span class="input-group-text"><i class="ph-currency-dollar"></i></span>
                                <input type="number" step="0.01" class="form-control form-control-lg" name="pos_usd_exchange_rate" id="pos_usd_exchange_rate" value="1.00" min="0.01" required autocomplete="off" placeholder="0.00">
                            </div>
                        </div>

                        <div class="col-lg-4 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["tax_percent"]; ?></label>
                            <div class="input-group">
                                <span class="input-group-text"><i class="ph-percent"></i></span>
                                <input type="number" step="0.01" class="form-control form-control-lg" name="pos_tax" id="pos_tax" required autocomplete="off" value="0.00" placeholder="0.00">
                            </div>
                        </div>

                        <div class="col-lg-4 col-md-12 mb-3 divLegalTipping" style="display: none;">
                            <label class="form-label"><?= $translate["legal_tipping"]; ?></label>
                            <div class="input-group">
                                <span class="input-group-text"><i class="ph-percent"></i></span>
                                <input type="number" step="0.01" class="form-control form-control-lg" name="pos_legal_tipping" id="pos_legal_tipping" required autocomplete="off" value="0.00" placeholder="0.00">
                            </div>
                        </div>

                        <div class=" col-lg-12 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["footer_ticket_message"]; ?></label>
                            <input type="text" class="form-control form-control-lg" name="pos_ticket_footer" id="pos_ticket_footer" required autocomplete="off" placeholder="<?= $translate["footer_ticket_message"]; ?>">
                        </div>

                        <div class="col-lg-12 mt-3 mb-3 border-bottom text-center cashbackConfiguration">
                            <label class="fs-base fw-bold pb-2 text-uppercase"><?= $translate["cashback_configuration"]; ?></label>
                        </div>

                        <div class="col-lg-4 col-md-12 mb-3 cashbackConfiguration">
                            <label class="form-label"><?= $translate["cashback_percentage"]; ?></label>
                            <div class="input-group">
                                <span class="input-group-text"><i class="ph-percent"></i></span>
                                <input type="number" step="0.01" class="form-control form-control-lg" name="pos_cash_back_percentage" id="pos_cash_back_percentage" min="0" autocomplete="off" value="0.00" placeholder="0.00">
                            </div>
                        </div>

                        <div class="col-lg-4 col-md-12 mb-3 cashbackConfiguration">
                            <label class="form-label"><?= $translate["cash_back_availability"]; ?></label>
                            <input type="number" class="form-control form-control-lg" name="pos_cash_back_availability_days" id="pos_cash_back_availability_days" min="0" value="8" autocomplete=" off" placeholder="0">
                            <div class="form-text"><span class="text-danger fs-15px">*</span> <?= $translate["quantity_of_day"]; ?></div>
                        </div>

                        <div class="col-lg-4 col-md-12 mb-3 cashbackConfiguration">
                            <label class="form-label"><?= $translate["cash_back_expiration"]; ?></label>
                            <input type="number" class="form-control form-control-lg" name="pos_cash_back_expiration_days" id="pos_cash_back_expiration_days" min="1" value="180" autocomplete="off" placeholder="180">
                            <div class="form-text"><span class="text-danger fs-15px">*</span> <?= $translate["quantity_of_day"]; ?></div>
                        </div>

                    </div>

                </div>
            </form>
            <!-- style="display: none;" -->
            <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 Branch modal -->

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