<!-- 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">
                    <h4 class="page-title fw-bold col-md-6 mb-0">Stripe <?= $translate["invoices"]; ?></h4>
                </div>
                <div class="col-xl-3 col-lg-3 col-md-6 btn-group">
                    <button class="btn btn-indigo text-uppercase btnAddInvoice" type="button"> <i class="ph-plus me-2"></i> <?= $translate["new_invoice"]; ?></button>
                </div>
            </div>

            <div class="row mt-3">

                <div class="col-lg-3 col-md-6 col-sm-12 mb-3">
                    <label class="form-label fw-medium text-uppercase"><?= $translate["enterprises"]; ?></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="listInvoiceDataToDatatable();" 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, "");

                            echo "<option value='All'>" . strtoupper($translate["all"]) . "</option>";

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

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

                <div class="col-xl-3 col-lg-4 col-md-6 col-sm-12 mb-2">
                    <label class="form-label fw-medium text-uppercase"><?= $translate["date_range"]; ?></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 daterange-predefined-this-month dateSelected" value="<?= date("Y-m-01"); ?> / <?= date("Y-m-d"); ?>" />
                    </div>
                </div>

                <div class="col-lg-3 col-md-6 col-sm-12 mb-3">
                    <label class="form-label fw-medium text-uppercase"><?= $translate["status"]; ?></label>
                    <div class="input-group">
                        <span class="input-group-text"><i class="ph ph-list-checks"></i></span>
                        <select class="form-control form-control-lg select2 searchStatus" onchange="listInvoiceDataToDatatable();" data-width="1%">
                            <option value="All" selected><?= $translate["all"]; ?></option>
                            <option value="paid"><?= $translate["paid"]; ?></option>
                            <option value="open"><?= $translate["open"]; ?></option>
                            <option value="overdue"><?= $translate["overdue"]; ?></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" onclick="listInvoiceDataToDatatable();"><i class="ph-magnifying-glass me-1"></i> <?= $translate["search"]; ?></button>
                    </div>
                </div>

            </div>

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


        <!-- Content area -->
        <!-- <div class="content"> -->

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

            <table class="table table-sm table-hover stripe-invoices-table">
                <thead>
                    <tr class="table-dark text-uppercase">
                        <th>#</th>
                        <th>Invoice ID</th>
                        <th>Invoice Date</th>
                        <th>Enterprise Name</th>
                        <th>Customer Email</th>
                        <th>Customer Name</th>
                        <th>Amount Due</th>
                        <th>Amount Paid</th>
                        <th>Status</th>
                        <th>Invoice URL</th>
                    </tr>
                </thead>
                <tfoot>
                    <tr class="table-dark text-uppercase fw-bold">
                        <td>__</td>
                        <td>__</td>
                        <td>__</td>
                        <td>__</td>
                        <td>__</td>
                        <td>__</td>
                        <td><span id="invoiceTotalDue">0.00</span></td>
                        <td><span id="invoiceTotalPaid">0.00</span></td>
                        <td>__</td>
                        <td>__</td>
                </tfoot>
            </table>

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


        <!-- </div> -->
        <!-- /content area -->

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

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

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