<div class="supplier-table-wrap">
	<table class="table supplier-table" id="jsonuser">
		<thead>
			<tr>
				<th>No.</th>
				<th>Nama Perusahaan</th>
				<th>Atas Nama</th>
				<th>Jabatan</th>
				<th>No. HP</th>
				<th>Jenis Usaha</th>
				<th>Tgl. Register</th>
				<th class="text-center">Aksi</th>
			</tr>
		</thead>
		<tbody>
			<?php if(!empty($result)){
				$no=$this->uri->segment(3)+1;
				foreach($result as $row){
				?>
				<tr>
					<td data-label="No."><?php echo $no; ?></td>
					<td data-label="Nama Perusahaan">
						<a href="#" class="supplier-link edit_supplier" data-id="<?php echo encrypt($row["id_supplier"]); ?>">
							<?php echo !empty($row["nama_perusahaan"]) ? $row["nama_perusahaan"] : '-'; ?>
						</a>
					</td>
					<td data-label="Atas Nama"><?=!empty($row["pemilik"]) ? $row["pemilik"] : '<span class="supplier-muted">-</span>';?></td>
					<td data-label="Jabatan"><?=!empty($row["jabatan"]) ? $row["jabatan"] : '<span class="supplier-muted">-</span>';?></td>
					<td data-label="No. HP"><?=!empty($row["telp"]) ? $row["telp"] : '<span class="supplier-muted">-</span>';?></td>
					<td data-label="Jenis Usaha"><?=!empty($row["jenis_usaha"]) ? $row["jenis_usaha"] : '<span class="supplier-muted">-</span>';?></td>
					<td data-label="Tgl. Register"><?=dtimes($row["tgl_terdaftar"],false,false);?></td>
					<td class="supplier-actions-cell" data-label="Aksi">
						<div class="supplier-actions">
							<a href="<?=base_url('supplier/detail/').encrypt_url($row["id_supplier"]); ?>" class="supplier-action supplier-action-detail">
								<i class="fa fa-eye"></i> Detail
							</a>
							<button class="supplier-action supplier-action-edit edit_supplier" data-id="<?php echo encrypt($row["id_supplier"]); ?>">
								<i class="fa fa-edit"></i> Edit
							</button>
							<button class="supplier-action supplier-action-delete" data-id="<?=$row["id_supplier"]; ?>" data-toggle="modal" data-target="#confirm-delete" href="#">
								<i class="fa fa-trash"></i> Hapus
							</button>
						</div>
					</td>
				</tr>
			<?php $no++;} }else{ ?>
				<tr>
					<td colspan="8" class="supplier-empty">Data belum ada</td>
				</tr>
			<?php } ?>
		</tbody>
	</table>

	<div class="supplier-mobile-list">
		<?php if(!empty($result)){
			$no=$this->uri->segment(3)+1;
			foreach($result as $row){
			?>
			<div class="supplier-mobile-card">
				<div class="supplier-mobile-head">
					<div class="supplier-mobile-badge"><?php echo $no; ?></div>
					<div class="flex-grow-1 min-w-0">
						<a href="<?=base_url('supplier/detail/').encrypt_url($row["id_supplier"]); ?>" class="supplier-mobile-title">
							<?php echo !empty($row["nama_perusahaan"]) ? $row["nama_perusahaan"] : '-'; ?>
						</a>
					</div>
				</div>

				<div class="supplier-mobile-divider"></div>

				<div class="supplier-mobile-fields">
					<div class="supplier-mobile-field">
						<div class="supplier-mobile-label"><i class="fa fa-users"></i> Atas Nama</div>
						<div class="supplier-mobile-value"><?=!empty($row["pemilik"]) ? $row["pemilik"] : '<span class="supplier-muted">-</span>';?></div>
					</div>
					<div class="supplier-mobile-field">
						<div class="supplier-mobile-label"><i class="fa fa-users"></i> Jabatan</div>
						<div class="supplier-mobile-value"><?=!empty($row["jabatan"]) ? $row["jabatan"] : '<span class="supplier-muted">-</span>';?></div>
					</div>
					<div class="supplier-mobile-field">
						<div class="supplier-mobile-label"><i class="fa fa-phone-square"></i> No. HP</div>
						<div class="supplier-mobile-value"><?=!empty($row["telp"]) ? $row["telp"] : '<span class="supplier-muted">-</span>';?></div>
					</div>
					<div class="supplier-mobile-field">
						<div class="supplier-mobile-label"><i class="fa fa-home"></i> Jenis Usaha</div>
						<div class="supplier-mobile-value"><?=!empty($row["jenis_usaha"]) ? $row["jenis_usaha"] : '<span class="supplier-muted">-</span>';?></div>
					</div>
					<div class="supplier-mobile-field">
						<div class="supplier-mobile-label"><i class="fa fa-calendar"></i> Tgl. Register</div>
						<div class="supplier-mobile-value"><?=dtimes($row["tgl_terdaftar"],false,false);?></div>
					</div>
				</div>

				<div class="supplier-mobile-actions">
					<a href="<?=base_url('supplier/detail/').encrypt_url($row["id_supplier"]); ?>" class="supplier-mobile-action supplier-mobile-action-detail">
						<i class="fa fa-eye"></i> Detail
					</a>
					<button class="supplier-mobile-action supplier-mobile-action-edit edit_supplier" data-id="<?php echo encrypt($row["id_supplier"]); ?>">
						<i class="fa fa-edit"></i> Edit
					</button>
					<button class="supplier-mobile-action supplier-mobile-action-delete" data-id="<?=$row["id_supplier"]; ?>" data-toggle="modal" data-target="#confirm-delete" href="#">
						<i class="fa fa-trash"></i> Hapus
					</button>
				</div>
			</div>
		<?php $no++;} }else{ ?>
			<div class="supplier-mobile-empty">Data belum ada</div>
		<?php } ?>
	</div>

	<div class="supplier-mobile-count">
		<i class="fa fa-file-text"></i>
		<span>Menampilkan: <?= !empty($result) ? count($result) : 0; ?></span>
	</div>

	<nav aria-label="Page navigation" class="supplier-pagination">
		<?php
			echo $this->ajax_pagination->create_links();
		?>
	</nav>
</div>
