<!-- PRINT SALE TICKET MODAL -->
<div id="printSaleTicketModal" class="modal" data-bs-keyboard="false" data-bs-backdrop="static" tabindex="-1">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">

            <input type="hidden" id="sale_id_modal">

            <div class="modal-body" id="printDiv"></div>

            <div class="modal-footer">
                <div class="w-full btn-group gap-1">
                    <button type="button" class="btn btn-warning btnPrintTicket"><i class="ph-printer me-1"></i> <?= $translate["print"]; ?></button>
                    <button type="button" class="btn btn-success btnOpenSendToWhatsApp"><i class="ph-whatsapp-logo me-1"></i> WhatsApp</button>
                    <button type="button" class="btn btn-indigo btnOpenSendToEmail"><i class="ph-envelope me-1"></i> <?= $translate["email"]; ?></button>
                </div>
                <div class="w-full btn-group">
                    <button type="button" class="btn btn-light btnClosePrintTicket text-uppercase" data-bs-dismiss="modal"><i class="mi-close me-1"></i> <?= $translate["close"]; ?></button>
                </div>
            </div>

        </div>
    </div>
</div>
<!-- PRINT SALE TICKET MODAL -->

<!-- SEND WHATSAPP TEXT MESSAGE MODAL -->
<div id="modalTextMessageWhatsApp" class="modal" data-bs-keyboard="false" data-bs-backdrop="static" tabindex="-1">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">

            <div class="modal-header">
                <h5 class="modal-title">Send Text Message Via WhatsApp</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>

            <div class="modal-body">
                <div class="row">

                    <div class="col-lg-12 col-md-12 mb-2">
                        <label class="form-label fs-6"><?= $translate["whatsapp_number"]; ?> <span class="text-danger">*</span></label>
                        <div class="input-group">
                            <input type="tel" class="form-control form-control-xl intelli-ws-phone-message fs-5" id="ws_phone_number" value="+1 809-838-9538" required autocomplete="off">
                        </div>
                    </div>

                    <div class="col-lg-12 col-md-12 mb-2">
                        <label class="form-label fs-6">Text Message <span class="text-danger">*</span></label>
                        <div class="input-group">
                            <textarea id="ws_text_message" cols="50" rows="10" class="form-control form-control-xl fs-5">WhatsApp Text Message</textarea>
                        </div>
                    </div>

                </div>
            </div>

            <div class="modal-footer btn-group">
                <button type="button" class="btn btn-success btnSendWhatsAppTextMessage"><i class="ph-whatsapp-logo me-1"></i> Send Message</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>
<!-- SEND WHATSAPP TEXT MESSAGE MODAL -->

<!-- SEND WHATSAPP TICKET MODAL -->
<div id="sendWhatsAppTicketModal" class="modal" data-bs-keyboard="false" data-bs-backdrop="static" tabindex="-1">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">

            <div class="modal-header">
                <h5 class="modal-title"><?= $translate["send_ticket_via_whatsapp"]; ?></h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>

            <div class="modal-body">
                <div class="row">

                    <div id="output"></div>

                    <div class="col-lg-12 col-md-12 mb-2">
                        <label class="form-label fs-6"><?= $translate["whatsapp_number"]; ?> <span class="text-danger">*</span></label>
                        <div class="input-group">
                            <!-- <span class="input-group-text"><i class="ph-whatsapp-logo"></i></span> -->
                            <input type="tel" class="form-control form-control-xl intelli-ws-phone-media-message fs-5" id="cus_send_whatsapp" required autocomplete="off">
                        </div>
                    </div>

                </div>
            </div>

            <div class="modal-footer btn-group">
                <button type="button" class="btn btn-success btnSendTicketToWhatsApp"><i class="ph-whatsapp-logo me-1"></i> <?= $translate["send_ticket"]; ?></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>
<!-- SEND WHATSAPP TICKET MODAL -->


<!-- SEND EMAIL TICKET MODAL -->
<div id="sendEmailTicketModal" class="modal" data-bs-keyboard="false" data-bs-backdrop="static" tabindex="-1">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <input type="hidden" id="sale_id_modal">

            <div class="modal-header">
                <h5 class="modal-title"><?= $translate["send_ticket_via_email"]; ?></h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>

            <div class="modal-body">
                <div class="row">

                    <div class="col-lg-12 col-md-12 mb-1">
                        <label class="form-label"><?= $translate["customer_email"]; ?> <span class="text-danger">*</span></label>
                        <div class="input-group">
                            <span class="input-group-text"><i class="ph-envelope"></i></span>
                            <input type="email" class="form-control form-control-xl fs-6" id="cus_send_email" required autocomplete="off" placeholder="email@domain.com">
                        </div>
                    </div>

                </div>
            </div>

            <div class="modal-footer btn-group">
                <button type="button" class="btn btn-indigo btnSendTicketToEmail"><i class="ph-envelope me-1"></i> <?= $translate["send_ticket"]; ?></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>
<!-- SEND WHATSAPP TICKET MODAL -->


<!-- SALES RESET MODAL -->
<div class="modal fade" id="modalTransactionResetReason">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">

            <div class="modal-header">
                <h5 class="modal-title"><?= $translate["reason_for_cancellation"]; ?></h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>

            <div class="modal-body">

                <div class="col-lg-12 col-md-12 mb-3">
                    <label class="form-label fs-6"><?= $translate['please_write_the_reason_why_you_want_to_cancel_the_debt'] ?>:</label>
                    <textarea rows="4" class="form-control" id="txtResetReason"></textarea>
                </div>

            </div>

            <div class="modal-footer btn-group">
                <button type="button" class="btn btn-indigo text-uppercase btnConfirmResetReason"><i class="ph-check-circle me-1"></i> <?= $translate["confirm"]; ?></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>
