<?php $rows = !empty($posts) ? $posts : array(); ?>
<div class="sj-table-wrap">
	<table class="sj-table">
		<thead><tr><th class="sj-col-no">No.</th><th>Nomor Surat</th><th>Nomor Transaksi</th><th>Nama Pelanggan</th><th>Tanggal Kirim</th><th class="sj-col-action">Aksi</th></tr></thead>
		<tbody>
		<?php if (!empty($rows)) { $number = (int)$start + 1; foreach ($rows as $row) { ?>
			<tr>
				<td class="sj-col-no" data-label="No."><?=$number++;?></td>
				<td data-label="Nomor Surat"><span class="sj-number-chip"><i class="fa fa-file-text-o"></i> SJ-<?=str_pad((int)$row['id'], 4, '0', STR_PAD_LEFT);?></span></td>
				<td data-label="Nomor Transaksi"><strong><?=html_escape($row['id_transaksi']);?></strong></td>
				<td data-label="Nama Pelanggan"><span class="sj-customer"><i class="fa fa-user-o"></i><?=html_escape($row['nama_pelanggan']);?></span></td>
				<td data-label="Tanggal Kirim"><span class="sj-date"><i class="fa fa-calendar"></i><?=dtimes($row['tanggal'], false, false);?></span></td>
				<td class="sj-col-action" data-label="Aksi"><button type="button" class="sj-print-btn preview-surat-from-list" data-id="<?=encrypt_url($row['id_invoice']);?>" aria-label="Pratinjau surat jalan <?=html_escape($row['id_transaksi']);?>"><i class="fa fa-print"></i><span>Cetak Surat</span></button></td>
			</tr>
		<?php } } else { ?>
			<tr><td colspan="6"><div class="sj-empty"><span class="sj-empty-icon"><i class="fa fa-file-text-o"></i></span><strong>Data surat jalan belum ditemukan</strong><small>Coba ubah kata kunci atau rentang tanggal pencarian.</small></div></td></tr>
		<?php } ?>
		</tbody>
	</table>
</div>
<?php if (!empty($rows)) { ?>
<div class="sj-pagination-row"><div class="sj-result-info">Menampilkan <?=count($rows);?> data pada halaman ini</div><nav aria-label="Navigasi halaman surat jalan"><?=$this->ajax_pagination->create_links();?></nav></div>
<?php } ?>
