Files
verifikator/resources/views/perhitungan/remunerasi/proyeksi/index.blade.php
T
2026-08-07 10:47:09 +07:00

198 lines
8.4 KiB
PHP

@extends('layouts.main')
@section('breadcrumb')
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript:void(0);">Perhitungan</a></li>
<li class="breadcrumb-item"><a href="javascript:void(0);">Remunerasi</a></li>
<li class="breadcrumb-item active" aria-current="page">{{ $title }}</li>
</ol>
@endsection
@section('css')
<style>
#proyeksi-table tbody td.unit-col {
max-width: 180px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
@endsection
@section('content')
<div class="row">
<div class="col-12">
<div class="card border">
<div class="card-body">
@include('components.datatable-header', [
'title' => 'Daftar Proyeksi Remunerasi',
'description' =>
'Berikut adalah proyeksi perhitungan remunerasi untuk periode ' .
$namaRange .
' ' .
$tahun,
])
<!-- Tabel Proyeksi -->
<div class="table-responsive">
<table class="table table-striped table-bordered w-100" id="proyeksi-table">
<thead>
<tr>
<th class="text-center">No</th>
<th class="text-center">Unit Kerja</th>
<th class="text-center">Total P1</th>
<th class="text-center">Total P2</th>
<th class="text-center">Total THR</th>
<th class="text-center">Total R13</th>
<th class="text-center">Total Publikasi</th>
<th class="text-center">Total Terpakai</th>
<th class="text-center">Total Remunerasi Periode Lalu</th>
<th class="text-center">Perkiraan Publikasi Semester Ini</th>
<th class="text-center">Total Tersisa</th>
</tr>
</thead>
<tfoot>
<tr>
<th colspan="2" class="text-center fw-bold">GRAND TOTAL</th>
<th class="fw-bold" id="grand-total-p1">-</th>
<th class="fw-bold" id="grand-total-p2">-</th>
<th class="fw-bold" id="grand-total-thr">-</th>
<th class="fw-bold" id="grand-total-r13">-</th>
<th class="fw-bold" id="grand-total-publikasi">-</th>
<th class="fw-bold" id="grand-total-remunerasi">-</th>
<th class="fw-bold" id="grand-total-periode-lalu">-</th>
<th class="fw-bold" id="grand-total-perkiraan-publikasi">-</th>
<th class="fw-bold" id="grand-total-tersisa">-</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('js')
<script>
let table;
function renderRupiah(data) {
const val = (data === null || data === undefined || data === '') ? '0,00' : data;
return '<div class="d-flex justify-content-between gap-1 nominal-cell"><span>Rp.</span><span>' + val + '</span></div>';
}
function formatRupiah(number) {
const formatted = new Intl.NumberFormat('id-ID', {
minimumFractionDigits: 2,
maximumFractionDigits: 2
}).format(number);
return '<div class="d-flex justify-content-between gap-1 nominal-cell"><span>Rp.</span><span>' + formatted + '</span></div>';
}
$(document).ready(function() {
initDataTable();
});
function initDataTable() {
table = $('#proyeksi-table').DataTable({
processing: true,
serverSide: true,
ajax: {
url: '{{ route('remunerasi.proyeksi.data') }}',
dataSrc: function(json) {
updateGrandTotals(json);
return json.data;
}
},
columns: [{
data: 'DT_RowIndex',
name: 'DT_RowIndex',
orderable: false,
searchable: false,
className: 'text-center'
},
{
data: 'unit_kerja',
name: 'unit_kerja',
className: 'unit-col',
render: function(data) {
const escaped = (data || '').replace(/"/g, '&quot;');
return '<span title="' + escaped + '">' + (data || '-') + '</span>';
}
},
{
data: 'total_p1_formatted',
name: 'total_p1',
className: 'text-end',
render: renderRupiah
},
{
data: 'total_p2_formatted',
name: 'total_p2',
className: 'text-end',
render: renderRupiah
},
{
data: 'total_thr_formatted',
name: 'total_thr',
className: 'text-end',
render: renderRupiah
},
{
data: 'total_r13_formatted',
name: 'total_r13',
className: 'text-end',
render: renderRupiah
},
{
data: 'total_publikasi_formatted',
name: 'total_publikasi',
className: 'text-end',
render: renderRupiah
},
{
data: 'total_remunerasi_formatted',
name: 'total_remunerasi',
className: 'text-end fw-bold',
render: renderRupiah
},
{
data: 'total_periode_lalu_formatted',
name: 'total_periode_lalu',
className: 'text-end',
render: renderRupiah
},
{
data: 'perkiraan_publikasi_formatted',
name: 'perkiraan_publikasi',
className: 'text-end',
render: renderRupiah
},
{
data: 'total_tersisa_formatted',
name: 'total_tersisa',
className: 'text-end fw-bold',
render: renderRupiah
}
],
language: {
processing: "Memuat data...",
}
});
}
function updateGrandTotals(json) {
$('#grand-total-p1').html(formatRupiah(json.grandTotalP1));
$('#grand-total-p2').html(formatRupiah(json.grandTotalP2));
$('#grand-total-thr').html(formatRupiah(json.grandTotalThr));
$('#grand-total-r13').html(formatRupiah(json.grandTotalR13));
$('#grand-total-publikasi').html(formatRupiah(json.grandTotalPublikasi));
$('#grand-total-remunerasi').html(formatRupiah(json.grandTotalRemunerasi));
$('#grand-total-periode-lalu').html(formatRupiah(json.grandTotalPeriodeLalu));
$('#grand-total-perkiraan-publikasi').html(formatRupiah(json.grandTotalPerkiraanPublikasi));
$('#grand-total-tersisa').html(formatRupiah(json.grandTotalTersisa));
}
</script>
@endsection