Compare commits

...

4 Commits

20 changed files with 1454 additions and 115 deletions
+2
View File
@@ -93,3 +93,5 @@ GOOGLE_DRIVE_FOLDER_ID=0AJQK-NMrB4b_Uk9PVA
# 1 = Login biasa (NIP/Password + Google OAuth)
# 2 = Login SSO Portal Untan (khusus domain *.untan.ac.id)
LOGIN_MODE=2
DOCS_TOKEN=3863b2e41c487d57f6a14d8a068eb817f244374bed7a9e3d
+3
View File
@@ -93,3 +93,6 @@ GOOGLE_DRIVE_FOLDER_ID=
# 1 = Login Biasa (NIP/Password + Google OAuth)
# 2 = Login SSO Portal Untan (khusus domain *.untan.ac.id)
LOGIN_MODE=2
# Token akses halaman dokumentasi API (/docs)
DOCS_TOKEN=
+3
View File
@@ -20,3 +20,6 @@ yarn-error.log
/.nova
/.vscode
/.zed
# Data snapshot JSON (mis. P1 Dawai: php artisan rekap:p1-dawai-json)
/resources/data/
@@ -0,0 +1,110 @@
<?php
namespace App\Console\Commands\Rekapitulasi;
use App\Models\Verifikator\Rekapitulasi;
use App\Services\DawaiService;
use App\Services\P1DawaiSnapshot;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Throwable;
class RekapP1DawaiJsonCommand extends Command
{
protected $signature = 'rekap:p1-dawai-json {--tahun= : Tahun P1 (default: tahun sekarang)}';
protected $description = 'Ambil data P1 seluruh pegawai dari API Dawai (Januari s.d. sekarang) dan simpan ke JSON (tanpa menulis ke database)';
public function handle(): int
{
$tahun = (int) (filled($this->option('tahun')) ? $this->option('tahun') : Carbon::now()->year);
$bulanTerakhir = $tahun === Carbon::now()->year ? Carbon::now()->month : 12;
if ($tahun > Carbon::now()->year) {
$this->error('Tahun tidak boleh melebihi tahun sekarang.');
return self::FAILURE;
}
$units = Rekapitulasi::where('tahun', $tahun)->pluck('id_unit_kerja')
->map(fn ($id) => (int) $id === 0 ? 99 : (int) $id)
->unique()
->values();
if ($units->isEmpty()) {
$units = collect([99, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
}
$dawai = new DawaiService;
$pegawaiMap = [];
$gagal = [];
$this->info("Mengambil P1 Dawai tahun {$tahun} (Januari - bulan {$bulanTerakhir}) untuk {$units->count()} unit...");
$bar = $this->output->createProgressBar($bulanTerakhir * $units->count());
$bar->start();
for ($bulan = 1; $bulan <= $bulanTerakhir; $bulan++) {
foreach ($units as $unit) {
try {
$rows = $dawai->getDataP1(null, $tahun, $bulan, $unit);
} catch (Throwable $th) {
$gagal[] = "bulan {$bulan} unit {$unit}: ".$th->getMessage();
$bar->advance();
continue;
}
foreach ($rows as $row) {
$nip = preg_replace("/['.\-]/", '', (string) ($row['nip'] ?? ''));
if ($nip === '') {
continue;
}
$pegawaiMap[$nip] ??= [
'nama' => $row['nama_lengkap'] ?? null,
'jenis_pegawai' => strtolower((string) ($row['jenis_pegawai'] ?? '')),
'id_unit' => $row['id_unit'] ?? null,
'nama_unit' => $row['nama_unit'] ?? null,
'bulanan' => [],
];
$bulanan = &$pegawaiMap[$nip]['bulanan'][$bulan];
$bulanan ??= ['p1' => 0.0, 'pajak' => 0.0, 'netto' => 0.0];
$bulanan['p1'] += (float) ($row['harga_p1'] ?? 0);
$bulanan['pajak'] += (float) ($row['pajak_p1'] ?? 0);
$bulanan['netto'] += (float) ($row['harga_p1_setelah_pajak'] ?? 0);
unset($bulanan);
}
$bar->advance();
}
}
$bar->finish();
$this->newLine(2);
if ($gagal !== []) {
foreach ($gagal as $pesan) {
$this->warn($pesan);
}
$this->error('Sebagian data gagal diambil, file JSON TIDAK disimpan agar tidak lengkap. Coba jalankan ulang.');
return self::FAILURE;
}
$now = Carbon::now();
$path = P1DawaiSnapshot::path($tahun, $now->format('Ymd_His'));
File::ensureDirectoryExists(dirname($path));
File::put($path, json_encode([
'tahun' => $tahun,
'bulan_terakhir' => $bulanTerakhir,
'created_at' => $now->toDateTimeString(),
'data' => $pegawaiMap,
], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
$this->info('✓ '.count($pegawaiMap)." pegawai disimpan ke {$path}");
return self::SUCCESS;
}
}
+208
View File
@@ -0,0 +1,208 @@
<?php
namespace App\Exports;
use App\Exports\Concerns\ForcesTextColumns;
use App\Http\Controllers\Perhitungan\Remunerasi\KeseluruhanController;
use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
use Maatwebsite\Excel\Concerns\WithCustomValueBinder;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Events\AfterSheet;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Style\Fill;
/**
* Export Keseluruhan mode perbandingan: P1 per bulan, Total, Total Pajak, dan Total Netto ditampilkan
* dua kolom (Database & Dawai). Pada baris yang ada selisih, kolom Jumlah P1, Total Pajak, dan Total Netto
* diberi latar kuning, dan bulan P1 yang berselisih diberi latar orange.
*/
class KeseluruhanCompareExport implements FromArray, ShouldAutoSize, WithColumnFormatting, WithCustomValueBinder, WithEvents, WithMapping
{
use ForcesTextColumns;
private const FIXED_COLUMNS = ['No.', 'Nama', 'NIP', 'Jenis Pegawai', 'Unit Kerja'];
private const SINGLE_COLUMNS = ['Jumlah P2', 'Jumlah THR', 'Jumlah R13', 'Jumlah Publikasi'];
private const PAIR_COLUMNS = ['Total', 'Total Pajak', 'Total Netto'];
private const HEADER_ROWS = 3;
private const BULAN_NAMES = [
1 => 'Januari', 2 => 'Februari', 3 => 'Maret', 4 => 'April', 5 => 'Mei', 6 => 'Juni',
7 => 'Juli', 8 => 'Agustus', 9 => 'September', 10 => 'Oktober', 11 => 'November', 12 => 'Desember',
];
private array $rows;
private int $bulanTerakhir;
private int $no = 0;
protected function nipColumns(): array
{
return ['C'];
}
public function __construct(int $tahun, ?string $jenisPegawai, mixed $unit, bool $includePppk2025 = false, bool $includeP1Zero = false)
{
$controller = app(KeseluruhanController::class);
$this->rows = $controller->getCompareRows($tahun, $jenisPegawai, $unit, $includePppk2025, $includeP1Zero);
$this->bulanTerakhir = $controller->getBulanTerakhir($tahun);
}
public function array(): array
{
return $this->rows;
}
public function map($row): array
{
$this->no++;
$bulanan = [];
for ($bulan = 1; $bulan <= $this->bulanTerakhir; $bulan++) {
$bulanan[] = $row['p1_bulanan_db'][$bulan] ?? 0;
$bulanan[] = $row['p1_bulanan_dawai'][$bulan] ?? 0;
}
return array_merge([
$this->no,
$row['nama'],
$row['nip'],
$row['jenis_pegawai'] === 'dosen' ? 'Dosen' : ($row['jenis_pegawai'] === 'tendik' ? 'Tendik' : '-'),
$row['nama_unit'],
], $bulanan, [
$row['jumlah_p2'],
$row['jumlah_thr'],
$row['jumlah_r13'],
$row['jumlah_publikasi'],
$row['total_db'],
$row['total_dawai'],
$row['total_pajak_db'],
$row['total_pajak_dawai'],
$row['total_netto_db'],
$row['total_netto_dawai'],
]);
}
private function lastColumnIndex(): int
{
return count(self::FIXED_COLUMNS) + 2 * $this->bulanTerakhir + count(self::SINGLE_COLUMNS) + 2 * count(self::PAIR_COLUMNS);
}
public function columnFormats(): array
{
$accountingFormat = '_("Rp"\ * #,##0.00_);_("Rp"\ * \-#,##0.00_);_("Rp"\ * "-"??_);_(@_)';
$formats = ['C' => '@'];
for ($i = count(self::FIXED_COLUMNS) + 1; $i <= $this->lastColumnIndex(); $i++) {
$formats[Coordinate::stringFromColumnIndex($i)] = $accountingFormat;
}
return $formats;
}
/**
* Header 3 tingkat disisipkan di atas data: baris 1 = grup ("Jumlah P1 (Januari - Sekarang)", Total, dst.),
* baris 2 = nama bulan, baris 3 = "Database" / "Dawai". Setelah itu baris dengan selisih diberi warna kuning.
*/
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$sheet = $event->sheet->getDelegate();
$sheet->insertNewRowBefore(1, self::HEADER_ROWS);
$col = fn (int $i) => Coordinate::stringFromColumnIndex($i);
$fixedCount = count(self::FIXED_COLUMNS);
foreach (self::FIXED_COLUMNS as $i => $label) {
$sheet->setCellValue($col($i + 1).'1', $label);
$sheet->mergeCells($col($i + 1).'1:'.$col($i + 1).'3');
}
$p1Start = $fixedCount + 1;
$sheet->setCellValue($col($p1Start).'1', 'Jumlah P1 (Januari - Sekarang)');
$sheet->mergeCells($col($p1Start).'1:'.$col($fixedCount + 2 * $this->bulanTerakhir).'1');
for ($bulan = 1; $bulan <= $this->bulanTerakhir; $bulan++) {
$start = $fixedCount + 2 * ($bulan - 1) + 1;
$sheet->setCellValue($col($start).'2', self::BULAN_NAMES[$bulan]);
$sheet->mergeCells($col($start).'2:'.$col($start + 1).'2');
$sheet->setCellValue($col($start).'3', 'Database');
$sheet->setCellValue($col($start + 1).'3', 'Dawai');
}
$idx = $fixedCount + 2 * $this->bulanTerakhir + 1;
foreach (self::SINGLE_COLUMNS as $label) {
$sheet->setCellValue($col($idx).'1', $label);
$sheet->mergeCells($col($idx).'1:'.$col($idx).'3');
$idx++;
}
foreach (self::PAIR_COLUMNS as $label) {
$sheet->setCellValue($col($idx).'1', $label);
$sheet->mergeCells($col($idx).'1:'.$col($idx + 1).'2');
$sheet->setCellValue($col($idx).'3', 'Database');
$sheet->setCellValue($col($idx + 1).'3', 'Dawai');
$idx += 2;
}
$lastCol = $col($this->lastColumnIndex());
$sheet->getStyle('A1:'.$lastCol.self::HEADER_ROWS)->applyFromArray([
'font' => ['bold' => true, 'color' => ['rgb' => 'FFFFFF']],
'fill' => [
'fillType' => Fill::FILL_SOLID,
'startColor' => ['rgb' => '4472C4'],
],
'alignment' => [
'horizontal' => Alignment::HORIZONTAL_CENTER,
'vertical' => Alignment::VERTICAL_CENTER,
'wrapText' => true,
],
]);
// Stabilo kuning hanya pada blok Jumlah P1, Total Pajak, dan Total Netto; stabilo orange
// pada pasangan kolom bulan P1 yang nilainya berbeda antara Database dan Dawai.
$p1End = $fixedCount + 2 * $this->bulanTerakhir;
$pairStart = $p1End + count(self::SINGLE_COLUMNS) + 1;
$blokKuning = [
[$p1Start, $p1End],
[$pairStart + 2, $pairStart + 3],
[$pairStart + 4, $pairStart + 5],
];
$warnai = function (int $baris, int $dari, int $sampai, string $rgb) use ($sheet, $col) {
$sheet->getStyle($col($dari).$baris.':'.$col($sampai).$baris)->getFill()
->setFillType(Fill::FILL_SOLID)
->getStartColor()->setRGB($rgb);
};
foreach ($this->rows as $i => $row) {
if (! $row['ada_selisih']) {
continue;
}
$baris = self::HEADER_ROWS + $i + 1;
foreach ($blokKuning as [$dari, $sampai]) {
$warnai($baris, $dari, $sampai, 'FFFF00');
}
for ($bulan = 1; $bulan <= $this->bulanTerakhir; $bulan++) {
if (abs(($row['p1_bulanan_db'][$bulan] ?? 0) - ($row['p1_bulanan_dawai'][$bulan] ?? 0)) >= 0.01) {
$start = $fixedCount + 2 * ($bulan - 1) + 1;
$warnai($baris, $start, $start + 1, 'FFC000');
}
}
}
},
];
}
}
+2 -2
View File
@@ -44,11 +44,11 @@ class KeseluruhanExport implements FromArray, ShouldAutoSize, WithColumnFormatti
return ['C'];
}
public function __construct(int $tahun, ?string $jenisPegawai, mixed $unit, bool $includePppk2025 = false, bool $includeP1Zero = false)
public function __construct(int $tahun, ?string $jenisPegawai, mixed $unit, bool $includePppk2025 = false, bool $includeP1Zero = false, string $sumberP1 = 'db')
{
$controller = app(KeseluruhanController::class);
$this->rows = $controller->getRekapRows($tahun, $jenisPegawai, $unit, $includePppk2025, $includeP1Zero);
$this->rows = $controller->getRekapRows($tahun, $jenisPegawai, $unit, $includePppk2025, $includeP1Zero, $sumberP1);
$this->bulanTerakhir = $controller->getBulanTerakhir($tahun);
}
@@ -22,9 +22,9 @@ class MengajarController extends Controller
$exceptions = [196312201988101001, 196106051986022001];
$start = Carbon::parse('2024-05-20 00:00:00');
$end = Carbon::parse('2024-06-15 23:59:59');
$user = Pegawai::select('id', 'nip', 'nama', 'jenis_pegawai')->where('nip', $request->nip)->orWhere('nip_siakad', $request->nip)->firstOrFail();
$user = Pegawai::select('id', 'nip', 'nama', 'jenis_pegawai')->where('nip', $request->nip)->orWhere('nip_siakad', $request->nip)->first();
if (!in_array($user->nip, $exceptions)) {
if (!in_array($user?->nip, $exceptions)) {
if (!now()->isBetween($start, $end)) {
return response()->json([
'code' => 400,
@@ -33,6 +33,7 @@ class MengajarController extends Controller
], 400);
}
}
abort_if(!$user, 404, 'Pegawai tidak ditemukan');
try {
if ($user->jenis_pegawai === 'dosen') {
$token = $request->bearerToken();
@@ -37,12 +37,14 @@ class PengajuanAbsenController extends Controller
$bulan--;
}
$pegawais = Honorer::with('unit:id,nama')
$filterAbsen = function ($query) use ($periode, $bulan) {
$query->where('periode', $periode)
->whereMonth('tanggal_mulai', $bulan);
};
$honorers = Honorer::with('unit:id,nama')
->select('nip', 'nama', 'unit_id')
->with(['absen' => function ($query) use ($periode, $bulan) {
$query->where('periode', $periode)
->whereMonth('tanggal_mulai', $bulan);
}])
->with(['absen' => $filterAbsen])
->get()
->map(function ($pegawai) {
$absen = $pegawai->absen;
@@ -52,13 +54,30 @@ class PengajuanAbsenController extends Controller
});
return $pegawai;
})
});
$tendiks = Tendik::select('nip', 'nama', 'unit_kerja_id', 'unit_kerja_nama')
->whereHas('absen', $filterAbsen)
->with(['absen' => $filterAbsen])
->get()
->map(function ($pegawai) {
$absen = $pegawai->absen;
$unit = ['id' => $pegawai->unit_kerja_id, 'nama' => $pegawai->unit_kerja_nama];
unset($pegawai->absen, $pegawai->unit_kerja_id, $pegawai->unit_kerja_nama);
$pegawai->unit = $unit;
$pegawai->absen = $absen->countBy(function ($absen) {
return $absen->status;
});
return $pegawai;
});
return $honorers
->concat($tendiks)
->filter(function ($pegawai) {
return $pegawai->absen->count();
})
->flatten(1);
return $pegawais;
->values();
}
public function show(Request $request, string $nip)
@@ -488,7 +507,7 @@ class PengajuanAbsenController extends Controller
}
return response()->json([
'code' => 400,
'code' => 200,
'status' => false,
'message' => 'Pengajuan absen tidak ditemukan',
]);
@@ -2,6 +2,7 @@
namespace App\Http\Controllers\Perhitungan\Remunerasi;
use App\Exports\KeseluruhanCompareExport;
use App\Exports\KeseluruhanExport;
use App\Http\Controllers\Controller;
use App\Models\Rekapitulasi\P1;
@@ -10,6 +11,7 @@ use App\Models\Verifikator\Publikasi;
use App\Models\Verifikator\UnitKerja;
use App\Models\Verifikator\View\Pegawai;
use App\Services\DawaiService;
use App\Services\P1DawaiSnapshot;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
@@ -44,8 +46,10 @@ class KeseluruhanController extends Controller
$unit = $request->unit;
$includePppk2025 = $request->boolean('include_pppk_2025');
$includeP1Zero = $request->boolean('include_p1_zero');
$sumberP1 = $this->normalizeSumberP1($request);
$this->ensureSnapshotTersedia($tahun, $sumberP1);
$rows = collect($this->getRekapRows($tahun, $jenisPegawai, $unit, $includePppk2025, $includeP1Zero));
$rows = collect($this->getRekapRows($tahun, $jenisPegawai, $unit, $includePppk2025, $includeP1Zero, $sumberP1));
return DataTables::of($rows)
->editColumn('jenis_pegawai', fn ($row) => $row['jenis_pegawai'] === 'dosen' ? 'Dosen' : ($row['jenis_pegawai'] === 'tendik' ? 'Tendik' : '-'))
@@ -76,12 +80,16 @@ class KeseluruhanController extends Controller
$start = microtime(true);
foreach ([null, 'dosen', 'tendik', 'Dosen', 'Tendik'] as $jenis) {
Cache::forget('remunerasi_keseluruhan_v8_'.$tahun.'_'.($jenis ?: 'semua'));
Cache::forget($this->rekapCacheKey($tahun, $jenis, 'db'));
Cache::forget($this->rekapCacheKey($tahun, $jenis, 'dawai'));
Cache::forget("keseluruhan_thr_{$jenis}_{$tahun}");
Cache::forget("keseluruhan_r13_{$jenis}_{$tahun}");
}
$rows = $this->buildRekap($tahun, null);
$sumberP1 = $this->normalizeSumberP1($request);
$this->ensureSnapshotTersedia($tahun, $sumberP1);
$rows = $this->buildRekap($tahun, null, $sumberP1);
return response()->json([
'success' => true,
@@ -102,6 +110,9 @@ class KeseluruhanController extends Controller
$unit = $request->unit;
$includePppk2025 = $request->boolean('include_pppk_2025');
$includeP1Zero = $request->boolean('include_p1_zero');
$sumberP1 = $this->normalizeSumberP1($request);
$compare = $request->boolean('compare');
$this->ensureSnapshotTersedia($tahun, $compare ? 'dawai' : $sumberP1);
$unitName = '_Semua_Unit_Kerja';
if ($unit !== null && $unit !== '') {
@@ -111,9 +122,14 @@ class KeseluruhanController extends Controller
}
}
$filename = "Remunerasi_Keseluruhan_{$tahun}{$unitName}.xlsx";
$sumberSuffix = $compare ? '_Compare_P1' : ($sumberP1 === 'dawai' ? '_P1_Dawai' : '');
$filename = "Remunerasi_Keseluruhan_{$tahun}{$unitName}{$sumberSuffix}.xlsx";
return Excel::download(new KeseluruhanExport($tahun, $jenisPegawai, $unit, $includePppk2025, $includeP1Zero), $filename);
if ($compare) {
return Excel::download(new KeseluruhanCompareExport($tahun, $jenisPegawai, $unit, $includePppk2025, $includeP1Zero), $filename);
}
return Excel::download(new KeseluruhanExport($tahun, $jenisPegawai, $unit, $includePppk2025, $includeP1Zero, $sumberP1), $filename);
}
/**
@@ -121,10 +137,60 @@ 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, bool $includePppk2025 = false, bool $includeP1Zero = false): array
public function getRekapRows(int $tahun, ?string $jenisPegawai, mixed $unit, bool $includePppk2025 = false, bool $includeP1Zero = false, string $sumberP1 = 'db'): array
{
$rows = $this->buildRekap($tahun, $jenisPegawai);
return $this->applyRowFilters($this->buildRekap($tahun, $jenisPegawai, $sumberP1), $unit, $includePppk2025, $includeP1Zero)
->sortBy('nama', SORT_NATURAL | SORT_FLAG_CASE)->values()->all();
}
/**
* Rekap perbandingan P1 Database vs JSON Dawai per pegawai (untuk export compare). Tiap baris memuat
* P1 bulanan, Total, Total Pajak & Total Netto untuk kedua sumber (akhiran _db / _dawai) plus flag
* 'ada_selisih' bila ada beda di P1 bulanan, pajak, atau netto. Komponen non-P1 (P2, THR, R13,
* Publikasi) sama di kedua sumber.
*/
public function getCompareRows(int $tahun, ?string $jenisPegawai, mixed $unit, bool $includePppk2025 = false, bool $includeP1Zero = false): array
{
$db = $this->buildRekap($tahun, $jenisPegawai, 'db')->keyBy('nip');
$dawai = $this->buildRekap($tahun, $jenisPegawai, 'dawai')->keyBy('nip');
$bulanTerakhir = $this->getBulanTerakhir($tahun);
$rows = $db->keys()->merge($dawai->keys())->unique()->map(function ($nip) use ($db, $dawai, $bulanTerakhir) {
$base = $db->get($nip) ?? $dawai->get($nip);
$row = $base;
foreach (['db' => $db->get($nip), 'dawai' => $dawai->get($nip)] as $sumber => $src) {
$p1 = $src['jumlah_p1'] ?? 0.0;
$pajakP1 = $src['pajak_p1'] ?? 0.0;
$nettoP1 = $src['netto_p1'] ?? 0.0;
$row['jumlah_p1_'.$sumber] = $p1;
$row['total_'.$sumber] = ($base['total'] - $base['jumlah_p1']) + $p1;
$row['total_pajak_'.$sumber] = ($base['total_pajak'] - $base['pajak_p1']) + $pajakP1;
$row['total_netto_'.$sumber] = ($base['total_netto'] - $base['netto_p1']) + $nettoP1;
for ($b = 1; $b <= $bulanTerakhir; $b++) {
$row['p1_bulanan_'.$sumber][$b] = $src['jumlah_p1_bulanan'][$b] ?? 0.0;
}
}
$selisih = abs($row['total_pajak_db'] - $row['total_pajak_dawai']) >= 0.01
|| abs($row['total_netto_db'] - $row['total_netto_dawai']) >= 0.01;
for ($b = 1; $b <= $bulanTerakhir; $b++) {
$selisih = $selisih || abs($row['p1_bulanan_db'][$b] - $row['p1_bulanan_dawai'][$b]) >= 0.01;
}
$row['ada_selisih'] = $selisih;
// Dipakai filter "P1 = 0": pegawai tampil bila P1 di salah satu sumber > 0.
$row['jumlah_p1'] = max($row['jumlah_p1_db'], $row['jumlah_p1_dawai']);
return $row;
})->values();
return $this->applyRowFilters($rows, $unit, $includePppk2025, $includeP1Zero)
->sortBy('nama', SORT_NATURAL | SORT_FLAG_CASE)->values()->all();
}
private function applyRowFilters(Collection $rows, mixed $unit, bool $includePppk2025, bool $includeP1Zero): Collection
{
if ($unit !== null && $unit !== '') {
$unitBucket = (int) $unit;
$rows = $rows->filter(function ($row) use ($unitBucket) {
@@ -144,14 +210,48 @@ class KeseluruhanController extends Controller
$rows = $rows->filter(fn ($row) => ($row['jumlah_p1'] ?? 0) > 0)->values();
}
return $rows->sortBy('nama', SORT_NATURAL | SORT_FLAG_CASE)->values()->all();
return $rows;
}
private function buildRekap(int $tahun, ?string $jenisPegawai): Collection
private function buildRekap(int $tahun, ?string $jenisPegawai, string $sumberP1 = 'db'): Collection
{
$cacheKey = 'remunerasi_keseluruhan_v8_'.$tahun.'_'.($jenisPegawai ?: 'semua');
return collect(Cache::remember(
$this->rekapCacheKey($tahun, $jenisPegawai, $sumberP1),
now()->addHours(6),
fn () => $this->computeRekap($tahun, $jenisPegawai, $sumberP1)
));
}
return collect(Cache::remember($cacheKey, now()->addHours(6), fn () => $this->computeRekap($tahun, $jenisPegawai)));
/**
* Cache sumber Dawai memuat nama file snapshot, sehingga otomatis berganti saat JSON baru dibuat.
*/
private function rekapCacheKey(int $tahun, ?string $jenisPegawai, string $sumberP1): string
{
$key = 'remunerasi_keseluruhan_v8_'.$tahun.'_'.($jenisPegawai ?: 'semua');
if ($sumberP1 === 'dawai') {
$file = P1DawaiSnapshot::latestPath($tahun);
$key .= '_dawai_'.($file ? basename($file) : 'none');
}
return $key;
}
private function normalizeSumberP1(Request $request): string
{
return $request->input('sumber_p1') === 'db' ? 'db' : 'dawai';
}
/**
* Pastikan snapshot JSON P1 Dawai tersedia bila sumber P1 = dawai.
*/
private function ensureSnapshotTersedia(int $tahun, string $sumberP1): void
{
abort_if(
$sumberP1 === 'dawai' && P1DawaiSnapshot::latestPath($tahun) === null,
422,
"File JSON P1 Dawai tahun {$tahun} belum ada. Jalankan: php artisan rekap:p1-dawai-json --tahun={$tahun}"
);
}
/**
@@ -179,26 +279,38 @@ class KeseluruhanController extends Controller
return json_decode((string) file_get_contents($path), true) ?: [];
}
private function computeRekap(int $tahun, ?string $jenisPegawai): array
private function computeRekap(int $tahun, ?string $jenisPegawai, string $sumberP1 = 'db'): array
{
$normalize = fn ($nip) => preg_replace("/['.\-]/", '', (string) $nip);
// 1. P1 = akumulasi Januari s.d. bulan berjalan (atau Desember untuk tahun yang sudah lewat)
$bulanTerakhir = $this->getBulanTerakhir($tahun);
$p1Rows = P1::query()
->where('tahun', $tahun)
->whereBetween('bulan', [1, $bulanTerakhir])
->when($jenisPegawai, fn ($q) => $q->whereRaw('LOWER(jenis_pegawai) = ?', [strtolower($jenisPegawai)]))
->get()
->groupBy(fn ($row) => $normalize($row->nip));
if ($sumberP1 === 'dawai') {
// Sumber P1 = snapshot JSON hasil tarikan API Dawai (php artisan rekap:p1-dawai-json).
$snapshot = collect(P1DawaiSnapshot::load($tahun)['data'] ?? [])
->filter(fn ($row) => ! $jenisPegawai || strtolower((string) ($row['jenis_pegawai'] ?? '')) === strtolower($jenisPegawai))
->mapWithKeys(fn ($row, $nip) => [$normalize($nip) => collect($row['bulanan'] ?? [])->only(range(1, $bulanTerakhir))]);
$p1 = $p1Rows->map(fn ($rows) => (float) $rows->sum('gaji_yang_dibayarkan'));
$p1Pajak = $p1Rows->map(fn ($rows) => (float) $rows->sum('pph21'));
$p1Netto = $p1Rows->map(fn ($rows) => (float) $rows->sum('gaji_bersih'));
$p1 = $snapshot->map(fn ($bulanan) => (float) $bulanan->sum('p1'));
$p1Pajak = $snapshot->map(fn ($bulanan) => (float) $bulanan->sum('pajak'));
$p1Netto = $snapshot->map(fn ($bulanan) => (float) $bulanan->sum('netto'));
$p1Bulanan = $snapshot->map(fn ($bulanan) => $bulanan->map(fn ($nilai) => (float) $nilai['p1']));
} else {
$p1Rows = P1::query()
->where('tahun', $tahun)
->whereBetween('bulan', [1, $bulanTerakhir])
->when($jenisPegawai, fn ($q) => $q->whereRaw('LOWER(jenis_pegawai) = ?', [strtolower($jenisPegawai)]))
->get()
->groupBy(fn ($row) => $normalize($row->nip));
// Rincian per bulan (dipakai untuk breakdown kolom bulanan di export Excel).
$p1Bulanan = $p1Rows->map(fn ($rows) => $rows->groupBy('bulan')->map(fn ($bulanRows) => (float) $bulanRows->sum('gaji_yang_dibayarkan')));
$p1 = $p1Rows->map(fn ($rows) => (float) $rows->sum('gaji_yang_dibayarkan'));
$p1Pajak = $p1Rows->map(fn ($rows) => (float) $rows->sum('pph21'));
$p1Netto = $p1Rows->map(fn ($rows) => (float) $rows->sum('gaji_bersih'));
// Rincian per bulan (dipakai untuk breakdown kolom bulanan di export Excel).
$p1Bulanan = $p1Rows->map(fn ($rows) => $rows->groupBy('bulan')->map(fn ($bulanRows) => (float) $bulanRows->sum('gaji_yang_dibayarkan')));
}
// 2. P2 = Semester 1 tahun terpilih
$periodeSemester1 = Periode::where('nama', 'LIKE', "%{$tahun} Semester 1%")->value('id_periode');
+59
View File
@@ -0,0 +1,59 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* Amankan halaman dokumentasi API (/docs) dengan token statis dari DOCS_TOKEN.
*
* Token diterima lewat header "Authorization: Bearer <token>", header "X-Docs-Token",
* atau query "?token=<token>". Setelah valid lewat query, dibuat cookie (berisi hash token)
* supaya request lanjutan dari halaman (mis. /docs/api.json) tetap lolos.
*/
class DocsToken
{
private const COOKIE = 'docs_access';
public function handle(Request $request, Closure $next): Response
{
$expected = (string) config('scramble.docs_token');
if ($expected === '') {
return $this->deny('DOCS_TOKEN belum dikonfigurasi.', 403);
}
$provided = $request->bearerToken()
?: $request->header('X-Docs-Token')
?: $request->query('token');
if (is_string($provided) && $provided !== '' && hash_equals($expected, $provided)) {
$response = $next($request);
return $response->withCookie(cookie(
self::COOKIE, hash('sha256', $expected), 60 * 8, '/docs', null, $request->isSecure(), true, false, 'lax'
));
}
// Token yang dikirim tapi salah selalu ditolak, walau cookie lama masih valid.
if (is_string($provided) && $provided !== '') {
return $this->deny('Token dokumentasi tidak valid.', 401)
->withCookie(cookie()->forget(self::COOKIE, '/docs'));
}
$cookie = $request->cookies->get(self::COOKIE);
if (is_string($cookie) && hash_equals(hash('sha256', $expected), $cookie)) {
return $next($request);
}
return $this->deny('Token dokumentasi tidak valid atau belum disertakan.', 401);
}
private function deny(string $message, int $status): Response
{
return response()->view('errors.docs-unauthorized', ['message' => $message], $status);
}
}
+21
View File
@@ -2,8 +2,13 @@
namespace App\Providers;
use App\Support\ApiDocsSummaries;
use Dedoc\Scramble\Scramble;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Routing\Route;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
class AppServiceProvider extends ServiceProvider
{
@@ -20,6 +25,22 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot(): void
{
Scramble::configure()->expose(
ui: fn (Router $router, $action) => $router->get('docs', $action)->name('scramble.docs.ui'),
document: fn (Router $router, $action) => $router->get('docs/api.json', $action)->name('scramble.docs.document'),
);
Scramble::afterOpenApiGenerated(new ApiDocsSummaries);
// Batasi endpoint yang tampil di /docs lewat config('scramble.visible_routes').
$defaultRoutes = Scramble::configure()->routes();
Scramble::routes(function (Route $route) use ($defaultRoutes) {
$visible = config('scramble.visible_routes', []);
return $defaultRoutes($route)
&& ($visible === [] || Str::is($visible, $route->uri()));
});
Relation::morphMap([
'App\Models\Syarat' => 'App\Models\DokSiremun\Syarat',
'App\Models\Mengajar' => 'App\Models\DokSiremun\Mengajar',
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App\Services;
/**
* Snapshot JSON P1 hasil tarikan API Dawai (read-only terhadap DB): resources/data/{tahun}/dawai_p1/latest_p1_dawai_{Ymd_His}.json.
* Format: {"tahun": 2026, "bulan_terakhir": 9, "created_at": "...", "data": {"<nip>": {"nama", "jenis_pegawai",
* "id_unit", "nama_unit", "bulanan": {"<bulan>": {"p1", "pajak", "netto"}}}}}.
*/
class P1DawaiSnapshot
{
public static function directory(int $tahun): string
{
return resource_path("data/{$tahun}/dawai_p1");
}
public static function path(int $tahun, string $tanggal): string
{
return self::directory($tahun)."/latest_p1_dawai_{$tanggal}.json";
}
/**
* File snapshot terbaru (berdasarkan tanggal & jam di nama file) untuk tahun tertentu, atau null bila belum ada.
*/
public static function latestPath(int $tahun): ?string
{
$files = glob(self::directory($tahun).'/latest_p1_dawai_*.json') ?: [];
if ($files === []) {
return null;
}
// Urutkan berdasarkan tanggal(+jam) di nama file, apa pun formatnya (2026-09-29, 20260929_185856, dst.);
// bila sama, yang terakhir diubah dianggap terbaru.
$stamp = fn (string $file) => str_pad(substr(preg_replace('/\D/', '', basename($file)), 0, 14), 14, '0');
usort($files, fn ($a, $b) => [$stamp($a), filemtime($a)] <=> [$stamp($b), filemtime($b)]);
return end($files);
}
public static function load(int $tahun): ?array
{
$path = self::latestPath($tahun);
if ($path === null) {
return null;
}
$decoded = json_decode((string) file_get_contents($path), true);
return is_array($decoded) ? $decoded + ['_file' => basename($path)] : null;
}
}
+2 -2
View File
@@ -98,9 +98,9 @@ class PoinService
}
if ($periode === 383) {
$rawQuery = '(poin_total / sks) as poin_per_sks';
$rawQuery = '(poin_total / CASE WHEN sks = 0 THEN 1 ELSE sks END) as poin_per_sks';
} else {
$rawQuery = '(poin_total / beban_mengajar) as poin_per_sks';
$rawQuery = '(poin_total / CASE WHEN beban_mengajar = 0 THEN 1 ELSE beban_mengajar END) as poin_per_sks';
}
$mengajars = $this->triDharmaService->mengajarSiakad($nip, $periode, 6, 8, $column, $rawQuery, $jenjang, $tipeMk)->sortByDesc('poin_per_sks');
+73
View File
@@ -0,0 +1,73 @@
<?php
namespace App\Support;
use Dedoc\Scramble\Support\Generator\OpenApi;
/**
* Nama endpoint yang tampil di halaman /docs (sidebar & judul operasi).
*
* Kunci: "<method> <path>" sesuai route. Endpoint yang docblock-nya sudah punya
* summary tidak ditimpa; tambahkan endpoint baru di sini agar punya nama yang rapi.
*/
class ApiDocsSummaries
{
private const SUMMARIES = [
'get /v1/rubrik' => 'Daftar Rubrik',
'get /v1/rubrik/{id}' => 'Detail Rubrik',
'get /v1/jabatan/{nip}' => 'Jabatan Pegawai',
'get /v1/jabatan/fungsional' => 'Daftar Jabatan Fungsional',
'get /v1/jabatan/tugas-tambahan' => 'Daftar Jabatan Tugas Tambahan',
'get /v1/pengajuan-absen' => 'Daftar Pengajuan Absen',
'get /v1/pengajuan-absen/{nip}' => 'Pengajuan Absen Pegawai',
'post /v1/pengajuan-absen' => 'Buat Pengajuan Absen',
'post /v1/pengajuan-absen/exists' => 'Duplikasi Pengajuan Absen',
'delete /v1/pengajuan-absen/delete/{id}' => 'Hapus Pengajuan Absen',
'patch /v1/pengajuan-absen/batalkan/{id}' => 'Batalkan Pengajuan Absen',
'get /v1/poin/{nip}' => 'Poin Pegawai',
'get /v1/pegawai' => 'Daftar Pegawai',
'get /v1/pegawai/{nip}' => 'Detail Pegawai',
'get /v1/laporan-kegiatan/kompetisi' => 'Laporan Kegiatan Kompetisi',
'get /v1/laporan-kegiatan/mbkm' => 'Laporan Kegiatan MBKM',
'get /v1/pengajuan/sanggahan/{nip}' => 'Daftar Sanggahan',
'post /v1/pengajuan/sanggahan' => 'Kirim Sanggahan',
'get /v1/pengajuan/tri-dharma/mengajar' => 'Pengajuan Mengajar',
'get /v1/pengajuan/tri-dharma/menguji' => 'Pengajuan Menguji',
'get /v1/pengajuan/tri-dharma/membimbing' => 'Pengajuan Membimbing',
'get /v1/pengajuan/mbkm' => 'Pengajuan MBKM',
'get /v1/pengajuan/modul' => 'Pengajuan Modul',
'get /v1/verifikator/presensi/honorer/{unit}' => 'Presensi Honorer per Unit',
'get /v1/verifikator/presensi/{unit}' => 'Presensi per Unit',
'get /v1/verifikator/presensi/{unit}/{nip}' => 'Detail Presensi Pegawai',
'get /v1/verifikator/presensi/{nip}/{nip}' => 'Detail Presensi Pegawai',
'get /v1/remunerasi/{nip}' => 'Remunerasi Pegawai',
'get /v1/remunerasi/poin' => 'Poin Remunerasi',
'get /v1/remunerasi/skp' => 'Data SKP',
'post /v1/verifikasi-absen/link' => 'Buat Link Verifikasi',
'get /v1/verifikasi-absen/{id}' => 'Detail Verifikasi Absen',
'post /v1/verifikasi-absen/{id}/setujui' => 'Setujui Pengajuan Absen',
'post /v1/verifikasi-absen/{id}/tolak' => 'Tolak Pengajuan Absen',
];
public function __invoke(OpenApi $openApi): void
{
foreach ($openApi->paths as $path) {
foreach ($path->operations as $operation) {
$key = strtolower($operation->method).' /'.ltrim($path->path, '/');
if ($operation->summary === '' && isset(self::SUMMARIES[$key])) {
$operation->summary(self::SUMMARIES[$key]);
}
}
}
}
}
+1
View File
@@ -10,6 +10,7 @@
"license": "MIT",
"require": {
"php": "^8.2",
"dedoc/scramble": "^0.13.45",
"google/apiclient": "^2.19",
"laravel/framework": "^12.0",
"laravel/socialite": "^5.23",
Generated
+250 -61
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ff4de989ae1021516a8c7e527a1faed3",
"content-hash": "10d90e96a4aad7de117b9533d45d6150",
"packages": [
{
"name": "brick/math",
@@ -291,6 +291,87 @@
],
"time": "2025-08-20T19:15:30+00:00"
},
{
"name": "dedoc/scramble",
"version": "v0.13.45",
"source": {
"type": "git",
"url": "https://github.com/dedoc/scramble.git",
"reference": "4f096c49d555c580d7ce7a978896bb3d8b28dc4d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dedoc/scramble/zipball/4f096c49d555c580d7ce7a978896bb3d8b28dc4d",
"reference": "4f096c49d555c580d7ce7a978896bb3d8b28dc4d",
"shasum": ""
},
"require": {
"illuminate/contracts": "^10.0|^11.0|^12.0|^13.0",
"myclabs/deep-copy": "^1.12",
"nikic/php-parser": "^5.0",
"php": "^8.1",
"phpstan/phpdoc-parser": "^1.0|^2.0",
"spatie/laravel-package-tools": "^1.9.2"
},
"require-dev": {
"larastan/larastan": "^3.3",
"laravel/pint": "^v1.1.0",
"laravel/scout": "^10.0|^11.0",
"nunomaduro/collision": "^7.0|^8.0",
"orchestra/testbench": "^8.0|^9.0|^10.0|^11.0",
"pestphp/pest": "^2.34|^3.7|^4.4",
"pestphp/pest-plugin-laravel": "^2.3|^3.1|^4.1",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan-deprecation-rules": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^10.5|^11.5.3|^12.5.12",
"spatie/laravel-permission": "^6.10|^7.2",
"spatie/pest-plugin-snapshots": "^2.1"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Dedoc\\Scramble\\ScrambleServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Dedoc\\Scramble\\": "src",
"Dedoc\\Scramble\\Database\\Factories\\": "database/factories"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Lytvynenko",
"email": "litvinenko95@gmail.com",
"role": "Developer"
}
],
"description": "Automatic generation of API documentation for Laravel applications.",
"homepage": "https://github.com/dedoc/scramble",
"keywords": [
"documentation",
"laravel",
"openapi"
],
"support": {
"issues": "https://github.com/dedoc/scramble/issues",
"source": "https://github.com/dedoc/scramble/tree/v0.13.45"
},
"funding": [
{
"url": "https://github.com/romalytvynenko",
"type": "github"
}
],
"time": "2026-09-18T15:47:56+00:00"
},
{
"name": "dflydev/dot-access-data",
"version": "v3.0.3",
@@ -3221,6 +3302,66 @@
],
"time": "2026-01-02T08:56:05+00:00"
},
{
"name": "myclabs/deep-copy",
"version": "1.13.4",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a",
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"doctrine/collections": "<1.6.8",
"doctrine/common": "<2.13.3 || >=3 <3.2.2"
},
"require-dev": {
"doctrine/collections": "^1.6.8",
"doctrine/common": "^2.13.3 || ^3.2.2",
"phpspec/prophecy": "^1.10",
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
},
"type": "library",
"autoload": {
"files": [
"src/DeepCopy/deep_copy.php"
],
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Create deep copies (clones) of your objects",
"keywords": [
"clone",
"copy",
"duplicate",
"object",
"object graph"
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.13.4"
},
"funding": [
{
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
"type": "tidelift"
}
],
"time": "2025-08-01T08:46:24+00:00"
},
{
"name": "nesbot/carbon",
"version": "3.11.4",
@@ -4041,6 +4182,53 @@
],
"time": "2026-04-10T01:33:53+00:00"
},
{
"name": "phpstan/phpdoc-parser",
"version": "2.3.6",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "1427af4647235b4a73b13940b1f1258d3584f36e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/1427af4647235b4a73b13940b1f1258d3584f36e",
"reference": "1427af4647235b4a73b13940b1f1258d3584f36e",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0"
},
"require-dev": {
"doctrine/annotations": "^2.0",
"nikic/php-parser": "^5.3.0",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"phpunit/phpunit": "^9.6",
"symfony/process": "^5.2"
},
"type": "library",
"autoload": {
"psr-4": {
"PHPStan\\PhpDocParser\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.6"
},
"time": "2026-09-27T20:07:45+00:00"
},
{
"name": "psr/cache",
"version": "3.0.0",
@@ -4779,6 +4967,67 @@
},
"time": "2025-12-14T04:43:48+00:00"
},
{
"name": "spatie/laravel-package-tools",
"version": "1.93.3",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-package-tools.git",
"reference": "7aeef26bd8d4909bec744dbf47aee7d1395588c1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/7aeef26bd8d4909bec744dbf47aee7d1395588c1",
"reference": "7aeef26bd8d4909bec744dbf47aee7d1395588c1",
"shasum": ""
},
"require": {
"illuminate/contracts": "^10.0|^11.0|^12.0|^13.0",
"php": "^8.1"
},
"require-dev": {
"mockery/mockery": "^1.5",
"orchestra/testbench": "^8.0|^9.2|^10.0|^11.0",
"pestphp/pest": "^2.1|^3.1|^4.0",
"phpunit/php-code-coverage": "^10.0|^11.0|^12.0",
"phpunit/phpunit": "^10.5|^11.5|^12.5",
"spatie/pest-plugin-test-time": "^2.2|^3.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\LaravelPackageTools\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"role": "Developer"
}
],
"description": "Tools for creating Laravel packages",
"homepage": "https://github.com/spatie/laravel-package-tools",
"keywords": [
"laravel-package-tools",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/laravel-package-tools/issues",
"source": "https://github.com/spatie/laravel-package-tools/tree/1.93.3"
},
"funding": [
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2026-09-28T07:16:50+00:00"
},
{
"name": "spatie/laravel-permission",
"version": "6.25.0",
@@ -8338,66 +8587,6 @@
},
"time": "2024-05-16T03:13:13+00:00"
},
{
"name": "myclabs/deep-copy",
"version": "1.13.4",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a",
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"doctrine/collections": "<1.6.8",
"doctrine/common": "<2.13.3 || >=3 <3.2.2"
},
"require-dev": {
"doctrine/collections": "^1.6.8",
"doctrine/common": "^2.13.3 || ^3.2.2",
"phpspec/prophecy": "^1.10",
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
},
"type": "library",
"autoload": {
"files": [
"src/DeepCopy/deep_copy.php"
],
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Create deep copies (clones) of your objects",
"keywords": [
"clone",
"copy",
"duplicate",
"object",
"object graph"
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.13.4"
},
"funding": [
{
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
"type": "tidelift"
}
],
"time": "2025-08-01T08:46:24+00:00"
},
{
"name": "nunomaduro/collision",
"version": "v8.9.4",
+191
View File
@@ -0,0 +1,191 @@
<?php
use App\Http\Middleware\DocsToken;
return [
/*
* Which routes to document. String or array form; use Scramble::routes() for custom selection.
*
* 'api_path' => [
* 'include' => 'api',
* 'exclude' => ['api/internal'],
* ],
*
* Without *, patterns match path segments (api matches api and api/users, not apiary).
* With *, Str::is is used (e.g. api/v*).
*
* One static include → default server is /{include} and paths are stripped (/users).
* Multiple includes or wildcards → server defaults to / and paths stay full (/api/users).
* Override with `servers`, or use Scramble::registerApi() for separate bases.
*/
'api_path' => 'api',
/*
* Your API domain. By default, app domain is used. This is also a part of the default API routes
* matcher, so when implementing your own, make sure you use this config if needed.
*/
'api_domain' => null,
/*
* The path where your OpenAPI specification will be exported.
*/
'export_path' => 'api.json',
/*
* Cache configuration for the generated OpenAPI document.
*
* Use `scramble:cache` to warm the cache and `scramble:clear` to invalidate it.
*/
'cache' => [
'key' => 'scramble.openapi',
'store' => 'file',
],
'info' => [
/*
* API version.
*/
'version' => env('API_VERSION', '0.0.1'),
/*
* Description rendered on the home page of the API documentation (`/docs/api`).
*/
'description' => 'Dokumentasi API Verifikator UNTAN.',
],
'ui' => [
'title' => null,
],
/*
* Load Scramble's development tools on documentation pages. An explicit
* SCRAMBLE_DEV_TOOLS value takes precedence over APP_DEBUG.
*/
'dev_tools' => [
'enabled' => env('SCRAMBLE_DEV_TOOLS', env('APP_DEBUG', false)),
],
'renderer' => 'elements',
'renderers' => [
/*
* Stoplight Elements config options: https://docs.stoplight.io/docs/elements/b074dc47b2826-elements-configuration-options
*/
'elements' => [
'view' => 'scramble::docs',
'theme' => 'light',
'hideTryIt' => false,
'hideSchemas' => true,
'logo' => '',
'tryItCredentialsPolicy' => 'include',
'layout' => 'responsive',
'router' => 'hash',
],
/*
* Scalar API reference config options: https://scalar.com/products/api-references/configuration
*/
'scalar' => [
'view' => 'scramble::scalar',
'cdn' => 'https://cdn.jsdelivr.net/npm/@scalar/api-reference',
'theme' => 'laravel',
'proxyUrl' => 'https://proxy.scalar.com',
'darkMode' => false,
'showDeveloperTools' => 'never',
'agent' => ['disabled' => true],
'credentials' => 'include',
],
],
/*
* The list of servers of the API. By default, when `null`, server URL will be created from
* `scramble.api_path` and `scramble.api_domain` config variables. When providing an array, you
* will need to specify the local server URL manually (if needed).
*
* Example of non-default config (final URLs are generated using Laravel `url` helper):
*
* ```php
* 'servers' => [
* 'Live' => 'api',
* 'Prod' => 'https://scramble.dedoc.co/api',
* ],
* ```
*/
'servers' => null,
/**
* Determines how Scramble stores the descriptions of enum cases.
* Available options:
* - 'description' – Case descriptions are stored as the enum schema's description using table formatting.
* - 'extension' – Case descriptions are stored in the `x-enumDescriptions` enum schema extension.
*
* @see https://redocly.com/docs-legacy/api-reference-docs/specification-extensions/x-enum-descriptions
* - false - Case descriptions are ignored.
*/
'enum_cases_description_strategy' => 'description',
/**
* Determines how Scramble stores the names of enum cases.
* Available options:
* - 'names' – Case names are stored in the `x-enumNames` enum schema extension.
* - 'varnames' - Case names are stored in the `x-enum-varnames` enum schema extension.
* - false - Case names are not stored.
*/
'enum_cases_names_strategy' => false,
/**
* When Scramble encounters deep objects in query parameters, it flattens the parameters so the generated
* OpenAPI document correctly describes the API. Flattening deep query parameters is relevant until
* OpenAPI 3.2 is released and query string structure can be described properly.
*
* For example, this nested validation rule describes the object with `bar` property:
* `['foo.bar' => ['required', 'int']]`.
*
* When `flatten_deep_query_parameters` is `true`, Scramble will document the parameter like so:
* `{"name":"foo[bar]", "schema":{"type":"int"}, "required":true}`.
*
* When `flatten_deep_query_parameters` is `false`, Scramble will document the parameter like so:
* `{"name":"foo", "schema": {"type":"object", "properties":{"bar":{"type": "int"}}, "required": ["bar"]}, "required":true}`.
*/
'flatten_deep_query_parameters' => true,
// Token akses halaman /docs diambil dari DOCS_TOKEN (lihat App\Http\Middleware\DocsToken).
'docs_token' => env('DOCS_TOKEN'),
/*
* Endpoint yang ditampilkan di /docs, berupa pola URI route (mendukung wildcard `*`).
* Kosongkan ([]) untuk menampilkan semua endpoint. Contoh:
* 'visible_routes' => [],
*/
'visible_routes' => ['api/v1/pengajuan-absen*'],
'middleware' => [
DocsToken::class,
],
'extensions' => [],
/*
* Automatically document API security (OpenAPI `security` / `securitySchemes`) based on route
* middleware.
*
* Disabled by default. Uncomment the line below to enable `MiddlewareAuthSecurityStrategy`.
* When at least one documented route uses middleware matching the configured patterns (by default
* `auth` and `auth:*`), bearer auth is applied globally. Routes without matching middleware are
* marked as public (`security: []`).
*
* Set to `null` explicitly to disable. If you already configure security manually via
* `afterOpenApiGenerated` / `extendOpenApi`, keep this disabled to avoid duplicate schemes.
*
* Customize with a class-string or [class, options]:
*
* 'security_strategy' => [
* \Dedoc\Scramble\SecurityDocumentation\MiddlewareAuthSecurityStrategy::class,
* [
* 'middleware' => ['auth', 'auth:*'],
* 'scheme' => \Dedoc\Scramble\Support\Generator\SecurityScheme::http('bearer'),
* ],
* ],
*/
// 'security_strategy' => \Dedoc\Scramble\SecurityDocumentation\MiddlewareAuthSecurityStrategy::class,
'security_strategy' => null,
];
@@ -0,0 +1,24 @@
<!doctype html>
<html lang="id">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Akses Ditolak | {{ config('app.name') }}</title>
<link rel="shortcut icon" href="{{ asset('assets/images/logo-untan.png') }}">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet">
<style>
body { margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #fafbfe; font-family: "Inter", sans-serif; color: #000; }
.box { max-width: 420px; padding: 40px 32px; text-align: center; background: #fff; border: 1px solid #e3e6ec; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
img { height: 56px; }
h1 { font-size: 20px; margin: 16px 0 8px; }
p { margin: 0; font-size: 14px; color: #6c757d; line-height: 1.6; }
</style>
</head>
<body>
<div class="box">
<img src="{{ asset('assets/images/logo-untan.png') }}" alt="UNTAN">
<h1>Akses Ditolak</h1>
<p>{{ $message }}</p>
</div>
</body>
</html>
@@ -55,11 +55,15 @@
@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-primary me-2" id="btnPerbaruiData">
</button>';
if (Auth::user()->id == 1) {
$actionButtons .= '<button type="button" class="btn btn-sm btn-outline-primary me-2" id="btnPerbaruiData">
<i class="mdi mdi-database-refresh-outline"></i> Perbarui Data
</button>
<button type="button" class="btn btn-sm btn-outline-secondary" id="btnRefresh">
</button>';
}
$actionButtons .= '<button type="button" class="btn btn-sm btn-outline-secondary" id="btnRefresh">
<i class="uil-refresh"></i>
Refresh
</button>';
@@ -80,16 +84,18 @@
<option value="dosen">Dosen</option>
<option value="tendik">Tendik</option>
</select>
<div class="d-flex align-items-center gap-3 mt-1">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="include_pppk_2025">
<label class="form-check-label" for="include_pppk_2025">PPPK 2025</label>
@if (Auth::user()->id == 1)
<div class="d-flex align-items-center gap-3 mt-1">
<div class="form-check">
<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 class="form-check">
<input class="form-check-input" type="checkbox" id="include_p1_zero">
<label class="form-check-label" for="include_p1_zero">P1 = 0</label>
</div>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="include_p1_zero">
<label class="form-check-label" for="include_p1_zero">P1 = 0</label>
</div>
</div>
@endif
</div>
<div class="col-sm-3">
@@ -117,6 +123,26 @@
@endfor
</select>
</div>
@if (Auth::user()->id == 1)
<div class="col-sm-3">
<label class="form-label">Sumber Jumlah P1</label>
<div class="d-flex align-items-center gap-3 mt-1">
<div class="form-check">
<input class="form-check-input" type="radio" name="sumber_p1" id="sumber_p1_db" value="db">
<label class="form-check-label" for="sumber_p1_db">Database</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="sumber_p1" id="sumber_p1_dawai" value="dawai" checked>
<label class="form-check-label" for="sumber_p1_dawai">JSON Dawai</label>
</div>
</div>
<div class="form-check mt-1">
<input class="form-check-input" type="checkbox" id="compare_p1">
<label class="form-check-label" for="compare_p1" title="Berlaku untuk Export Excel">Bandingkan Database vs Dawai (Export)</label>
</div>
</div>
@endif
</div>
<!-- Tabel Data -->
@@ -205,6 +231,7 @@
d.tahun = $('#filter-tahun').val();
d.include_pppk_2025 = $('#include_pppk_2025').is(':checked') ? 1 : 0;
d.include_p1_zero = $('#include_p1_zero').is(':checked') ? 1 : 0;
d.sumber_p1 = $('input[name="sumber_p1"]:checked').val();
}
},
columns: [
@@ -250,10 +277,17 @@
}
});
$('#filter-jenis-pegawai, #filter-unit, #filter-tahun, #include_pppk_2025, #include_p1_zero').on('change', function() {
$('#filter-jenis-pegawai, #filter-unit, #filter-tahun, #include_pppk_2025, #include_p1_zero, input[name="sumber_p1"]').on('change', function() {
table.draw();
});
// Tampilkan pesan dari server (mis. file JSON P1 Dawai belum ada) alih-alih alert bawaan DataTables.
$.fn.dataTable.ext.errMode = 'none';
$('#keseluruhan-table').on('error.dt', function(e, settings, techNote, message) {
var xhr = settings.jqXHR;
showError('Gagal', (xhr && xhr.responseJSON && xhr.responseJSON.message) || 'Terjadi kesalahan saat memuat data.');
});
$('#btnRefresh').on('click', function() {
var button = $(this);
var originalText = button.html();
@@ -293,7 +327,7 @@
$.ajax({
url: "{{ route('remunerasi.keseluruhan.refresh') }}",
method: 'POST',
data: { tahun: $('#filter-tahun').val() }
data: { tahun: $('#filter-tahun').val(), sumber_p1: $('input[name="sumber_p1"]:checked').val() }
}).done(function(res) {
clearInterval(timer);
setPct(100);
@@ -327,6 +361,8 @@
if (tahun) { params.push('tahun=' + tahun); }
params.push('include_pppk_2025=' + includePppk2025);
params.push('include_p1_zero=' + includeP1Zero);
params.push('sumber_p1=' + $('input[name="sumber_p1"]:checked').val());
params.push('compare=' + ($('#compare_p1').is(':checked') ? 1 : 0));
var url = "{{ route('remunerasi.keseluruhan.export') }}";
if (params.length > 0) {
+234
View File
@@ -0,0 +1,234 @@
<!doctype html>
<html lang="en" data-theme="{{ $config->renderer()->get('theme', 'light') }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="color-scheme" content="{{ $config->renderer()->get('theme', 'light') }}">
<title>{{ $config->get('ui.title') ?? config('app.name') . ' - API Docs' }}</title>
<script src="https://unpkg.com/@stoplight/elements@8.4.2/web-components.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@stoplight/elements@8.4.2/styles.min.css">
<link rel="shortcut icon" href="{{ asset('assets/images/logo-untan.png') }}">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet">
@include('scramble::dev-tools', ['renderer' => 'elements'])
<script>
const originalFetch = window.fetch;
// intercept TryIt requests and add the XSRF-TOKEN header,
// which is necessary for Sanctum cookie-based authentication to work correctly
window.fetch = (url, options) => {
const CSRF_TOKEN_COOKIE_KEY = "XSRF-TOKEN";
const CSRF_TOKEN_HEADER_KEY = "X-XSRF-TOKEN";
const getCookieValue = (key) => {
const cookie = document.cookie.split(';').find((cookie) => cookie.trim().startsWith(key));
return cookie?.split("=")[1];
};
const updateFetchHeaders = (
headers,
headerKey,
headerValue,
) => {
if (headers instanceof Headers) {
headers.set(headerKey, headerValue);
} else if (Array.isArray(headers)) {
headers.push([headerKey, headerValue]);
} else if (headers) {
headers[headerKey] = headerValue;
}
};
const csrfToken = getCookieValue(CSRF_TOKEN_COOKIE_KEY);
if (csrfToken) {
const { headers = new Headers() } = options || {};
updateFetchHeaders(headers, CSRF_TOKEN_HEADER_KEY, decodeURIComponent(csrfToken));
return originalFetch(url, {
...options,
headers,
});
}
return originalFetch(url, options);
};
</script>
<style>
:root { --verif-primary: #0166d2; --verif-bg: #fafbfe; --verif-topbar: 70px; }
html, body { margin:0; height:100%; font-family: "Inter", sans-serif; }
elements-api { display: block; height: 100%; }
elements-api, elements-api * { font-family: "Inter", sans-serif; }
elements-api { --color-primary: var(--verif-primary); --color-primary-light: #3d8ce0; --color-primary-dark: #014f9f; --color-primary-darker: #013a75; }
.verif-topbar { height: var(--verif-topbar); box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 0 24px; background: #fff; border-bottom: 1px solid #e3e6ec; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.verif-topbar img { height: 36px; }
.verif-topbar span { font-size: 20px; font-weight: 600; color: #000; }
.verif-topbar small { font-size: 13px; color: #6c757d; margin-left: 6px; }
.verif-content { height: calc(100vh - var(--verif-topbar)); overflow-y: auto; }
body { background-color: var(--verif-bg); }
/* Layout mengikuti aplikasi Verifikator: sidebar kiri + topbar */
:root { --verif-side: 260px; }
.verif-side { position: fixed; top: 0; bottom: 0; left: 0; width: var(--verif-side); background: #fff; border-right: 1px solid #e3e6ec; display: flex; flex-direction: column; z-index: 10; }
.verif-logo { height: var(--verif-topbar); display: flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; text-decoration: none; }
.verif-logo img { height: 36px; margin-bottom: 5px; }
.verif-logo span { font-size: 20px; color: #000; }
.verif-nav { flex: 1; overflow-y: auto; padding: 0 0 24px; }
.verif-nav-title { padding: 12px 20px 6px; font-size: 12px; letter-spacing: .05rem; text-transform: uppercase; font-weight: 700; color: #000; }
.verif-nav a { display: flex; align-items: center; gap: 8px; margin: 2px 8px; padding: 8px 12px; border-radius: 8px; font-size: 14px; color: #000; text-decoration: none; }
.verif-nav a:hover { color: var(--verif-primary); }
.verif-nav a.active { background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1d4ed8 100%); color: #fff; }
.verif-nav a .m { flex-shrink: 0; min-width: 34px; text-align: center; font-size: 10px; font-weight: 700; text-transform: uppercase; border-radius: 4px; padding: 1px 4px; background: #e8f1fb; color: var(--verif-primary); }
.verif-nav a.active .m { background: rgba(255,255,255,.2); color: #fff; }
.verif-nav a .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Warna metode HTTP */
.verif-nav a .m { --mc: #0166d2; background: color-mix(in srgb, var(--mc) 14%, #fff); color: var(--mc); }
.verif-nav a .m-get { --mc: #0acf97; }
.verif-nav a .m-post { --mc: #0166d2; }
.verif-nav a .m-put { --mc: #e6a700; }
.verif-nav a .m-patch { --mc: #fd7e14; }
.verif-nav a .m-delete { --mc: #fa5c7c; }
.verif-nav a.active .m { background: rgba(255,255,255,.22); color: #fff; }
/* Scrollbar tipis seperti simplebar di aplikasi */
* { scrollbar-width: thin; scrollbar-color: rgba(115, 124, 138, .45) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(115, 124, 138, .45); border-radius: 6px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(115, 124, 138, .7); }
.verif-nav { padding-right: 2px; }
.verif-main { margin-left: var(--verif-side); height: 100vh; display: flex; flex-direction: column; }
/* Area konten: lebar penuh, rapi */
.sl-elements-api > div.sl-overflow-y-auto { padding-left: 32px !important; padding-right: 32px !important; background: var(--verif-bg) !important; }
.sl-elements-api > div.sl-overflow-y-auto > div { max-width: none !important; width: 100%; padding-top: 32px !important; padding-bottom: 48px !important; }
[data-testid="two-column-right"] { width: 52% !important; margin-left: 40px !important; }
[data-testid="two-column-right"] > * { border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
[data-testid="two-column-left"] { min-width: 0; }
.sl-elements-api h1 { font-size: 30px !important; font-weight: 600 !important; }
.sl-elements-api h2 { font-size: 22px !important; font-weight: 600 !important; }
.sl-elements-api h3 { font-size: 17px !important; font-weight: 600 !important; }
/* Contoh respons/request: lebar penuh, tanpa terpotong */
[data-testid="two-column-right"] pre, [data-testid="two-column-right"] code { font-size: 13px; }
[data-testid="two-column-right"] .sl-code-viewer, [data-testid="two-column-right"] .sl-panel__content { max-height: none !important; }
.verif-topbar { justify-content: flex-start; flex-shrink: 0; }
.verif-content { flex: 1; min-height: 0; height: auto !important; }
/* Sembunyikan sidebar bawaan Elements pada layar lebar (diganti sidebar di atas) */
.sl-elements-api > div:first-child:has([style*="min-width: 300px"]) { display: none !important; }
@media (max-width: 991px) {
.verif-side { display: none; }
.verif-main { margin-left: 0; }
}
/* issues about the dark theme of stoplight/mosaic-code-viewer using web component:
* https://github.com/stoplightio/elements/issues/2188#issuecomment-1485461965
*/
[data-theme="dark"] .token.property {
color: rgb(128, 203, 196) !important;
}
[data-theme="dark"] .token.operator {
color: rgb(255, 123, 114) !important;
}
[data-theme="dark"] .token.number {
color: rgb(247, 140, 108) !important;
}
[data-theme="dark"] .token.string {
color: rgb(165, 214, 255) !important;
}
[data-theme="dark"] .token.boolean {
color: rgb(121, 192, 255) !important;
}
[data-theme="dark"] .token.punctuation {
color: #dbdbdb !important;
}
</style>
</head>
<body style="height: 100vh; overflow-y: hidden">
@php
$verifMethods = ['get', 'post', 'put', 'patch', 'delete'];
$verifGroups = [];
foreach (($spec['paths'] ?? []) as $verifPath => $verifItem) {
foreach ($verifItem as $verifMethod => $verifOp) {
if (! in_array($verifMethod, $verifMethods, true) || empty($verifOp['operationId'])) {
continue;
}
$verifGroups[$verifOp['tags'][0] ?? 'Lainnya'][] = [
'id' => $verifOp['operationId'],
'method' => $verifMethod,
'label' => $verifOp['summary'] ?? $verifPath,
'path' => $verifPath,
];
}
}
@endphp
<aside class="verif-side">
<a class="verif-logo" href="#/">
<img src="{{ asset('assets/images/logo-untan.png') }}" alt="UNTAN">
<span>{{ config('app.name') }}</span>
</a>
<nav class="verif-nav" id="verif-nav">
<div class="verif-nav-title">Dashboard</div>
<a href="#/" data-hash="#/"><span class="t">Overview</span></a>
@foreach($verifGroups as $verifTag => $verifOps)
<div class="verif-nav-title">{{ preg_replace('/(?<=[a-z])(?=[A-Z])/', ' ', $verifTag) }}</div>
@foreach($verifOps as $verifOp)
<a href="#/operations/{{ rawurlencode($verifOp['id']) }}" data-hash="#/operations/{{ rawurlencode($verifOp['id']) }}" title="{{ $verifOp['path'] }}">
<span class="m m-{{ $verifOp['method'] }}">{{ $verifOp['method'] }}</span>
<span class="t">{{ $verifOp['label'] }}</span>
</a>
@endforeach
@endforeach
</nav>
</aside>
<div class="verif-main">
<header class="verif-topbar">
<span>API Documentation</span>
</header>
<div class="verif-content">
<elements-api
id="docs"
@foreach($config->renderer()->all(except: ['theme']) as $key => $value)
@continue(! $value)
{{ $key }}="{{ $value === true ? 'true' : ($value === false ? 'false' : $value) }}"
@endforeach
/>
<script>
(async () => {
const docs = document.getElementById('docs');
docs.apiDescriptionDocument = @json($spec);
})();
// Tandai item sidebar yang aktif sesuai hash (router Elements memakai hash).
(() => {
const links = document.querySelectorAll('#verif-nav a');
const sync = () => {
const hash = location.hash || '#/';
links.forEach((a) => {
const on = a.dataset.hash === hash;
a.classList.toggle('active', on);
if (on) a.scrollIntoView({ block: 'nearest' });
});
};
addEventListener('hashchange', sync);
sync();
})();
</script>
@if($config->renderer()->get('theme', 'light') === 'system')
<script>
var mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
function updateTheme(e) {
if (e.matches) {
window.document.documentElement.setAttribute('data-theme', 'dark');
window.document.getElementsByName('color-scheme')[0].setAttribute('content', 'dark');
} else {
window.document.documentElement.setAttribute('data-theme', 'light');
window.document.getElementsByName('color-scheme')[0].setAttribute('content', 'light');
}
}
mediaQuery.addEventListener('change', updateTheme);
updateTheme(mediaQuery);
</script>
@endif
</div>
</div>
</body>
</html>