<!-- SALES RESET MODAL -->


<!-- CANCEL MODAL -->
<div id="modalTransactionCancelReason" class="modal" tabindex="-1">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title"><?= $translate["reason_for_cancellation"]; ?></h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>

            <div class="modal-body">

                <div class="row">

                    <div class="col-lg-12 col-md-12 mb-3">
                        <label class="form-label fs-6"><?= $translate["please_write_the_reason_for_the_cancellation"]; ?></label>
                        <textarea rows="4" class="form-control" id="txtCancellationReason"></textarea>
                    </div>

                </div>

            </div>

            <div class="modal-footer btn-group">
                <button type="button" class="btn btn-indigo text-uppercase btnConfirmCancellationReason"><i class="ph-floppy-disk-back me-1"></i> <?= $translate["confirm"]; ?></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>
<!-- CANCEL MODAL -->


<!-- CUSTOMER MODAL -->
<div id="customer-modal" class="modal" tabindex="-1">
    <div class="modal-dialog">
        <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="frmAddEditCustomer" 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="cus_id" id="cus_id">
                        <input type="hidden" name="cus_ent_id" id="cus_ent_id">
                        <input type="hidden" name="cus_pos_id" id="cus_pos_id">

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

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

                        <div class="col-lg-6 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["email"]; ?></label>
                            <div class="input-group">
                                <span class="input-group-text"><i class="ph-envelope-simple"></i></span>
                                <input type="email" class="form-control form-control-lg" name="cus_email" id="cus_email" required autocomplete="off" placeholder="email@domain.com">
                            </div>
                        </div>

                        <div class="col-lg-6 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["fiscal_number"]; ?> (EIN,RNC,NIF)</label>
                            <div class="input-group">
                                <span class="input-group-text"><i class="ph-hash-straight"></i></span>
                                <input type="text" class="form-control form-control-lg" name="cus_fiscal_number" id="cus_fiscal_number" required autocomplete="off" placeholder="<?= $translate["fiscal_number"]; ?>">
                            </div>
                        </div>

                        <div class="col-lg-12 col-md-12 mb-3">
                            <label class="form-label"><?= $translate["address"]; ?></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="cus_address" id="cus_address" required autocomplete="off" placeholder="<?= $translate["address"]; ?>">
                            </div>
                        </div>

                    </div>

                </div>

            </form>

            <div class="modal-footer btn-group">
                <button type="button" class="btn btn-indigo text-uppercase btnSaveCustomer"><i class="ph-floppy-disk-back me-1"></i> <?= $translate["save"]; ?></button>
                <button type="button" class="btn btn-indigo text-uppercase btnEditCustomer"><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>
<!-- CUSTOMER MODAL -->


<!-- EXPENSE MODAL -->
<div id="expense-modal" class="modal" tabindex="-1">
    <div class="modal-dialog modal-lg">
        <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="frmAddEditExpenseData" 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="exp_id" id="exp_id">
                        <input type="hidden" name="exp_ent_id" id="exp_ent_id">
                        <input type="hidden" name="exp_pos_id" id="exp_pos_id">
                        <input type="hidden" name="exp_type" id="exp_type">
                        <input type="hidden" name="exp_total" id="exp_total">

                        <div class="mb-4 text-uppercase fw-medium notAllowed">
                            <div class="col-lg-12">
                                <div class="input-group">
                                    <span class="input-group-text form-control form-control-lg content-left"><?= $translate["branch"]; ?></span>
                                    <span class="input-group-text form-control form-control-lg pos_description content-right"></span>
                                </div>
                            </div>
                        </div>

                        <div class="col-lg-6 col-md-6 mb-3">
                            <label class="form-label"><?= $translate["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 dpDatePicker" name="exp_date" id="exp_date" value="<?= date('Y-m-d'); ?>">
                            </div>
                        </div>

                        <div class="col-lg-6 col-md-6 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 btnAddNewExpense"><i class="ph-plus me-1"></i> <?= $translate["add"]; ?></button>
                            </div>
                        </div>


                        <div class="col-lg-12 col-md-12 col-sm-12">
                            <div class="table-responsive">

                                <table class="table table-sm table-hover expenses-table-details">
                                    <thead class="table-warning">
                                        <tr class="text-uppercase fs-5">
                                            <th colspan="2"><span><?= $translate["total_expense"]; ?></span></th>
                                            <th><span id="span_exp_total">0.00</span></th>
                                        </tr>
                                        <tr class="table-dark text-uppercase">
                                            <td>x</td>
                                            <td><?= $translate["description"]; ?></td>
                                            <td><?= $translate["amount"]; ?></td>
                                        </tr>
                                    </thead>
                                    <tbody id="tbExpenseBody"></tbody>
                                </table>

                            </div>
                        </div>

                    </div>

                </div>

            </form>

            <div class="modal-footer">
                <button type="button" class="btn btn-indigo text-uppercase btnSaveExpense"><i class="ph-floppy-disk-back me-1"></i> <?= $translate["save"]; ?></button>
                <button type="button" class="btn btn-indigo text-uppercase btnEditExpense"><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>
<!-- EXPENSE MODAL -->

<script src="scripts/intl-phone-format.js?v=<?= md5(time()) ?>"></script>