<div class="rounded-2xl border border-slate-200 bg-white shadow-sm dark:border-slate-700 dark:bg-slate-900">

    <div class="p-5">
        <div class="overflow-x-auto rounded-xl border border-slate-200 dark:border-slate-700">
            <table class="DataTables min-w-full divide-y divide-slate-200 text-sm dark:divide-slate-700" id="DataTables" width="100%">
                <thead class="bg-slate-50 text-slate-600 dark:bg-slate-800 dark:text-slate-300">
                    <tr>
                        <th class="px-4 py-3 text-left font-semibold"><?= lang('invoice') ?></th>
                        <th class="px-4 py-3 text-left font-semibold"><?= lang('amount') . ' ' . ('credited') ?></th>
                        <th class="px-4 py-3 text-left font-semibold"><?= lang('date') ?></th>
                        <th class="px-4 py-3 text-left font-semibold no-sort"><?= lang('action') ?></th>
                    </tr>
                </thead>
                <tbody class="divide-y divide-slate-100 dark:divide-slate-800">
                    <?php
                    if (!empty($all_credit_used)) {
                        foreach ($all_credit_used as $v_credit_used):
                            $invoice_info = get_row('tbl_invoices', array('invoices_id' => $v_credit_used->invoices_id));
                    ?>
                            <tr id="table_reminder_<?= $v_credit_used->credit_used_id ?>">
                                <td class="px-4 py-3">
                                    <a href="<?= base_url('admin/invoice/manage_invoice/invoice_details/' . $v_credit_used->invoices_id) ?>" class="text-primary hover:underline">
                                        <?= html_escape(!empty($invoice_info->reference_no) ? $invoice_info->reference_no : '-') ?>
                                    </a>
                                </td>
                                <td class="px-4 py-3 text-slate-700 dark:text-slate-200"><?= display_money($v_credit_used->amount, default_currency()) ?></td>
                                <td class="px-4 py-3 text-slate-700 dark:text-slate-200"><?= display_date($v_credit_used->date) ?></td>
                                <td class="px-4 py-3">
                                    <?=
                                    ajax_anchor(
                                        base_url("admin/credit_note/delete/delete_invoice_credited/" . $v_credit_used->invoices_id . '/' . $v_credit_used->credit_used_id),
                                        lang('delete'),
                                        array(
                                            "class" => "inline-flex items-center rounded-lg border border-rose-200 bg-rose-50 px-2.5 py-1 text-xs font-semibold text-rose-600 transition hover:bg-rose-100 dark:border-rose-900/60 dark:bg-rose-950/30 dark:text-rose-300 dark:hover:bg-rose-900/40",
                                            "title" => lang('delete'),
                                            "data-fade-out-on-success" => "#table_reminder_" . $v_credit_used->credit_used_id
                                        )
                                    );
                                    ?>
                                </td>
                            </tr>
                        <?php
                        endforeach;
                    } else {
                        ?>
                        <tr>
                            <td colspan="4" class="px-4 py-6 text-center text-sm text-slate-500 dark:text-slate-400"><?= lang('nothing_to_display') ?></td>
                        </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
