Perbaikan Data keseluruhan dan Total Pajak dan Total Netto
This commit is contained in:
@@ -56,6 +56,9 @@
|
||||
$actionButtons = '<button type="button" class="btn btn-sm btn-outline-success me-2" id="btn-export">
|
||||
<i class="uil-file-download-alt"></i> Export
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-primary me-2" id="btnPerbaruiData">
|
||||
<i class="mdi mdi-database-refresh-outline"></i> Perbarui Data
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" id="btnRefresh">
|
||||
<i class="uil-refresh"></i>
|
||||
Refresh
|
||||
@@ -137,6 +140,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="warmCacheModal" tabindex="-1" aria-hidden="true" data-bs-backdrop="static"
|
||||
data-bs-keyboard="false">
|
||||
<div class="modal-dialog modal-sm modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body text-center p-4">
|
||||
<h6 class="mb-1">Memperbarui Data Keseluruhan</h6>
|
||||
<p class="text-muted small mb-3">Menyusun ulang rekap P1, P2, THR, R13, dan Publikasi…</p>
|
||||
<div class="progress" style="height: 14px;">
|
||||
<div id="warm-cache-bar"
|
||||
class="progress-bar progress-bar-striped progress-bar-animated bg-primary" role="progressbar"
|
||||
style="width: 0%"></div>
|
||||
</div>
|
||||
<div id="warm-cache-pct" class="fw-semibold mt-2">0%</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('js')
|
||||
@@ -164,6 +185,14 @@
|
||||
'"></i> ' + jenis.toUpperCase() + '</small>';
|
||||
}
|
||||
|
||||
// Penanda pegawai yang P2-nya diambil dari snapshot JSON (CPNS), warna tosca.
|
||||
function renderCpnsTag(sumber) {
|
||||
if (sumber !== 'json') {
|
||||
return '';
|
||||
}
|
||||
return ' <small class="d-inline-block fw-bold" title="P2 dari snapshot JSON (belum tersimpan di DB)" style="padding: 1px 18px 1px 6px; color: #0fb5a5; background: linear-gradient(to right, rgba(20, 184, 166, 0.25), rgba(20, 184, 166, 0)); clip-path: polygon(0 0, 100% 0, calc(100% - 20px) 100%, 0 100%);"><i class="uil-file-check-alt"></i> CPNS</small>';
|
||||
}
|
||||
|
||||
var table = $('#keseluruhan-table').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
@@ -191,17 +220,17 @@
|
||||
return '<div>' +
|
||||
'<div class="fw-semibold">' + nama + '</div>' +
|
||||
'<div class="text-muted small font-monospace">' + nip + '</div>' +
|
||||
'<div class="mt-1">' + renderJenisPegawaiTag(row.jenis_pegawai) + '</div>' +
|
||||
'<div class="mt-1">' + renderJenisPegawaiTag(row.jenis_pegawai) + renderCpnsTag(row.p2_sumber) + '</div>' +
|
||||
'</div>';
|
||||
}
|
||||
},
|
||||
{ data: 'nama_unit', name: 'nama_unit' },
|
||||
{ data: 'jumlah_p1', name: 'jumlah_p1', className: 'text-end font-monospace', orderable: false },
|
||||
{ data: 'jumlah_p2', name: 'jumlah_p2', className: 'text-end font-monospace', orderable: false },
|
||||
{ data: 'jumlah_thr', name: 'jumlah_thr', className: 'text-end font-monospace', orderable: false },
|
||||
{ data: 'jumlah_r13', name: 'jumlah_r13', className: 'text-end font-monospace', orderable: false },
|
||||
{ data: 'jumlah_publikasi', name: 'jumlah_publikasi', className: 'text-end font-monospace', orderable: false },
|
||||
{ data: 'total', name: 'total', className: 'text-end font-monospace fw-bold', orderable: false }
|
||||
{ data: 'jumlah_p1', name: 'jumlah_p1', className: 'text-end font-monospace' },
|
||||
{ data: 'jumlah_p2', name: 'jumlah_p2', className: 'text-end font-monospace' },
|
||||
{ data: 'jumlah_thr', name: 'jumlah_thr', className: 'text-end font-monospace' },
|
||||
{ data: 'jumlah_r13', name: 'jumlah_r13', className: 'text-end font-monospace' },
|
||||
{ data: 'jumlah_publikasi', name: 'jumlah_publikasi', className: 'text-end font-monospace' },
|
||||
{ data: 'total', name: 'total', className: 'text-end font-monospace fw-bold' }
|
||||
],
|
||||
order: [],
|
||||
language: {
|
||||
@@ -237,6 +266,51 @@
|
||||
}, false);
|
||||
});
|
||||
|
||||
$('#btnPerbaruiData').on('click', function() {
|
||||
var button = $(this);
|
||||
var modal = bootstrap.Modal.getOrCreateInstance(document.getElementById('warmCacheModal'));
|
||||
var $bar = $('#warm-cache-bar');
|
||||
var $pct = $('#warm-cache-pct');
|
||||
var pct = 0;
|
||||
|
||||
function setPct(v) {
|
||||
pct = v;
|
||||
$bar.css('width', v + '%');
|
||||
$pct.text(v + '%');
|
||||
}
|
||||
|
||||
setPct(0);
|
||||
button.prop('disabled', true);
|
||||
modal.show();
|
||||
|
||||
// Progres merangkak sampai ~90% selama menunggu server.
|
||||
var timer = setInterval(function() {
|
||||
if (pct < 90) {
|
||||
setPct(Math.min(90, pct + Math.max(1, Math.round((90 - pct) / 12))));
|
||||
}
|
||||
}, 350);
|
||||
|
||||
$.ajax({
|
||||
url: "{{ route('remunerasi.keseluruhan.refresh') }}",
|
||||
method: 'POST',
|
||||
data: { tahun: $('#filter-tahun').val() }
|
||||
}).done(function(res) {
|
||||
clearInterval(timer);
|
||||
setPct(100);
|
||||
setTimeout(function() {
|
||||
modal.hide();
|
||||
table.ajax.reload(null, false);
|
||||
showSuccess('Berhasil!', 'Data keseluruhan diperbarui - ' + (res.rows || 0) + ' pegawai (' + (res.seconds || 0) + ' detik).');
|
||||
}, 450);
|
||||
}).fail(function(xhr) {
|
||||
clearInterval(timer);
|
||||
modal.hide();
|
||||
showError('Gagal', (xhr.responseJSON && xhr.responseJSON.message) || 'Terjadi kesalahan saat memperbarui data.');
|
||||
}).always(function() {
|
||||
button.prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#btn-export').on('click', function() {
|
||||
var button = $(this);
|
||||
var originalHtml = button.html();
|
||||
|
||||
Reference in New Issue
Block a user