<?php if (count($saldo) > 0): ?>
	<div class="wrap-table-alamat">
		<?php foreach ($saldo as $res): ?>
			<?php
			$status = ((int) $res->darike === 2) ? (int) $func->getSaldotarik($res->sambung, 'status') : 1;
			if ($status === 0) {
				$statusHtml = "<span style='color:#c0392b'>Sedang Diproses</span>";
			} elseif ($status === 1) {
				$statusHtml = "<span style='color:#27ae60'>Sukses</span>";
			} else {
				$statusHtml = "<span style='color:#c0392b'>Gagal</span>";
			}

			$jumlah     = $func->formUang($res->jumlah);
			$jenisKredit = ((int) $res->darike !== 2 && (int) $res->darike !== 3);
			$jumlahHtml = $jenisKredit
				? "<span style='color:#27ae60'>+ Rp {$jumlah}</span>"
				: "<span style='color:#c0392b'>- Rp {$jumlah}</span>";
			?>
			<ul class="list-items mb-2">
				<li>
					<div class="col-12">
						<div class="row">
							<div class="col-12">
								<span class="text-secondary small mb-2"><?= esc($func->ubahTgl('d M Y H:i', $res->tgl)) ?></span><br />
								<span><b class="text-danger font-weight-normal mb-0"><?= $jumlahHtml ?></b></span>
								<span class="text-success small"> - <i style="color:#f39c12"> <?= $statusHtml ?>
										(<?= esc($res->keterangan) ?>)
										<br />
										Saldo: <span class="font-weight-normal mb-0">Rp <?= esc($func->formUang($res->saldoakhir)) ?></span>
									</i> </span>
							</div>
						</div>
					</div>
				</li>
			</ul>
		<?php endforeach; ?>
	</div>
	<?= $func->createPagination($rows, $page, $perpage, 'historySaldo') ?>
<?php else: ?>
	<div class="w-full txt-center"><b>BELUM ADA TRANSAKSI</b></div>
<?php endif; ?>
