feat: add calculation rules, management features, and services for period 401
This commit is contained in:
@@ -723,6 +723,13 @@
|
||||
<span> Periode </span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="side-nav-item si-aturan-perhitungan">
|
||||
<a href="{{ route('manajemen.aturan-perhitungan.index') }}" class="side-nav-link ni-aturan-perhitungan">
|
||||
<i class="uil-calculator"></i>
|
||||
<span> Aturan Perhitungan </span>
|
||||
</a>
|
||||
</li>
|
||||
@endcanany
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('css')
|
||||
<style>
|
||||
#aturanTable thead th {
|
||||
background: linear-gradient(135deg, #2080f5 0%, #0166d2 100%) !important;
|
||||
color: #fff !important;
|
||||
border-color: #0166d2 !important;
|
||||
}
|
||||
|
||||
#aturanTable tbody tr {
|
||||
transition: background-color 0.15s ease-in-out;
|
||||
}
|
||||
|
||||
#aturanTable tbody tr:hover > * {
|
||||
background-color: rgba(13, 110, 253, 0.08) !important;
|
||||
box-shadow: none;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('breadcrumb')
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="javascript:void(0);">Manajemen</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ $title }}</li>
|
||||
</ol>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card border">
|
||||
<div class="card-body">
|
||||
@include('components.datatable-header', [
|
||||
'title' => 'Daftar Aturan Perhitungan',
|
||||
'description' => 'Berikut adalah daftar aturan perhitungan remunerasi yang dapat diaktifkan atau dinonaktifkan seperti pada menu Periode',
|
||||
'actionButton' => ''
|
||||
])
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered w-100" id="aturanTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center" style="width: 5%">No</th>
|
||||
<th>Nama Aturan</th>
|
||||
<th>Deskripsi</th>
|
||||
<th class="text-center" style="width: 15%">Periode Berlaku</th>
|
||||
<th class="text-center" style="width: 12%">Status</th>
|
||||
@if($canUbah)
|
||||
<th class="text-center" style="width: 10%">Switch</th>
|
||||
<th class="text-center" style="width: 8%">Aksi</th>
|
||||
@endif
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Edit Form -->
|
||||
<div class="modal fade" id="aturanModal" tabindex="-1" role="dialog" aria-labelledby="aturanModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<form id="aturanForm">
|
||||
@csrf
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="aturanModalLabel">Edit Aturan Perhitungan</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="hidden" id="aturan_id" name="aturan_id">
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="nama" class="form-label">Nama Aturan <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="nama" name="nama" required>
|
||||
<div class="invalid-feedback"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="deskripsi" class="form-label">Deskripsi</label>
|
||||
<textarea class="form-control" id="deskripsi" name="deskripsi" rows="3"></textarea>
|
||||
<div class="invalid-feedback"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="status" class="form-label">Status <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="status" name="status" required>
|
||||
<option value="1">Aktif</option>
|
||||
<option value="0">Non Aktif</option>
|
||||
</select>
|
||||
<div class="invalid-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-primary" id="submitBtn">Simpan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('js')
|
||||
<script>
|
||||
let table;
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize DataTable
|
||||
table = $('#aturanTable').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
url: "{{ route('manajemen.aturan-perhitungan.data') }}"
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
data: 'DT_RowIndex',
|
||||
name: 'DT_RowIndex',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
className: 'text-center'
|
||||
},
|
||||
{
|
||||
data: 'nama',
|
||||
name: 'nama',
|
||||
className: 'fw-bold'
|
||||
},
|
||||
{
|
||||
data: 'deskripsi',
|
||||
name: 'deskripsi'
|
||||
},
|
||||
{
|
||||
data: 'periode_badge',
|
||||
name: 'periode_badge',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
className: 'text-center'
|
||||
},
|
||||
{
|
||||
data: 'status_badge',
|
||||
name: 'status_badge',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
className: 'text-center'
|
||||
},
|
||||
@if($canUbah)
|
||||
{
|
||||
data: 'switch',
|
||||
name: 'switch',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
className: 'text-center'
|
||||
},
|
||||
{
|
||||
data: 'action',
|
||||
name: 'action',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
className: 'text-center'
|
||||
}
|
||||
@endif
|
||||
],
|
||||
language: {
|
||||
processing: "<div class='spinner'></div> Sedang Memuat...",
|
||||
}
|
||||
});
|
||||
|
||||
// Handle edit button
|
||||
$(document).on('click', '.edit-btn', function() {
|
||||
let id = $(this).data('id');
|
||||
let url = "{{ route('manajemen.aturan-perhitungan.show', ':id') }}".replace(':id', id);
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'GET',
|
||||
success: function(response) {
|
||||
$('#aturan_id').val(response.id);
|
||||
$('#nama').val(response.nama);
|
||||
$('#deskripsi').val(response.deskripsi);
|
||||
$('#status').val(response.status ? '1' : '0');
|
||||
|
||||
$('.is-invalid').removeClass('is-invalid');
|
||||
$('.invalid-feedback').text('');
|
||||
|
||||
$('#aturanModal').modal('show');
|
||||
},
|
||||
error: function() {
|
||||
showAlert('error', 'Gagal memuat data aturan perhitungan');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Handle toggle/switch status button (direct switch)
|
||||
$(document).on('change', '.switch-status-btn', function() {
|
||||
let id = $(this).data('id');
|
||||
let isChecked = $(this).is(':checked');
|
||||
let url = "{{ route('manajemen.aturan-perhitungan.toggle', ':id') }}".replace(':id', id);
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
data: {
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
table.ajax.reload(null, false);
|
||||
showAlert('success', response.message);
|
||||
},
|
||||
error: function() {
|
||||
table.ajax.reload(null, false);
|
||||
showAlert('error', 'Gagal mengubah status aturan perhitungan');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.toggle-btn', function() {
|
||||
let id = $(this).data('id');
|
||||
let url = "{{ route('manajemen.aturan-perhitungan.toggle', ':id') }}".replace(':id', id);
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
data: {
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
table.ajax.reload(null, false);
|
||||
showAlert('success', response.message);
|
||||
},
|
||||
error: function() {
|
||||
showAlert('error', 'Gagal mengubah status aturan perhitungan');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Handle form submission
|
||||
$('#aturanForm').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
let id = $('#aturan_id').val();
|
||||
let url = "{{ route('manajemen.aturan-perhitungan.update', ':id') }}".replace(':id', id);
|
||||
|
||||
let formData = {
|
||||
_token: '{{ csrf_token() }}',
|
||||
_method: 'PUT',
|
||||
nama: $('#nama').val(),
|
||||
deskripsi: $('#deskripsi').val(),
|
||||
status: $('#status').val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
beforeSend: function() {
|
||||
$('#submitBtn').prop('disabled', true).text('Menyimpan...');
|
||||
$('.is-invalid').removeClass('is-invalid');
|
||||
$('.invalid-feedback').text('');
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
$('#aturanModal').modal('hide');
|
||||
table.ajax.reload(null, false);
|
||||
showAlert('success', response.message);
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
if (xhr.status === 422) {
|
||||
let errors = xhr.responseJSON.errors;
|
||||
$.each(errors, function(key, value) {
|
||||
$('#' + key).addClass('is-invalid');
|
||||
$('#' + key).siblings('.invalid-feedback').text(value[0]);
|
||||
});
|
||||
} else {
|
||||
showAlert('error', xhr.responseJSON?.message || 'Terjadi kesalahan saat menyimpan data');
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$('#submitBtn').prop('disabled', false).text('Simpan');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function showAlert(type, message) {
|
||||
if (typeof Swal !== 'undefined') {
|
||||
Swal.fire({
|
||||
icon: type,
|
||||
title: type === 'success' ? 'Berhasil' : 'Perhatian',
|
||||
text: message,
|
||||
timer: 2000,
|
||||
showConfirmButton: false
|
||||
});
|
||||
} else {
|
||||
alert(message);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@@ -325,7 +325,8 @@
|
||||
// Baris hasil biasa; untuk P2 (Bruto) dengan Adhoc,
|
||||
// baris bruto mentah bukan hasil akhir (disusul pengurangan Adhoc).
|
||||
$isResult = $isLast;
|
||||
if ($hasAdhocInMonth) {
|
||||
$isAturanBaruDetail = !empty($adhoc['is_aturan_baru']);
|
||||
if ($hasAdhocInMonth && !$isAturanBaruDetail) {
|
||||
if ($fKey === 'bruto' && $isLast && $hasAdhocDetail) {
|
||||
$isResult = false;
|
||||
} elseif ($fKey === 'ratio') {
|
||||
@@ -340,7 +341,7 @@
|
||||
<li @if ($isResult) class="formula-result" @endif>{{ $displayStep }}</li>
|
||||
@endforeach
|
||||
|
||||
@if ($fKey === 'bruto' && $hasAdhocDetail)
|
||||
@if ($fKey === 'bruto' && $hasAdhocDetail && empty($adhoc['is_aturan_baru']))
|
||||
<li>P2 (Bruto) − P2 Adhoc</li>
|
||||
<li>Rp. {{ number_format($sec['p2_total_bruto'], 2, ',', '.') }} − Rp. {{ number_format($adhoc['potongan'], 2, ',', '.') }}</li>
|
||||
<li class="formula-result">Rp. {{ number_format($sec['bruto'], 2, ',', '.') }}</li>
|
||||
@@ -354,23 +355,6 @@
|
||||
{{-- Kanan: Detail Jabatan --}}
|
||||
<div class="col-12 col-md-7">
|
||||
@if ($sec['is_dosen'])
|
||||
{{-- Jabatan Fungsional --}}
|
||||
@if (!empty($p2f['fungsional']))
|
||||
<div class="formula-section">
|
||||
<div class="formula-title">Jabatan Fungsional</div>
|
||||
<div class="formula-info">
|
||||
Jabatan: <strong>{{ $p2f['fungsional']['jabatan'] ?? '-' }}</strong><br>
|
||||
Grade: <strong>{{ $p2f['fungsional']['grade'] ?? '-' }}</strong><br>
|
||||
Harga Jabatan: <strong>{{ number_format($p2f['fungsional']['harga'] ?? 0, 2, ',', '.') }}</strong>
|
||||
</div>
|
||||
<ul class="formula-steps">
|
||||
@foreach ($p2f['fungsional']['steps'] as $step)
|
||||
<li @if ($loop->last) class="formula-result" @endif>{{ $step }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Jabatan Tugas Tambahan --}}
|
||||
@if (!empty($p2f['tambahan']))
|
||||
<div class="formula-section">
|
||||
@@ -388,24 +372,58 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Adhoc --}}
|
||||
@if ($hasAdhocDetail)
|
||||
@php $selisihPerPoin = $adhoc['nilai_per_poin_normal'] - $adhoc['nilai_per_poin_adhoc']; @endphp
|
||||
{{-- Jabatan Fungsional --}}
|
||||
@if (!empty($p2f['fungsional']))
|
||||
<div class="formula-section">
|
||||
<div class="formula-title">Adhoc</div>
|
||||
<div class="formula-title">Jabatan Fungsional</div>
|
||||
<div class="formula-info">
|
||||
Poin P2 Adhoc: <strong>{{ number_format($adhoc['poin'], 2, ',', '.') }}</strong><br>
|
||||
Nilai per Poin (Normal): <strong>Rp. {{ number_format($adhoc['nilai_per_poin_normal'], 2, ',', '.') }}</strong><br>
|
||||
Nilai per Poin (Adhoc): <strong>Rp. {{ number_format($adhoc['nilai_per_poin_adhoc'], 2, ',', '.') }}</strong>
|
||||
Jabatan: <strong>{{ $p2f['fungsional']['jabatan'] ?? '-' }}</strong><br>
|
||||
Grade: <strong>{{ $p2f['fungsional']['grade'] ?? '-' }}</strong><br>
|
||||
Harga Jabatan: <strong>{{ number_format($p2f['fungsional']['harga'] ?? 0, 2, ',', '.') }}</strong>
|
||||
</div>
|
||||
<ul class="formula-steps">
|
||||
<li>Poin P2 Adhoc × (Nilai per Poin Normal − Nilai per Poin Adhoc)</li>
|
||||
<li>{{ number_format($adhoc['poin'], 2, ',', '.') }} × (Rp. {{ number_format($adhoc['nilai_per_poin_normal'], 2, ',', '.') }} − Rp. {{ number_format($adhoc['nilai_per_poin_adhoc'], 2, ',', '.') }})</li>
|
||||
<li>{{ number_format($adhoc['poin'], 2, ',', '.') }} × Rp. {{ number_format($selisihPerPoin, 2, ',', '.') }}</li>
|
||||
<li class="formula-result">Rp. {{ number_format($adhoc['potongan'], 2, ',', '.') }}</li>
|
||||
@foreach ($p2f['fungsional']['steps'] as $step)
|
||||
<li @if ($loop->last) class="formula-result" @endif>{{ $step }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Adhoc --}}
|
||||
@if ($hasAdhocDetail)
|
||||
@if (!empty($adhoc['is_aturan_baru']))
|
||||
<div class="formula-section">
|
||||
<div class="formula-title">Adhoc</div>
|
||||
<div class="formula-info">
|
||||
Poin P2 Adhoc Total: <strong>{{ number_format($adhoc['poin_total'], 2, ',', '.') }}</strong><br>
|
||||
Poin P2 Adhoc Masuk JTT: <strong>{{ number_format($adhoc['poin_jtt'], 2, ',', '.') }}</strong><br>
|
||||
Sisa Poin P2 Adhoc: <strong>{{ number_format($adhoc['poin_sisa'], 2, ',', '.') }}</strong><br>
|
||||
Nilai per Poin (Adhoc): <strong>Rp. {{ number_format($adhoc['nilai_per_poin'], 2, ',', '.') }}</strong>
|
||||
</div>
|
||||
<ul class="formula-steps">
|
||||
<li>Sisa Poin P2 Adhoc × Nilai per Poin Adhoc</li>
|
||||
<li>{{ number_format($adhoc['poin_sisa'], 2, ',', '.') }} × Rp. {{ number_format($adhoc['nilai_per_poin'], 2, ',', '.') }}</li>
|
||||
<li class="formula-result">Rp. {{ number_format($adhoc['p2_adhoc'], 2, ',', '.') }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
@else
|
||||
@php $selisihPerPoin = $adhoc['nilai_per_poin_normal'] - $adhoc['nilai_per_poin_adhoc']; @endphp
|
||||
<div class="formula-section">
|
||||
<div class="formula-title">Adhoc</div>
|
||||
<div class="formula-info">
|
||||
Poin P2 Adhoc: <strong>{{ number_format($adhoc['poin'], 2, ',', '.') }}</strong><br>
|
||||
Nilai per Poin (Normal): <strong>Rp. {{ number_format($adhoc['nilai_per_poin_normal'], 2, ',', '.') }}</strong><br>
|
||||
Nilai per Poin (Adhoc): <strong>Rp. {{ number_format($adhoc['nilai_per_poin_adhoc'], 2, ',', '.') }}</strong>
|
||||
</div>
|
||||
<ul class="formula-steps">
|
||||
<li>Poin P2 Adhoc × (Nilai per Poin Normal − Nilai per Poin Adhoc)</li>
|
||||
<li>{{ number_format($adhoc['poin'], 2, ',', '.') }} × (Rp. {{ number_format($adhoc['nilai_per_poin_normal'], 2, ',', '.') }} − Rp. {{ number_format($adhoc['nilai_per_poin_adhoc'], 2, ',', '.') }})</li>
|
||||
<li>{{ number_format($adhoc['poin'], 2, ',', '.') }} × Rp. {{ number_format($selisihPerPoin, 2, ',', '.') }}</li>
|
||||
<li class="formula-result">Rp. {{ number_format($adhoc['potongan'], 2, ',', '.') }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
@else
|
||||
{{-- Tendik: single jabatan --}}
|
||||
<div class="formula-section">
|
||||
|
||||
Reference in New Issue
Block a user