Files
2026-10-20 13:16:38 +09:00

66 lines
3.1 KiB
PHP

<?php
defined('SERUBI_ADMIN') || exit;
$tenors = $params['tenors'];
if ($draft !== null) {
$bands = array_values($draft['bands'] ?? []);
$rates = array_values($draft['rates'] ?? []);
} else {
$bands = array_map('fmt_idr', $params['depositoBands']);
$rates = [];
foreach ($params['depositoBands'] as $i => $_) {
foreach ($tenors as $t) {
$rates[$i][$t] = fmt_pct($params['depositoRates'][$t][$i]['rate'] ?? 0);
}
}
}
$last = count($bands) - 1;
?>
<form method="post" id="paramForm" data-kind="deposito" novalidate>
<?= csrf_field() ?>
<input type="hidden" name="action" value="save_deposito">
<p class="hint-block"><?= icon('info') ?><span>Nominal di bawah Rp<?= e(fmt_idr($params['settings']['deposito_min'])) ?> tidak mendapat bunga deposito (atur di Parameter bank). Rate dalam persen per tahun.</span></p>
<section class="panel">
<header class="panel-head"><h2>Tabel rate deposito</h2><p>Baris = kelompok nominal, kolom = jangka waktu.</p></header>
<?= field_error($errors, 'deposito') ?>
<div class="matrix-scroll" tabindex="0" role="region" aria-label="Tabel rate deposito, dapat digeser">
<table class="matrix" id="depoMatrix">
<thead>
<tr>
<th scope="col">Nominal</th>
<?php foreach ($tenors as $t): ?><th scope="col"><?= (int)$t ?> bln</th><?php endforeach; ?>
<th scope="col"><span class="visually-hidden">Hapus</span></th>
</tr>
</thead>
<tbody>
<?php foreach ($bands as $i => $max): ?>
<tr class="tier-row">
<th scope="row">
<div class="tier-range">
<span class="tier-from"></span>
<div class="input-affix is-idr tier-max-wrap">
<span>Rp</span>
<input name="bands[<?= $i ?>]" class="t-max" value="<?= e($i === $last ? '' : $max) ?>" inputmode="numeric" autocomplete="off" aria-label="Sampai dengan nominal, baris <?= $i + 1 ?>">
</div>
</div>
</th>
<?php foreach ($tenors as $t): ?>
<td data-label="<?= (int)$t ?> bulan">
<div class="input-affix tier-rate">
<input name="rates[<?= $i ?>][<?= (int)$t ?>]" data-tenor="<?= (int)$t ?>" class="t-rate" value="<?= e($rates[$i][$t] ?? '') ?>" inputmode="decimal" autocomplete="off" aria-label="Rate <?= (int)$t ?> bulan, baris <?= $i + 1 ?>">
<span>%</span>
</div>
</td>
<?php endforeach; ?>
<td class="tier-del-cell"><button type="button" class="icon-btn tier-del" aria-label="Hapus baris <?= $i + 1 ?>"><?= icon('trash') ?></button></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<button type="button" class="btn btn-ghost tier-add" data-target="depoMatrix"><?= icon('plus') ?><span>Tambah kelompok nominal</span></button>
</section>
<div class="form-actions">
<button class="btn btn-primary" type="submit"><?= icon('save') ?><span>Simpan rate deposito</span></button>
</div>
</form>