Penambahan Filter Jenjang Pendidikan untuk menu P2 dan Simulasi Jabatan
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Helpers\JenjangPendidikanHelper;
|
||||
use App\Models\Verifikator\JabatanFungsionalRiwayat;
|
||||
use App\Models\Verifikator\JabatanPegawaiDetail;
|
||||
use App\Models\Verifikator\JabatanTugasTambahanRiwayat;
|
||||
@@ -53,11 +54,12 @@ class SimulasiJabatanExport implements WithMultipleSheets
|
||||
private readonly ?string $jenis = null,
|
||||
private readonly int|string|null $unitKerjaId = null,
|
||||
private readonly bool $grade12 = false,
|
||||
private readonly ?string $jenjangPendidikan = null,
|
||||
) {}
|
||||
|
||||
public function sheets(): array
|
||||
{
|
||||
$rows = SimulasiJabatanSheet::rows($this->periode, $this->bulan, $this->unitKerjaId, $this->jenis, false, $this->grade12);
|
||||
$rows = SimulasiJabatanSheet::rows($this->periode, $this->bulan, $this->unitKerjaId, $this->jenis, false, $this->grade12, false, $this->jenjangPendidikan);
|
||||
$sheets = [new SimulasiJabatanSheet('All', $rows)];
|
||||
foreach ($rows->groupBy(fn ($row) => $row['unit_kerja'] ?: 'Tanpa Unit Kerja') as $unit => $unitRows) {
|
||||
$sheets[] = new SimulasiJabatanSheet($unit, $unitRows->values());
|
||||
@@ -70,12 +72,13 @@ class SimulasiJabatanSheet implements FromCollection, WithHeadings, WithStyles,
|
||||
{
|
||||
public function __construct(private readonly string $sheetTitle, private readonly Collection $items) {}
|
||||
|
||||
public static function rows(int $periode, ?int $bulan = null, int|string|null $unitKerjaId = null, ?string $jenis = null, bool $raw = false, bool $grade12 = false, bool $splitUnit = false): Collection
|
||||
public static function rows(int $periode, ?int $bulan = null, int|string|null $unitKerjaId = null, ?string $jenis = null, bool $raw = false, bool $grade12 = false, bool $splitUnit = false, ?string $jenjangPendidikan = null): Collection
|
||||
{
|
||||
$q = JabatanPegawaiDetailPoin::query()->select([
|
||||
'verifikator.jabatan_pegawais.nip', 'verifikator.poin_per_bulans.jabatan_pegawai_detail_id',
|
||||
'verifikator.pegawais.nama as nama_pegawai', 'verifikator.jabatan_pegawai_details.jenis_pegawai',
|
||||
'verifikator.pegawais.unit_kerja_nama as unit_kerja', 'verifikator.pegawais.unit_kerja_id',
|
||||
'verifikator.pegawais.pendidikan_terakhir',
|
||||
'verifikator.poin_per_bulans.poin_kegiatan',
|
||||
'verifikator.poin_per_bulans.poin_absen', 'verifikator.poin_per_bulans.poin_skp',
|
||||
'verifikator.poin_per_bulans.poin_grade_14_17', 'verifikator.poin_per_bulans.detail_p2',
|
||||
@@ -113,6 +116,7 @@ class SimulasiJabatanSheet implements FromCollection, WithHeadings, WithStyles,
|
||||
$q->where('verifikator.pegawais.unit_kerja_id', (int) $unitKerjaId);
|
||||
}
|
||||
if ($jenis) $q->where('verifikator.jabatan_pegawai_details.jenis_pegawai', $jenis);
|
||||
if ($jenjangPendidikan) JenjangPendidikanHelper::applyQueryFilter($q, 'verifikator.pegawais.pendidikan_terakhir', $jenjangPendidikan);
|
||||
$excel = collect(json_decode(file_get_contents(public_path('data-jabatan-excel.json')), true) ?: [])->keyBy(fn ($x) => mb_strtolower(trim($x['nama_jabatan'] ?? '')));
|
||||
$source = $q->get();
|
||||
$details = JabatanPegawaiDetail::with(['fungsional','tambahan'])->whereIn('id', $source->pluck('jabatan_pegawai_detail_id'))->get()->keyBy('id');
|
||||
@@ -297,6 +301,7 @@ class SimulasiJabatanSheet implements FromCollection, WithHeadings, WithStyles,
|
||||
$out['raw_p2_final_374_g12'] = $final374g12;
|
||||
$out['raw_p2_final_377_g12'] = $final377g12;
|
||||
$out['raw_p2_final_excel_g12'] = $finalExcelg12;
|
||||
$out['raw_pendidikan_terakhir'] = (string) ($r->pendidikan_terakhir ?? '');
|
||||
}
|
||||
|
||||
// Mode gabung (default): satu baris per pegawai — total seluruh unit bayar.
|
||||
|
||||
Reference in New Issue
Block a user