Penambahan Menu Simulasi Jabatan menu Lainnya

This commit is contained in:
Ariyutta
2026-09-02 17:13:25 +07:00
parent c36057d0b6
commit 11e58d33a1
8 changed files with 2225 additions and 9 deletions
+4
View File
@@ -26,6 +26,10 @@
<td class="text-center">2</td>
<td><a href="{{ route('lainnya.mode-perhitungan-remunerasi.index') }}">Mode Perhitungan Remunerasi</a></td>
</tr>
<tr>
<td class="text-center">3</td>
<td><a href="{{ route('lainnya.simulasi-jabatan.index') }}">Simulasi Jabatan</a></td>
</tr>
</tbody>
</table>
</div>
@@ -0,0 +1,381 @@
@extends('layouts.main')
@section('css')
<style>
#simulasi-jabatan-table {
table-layout: fixed;
}
#simulasi-jabatan-table tbody td.pegawai-col .text-truncate {
max-width: 220px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
#simulasi-jabatan-table tbody td.unit-kerja-col {
width: 30%;
max-width: 30%;
}
#simulasi-jabatan-table tbody td.unit-kerja-col .text-truncate {
display: block;
width: 100%;
max-width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
#simulasi-jabatan-table tbody td.pegawai-col>div {
line-height: 1.3;
}
#simulasi-jabatan-table tbody td {
padding-top: .5rem;
padding-bottom: .5rem;
}
#simulasi-jabatan-table tbody tr {
cursor: pointer;
}
#jabatanModal .table thead th {
background: #20c997 !important;
background-color: #20c997 !important;
color: #fff !important;
border-color: #1bab80 !important;
}
#detail-tambahan-table thead th {
background: #fd7e14 !important;
background-color: #fd7e14 !important;
color: #fff !important;
border-color: #dc6500 !important;
}
#jabatanModal .modal-body>.table-responsive:first-of-type table thead th:nth-child(n+11),
#jabatanModal .modal-body>.table-responsive:first-of-type table tbody td:nth-child(n+11) {
display: none;
}
</style>
@endsection
@section('breadcrumb')
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="{{ route('lainnya.index') }}">Lainnya</a></li>
<li class="breadcrumb-item active">{{ $title }}</li>
</ol>
@endsection
@section('content')
<div class="card border">
<div class="card-body">
@include('components.datatable-header', [
'title' => 'Simulasi Jabatan',
'description' => 'Daftar pegawai dan Poin Remunerasi berdasarkan periode dan bulan.',
])
<div class="row mb-3">
<div class="col-md-3"><label class="form-label">Periode</label><select id="periode"
class="form-select select2" data-placeholder="Pilih Periode">
@foreach ($periodes as $periode)
<option value="{{ $periode->id_periode }}"
{{ $periode->id_periode == $periodeNow ? 'selected' : '' }}>{{ $periode->nama }}</option>
@endforeach
</select></div>
<div class="col-md-3"><label class="form-label">Bulan</label><select id="bulan"
class="form-select select2" data-placeholder="Pilih Bulan"></select></div>
<div class="col-md-3"><label class="form-label">Unit Kerja</label><select id="unit_kerja"
class="form-select select2" data-placeholder="Pilih Unit Kerja">
<option value="">Semua Unit Kerja</option>
@foreach ($unitKerjas as $unit)
<option value="{{ $unit }}">{{ $unit }}</option>
@endforeach
</select></div>
<div class="col-md-3"><label class="form-label">Jenis Pegawai</label><select id="jenis_pegawai"
class="form-select select2" data-placeholder="Pilih Jenis Pegawai">
<option value="">Semua Jenis Pegawai</option>
<option value="dosen">Dosen</option>
<option value="tendik">Tendik</option>
</select></div>
</div>
<div class="table-responsive">
<table id="simulasi-jabatan-table" class="table table-bordered dt-styled nowrap" style="width:100%">
<thead>
<tr>
<th>Pegawai</th>
<th>Unit Kerja</th>
<th>Poin P2</th>
<th>Poin Adhoc</th>
<th>Poin Absen</th>
<th>Poin SKP</th>
<th>Poin Grade 14-17</th>
<th>Total Poin</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
<div class="modal fade" id="jabatanModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-centered">
<div class="modal-content">
<div class="modal-header bg-primary text-white">
<h5 class="modal-title">Detail Jabatan</h5><button type="button" class="btn-close btn-close-white"
data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<p>Pegawai: <strong id="detail-pegawai">-</strong></p>
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>Bulan</th>
<th>Jabatan Fungsional</th>
<th>Grade</th>
<th>Poin P2</th>
<th>Harga Jabatan 374</th>
<th>Harga P2 374</th>
<th>Harga Jabatan 377</th>
<th>Harga P2 377</th>
<th>Harga Jabatan Excel</th>
<th>Harga P2 Excel</th>
<th>Harga Jabatan Tambahan 374</th>
<th>Harga P2 Tambahan 374</th>
<th>Harga Jabatan Tambahan 377</th>
<th>Harga P2 Tambahan 377</th>
</tr>
</thead>
<tbody id="detail-jabatan-body"></tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('js')
<script>
$(function() {
const months = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September',
'Oktober', 'November', 'Desember'
];
function renderJenisPegawaiTag(jenis) {
var config = {
'dosen': {
label: 'DOSEN',
color: 'var(--ct-primary)',
rgb: 'var(--ct-primary-rgb)',
icon: 'uil-user-graduate'
},
'tendik': {
label: 'TENDIK',
color: '#fd7e14',
rgb: '253, 126, 20',
icon: 'uil-briefcase-alt'
}
};
var c = config[(jenis || '').toLowerCase()];
return c ? '<small class="d-inline-block fw-bold" style="padding:1px 18px 1px 6px;color:' + c
.color + ';background:linear-gradient(to right, rgba(' + c.rgb + ', 0.25), rgba(' + c.rgb +
', 0));clip-path:polygon(0 0, 100% 0, calc(100% - 20px) 100%, 0 100%);"><i class="' + c.icon +
'"></i> ' + c.label + '</small>' : '';
}
function refreshMonths() {
const p = Number($('#periode').val());
const start = p % 2 ? 0 : 6;
const firstValue = p % 2 ? 1 : 7;
const $bulan = $('#bulan');
if ($bulan.hasClass('select2-hidden-accessible')) {
$bulan.select2('destroy');
}
$bulan.html(months.slice(start, start + 6).map((m, i) =>
`<option value="${firstValue + i}">${m}</option>`).join('')).val(String(firstValue));
$bulan.select2({
width: '100%',
placeholder: 'Pilih Bulan'
});
}
refreshMonths();
const table = $('#simulasi-jabatan-table').DataTable({
processing: true,
serverSide: true,
autoWidth: false,
ajax: {
url: '{{ route('lainnya.simulasi-jabatan.data') }}',
data: d => {
d.periode = $('#periode').val();
d.bulan = $('#bulan').val();
d.unit_kerja = $('#unit_kerja').val();
d.jenis_pegawai = $('#jenis_pegawai').val();
}
},
columns: [{
data: 'nama_pegawai',
name: 'nama_pegawai',
orderable: false,
className: 'pegawai-col',
width: '25%',
render: function(data, type, row) {
if (type !== 'display') {
return data;
}
return '<div><div class="fw-semibold text-truncate">' + (data || '-') +
'</div><div class="text-muted small font-monospace">' + (row.nip ||
'-') + '</div><div class="mt-1">' + renderJenisPegawaiTag(row
.jenis_pegawai) + '</div></div>';
}
}, {
data: 'unit_kerja',
name: 'unit_kerja',
orderable: false,
className: 'unit-kerja-col',
width: '30%',
render: function(data, type) {
if (type !== 'display') {
return data;
}
var unit = data || '-';
return '<div class="text-truncate" title="' + unit + '">' + unit +
'</div>';
}
},
{
data: 'poin_kegiatan',
name: 'poin_kegiatan',
className: 'text-end font-monospace',
width: '15%'
}, {
data: 'poin_adhoc',
name: 'poin_adhoc',
className: 'text-end font-monospace',
width: '15%'
}, {
data: 'poin_absen',
name: 'poin_absen',
className: 'text-end font-monospace',
width: '15%'
}, {
data: 'poin_skp',
name: 'poin_skp',
className: 'text-end font-monospace',
width: '15%'
}, {
data: 'poin_grade_14_17',
name: 'poin_grade_14_17',
className: 'text-end font-monospace',
width: '15%'
}, {
data: 'total_poin',
name: 'total_poin',
className: 'text-end font-monospace fw-bold',
width: '15%'
}
]
});
setTimeout(function() {
refreshMonths();
table.ajax.reload();
}, 300);
$('#periode').on('change', function() {
refreshMonths();
setTimeout(refreshMonths, 50);
table.ajax.reload();
});
$('#bulan, #unit_kerja, #jenis_pegawai').on('change', () => table.ajax.reload());
$('#simulasi-jabatan-table tbody').on('click', 'tr', function() {
var rowData = table.row(this).data();
if (!rowData || !rowData.nip) {
return;
}
var nip = rowData.nip;
$('#detail-pegawai').text(rowData.nama_pegawai || '-');
$('#detail-jabatan-body').html(
'<tr><td colspan="10" class="text-center">Memuat data...</td></tr>');
bootstrap.Modal.getOrCreateInstance(document.getElementById('jabatanModal'), {
backdrop: 'static',
keyboard: true,
focus: true
}).show();
if (!$('#detail-tambahan-table').length) {
$('#jabatanModal .modal-body').append(
'<div class="table-responsive mt-4"><table id="detail-tambahan-table" class="table table-bordered"><thead><tr><th>Bulan</th><th>Jabatan Tugas Tambahan</th><th>Grade</th><th>Poin P2</th><th>Harga Jabatan 374</th><th>Harga P2 374</th><th>Harga Jabatan 377</th><th>Harga P2 377</th><th>Harga Jabatan Excel</th><th>Harga P2 Excel</th></tr></thead><tbody id="detail-tambahan-body"><tr><td colspan="10" class="text-center">Memuat data...</td></tr></tbody></table></div>'
);
}
$('#detail-tambahan-body').html('<tr><td colspan="10" class="text-center">Memuat data...</td></tr>');
var poinKegiatan = parseFloat(String(rowData.poin_kegiatan || '0').replace(/\./g, '')
.replace(',', '.')) || 0;
var parsePoint = function(value) {
return parseFloat(String(value || '0').replace(/\./g, '').replace(',', '.')) || 0;
};
var totalPoin = parsePoint(rowData.total_poin);
var poinAdhoc = parsePoint(rowData.poin_adhoc);
var detailUrl = '{{ route('lainnya.simulasi-jabatan.detail', ['nip' => '__NIP__']) }}'
.replace('__NIP__', nip) + '?poin_kegiatan=' + encodeURIComponent(poinKegiatan) +
'&total_poin=' + encodeURIComponent(totalPoin) + '&poin_adhoc=' + encodeURIComponent(
poinAdhoc);
$.get(detailUrl, function(res) {
$('#detail-pegawai').text(res.pegawai);
var rows = res.data.map(function(x) {
return '<tr><td class="text-center">' + x.bulan + '</td><td>' + x
.jabatan + '</td><td class="text-center">' + x.grade +
'</td><td class="text-end font-monospace">' + x.poin_kegiatan +
'</td><td class="text-end font-monospace">' + x.harga_374 +
'</td><td class="text-end font-monospace">' + x.harga_p2_374 +
'</td><td class="text-end font-monospace">' + x.harga_377 +
'</td><td class="text-end font-monospace">' + x.harga_p2_377 +
'</td><td class="text-end font-monospace">' + x.harga_excel +
'</td><td class="text-end font-monospace">' + x.harga_p2_excel +
'</td><td class="text-end font-monospace">' + x
.harga_tambahan_374 +
'</td><td class="text-end font-monospace">' + x
.harga_p2_tambahan_374 +
'</td><td class="text-end font-monospace">' + x
.harga_tambahan_377 +
'</td><td class="text-end font-monospace">' + x
.harga_p2_tambahan_377 + '</td><td class="text-end font-monospace">' + x.harga_tambahan_excel + '</td><td class="text-end font-monospace">' + x.harga_p2_tambahan_excel + '</td></tr>';
}).join('');
if (rows) {
rows +=
'<tr class="fw-bold"><td colspan="5" class="text-center">Total</td><td class="text-end font-monospace">' +
res.total_harga_p2_374 +
'</td><td></td><td class="text-end font-monospace">' + res
.total_harga_p2_377 +
'</td><td></td><td class="text-end font-monospace">' + res
.total_harga_p2_excel + '</td></tr>';
}
$('#detail-jabatan-body').html(rows ||
'<tr><td colspan="10" class="text-center">Data jabatan tidak ditemukan</td></tr>'
);
var tambahanRows = res.data.filter(function(x) {
return x.jabatan_tambahan !== '-';
}).map(function(x) {
return '<tr><td class="text-center">' + x.bulan + '</td><td>' + x
.jabatan_tambahan + '</td><td class="text-center">' + x.grade_tambahan +
'</td><td class="text-end font-monospace">' + x.poin_tambahan +
'</td><td class="text-end font-monospace">' + x
.harga_tambahan_374 +
'</td><td class="text-end font-monospace">' + x
.harga_p2_tambahan_374 +
'</td><td class="text-end font-monospace">' + x
.harga_tambahan_377 +
'</td><td class="text-end font-monospace">' + x
.harga_p2_tambahan_377 + '</td><td class="text-end font-monospace">' + x.harga_tambahan_excel + '</td><td class="text-end font-monospace">' + x.harga_p2_tambahan_excel + '</td></tr>';
}).join('');
if (tambahanRows) {
var parseNominal = function(value) { return parseFloat(String(value || '0').replace(/\./g, '').replace(',', '.')) || 0; };
var totalExcelTambahan = res.data.filter(function(x) { return x.jabatan_tambahan !== '-'; }).reduce(function(total, x) { return total + parseNominal(x.harga_p2_tambahan_excel); }, 0);
var formatNominal = function(value) { return value.toLocaleString('id-ID', { minimumFractionDigits: 2, maximumFractionDigits: 2 }); };
tambahanRows += '<tr class="fw-bold"><td colspan="5" class="text-center">Total</td><td class="text-end font-monospace">' + res.total_harga_p2_tambahan_374 + '</td><td></td><td class="text-end font-monospace">' + res.total_harga_p2_tambahan_377 + '</td><td></td><td class="text-end font-monospace">' + formatNominal(totalExcelTambahan) + '</td></tr>';
}
$('#detail-tambahan-body').html(tambahanRows ||
'<tr><td colspan="10" class="text-center">Tidak memiliki Jabatan Tugas Tambahan</td></tr>'
);
});
});
});
</script>
@endsection
@@ -95,8 +95,10 @@
<th>Unit Pembayaran</th>
<th>Unit Kerja</th>
<th>Poin Kegiatan</th>
<th>Poin Adhoc</th>
<th>Poin Absen</th>
<th>Poin SKP</th>
<th>Poin Grade 14-17</th>
</tr>
</thead>
<tbody></tbody>
@@ -211,6 +213,13 @@
orderable: false,
width: '15%'
},
{
data: 'poin_adhoc',
name: 'poin_adhoc',
className: 'text-end font-monospace',
orderable: false,
width: '15%'
},
{
data: 'poin_absen',
name: 'poin_absen',
@@ -224,6 +233,13 @@
className: 'text-end font-monospace',
orderable: false,
width: '15%'
},
{
data: 'poin_grade_14_17',
name: 'poin_grade_14_17',
className: 'text-end font-monospace',
orderable: false,
width: '15%'
}
],
order: [[0, 'asc']], // Default order by first column