Penambahan filter PPPK di Keseluruhan
This commit is contained in:
@@ -44,11 +44,11 @@ class KeseluruhanExport implements FromArray, ShouldAutoSize, WithColumnFormatti
|
||||
return ['C'];
|
||||
}
|
||||
|
||||
public function __construct(int $tahun, ?string $jenisPegawai, mixed $unit)
|
||||
public function __construct(int $tahun, ?string $jenisPegawai, mixed $unit, bool $includePppk2025 = false)
|
||||
{
|
||||
$controller = app(KeseluruhanController::class);
|
||||
|
||||
$this->rows = $controller->getRekapRows($tahun, $jenisPegawai, $unit);
|
||||
$this->rows = $controller->getRekapRows($tahun, $jenisPegawai, $unit, $includePppk2025);
|
||||
$this->bulanTerakhir = $controller->getBulanTerakhir($tahun);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,8 +42,9 @@ class KeseluruhanController extends Controller
|
||||
$tahun = (int) ($request->tahun ?: now()->year);
|
||||
$jenisPegawai = $request->jenis_pegawai ?: null;
|
||||
$unit = $request->unit;
|
||||
$includePppk2025 = $request->boolean('include_pppk_2025');
|
||||
|
||||
$rows = collect($this->getRekapRows($tahun, $jenisPegawai, $unit));
|
||||
$rows = collect($this->getRekapRows($tahun, $jenisPegawai, $unit, $includePppk2025));
|
||||
|
||||
return DataTables::of($rows)
|
||||
->editColumn('jenis_pegawai', fn ($row) => $row['jenis_pegawai'] === 'dosen' ? 'Dosen' : ($row['jenis_pegawai'] === 'tendik' ? 'Tendik' : '-'))
|
||||
@@ -69,6 +70,7 @@ class KeseluruhanController extends Controller
|
||||
$tahun = (int) ($request->tahun ?: now()->year);
|
||||
$jenisPegawai = $request->jenis_pegawai ?: null;
|
||||
$unit = $request->unit;
|
||||
$includePppk2025 = $request->boolean('include_pppk_2025');
|
||||
|
||||
$unitName = '_Semua_Unit_Kerja';
|
||||
if ($unit !== null && $unit !== '') {
|
||||
@@ -80,7 +82,7 @@ class KeseluruhanController extends Controller
|
||||
|
||||
$filename = "Remunerasi_Keseluruhan_{$tahun}{$unitName}.xlsx";
|
||||
|
||||
return Excel::download(new KeseluruhanExport($tahun, $jenisPegawai, $unit), $filename);
|
||||
return Excel::download(new KeseluruhanExport($tahun, $jenisPegawai, $unit, $includePppk2025), $filename);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +90,7 @@ class KeseluruhanController extends Controller
|
||||
* tahun terpilih. Dipakai bersama oleh data() (DataTables) dan KeseluruhanExport supaya kedua
|
||||
* sisi (tampilan web & export Excel) selalu konsisten.
|
||||
*/
|
||||
public function getRekapRows(int $tahun, ?string $jenisPegawai, mixed $unit): array
|
||||
public function getRekapRows(int $tahun, ?string $jenisPegawai, mixed $unit, bool $includePppk2025 = false): array
|
||||
{
|
||||
$rows = $this->buildRekap($tahun, $jenisPegawai);
|
||||
|
||||
@@ -103,6 +105,10 @@ class KeseluruhanController extends Controller
|
||||
})->values();
|
||||
}
|
||||
|
||||
if (! $includePppk2025) {
|
||||
$rows = $rows->filter(fn ($row) => ! str_contains($row['nip'] ?? '', '202521'))->values();
|
||||
}
|
||||
|
||||
return $rows->sortBy('nama', SORT_NATURAL | SORT_FLAG_CASE)->values()->all();
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,10 @@
|
||||
<option value="dosen">Dosen</option>
|
||||
<option value="tendik">Tendik</option>
|
||||
</select>
|
||||
<div class="form-check mt-1">
|
||||
<input class="form-check-input" type="checkbox" id="include_pppk_2025">
|
||||
<label class="form-check-label" for="include_pppk_2025">PPPK 2025</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
@@ -164,6 +168,7 @@
|
||||
d.jenis_pegawai = $('#filter-jenis-pegawai').val();
|
||||
d.unit = $('#filter-unit').val();
|
||||
d.tahun = $('#filter-tahun').val();
|
||||
d.include_pppk_2025 = $('#include_pppk_2025').is(':checked') ? 1 : 0;
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
@@ -209,7 +214,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#filter-jenis-pegawai, #filter-unit, #filter-tahun').on('change', function() {
|
||||
$('#filter-jenis-pegawai, #filter-unit, #filter-tahun, #include_pppk_2025').on('change', function() {
|
||||
table.draw();
|
||||
});
|
||||
|
||||
@@ -233,10 +238,12 @@
|
||||
var jenisPegawai = $('#filter-jenis-pegawai').val();
|
||||
var unit = $('#filter-unit').val();
|
||||
var tahun = $('#filter-tahun').val();
|
||||
var includePppk2025 = $('#include_pppk_2025').is(':checked') ? 1 : 0;
|
||||
|
||||
if (jenisPegawai) { params.push('jenis_pegawai=' + jenisPegawai); }
|
||||
if (unit) { params.push('unit=' + unit); }
|
||||
if (tahun) { params.push('tahun=' + tahun); }
|
||||
params.push('include_pppk_2025=' + includePppk2025);
|
||||
|
||||
var url = "{{ route('remunerasi.keseluruhan.export') }}";
|
||||
if (params.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user