diff --git a/app/Http/Controllers/PitStopController.php b/app/Http/Controllers/PitStopController.php
index d741ca5..3235e9b 100644
--- a/app/Http/Controllers/PitStopController.php
+++ b/app/Http/Controllers/PitStopController.php
@@ -680,28 +680,174 @@ class PitStopController extends Controller
->orderBy('t.unit_name')
->get();
+ // Rekap karyawan (all unit)
+ $pegawaiRecap = DB::connection('pgsql')
+ ->table('public.mappegawaijabatantounitkerja_m as mp')
+ ->join('public.pegawai_m as pg', 'pg.id', '=', 'mp.objectpegawaifk')
+ ->join('public.unitkerjapegawai_m as ukp', 'ukp.id', '=', 'mp.objectunitkerjapegawaifk')
+ ->leftJoin('public.praakre as p', function ($join) {
+ $join->on('p.pegawai_id', '=', 'pg.id')
+ ->where(function ($q) {
+ $q->whereNull('p.tipe_karyawan')
+ ->orWhere('p.tipe_karyawan', 'internal');
+ });
+ })
+ ->leftJoin('public.masterpitstop as m', function ($join) {
+ $join->on(DB::raw('m.id::text'), '=', 'p.masterpitstop_id')
+ ->where('m.statusenabled', true);
+ })
+ ->where('mp.statusenabled', true)
+ ->where('mp.isprimary', true)
+ ->where('pg.statusenabled', true)
+ ->where('pg.kedudukanfk', 1)
+ ->where('ukp.statusenabled', true)
+ ->select([
+ DB::raw('ukp.id as unit_id'),
+ DB::raw("coalesce(ukp.name, '-') as unit_name"),
+ 'pg.id',
+ DB::raw("coalesce(pg.namalengkap, '-') as nama"),
+ DB::raw("coalesce(pg.nip_pns, '-') as nip_pns"),
+ DB::raw("count(distinct m.id) as lulus_count"),
+ DB::raw("coalesce((
+ select string_agg(ms.nama, ', ' order by ms.id)
+ from public.masterpitstop ms
+ left join public.praakre px
+ on px.pegawai_id = pg.id
+ and (px.tipe_karyawan is null or px.tipe_karyawan = 'internal')
+ and px.masterpitstop_id = ms.id::text
+ where ms.statusenabled = true
+ and px.id is null
+ ), '') as belum_steps"),
+ ])
+ ->groupBy('ukp.id', 'ukp.name', 'pg.id', 'pg.namalengkap', 'pg.nip_pns')
+ ->orderBy('ukp.name')
+ ->orderBy('pg.namalengkap')
+ ->get();
+
+ $pegawaiIds = collect($pegawaiRecap)->pluck('id')->filter()->values()->all();
+ $praakreDetailAll = collect();
+ if (count($pegawaiIds) > 0) {
+ $praakreDetailAll = DB::connection('pgsql')
+ ->table('public.praakre as p')
+ ->leftJoin('public.masterpitstop as m', function ($join) {
+ $join->on(DB::raw('m.id::text'), '=', 'p.masterpitstop_id')
+ ->where('m.statusenabled', true);
+ })
+ ->leftJoin('public.pegawai_m as pen', function ($join) {
+ $join->on(DB::raw('pen.id::text'), '=', 'p.action_at');
+ })
+ ->whereIn('p.pegawai_id', $pegawaiIds)
+ ->where(function ($q) {
+ $q->whereNull('p.tipe_karyawan')
+ ->orWhere('p.tipe_karyawan', 'internal');
+ })
+ ->whereNotNull('m.id')
+ ->select([
+ 'p.pegawai_id',
+ DB::raw("coalesce(m.nama, '-') as pitstop_nama"),
+ 'p.nilai',
+ DB::raw("coalesce(pen.namalengkap, '-') as penilai_nama"),
+ ])
+ ->orderBy('p.pegawai_id')
+ ->orderBy('m.id')
+ ->orderBy('p.id')
+ ->get();
+ }
+
$filename = 'monitoring-pra-akreditasi-ringkasan-' . $generatedAt->format('Ymd-Hi') . '.xlsx';
- return $this->streamXlsx($filename, function (Spreadsheet $spreadsheet) use ($unitAgg, $totalSteps) {
- $sheet = $spreadsheet->getActiveSheet();
- $sheet->setTitle('Internal (Summary)');
+ return $this->streamXlsx($filename, function (Spreadsheet $spreadsheet) use ($unitAgg, $pegawaiRecap, $praakreDetailAll, $totalSteps) {
+ // Sheet 1: Rekap Unit
+ $unitSheet = $spreadsheet->getActiveSheet();
+ $unitSheet->setTitle('Rekap Unit');
$headers = ['Nama Unit', 'Total Pitstop', 'Total Karyawan', 'Karyawan Selesai'];
foreach ($headers as $i => $h) {
- $sheet->setCellValueByColumnAndRow($i + 1, 1, $h);
+ $unitSheet->setCellValueByColumnAndRow($i + 1, 1, $h);
}
- $sheet->getStyle('A1:E1')->getFont()->setBold(true);
+ $unitSheet->getStyle('A1:D1')->getFont()->setBold(true);
$row = 2;
foreach ($unitAgg as $r) {
- $sheet->setCellValueByColumnAndRow(1, $row, (string) ($r->unit_name ?? '-'));
- $sheet->setCellValueByColumnAndRow(2, $row, (int) $totalSteps);
- $sheet->setCellValueByColumnAndRow(3, $row, (int) ($r->total_pegawai ?? 0));
- $sheet->setCellValueByColumnAndRow(4, $row, (int) ($r->pegawai_selesai ?? 0));
+ $unitSheet->setCellValueByColumnAndRow(1, $row, (string) ($r->unit_name ?? '-'));
+ $unitSheet->setCellValueByColumnAndRow(2, $row, (int) $totalSteps);
+ $unitSheet->setCellValueByColumnAndRow(3, $row, (int) ($r->total_pegawai ?? 0));
+ $unitSheet->setCellValueByColumnAndRow(4, $row, (int) ($r->pegawai_selesai ?? 0));
$row++;
}
- foreach(range('A', 'E') as $col){
- $sheet->getColumnDimension($col)->setAutoSize(true);
+ foreach (range('A', 'D') as $col) {
+ $unitSheet->getColumnDimension($col)->setAutoSize(true);
}
+
+ // Sheet 2: Rekap Karyawan
+ $pegawaiSheet = $spreadsheet->createSheet();
+ $pegawaiSheet->setTitle('Rekap Karyawan');
+
+ $pegawaiHeaders = ['Nama Unit', 'Nama Karyawan', 'NIP', 'Lulus Pitstop', 'Total Pitstop', 'Belum Dikerjakan'];
+ foreach ($pegawaiHeaders as $i => $h) {
+ $pegawaiSheet->setCellValueByColumnAndRow($i + 1, 1, $h);
+ }
+ $pegawaiSheet->getStyle('A1:F1')->getFont()->setBold(true);
+
+ $pegawaiRow = 2;
+ foreach ($pegawaiRecap as $r) {
+ $pegawaiSheet->setCellValueByColumnAndRow(1, $pegawaiRow, (string) ($r->unit_name ?? '-'));
+ $pegawaiSheet->setCellValueByColumnAndRow(2, $pegawaiRow, (string) ($r->nama ?? '-'));
+ $pegawaiSheet->setCellValueExplicitByColumnAndRow(3, $pegawaiRow, (string) ($r->nip_pns ?? '-'), DataType::TYPE_STRING);
+ $pegawaiSheet->setCellValueByColumnAndRow(4, $pegawaiRow, (int) ($r->lulus_count ?? 0));
+ $pegawaiSheet->setCellValueByColumnAndRow(5, $pegawaiRow, (int) $totalSteps);
+ $pegawaiSheet->setCellValueByColumnAndRow(6, $pegawaiRow, (string) ($r->belum_steps ?? ''));
+ $pegawaiRow++;
+ }
+ foreach (range('A', 'F') as $col) {
+ $pegawaiSheet->getColumnDimension($col)->setAutoSize(true);
+ }
+
+ // Sheet 3: Detail PraAkre Karyawan
+ $detailSheet = $spreadsheet->createSheet();
+ $detailSheet->setTitle('Detail PraAkre');
+
+ $detailHeaders = ['Nama Unit', 'Nama Karyawan', 'NIP', 'Pitstop', 'Nilai', 'Penilai'];
+ foreach ($detailHeaders as $i => $h) {
+ $detailSheet->setCellValueByColumnAndRow($i + 1, 1, $h);
+ }
+ $detailSheet->getStyle('A1:F1')->getFont()->setBold(true);
+
+ $pegawaiById = collect($pegawaiRecap)->keyBy('id');
+ $detailRow = 2;
+ $lastPegawaiId = null;
+ foreach ($praakreDetailAll as $d) {
+ if (!is_null($lastPegawaiId) && (string) $lastPegawaiId !== (string) $d->pegawai_id) {
+ $detailSheet->getStyle('A' . $detailRow . ':F' . $detailRow)
+ ->applyFromArray([
+ 'borders' => [
+ 'top' => [
+ 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
+ 'color' => ['argb' => 'FF999999'],
+ ],
+ ],
+ 'fill' => [
+ 'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
+ 'startColor' => ['argb' => 'FF1E88E5'],
+ ],
+ ]);
+ $detailRow++;
+ }
+
+ $pg = $pegawaiById->get($d->pegawai_id);
+ $detailSheet->setCellValueByColumnAndRow(1, $detailRow, (string) data_get($pg, 'unit_name', '-'));
+ $detailSheet->setCellValueByColumnAndRow(2, $detailRow, (string) data_get($pg, 'nama', '-'));
+ $detailSheet->setCellValueExplicitByColumnAndRow(3, $detailRow, (string) data_get($pg, 'nip_pns', '-'), DataType::TYPE_STRING);
+ $detailSheet->setCellValueByColumnAndRow(4, $detailRow, (string) ($d->pitstop_nama ?? '-'));
+ $detailSheet->setCellValueByColumnAndRow(5, $detailRow, (string) ($d->nilai ?? ''));
+ $detailSheet->setCellValueByColumnAndRow(6, $detailRow, (string) ($d->penilai_nama ?? '-'));
+ $detailRow++;
+ $lastPegawaiId = $d->pegawai_id;
+ }
+ foreach (range('A', 'F') as $col) {
+ $detailSheet->getColumnDimension($col)->setAutoSize(true);
+ }
+
+ $spreadsheet->setActiveSheetIndex(0);
});
}
@@ -715,11 +861,17 @@ class PitStopController extends Controller
abort_if(!$unit, 404);
- $rows = DB::connection('pgsql')
+ $pegawaiRows = DB::connection('pgsql')
->table('public.mappegawaijabatantounitkerja_m as mp')
->join('public.pegawai_m as pg', 'pg.id', '=', 'mp.objectpegawaifk')
->join('public.unitkerjapegawai_m as ukp', 'ukp.id', '=', 'mp.objectunitkerjapegawaifk')
- ->leftJoin('public.praakre as p', 'p.pegawai_id', '=', 'pg.id')
+ ->leftJoin('public.praakre as p', function ($join) {
+ $join->on('p.pegawai_id', '=', 'pg.id')
+ ->where(function ($q) {
+ $q->whereNull('p.tipe_karyawan')
+ ->orWhere('p.tipe_karyawan', 'internal');
+ });
+ })
->leftJoin('public.masterpitstop as m', function ($join) {
$join->on(DB::raw('m.id::text'), '=', 'p.masterpitstop_id')
->where('m.statusenabled', true);
@@ -740,6 +892,7 @@ class PitStopController extends Controller
from public.masterpitstop ms
left join public.praakre px
on px.pegawai_id = pg.id
+ and (px.tipe_karyawan is null or px.tipe_karyawan = 'internal')
and px.masterpitstop_id = ms.id::text
where ms.statusenabled = true
and px.id is null
@@ -749,33 +902,108 @@ class PitStopController extends Controller
->orderBy('pg.namalengkap')
->get();
+ $pegawaiIds = collect($pegawaiRows)->pluck('id')->filter()->values()->all();
+
+ $praakreRows = collect();
+ if (count($pegawaiIds) > 0) {
+ $praakreRows = DB::connection('pgsql')
+ ->table('public.praakre as p')
+ ->leftJoin('public.masterpitstop as m', function ($join) {
+ $join->on(DB::raw('m.id::text'), '=', 'p.masterpitstop_id')
+ ->where('m.statusenabled', true);
+ })
+ ->leftJoin('public.pegawai_m as pen', function ($join) {
+ $join->on(DB::raw('pen.id::text'), '=', 'p.action_at');
+ })
+ ->whereIn('p.pegawai_id', $pegawaiIds)
+ ->where(function ($q) {
+ $q->whereNull('p.tipe_karyawan')
+ ->orWhere('p.tipe_karyawan', 'internal');
+ })
+ ->whereNotNull('m.id')
+ ->select([
+ 'p.pegawai_id',
+ DB::raw("coalesce(m.nama, '-') as pitstop_nama"),
+ 'p.nilai',
+ DB::raw("coalesce(pen.namalengkap, '-') as penilai_nama"),
+ ])
+ ->orderBy('p.pegawai_id')
+ ->orderBy('m.id')
+ ->orderBy('p.id')
+ ->get();
+ }
+
$filename = 'monitoring-pra-akreditasi-unit-' . (int) $unitId . '-' . $generatedAt->format('Ymd-Hi') . '.xlsx';
- return $this->streamXlsx($filename, function (Spreadsheet $spreadsheet) use ($rows, $unit, $totalSteps) {
- $sheet = $spreadsheet->getActiveSheet();
- $sheet->setTitle('Internal (Detail)');
+ return $this->streamXlsx($filename, function (Spreadsheet $spreadsheet) use ($pegawaiRows, $praakreRows, $unit, $totalSteps) {
+ // Sheet 1: Rekap
+ $rekapSheet = $spreadsheet->getActiveSheet();
+ $rekapSheet->setTitle('Rekap');
- $headers = ['Nama Unit', 'Nama Karyawan', 'NIP', 'Lulus Pitstop', 'Total Pitstop', 'Belum Dikerjakan'];
- foreach ($headers as $i => $h) {
- $sheet->setCellValueByColumnAndRow($i + 1, 1, $h);
+ $rekapHeaders = ['Nama Unit', 'Nama Karyawan', 'NIP', 'Lulus Pitstop', 'Total Pitstop', 'Belum Dikerjakan'];
+ foreach ($rekapHeaders as $i => $h) {
+ $rekapSheet->setCellValueByColumnAndRow($i + 1, 1, $h);
}
- $sheet->getStyle('A1:I1')->getFont()->setBold(true);
+ $rekapSheet->getStyle('A1:F1')->getFont()->setBold(true);
- $row = 2;
- foreach ($rows as $r) {
- $lulus = (int) ($r->lulus_count ?? 0);
- $selesai = $totalSteps > 0 && $lulus >= $totalSteps ? 1 : 0;
+ $rekapRow = 2;
+ foreach ($pegawaiRows as $pg) {
+ $rekapSheet->setCellValueByColumnAndRow(1, $rekapRow, (string) ($unit->name ?? '-'));
+ $rekapSheet->setCellValueByColumnAndRow(2, $rekapRow, (string) ($pg->nama ?? '-'));
+ $rekapSheet->setCellValueExplicitByColumnAndRow(3, $rekapRow, (string) ($pg->nip_pns ?? '-'), DataType::TYPE_STRING);
+ $rekapSheet->setCellValueByColumnAndRow(4, $rekapRow, (int) ($pg->lulus_count ?? 0));
+ $rekapSheet->setCellValueByColumnAndRow(5, $rekapRow, (int) $totalSteps);
+ $rekapSheet->setCellValueByColumnAndRow(6, $rekapRow, (string) ($pg->belum_steps ?? ''));
+ $rekapRow++;
+ }
+ foreach (range('A', 'F') as $col) {
+ $rekapSheet->getColumnDimension($col)->setAutoSize(true);
+ }
- $sheet->setCellValueByColumnAndRow(1, $row, (string) ($unit->name ?? '-'));
- $sheet->setCellValueByColumnAndRow(2, $row, (string) ($r->nama ?? '-'));
- $sheet->setCellValueExplicitByColumnAndRow(3, $row, (string) ($r->nip_pns ?? '-'), DataType::TYPE_STRING);
- $sheet->setCellValueByColumnAndRow(4, $row, $lulus);
- $sheet->setCellValueByColumnAndRow(5, $row, (int) $totalSteps);
- $sheet->setCellValueByColumnAndRow(6, $row, (string) ($r->belum_steps ?? ''));
- $row++;
+ // Sheet 2: Detail
+ $detailSheet = $spreadsheet->createSheet();
+ $detailSheet->setTitle('Detail PraAkre');
+
+ $detailHeaders = ['Nama Karyawan', 'NIP', 'Pitstop', 'Nilai', 'Penilai'];
+ foreach ($detailHeaders as $i => $h) {
+ $detailSheet->setCellValueByColumnAndRow($i + 1, 1, $h);
}
- foreach(range('A', 'I') as $col){
- $sheet->getColumnDimension($col)->setAutoSize(true);
+ $detailSheet->getStyle('A1:E1')->getFont()->setBold(true);
+
+ $pegawaiById = collect($pegawaiRows)->keyBy('id');
+ $detailRow = 2;
+ $lastPegawaiId = null;
+ foreach ($praakreRows as $d) {
+ if (!is_null($lastPegawaiId) && (string) $lastPegawaiId !== (string) $d->pegawai_id) {
+ $detailSheet->getStyle('A' . $detailRow . ':E' . $detailRow)
+ ->applyFromArray([
+ 'borders' => [
+ 'top' => [
+ 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
+ 'color' => ['argb' => 'FF999999'],
+ ],
+ ],
+ 'fill' => [
+ 'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
+ 'startColor' => ['argb' => 'FF1E88E5'],
+ ],
+ ]);
+ $detailRow++;
+ }
+ $pg = $pegawaiById->get($d->pegawai_id);
+ $detailSheet->setCellValueByColumnAndRow(1, $detailRow, (string) data_get($pg, 'nama', '-'));
+ $detailSheet->setCellValueExplicitByColumnAndRow(2, $detailRow, (string) data_get($pg, 'nip_pns', '-'), DataType::TYPE_STRING);
+ $detailSheet->setCellValueByColumnAndRow(3, $detailRow, (string) ($d->pitstop_nama ?? '-'));
+ $detailSheet->setCellValueByColumnAndRow(4, $detailRow, (string) ($d->nilai ?? ''));
+ $detailSheet->setCellValueByColumnAndRow(5, $detailRow, (string) ($d->penilai_nama ?? '-'));
+ $detailRow++;
+ $lastPegawaiId = $d->pegawai_id;
}
+ foreach (range('A', 'E') as $col) {
+ $detailSheet->getColumnDimension($col)->setAutoSize(true);
+ }
+
+ // default active sheet
+ $spreadsheet->setActiveSheetIndex(0);
});
}
@@ -819,28 +1047,159 @@ class PitStopController extends Controller
->orderBy('t.tipe')
->get();
+ // Rekap karyawan external (all tipe)
+ $pegawaiRecap = DB::connection('pgsql')
+ ->table('public.pegawai_luar_pl as pl')
+ ->leftJoin('public.praakre as p', function ($join) {
+ $join->on('p.pegawai_id', '=', 'pl.id')
+ ->where('p.tipe_karyawan', 'luar');
+ })
+ ->leftJoin('public.masterpitstop as m', function ($join) {
+ $join->on(DB::raw('m.id::text'), '=', 'p.masterpitstop_id')
+ ->where('m.statusenabled', true);
+ })
+ ->select([
+ DB::raw("coalesce(nullif(pl.tipe, ''), '-') as tipe"),
+ 'pl.id',
+ DB::raw("coalesce(pl.nama, '-') as nama"),
+ DB::raw("coalesce(pl.nik, '-') as nik"),
+ DB::raw("count(distinct m.id) as lulus_count"),
+ DB::raw("coalesce((
+ select string_agg(ms.nama, ', ' order by ms.id)
+ from public.masterpitstop ms
+ left join public.praakre px
+ on px.pegawai_id = pl.id
+ and px.tipe_karyawan = 'luar'
+ and px.masterpitstop_id = ms.id::text
+ where ms.statusenabled = true
+ and px.id is null
+ ), '') as belum_steps"),
+ ])
+ ->groupBy(DB::raw("coalesce(nullif(pl.tipe, ''), '-')"), 'pl.id', 'pl.nama', 'pl.nik')
+ ->orderBy(DB::raw("coalesce(nullif(pl.tipe, ''), '-')"))
+ ->orderBy('pl.nama')
+ ->get();
+
+ $pegawaiIds = collect($pegawaiRecap)->pluck('id')->filter()->values()->all();
+ $praakreDetailAll = collect();
+ if (count($pegawaiIds) > 0) {
+ $praakreDetailAll = DB::connection('pgsql')
+ ->table('public.praakre as p')
+ ->leftJoin('public.masterpitstop as m', function ($join) {
+ $join->on(DB::raw('m.id::text'), '=', 'p.masterpitstop_id')
+ ->where('m.statusenabled', true);
+ })
+ ->leftJoin('public.pegawai_m as pen', function ($join) {
+ $join->on(DB::raw('pen.id::text'), '=', 'p.action_at');
+ })
+ ->whereIn('p.pegawai_id', $pegawaiIds)
+ ->where('p.tipe_karyawan', 'luar')
+ ->whereNotNull('m.id')
+ ->select([
+ 'p.pegawai_id',
+ DB::raw("coalesce(m.nama, '-') as pitstop_nama"),
+ 'p.nilai',
+ DB::raw("coalesce(pen.namalengkap, '-') as penilai_nama"),
+ ])
+ ->orderBy('p.pegawai_id')
+ ->orderBy('m.id')
+ ->orderBy('p.id')
+ ->get();
+ }
+
$filename = 'monitoring-karyawan-luar-ringkasan-' . $generatedAt->format('Ymd-Hi') . '.xlsx';
- return $this->streamXlsx($filename, function (Spreadsheet $spreadsheet) use ($tipeAgg, $totalSteps) {
- $sheet = $spreadsheet->getActiveSheet();
- $sheet->setTitle('External (Summary)');
+ return $this->streamXlsx($filename, function (Spreadsheet $spreadsheet) use ($tipeAgg, $pegawaiRecap, $praakreDetailAll, $totalSteps) {
+ // Sheet 1: Rekap Unit/Tipe
+ $unitSheet = $spreadsheet->getActiveSheet();
+ $unitSheet->setTitle('Rekap Unit');
$headers = ['Unit', 'Total Pitstop', 'Total Karyawan External', 'Karyawan External Selesai'];
foreach ($headers as $i => $h) {
- $sheet->setCellValueByColumnAndRow($i + 1, 1, $h);
+ $unitSheet->setCellValueByColumnAndRow($i + 1, 1, $h);
}
- $sheet->getStyle('A1:D1')->getFont()->setBold(true);
+ $unitSheet->getStyle('A1:D1')->getFont()->setBold(true);
$row = 2;
foreach ($tipeAgg as $r) {
- $sheet->setCellValueByColumnAndRow(1, $row, (string) ($r->tipe ?? '-'));
- $sheet->setCellValueByColumnAndRow(2, $row, (int) $totalSteps);
- $sheet->setCellValueByColumnAndRow(3, $row, (int) ($r->total_pegawai ?? 0));
- $sheet->setCellValueByColumnAndRow(4, $row, (int) ($r->pegawai_selesai ?? 0));
+ $unitSheet->setCellValueByColumnAndRow(1, $row, (string) ($r->tipe ?? '-'));
+ $unitSheet->setCellValueByColumnAndRow(2, $row, (int) $totalSteps);
+ $unitSheet->setCellValueByColumnAndRow(3, $row, (int) ($r->total_pegawai ?? 0));
+ $unitSheet->setCellValueByColumnAndRow(4, $row, (int) ($r->pegawai_selesai ?? 0));
$row++;
}
-
- foreach(range('A', 'D') as $col){
- $sheet->getColumnDimension($col)->setAutoSize(true);
+ foreach (range('A', 'D') as $col) {
+ $unitSheet->getColumnDimension($col)->setAutoSize(true);
}
+
+ // Sheet 2: Rekap Karyawan
+ $pegawaiSheet = $spreadsheet->createSheet();
+ $pegawaiSheet->setTitle('Rekap Karyawan');
+
+ $pegawaiHeaders = ['Unit', 'Nama', 'NIK', 'Lulus Pitstop', 'Total Pitstop', 'Belum Dikerjakan'];
+ foreach ($pegawaiHeaders as $i => $h) {
+ $pegawaiSheet->setCellValueByColumnAndRow($i + 1, 1, $h);
+ }
+ $pegawaiSheet->getStyle('A1:F1')->getFont()->setBold(true);
+
+ $pegawaiRow = 2;
+ foreach ($pegawaiRecap as $r) {
+ $pegawaiSheet->setCellValueByColumnAndRow(1, $pegawaiRow, (string) ($r->tipe ?? '-'));
+ $pegawaiSheet->setCellValueByColumnAndRow(2, $pegawaiRow, (string) ($r->nama ?? '-'));
+ $pegawaiSheet->setCellValueExplicitByColumnAndRow(3, $pegawaiRow, (string) ($r->nik ?? '-'), DataType::TYPE_STRING);
+ $pegawaiSheet->setCellValueByColumnAndRow(4, $pegawaiRow, (int) ($r->lulus_count ?? 0));
+ $pegawaiSheet->setCellValueByColumnAndRow(5, $pegawaiRow, (int) $totalSteps);
+ $pegawaiSheet->setCellValueByColumnAndRow(6, $pegawaiRow, (string) ($r->belum_steps ?? ''));
+ $pegawaiRow++;
+ }
+ foreach (range('A', 'F') as $col) {
+ $pegawaiSheet->getColumnDimension($col)->setAutoSize(true);
+ }
+
+ // Sheet 3: Detail PraAkre
+ $detailSheet = $spreadsheet->createSheet();
+ $detailSheet->setTitle('Detail PraAkre');
+
+ $detailHeaders = ['Unit', 'Nama', 'NIK', 'Pitstop', 'Nilai', 'Penilai'];
+ foreach ($detailHeaders as $i => $h) {
+ $detailSheet->setCellValueByColumnAndRow($i + 1, 1, $h);
+ }
+ $detailSheet->getStyle('A1:F1')->getFont()->setBold(true);
+
+ $pegawaiById = collect($pegawaiRecap)->keyBy('id');
+ $detailRow = 2;
+ $lastPegawaiId = null;
+ foreach ($praakreDetailAll as $d) {
+ if (!is_null($lastPegawaiId) && (string) $lastPegawaiId !== (string) $d->pegawai_id) {
+ $detailSheet->getStyle('A' . $detailRow . ':F' . $detailRow)
+ ->applyFromArray([
+ 'borders' => [
+ 'top' => [
+ 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
+ 'color' => ['argb' => 'FF999999'],
+ ],
+ ],
+ 'fill' => [
+ 'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
+ 'startColor' => ['argb' => 'FF1E88E5'],
+ ],
+ ]);
+ $detailRow++;
+ }
+
+ $pg = $pegawaiById->get($d->pegawai_id);
+ $detailSheet->setCellValueByColumnAndRow(1, $detailRow, (string) data_get($pg, 'tipe', '-'));
+ $detailSheet->setCellValueByColumnAndRow(2, $detailRow, (string) data_get($pg, 'nama', '-'));
+ $detailSheet->setCellValueExplicitByColumnAndRow(3, $detailRow, (string) data_get($pg, 'nik', '-'), DataType::TYPE_STRING);
+ $detailSheet->setCellValueByColumnAndRow(4, $detailRow, (string) ($d->pitstop_nama ?? '-'));
+ $detailSheet->setCellValueByColumnAndRow(5, $detailRow, (string) ($d->nilai ?? ''));
+ $detailSheet->setCellValueByColumnAndRow(6, $detailRow, (string) ($d->penilai_nama ?? '-'));
+ $detailRow++;
+ $lastPegawaiId = $d->pegawai_id;
+ }
+ foreach (range('A', 'F') as $col) {
+ $detailSheet->getColumnDimension($col)->setAutoSize(true);
+ }
+
+ $spreadsheet->setActiveSheetIndex(0);
});
}
@@ -876,34 +1235,104 @@ class PitStopController extends Controller
->orderBy('pl.nama')
->get();
+ $pegawaiIds = collect($rows)->pluck('id')->filter()->values()->all();
+ $praakreRows = collect();
+ if (count($pegawaiIds) > 0) {
+ $praakreRows = DB::connection('pgsql')
+ ->table('public.praakre as p')
+ ->leftJoin('public.masterpitstop as m', function ($join) {
+ $join->on(DB::raw('m.id::text'), '=', 'p.masterpitstop_id')
+ ->where('m.statusenabled', true);
+ })
+ ->leftJoin('public.pegawai_m as pen', function ($join) {
+ $join->on(DB::raw('pen.id::text'), '=', 'p.action_at');
+ })
+ ->whereIn('p.pegawai_id', $pegawaiIds)
+ ->where('p.tipe_karyawan', 'luar')
+ ->whereNotNull('m.id')
+ ->select([
+ 'p.pegawai_id',
+ DB::raw("coalesce(m.nama, '-') as pitstop_nama"),
+ 'p.nilai',
+ DB::raw("coalesce(pen.namalengkap, '-') as penilai_nama"),
+ ])
+ ->orderBy('p.pegawai_id')
+ ->orderBy('m.id')
+ ->orderBy('p.id')
+ ->get();
+ }
+
$filename = 'monitoring-karyawan-luar-' . preg_replace('/[^a-zA-Z0-9_-]+/', '-', (string) $tipe) . '-' . $generatedAt->format('Ymd-Hi') . '.xlsx';
- return $this->streamXlsx($filename, function (Spreadsheet $spreadsheet) use ($rows, $tipe, $totalSteps) {
- $sheet = $spreadsheet->getActiveSheet();
- $sheet->setTitle('External (Detail)');
+ return $this->streamXlsx($filename, function (Spreadsheet $spreadsheet) use ($rows, $praakreRows, $tipe, $totalSteps) {
+ // Sheet 1: Rekap
+ $rekapSheet = $spreadsheet->getActiveSheet();
+ $rekapSheet->setTitle('Rekap');
- $headers = ['Unit', 'Nama', 'NIK', 'Lulus Pitstop', 'Total Pitstop', 'Belum Dikerjakan'];
- foreach ($headers as $i => $h) {
- $sheet->setCellValueByColumnAndRow($i + 1, 1, $h);
+ $rekapHeaders = ['Unit', 'Nama', 'NIK', 'Lulus Pitstop', 'Total Pitstop', 'Belum Dikerjakan'];
+ foreach ($rekapHeaders as $i => $h) {
+ $rekapSheet->setCellValueByColumnAndRow($i + 1, 1, $h);
}
- $sheet->getStyle('A1:H1')->getFont()->setBold(true);
+ $rekapSheet->getStyle('A1:F1')->getFont()->setBold(true);
- $row = 2;
+ $rekapRow = 2;
foreach ($rows as $r) {
- $lulus = (int) ($r->lulus_count ?? 0);
- $selesai = $totalSteps > 0 && $lulus >= $totalSteps ? 1 : 0;
-
- $sheet->setCellValueByColumnAndRow(1, $row, (string) $tipe);
- $sheet->setCellValueByColumnAndRow(2, $row, (string) ($r->nama ?? '-'));
- $sheet->setCellValueExplicitByColumnAndRow(3, $row, (string) ($r->nik ?? '-'), DataType::TYPE_STRING);
- $sheet->setCellValueByColumnAndRow(4, $row, $lulus);
- $sheet->setCellValueByColumnAndRow(5, $row, (int) $totalSteps);
- $sheet->setCellValueByColumnAndRow(6, $row, (string) ($r->belum_steps ?? ''));
- $row++;
+ $rekapSheet->setCellValueByColumnAndRow(1, $rekapRow, (string) $tipe);
+ $rekapSheet->setCellValueByColumnAndRow(2, $rekapRow, (string) ($r->nama ?? '-'));
+ $rekapSheet->setCellValueExplicitByColumnAndRow(3, $rekapRow, (string) ($r->nik ?? '-'), DataType::TYPE_STRING);
+ $rekapSheet->setCellValueByColumnAndRow(4, $rekapRow, (int) ($r->lulus_count ?? 0));
+ $rekapSheet->setCellValueByColumnAndRow(5, $rekapRow, (int) $totalSteps);
+ $rekapSheet->setCellValueByColumnAndRow(6, $rekapRow, (string) ($r->belum_steps ?? ''));
+ $rekapRow++;
+ }
+ foreach (range('A', 'F') as $col) {
+ $rekapSheet->getColumnDimension($col)->setAutoSize(true);
}
- foreach(range('A', 'H') as $col){
- $sheet->getColumnDimension($col)->setAutoSize(true);
+ // Sheet 2: Detail
+ $detailSheet = $spreadsheet->createSheet();
+ $detailSheet->setTitle('Detail PraAkre');
+
+ $detailHeaders = ['Unit', 'Nama', 'NIK', 'Pitstop', 'Nilai', 'Penilai'];
+ foreach ($detailHeaders as $i => $h) {
+ $detailSheet->setCellValueByColumnAndRow($i + 1, 1, $h);
}
+ $detailSheet->getStyle('A1:F1')->getFont()->setBold(true);
+
+ $pegawaiById = collect($rows)->keyBy('id');
+ $detailRow = 2;
+ $lastPegawaiId = null;
+ foreach ($praakreRows as $d) {
+ if (!is_null($lastPegawaiId) && (string) $lastPegawaiId !== (string) $d->pegawai_id) {
+ $detailSheet->getStyle('A' . $detailRow . ':F' . $detailRow)
+ ->applyFromArray([
+ 'borders' => [
+ 'top' => [
+ 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
+ 'color' => ['argb' => 'FF999999'],
+ ],
+ ],
+ 'fill' => [
+ 'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
+ 'startColor' => ['argb' => 'FF1E88E5'],
+ ],
+ ]);
+ $detailRow++;
+ }
+ $pg = $pegawaiById->get($d->pegawai_id);
+ $detailSheet->setCellValueByColumnAndRow(1, $detailRow, (string) $tipe);
+ $detailSheet->setCellValueByColumnAndRow(2, $detailRow, (string) data_get($pg, 'nama', '-'));
+ $detailSheet->setCellValueExplicitByColumnAndRow(3, $detailRow, (string) data_get($pg, 'nik', '-'), DataType::TYPE_STRING);
+ $detailSheet->setCellValueByColumnAndRow(4, $detailRow, (string) ($d->pitstop_nama ?? '-'));
+ $detailSheet->setCellValueByColumnAndRow(5, $detailRow, (string) ($d->nilai ?? ''));
+ $detailSheet->setCellValueByColumnAndRow(6, $detailRow, (string) ($d->penilai_nama ?? '-'));
+ $detailRow++;
+ $lastPegawaiId = $d->pegawai_id;
+ }
+ foreach (range('A', 'F') as $col) {
+ $detailSheet->getColumnDimension($col)->setAutoSize(true);
+ }
+
+ $spreadsheet->setActiveSheetIndex(0);
});
}
@@ -1271,6 +1700,9 @@ class PitStopController extends Controller
$join->on(DB::raw('m.id::text'), '=', 'p.masterpitstop_id')
->where('m.statusenabled', true);
})
+ ->leftJoin('public.pegawai_m as pen', function ($join) {
+ $join->on(DB::raw('pen.id::text'), '=', 'p.action_at');
+ })
->where('p.pegawai_id', $pegawaiId)
// ->where('p.status', 'lulus')
->whereNotNull('m.id')
@@ -1279,6 +1711,7 @@ class PitStopController extends Controller
'p.masterpitstop_id',
DB::raw("coalesce(m.nama, '-') as step_nama"),
'p.nilai',
+ DB::raw("coalesce(pen.namalengkap, '-') as penilai_nama"),
DB::raw("to_char(p.created_at, 'DD-MM-YYYY HH24:MI') as created_at"),
])
->orderByDesc('p.id')
@@ -1313,6 +1746,9 @@ class PitStopController extends Controller
$join->on(DB::raw('m.id::text'), '=', 'p.masterpitstop_id')
->where('m.statusenabled', true);
})
+ ->leftJoin('public.pegawai_m as pen', function ($join) {
+ $join->on(DB::raw('pen.id::text'), '=', 'p.action_at');
+ })
->where('p.tipe_karyawan', 'luar')
->where('p.pegawai_id', $pegawaiId)
->whereNotNull('m.id')
@@ -1321,6 +1757,7 @@ class PitStopController extends Controller
'p.masterpitstop_id',
DB::raw("coalesce(m.nama, '-') as step_nama"),
'p.nilai',
+ DB::raw("coalesce(pen.namalengkap, '-') as penilai_nama"),
DB::raw("to_char(p.created_at, 'DD-MM-YYYY HH24:MI') as created_at"),
])
->orderByDesc('p.id')
@@ -1503,6 +1940,9 @@ class PitStopController extends Controller
$join->on(DB::raw('m.id::text'), '=', 'p.masterpitstop_id')
->where('m.statusenabled', true);
})
+ ->leftJoin('public.pegawai_m as pen', function ($join) {
+ $join->on(DB::raw('pen.id::text'), '=', 'p.action_at');
+ })
->where('p.pegawai_id', $pegawaiId)
->whereNotNull('m.id')
->select([
@@ -1510,6 +1950,7 @@ class PitStopController extends Controller
'p.masterpitstop_id',
DB::raw("coalesce(m.nama, '-') as step_nama"),
'p.nilai',
+ DB::raw("coalesce(pen.namalengkap, '-') as penilai_nama"),
DB::raw("to_char(p.created_at, 'DD-MM-YYYY HH24:MI') as created_at"),
])
->orderByDesc('p.id')
@@ -1544,6 +1985,9 @@ class PitStopController extends Controller
$join->on(DB::raw('m.id::text'), '=', 'p.masterpitstop_id')
->where('m.statusenabled', true);
})
+ ->leftJoin('public.pegawai_m as pen', function ($join) {
+ $join->on(DB::raw('pen.id::text'), '=', 'p.action_at');
+ })
->where('p.tipe_karyawan', 'luar')
->where('p.status', 'lulus')
->where('p.pegawai_id', $pegawaiId)
@@ -1553,6 +1997,8 @@ class PitStopController extends Controller
'p.masterpitstop_id',
DB::raw("coalesce(m.nama, '-') as step_nama"),
'p.status',
+ 'p.nilai',
+ DB::raw("coalesce(pen.namalengkap, '-') as penilai_nama"),
DB::raw("to_char(p.created_at, 'DD-MM-YYYY HH24:MI') as created_at"),
])
->orderByDesc('p.id')
diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php
index a1b8773..eb5bcfc 100644
--- a/resources/views/auth/login.blade.php
+++ b/resources/views/auth/login.blade.php
@@ -20,10 +20,10 @@
.right-panel {
background: #ffffff;
- min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
+ padding: 24px;
}
.card-custom {
@@ -51,49 +51,50 @@
.hide-xs {
display: none !important;
}
+ .right-panel {
+ min-height: auto;
+ padding: 20px 16px;
+ align-items: flex-start;
+ }
+ .left-panel {
+ min-height: auto;
+ padding: 16px;
+ }
+ .login-hero-title {
+ font-size: 22px;
+ line-height: 1.25;
+ }
+ .login-monitor-card {
+ border-radius: 12px;
+ box-shadow: 0 8px 25px rgba(0,0,0,0.06);
+ border: none;
+ }
+ #searchAllKaryawan {
+ width: 100% !important;
+ }
+ }
+
+ @media (min-width: 576px) {
+ .right-panel {
+ min-height: 100vh;
+ }
}
@endsection
@section('content')
-
-
-
-
-
-
-
Monitoring Pra Akreditasi
-
-
-
-
-
-
- | Nama |
- Unit / Tipe |
- Progress |
- Belum dikerjakan |
- Jenis |
- Aksi |
-
-
-
-
-
-
+
+
+
+
+
 }})
