<h4 class="mb-4"><i class="fas fa-hashtag me-2"></i><?= lang('admin.form_numbers') ?></h4>
<div class="card"><div class="card-body">
    <table id="fn-table" class="table table-striped w-100" data-url="/admin/form-numbers/datatable"
           data-columns='[{"data":"name"},{"data":"type"},{"data":"range"},{"data":"current"},{"data":"issued"},{"data":"remaining"},{"data":"active"},{"data":"actions","orderable":false}]'>
        <thead><tr><th>Pool Name</th><th>Type</th><th>Range</th><th>Current</th><th>Issued</th><th>Remaining</th><th>Status</th><th>Actions</th></tr></thead>
    </table>
</div></div>
<?php $__view->push('scripts') ?>
<script>
DataTableHelper.init('fn-table',{paging:false});
$(document).on('click','.btn-issue-form',function(){if(!confirm('Issue next form number?'))return;
    $.post('/admin/form-numbers/'+$(this).data('id')+'/issue',{_token:'<?= csrf_token() ?>'},function(r){if(r.success){FormHelper.showToast('success','Issued: '+r.form_number);DataTableHelper.reload('fn-table');}else FormHelper.showToast('error',r.message);},'json');});
</script>
<?php $__view->endPush() ?>