Penambahn P1 Dev
This commit is contained in:
@@ -123,15 +123,15 @@
|
||||
|
||||
<!-- Tabel Data Pagu -->
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered w-100" id="paguTable">
|
||||
<table class="table table-bordered w-100 dt-styled" id="paguTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Unit Kerja</th>
|
||||
<th>Tahun</th>
|
||||
<th>Pagu Smt 1</th>
|
||||
<th>Pagu Smt 2</th>
|
||||
<th class="text-center">Tahun</th>
|
||||
<th class="text-center">Pagu Smt 1</th>
|
||||
<th class="text-center">Pagu Smt 2</th>
|
||||
@if($canUbah || $canHapus)
|
||||
<th>Aksi</th>
|
||||
<th class="text-center">Aksi</th>
|
||||
@endif
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -220,6 +220,24 @@
|
||||
const hideJumlahCards = {{ $hideJumlahCards ? 'true' : 'false' }};
|
||||
const currentYear = '{{ date("Y") }}';
|
||||
|
||||
function renderRupiah(data) {
|
||||
if (data === '?') {
|
||||
return '<div class="text-center font-monospace">?</div>';
|
||||
}
|
||||
if (!data) {
|
||||
return '<div class="d-flex justify-content-between gap-1 nominal-cell"><span>Rp.</span><span>0</span></div>';
|
||||
}
|
||||
var str = String(data).trim();
|
||||
if (str.startsWith('Rp.') || str.startsWith('Rp')) {
|
||||
var parts = str.split(' ');
|
||||
var number = parts.slice(1).join(' ');
|
||||
return '<div class="d-flex justify-content-between gap-1 nominal-cell"><span>Rp.</span><span>' + number + '</span></div>';
|
||||
}
|
||||
var num = Number(str);
|
||||
var formatted = isNaN(num) ? str : num.toLocaleString('id-ID');
|
||||
return '<div class="d-flex justify-content-between gap-1 nominal-cell"><span>Rp.</span><span>' + formatted + '</span></div>';
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize Select2 for filter periode, default to current year
|
||||
$('#periode').select2({
|
||||
@@ -303,9 +321,23 @@
|
||||
// Define columns
|
||||
var columns = [
|
||||
{ data: 'unit_kerja_nama', name: 'unit_kerja_nama' },
|
||||
{ data: 'tahun', name: 'tahun', className: 'text-center' },
|
||||
{ data: 'pagu_smt1', name: 'pagu_smt1', className: 'text-center' },
|
||||
{ data: 'pagu_smt2', name: 'pagu_smt2', className: 'text-center' }
|
||||
{ data: 'tahun', name: 'tahun', className: 'text-center', width: '10%' },
|
||||
{
|
||||
data: 'pagu_smt1',
|
||||
name: 'pagu_smt1',
|
||||
width: '18%',
|
||||
render: function(data) {
|
||||
return renderRupiah(data);
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'pagu_smt2',
|
||||
name: 'pagu_smt2',
|
||||
width: '18%',
|
||||
render: function(data) {
|
||||
return renderRupiah(data);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
if (showAksi) {
|
||||
|
||||
Reference in New Issue
Block a user