<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>

<?= message_box('success'); ?>
<?= message_box('error'); ?>

<?php
$created = can_action('151', 'created');
$edited = can_action('151', 'edited');
$deleted = can_action('151', 'deleted');
?>

<div class="space-y-4">
	<div class="rounded-2xl border border-border bg-card shadow-sm">
		<div class="table-responsive p-4">
			<table class="table table-striped DataTables" id="DataTables" width="100%">
				<thead>
					<tr>
						<th><?= lang('name'); ?></th>
						<th class="col-sm-1"><?= lang('mobile'); ?></th>
						<th class="col-sm-1"><?= lang('phone'); ?></th>
						<th class="col-sm-2"><?= lang('email'); ?></th>
						<th class="col-sm-2"><?= lang('address'); ?></th>
						<th class="col-sm-2"><?= lang('vat_number'); ?></th>
						<?php $show_custom_fields = custom_form_table(19, null);
						if (!empty($show_custom_fields)) {
							foreach ($show_custom_fields as $c_label => $v_fields) {
								if (!empty($c_label)) {
						?>
									<th><?= $c_label; ?></th>
						<?php }
							}
						}
						?>
						<?php if (!empty($edited) || !empty($deleted)) { ?>
							<th class="col-options no-sort col-sm-1 text-right"><?= lang('action'); ?></th>
						<?php } ?>
					</tr>
				</thead>
				<tbody></tbody>
			</table>
		</div>
	</div>
</div>

<script type="text/javascript">
	list = base_url + "admin/supplier/supplierList";
	window.erpDatatablePreload = window.erpDatatablePreload || {};
	window.erpDatatablePreload.DataTables = window.erpDatatablePreload.DataTables || {};
	<?php if (!empty($datatable_preload)) { ?>
	window.erpDatatablePreload.DataTables["list"] = <?= json_encode($datatable_preload, JSON_UNESCAPED_SLASHES) ?>;
	<?php } ?>
</script>
