Penambahan Halaman Keseluruhan
This commit is contained in:
@@ -553,6 +553,15 @@
|
||||
</a>
|
||||
</li>
|
||||
@endrole
|
||||
|
||||
@role('Superuser')
|
||||
<li class="li-remunerasi-keseluruhan">
|
||||
<a href="{{ route('remunerasi.keseluruhan.index') }}">
|
||||
<i class="uil-layer-group" style="margin-right: 3px; font-size:18px"></i>
|
||||
<span> Keseluruhan </span>
|
||||
</a>
|
||||
</li>
|
||||
@endrole
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@@ -0,0 +1,281 @@
|
||||
@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('content')
|
||||
<!-- Summary Card -->
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div class="card border">
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="flex-shrink-0">
|
||||
<div class="bg-primary text-white rounded-2 p-2">
|
||||
<i class="uil-coins fs-4"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<h6 class="text-muted mb-1">Total Keseluruhan</h6>
|
||||
<h4 class="mb-0" id="totalKeseluruhanDisplay">-</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div class="card border">
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="flex-shrink-0">
|
||||
<div class="bg-success text-white rounded-2 p-2">
|
||||
<i class="uil-users-alt fs-4"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<h6 class="text-muted mb-1">Jumlah Pegawai</h6>
|
||||
<h4 class="mb-0" id="jumlahPegawaiDisplay">-</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Table -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card border">
|
||||
<div class="card-body">
|
||||
@php
|
||||
$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-secondary" id="btnRefresh">
|
||||
<i class="uil-refresh"></i>
|
||||
Refresh
|
||||
</button>';
|
||||
@endphp
|
||||
|
||||
@include('components.datatable-header', [
|
||||
'title' => 'Rekap Keseluruhan Remunerasi',
|
||||
'description' => 'Rekap Jumlah P1, P2, THR, R13, dan Publikasi per pegawai',
|
||||
'actionButton' => $actionButtons,
|
||||
])
|
||||
|
||||
<!-- Filter Section -->
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-3">
|
||||
<label for="filter-jenis-pegawai" class="form-label">Jenis Pegawai</label>
|
||||
<select name="jenis_pegawai" id="filter-jenis-pegawai" class="form-select select2" data-placeholder="Semua Jenis">
|
||||
<option value=""></option>
|
||||
<option value="dosen">Dosen</option>
|
||||
<option value="tendik">Tendik</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<label for="filter-unit" class="form-label">Unit Kerja</label>
|
||||
<select name="unit" id="filter-unit" class="form-select select2" data-placeholder="Semua Unit Kerja">
|
||||
<option value=""></option>
|
||||
<option value="99">Universitas</option>
|
||||
<option value="1">Fakultas Hukum</option>
|
||||
<option value="2">Fakultas Ekonomi dan Bisnis</option>
|
||||
<option value="3">Fakultas Pertanian</option>
|
||||
<option value="4">Fakultas Teknik</option>
|
||||
<option value="5">Fakultas Ilmu Sosial dan Ilmu Politik</option>
|
||||
<option value="6">Fakultas Keguruan dan Ilmu Pendidikan</option>
|
||||
<option value="7">Fakultas Kehutanan</option>
|
||||
<option value="8">Fakultas Matematika dan Ilmu Pengetahuan Alam</option>
|
||||
<option value="9">Fakultas Kedokteran</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<label for="filter-tahun" class="form-label">Tahun</label>
|
||||
<select name="tahun" id="filter-tahun" class="form-select select2" data-placeholder="Pilih Tahun">
|
||||
@for ($year = date('Y'); $year >= 2025; $year--)
|
||||
<option value="{{ $year }}" {{ $year == date('Y') ? 'selected' : '' }}>{{ $year }}</option>
|
||||
@endfor
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tabel Data -->
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered w-100 dt-styled" id="keseluruhan-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Pegawai</th>
|
||||
<th>Unit Kerja</th>
|
||||
<th class="text-center">Jumlah P1</th>
|
||||
<th class="text-center">Jumlah P2</th>
|
||||
<th class="text-center">Jumlah THR</th>
|
||||
<th class="text-center">Jumlah R13</th>
|
||||
<th class="text-center">Jumlah Publikasi</th>
|
||||
<th class="text-center">Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('js')
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
function renderRupiah(data) {
|
||||
if (!data) {
|
||||
return 'Rp. 0,00';
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
function renderJenisPegawaiTag(jenis) {
|
||||
var config = {
|
||||
'Dosen': { color: 'var(--ct-primary)', rgb: 'var(--ct-primary-rgb)', icon: 'uil-user-graduate' },
|
||||
'Tendik': { color: '#fd7e14', rgb: '253, 126, 20', icon: 'uil-briefcase-alt' }
|
||||
};
|
||||
var c = config[jenis];
|
||||
if (!c) {
|
||||
return '';
|
||||
}
|
||||
return '<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> ' + jenis.toUpperCase() + '</small>';
|
||||
}
|
||||
|
||||
var table = $('#keseluruhan-table').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
autoWidth: false,
|
||||
ajax: {
|
||||
url: "{{ route('remunerasi.keseluruhan.data') }}",
|
||||
data: function(d) {
|
||||
d.jenis_pegawai = $('#filter-jenis-pegawai').val();
|
||||
d.unit = $('#filter-unit').val();
|
||||
d.tahun = $('#filter-tahun').val();
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
data: 'nama',
|
||||
name: 'nama',
|
||||
render: function(data, type, row) {
|
||||
if (type !== 'display') {
|
||||
return data;
|
||||
}
|
||||
var nama = data || '-';
|
||||
var nip = row.nip || '-';
|
||||
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>';
|
||||
}
|
||||
},
|
||||
{ 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 }
|
||||
],
|
||||
order: [],
|
||||
language: {
|
||||
processing: "<div class='spinner'></div> Sedang Memuat...",
|
||||
},
|
||||
drawCallback: function(settings) {
|
||||
var api = this.api();
|
||||
var response = api.ajax.json();
|
||||
|
||||
if (response && response.totalKeseluruhan !== undefined) {
|
||||
$('#totalKeseluruhanDisplay').text('Rp ' + response.totalKeseluruhan);
|
||||
$('#jumlahPegawaiDisplay').text(response.jumlahPegawai + ' orang');
|
||||
} else {
|
||||
$('#totalKeseluruhanDisplay').text('Rp 0');
|
||||
$('#jumlahPegawaiDisplay').text('0 orang');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#filter-jenis-pegawai, #filter-unit, #filter-tahun').on('change', function() {
|
||||
table.draw();
|
||||
});
|
||||
|
||||
$('#btnRefresh').on('click', function() {
|
||||
var button = $(this);
|
||||
var originalText = button.html();
|
||||
|
||||
button.prop('disabled', true).html('<i class="uil-sync uil-spin"></i> Refreshing...');
|
||||
|
||||
table.ajax.reload(function() {
|
||||
button.prop('disabled', false).html(originalText);
|
||||
showSuccess('Berhasil!', 'Data berhasil direfresh');
|
||||
}, false);
|
||||
});
|
||||
|
||||
$('#btn-export').on('click', function() {
|
||||
var button = $(this);
|
||||
var originalHtml = button.html();
|
||||
|
||||
var params = [];
|
||||
var jenisPegawai = $('#filter-jenis-pegawai').val();
|
||||
var unit = $('#filter-unit').val();
|
||||
var tahun = $('#filter-tahun').val();
|
||||
|
||||
if (jenisPegawai) { params.push('jenis_pegawai=' + jenisPegawai); }
|
||||
if (unit) { params.push('unit=' + unit); }
|
||||
if (tahun) { params.push('tahun=' + tahun); }
|
||||
|
||||
var url = "{{ route('remunerasi.keseluruhan.export') }}";
|
||||
if (params.length > 0) {
|
||||
url += '?' + params.join('&');
|
||||
}
|
||||
|
||||
button.prop('disabled', true).html('<i class="uil-sync uil-spin"></i> Exporting...');
|
||||
|
||||
fetch(url)
|
||||
.then(function(response) {
|
||||
if (!response.ok) { throw new Error('gagal'); }
|
||||
var filename = 'remunerasi_keseluruhan.xlsx';
|
||||
var disposition = response.headers.get('Content-Disposition');
|
||||
if (disposition) {
|
||||
var match = disposition.match(/filename[^;=\n]*=['"]?([^'"\n]+)['"]?/);
|
||||
if (match) { filename = match[1]; }
|
||||
}
|
||||
return response.blob().then(function(blob) {
|
||||
return { blob: blob, filename: filename };
|
||||
});
|
||||
})
|
||||
.then(function(data) {
|
||||
var downloadUrl = URL.createObjectURL(data.blob);
|
||||
var a = document.createElement('a');
|
||||
a.href = downloadUrl;
|
||||
a.download = data.filename;
|
||||
a.style.display = 'none';
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(downloadUrl);
|
||||
button.prop('disabled', false).html(originalHtml);
|
||||
showSuccess('Berhasil!', 'File Excel berhasil didownload');
|
||||
})
|
||||
.catch(function() {
|
||||
button.prop('disabled', false).html(originalHtml);
|
||||
showError('Gagal', 'Terjadi kesalahan saat export Excel');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user