+
Login Admin Pra Akreditasi
+
Masuk untuk mengelola penilaian dan monitoring.
-
-
-
-
-
-
- Login Admin Pra Akreditasi
-
-
+
+
+
+
+
+
Monitoring Pra Akreditasi
+
+
+
+
+
+ | Nama |
+ Unit / Tipe |
+ Progress |
+ Belum dikerjakan |
+ Jenis |
+ Aksi |
+
+
+
+
+
+
diff --git a/resources/views/partials/main.blade.php b/resources/views/partials/main.blade.php
index d08620e..ec872af 100644
--- a/resources/views/partials/main.blade.php
+++ b/resources/views/partials/main.blade.php
@@ -1,9 +1,11 @@
-
+
Pra Akreditasi {{ $title ? "| {$title}" : ' '}}
+
+
diff --git a/resources/views/partials/main_auth.blade.php b/resources/views/partials/main_auth.blade.php
index 9669d16..d95bef3 100644
--- a/resources/views/partials/main_auth.blade.php
+++ b/resources/views/partials/main_auth.blade.php
@@ -1,9 +1,11 @@
-
+
Pra Akreditasi RSAB Harapan Kita
+
+
diff --git a/resources/views/pitstop/progress_external_detail.blade.php b/resources/views/pitstop/progress_external_detail.blade.php
index 2260838..a12ec34 100644
--- a/resources/views/pitstop/progress_external_detail.blade.php
+++ b/resources/views/pitstop/progress_external_detail.blade.php
@@ -67,6 +67,14 @@
+
@@ -74,6 +82,7 @@
| Nama Step |
Nilai |
+ Pemberi Nilai |
Waktu |
@@ -135,6 +144,7 @@
| ${escapeHtml(r.step_nama ?? '-')} |
${r.nilai} |
+ ${escapeHtml(r.penilai_nama ?? '-')} |
${escapeHtml(waktu)} |
`;
})
diff --git a/resources/views/pitstop/progress_unit.blade.php b/resources/views/pitstop/progress_unit.blade.php
index 127ae72..1d80ab3 100644
--- a/resources/views/pitstop/progress_unit.blade.php
+++ b/resources/views/pitstop/progress_unit.blade.php
@@ -151,6 +151,14 @@
+
@@ -158,6 +166,7 @@
| Nama Step |
Nilai |
+ Pemberi Nilai |
Waktu |
@@ -223,6 +232,7 @@
| ${escapeHtml(r.step_nama ?? '-')} |
${r.nilai} |
+ ${escapeHtml(r.penilai_nama ?? '-')} |
${escapeHtml(waktu)} |
`;
})
diff --git a/resources/views/pitstop/progress_unit_detail.blade.php b/resources/views/pitstop/progress_unit_detail.blade.php
index acd6b4d..13ec68a 100644
--- a/resources/views/pitstop/progress_unit_detail.blade.php
+++ b/resources/views/pitstop/progress_unit_detail.blade.php
@@ -67,6 +67,14 @@
+
@@ -74,6 +82,7 @@
| Nama Step |
Nilai |
+ Pemberi Nilai |
Waktu |
@@ -140,6 +149,7 @@
| ${escapeHtml(r.step_nama ?? '-')} |
${r.nilai} |
+ ${escapeHtml(r.penilai_nama ?? '-')} |
${escapeHtml(waktu)} |
`;
})