<div class="d-flex justify-content-between align-items-center mb-3">
    <h5 class="mb-0"><?= lang('adv_finance.installment_templates') ?></h5>
    <a href="/advanced-finance/installment-templates/create" class="btn btn-primary btn-sm"><i class="fas fa-plus me-1"></i><?= lang('common.create') ?></a>
</div>
<div class="card">
    <div class="card-body">
        <table id="template-table" class="table table-striped w-100"
               data-url="/advanced-finance/installment-templates/datatable"
               data-columns='[
                   {"data":"template_code","title":"Code"},
                   {"data":"name_en","title":"Name (EN)"},
                   {"data":"name_ar","title":"Name (AR)"},
                   {"data":"number_of_installments","title":"# Installments"},
                   {"data":"frequency","title":"Frequency"},
                   {"data":"down_payment_pct","title":"Down Payment %"},
                   {"data":"is_active","title":"Status","orderable":false},
                   {"data":"id","title":"Actions","orderable":false,"searchable":false}
               ]'>
            <thead><tr><th>Code</th><th>Name (EN)</th><th>Name (AR)</th><th># Inst.</th><th>Freq.</th><th>Down %</th><th>Status</th><th>Actions</th></tr></thead>
        </table>
    </div>
</div>
<?php $__view->push('scripts') ?>
<script>
document.addEventListener('DOMContentLoaded', function() {
    DataTableHelper.init('template-table', {
        columnDefs: [{
            targets: -1,
            render: function(data) {
                return '<a href="/advanced-finance/installment-templates/' + data + '/edit" class="btn btn-sm btn-outline-warning"><i class="fas fa-edit"></i></a>';
            }
        }]
    });
});
</script>
<?php $__view->endPush() ?>