Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e1575ac62 | |||
| 597e5fe5b6 | |||
| 1c8930ee93 | |||
| 2059c9b5af | |||
| d65dfa6977 | |||
| ead04f6f7f | |||
| 7967b7730f | |||
| 628d84f0aa | |||
| 8809dfbe8d | |||
| 85695a43c7 | |||
| 179ec355e5 | |||
| d416ff59d6 | |||
| a2db11f73c | |||
| f625a5f9af | |||
| 56de1de10e | |||
| 85512cce45 | |||
| c2ae7092ce | |||
| 41d9381170 | |||
| 5fc2f51108 | |||
| 797c9371ce | |||
| 8e5432c983 | |||
| 3dc0f870c9 | |||
| eaeb276774 | |||
| 77ae40b53f | |||
| 79a005d05a | |||
| ad6246d951 | |||
| c314baf68b | |||
| dbcea98ab0 | |||
| 32ff9e9db1 | |||
| c4fe692f3b | |||
| 51eb896897 | |||
| bd97f7510f | |||
| 768d07b0d3 | |||
| e4b446ed6a | |||
| 03c19fa986 | |||
| 4f18d40468 |
@@ -82,8 +82,6 @@ VITE_APP_NAME="${APP_NAME}"
|
||||
# CONFIG
|
||||
PERIODE_VERIFIKATOR=395
|
||||
|
||||
VERIFIKATOR_WEBHOOK_URL=http://172.16.50.94:8087/webhook/verifikator
|
||||
VERIFIKATOR_WEBHOOK_KEY=
|
||||
|
||||
VERIFIKASI_ABSEN_WA_URL=http://verifikator-untan.test/verifikasi-absen
|
||||
|
||||
@@ -93,3 +91,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
-2
@@ -82,8 +82,6 @@ VITE_APP_NAME="${APP_NAME}"
|
||||
# CONFIG
|
||||
PERIODE_VERIFIKATOR=395
|
||||
|
||||
VERIFIKATOR_WEBHOOK_URL=http://172.16.50.94:8087/webhook/verifikator
|
||||
VERIFIKATOR_WEBHOOK_KEY=
|
||||
|
||||
VERIFIKASI_ABSEN_WA_URL=http://verifikator-untan.test/verifikasi-absen
|
||||
|
||||
@@ -93,3 +91,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=
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Remunerasi;
|
||||
|
||||
use App\Models\Verifikator\Periode;
|
||||
use App\Models\Verifikator\View\Pegawai;
|
||||
use App\Services\PerhitunganKegiatanService;
|
||||
use Exception;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class GenerateKekuranganP2JsonCommand extends Command
|
||||
{
|
||||
protected $signature = 'remunerasi:p2-json
|
||||
{nip* : NIP pegawai (boleh lebih dari satu)}
|
||||
{--periode= : ID periode (default: periode aktif)}
|
||||
{--tahun= : Tahun folder JSON (default: diambil dari nama periode)}
|
||||
{--dry-run : Tampilkan hasil saja, jangan tulis file JSON}';
|
||||
|
||||
protected $description = 'Hitung P2 pegawai lewat listKegiatan (save=false) lalu simpan/perbarui ke JSON kekurangan P2 (resources/data/{tahun}/kekurangan_p2_{periode}.json). Tidak menyimpan ke database.';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$periode = (int) ($this->option('periode') ?? Periode::where('status', true)->value('id_periode'));
|
||||
|
||||
if (! $periode) {
|
||||
$this->error('Tidak ada periode aktif. Gunakan --periode=<id_periode>.');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$namaPeriode = (string) Periode::where('id_periode', $periode)->value('nama');
|
||||
$tahun = (int) ($this->option('tahun') ?: (preg_match('/\d{4}/', $namaPeriode, $m) ? $m[0] : 0));
|
||||
|
||||
if (! $tahun) {
|
||||
$this->error('Tahun tidak dapat ditentukan dari nama periode. Gunakan --tahun=<tahun>.');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$bulan = $periode % 2 === 1 ? [1, 2, 3, 4, 5, 6] : [7, 8, 9, 10, 11, 12];
|
||||
$service = new PerhitunganKegiatanService;
|
||||
$hasil = [];
|
||||
|
||||
foreach ($this->argument('nip') as $nip) {
|
||||
$nip = preg_replace("/['.\-\s]/", '', $nip);
|
||||
|
||||
$pegawai = Pegawai::withoutGlobalScope('aktif')
|
||||
->with([
|
||||
'jabatans' => fn ($q) => $q->where('periode', $periode),
|
||||
'jabatans.detail' => fn ($q) => $q->whereIn('bulan', $bulan),
|
||||
])
|
||||
->where(fn ($q) => $q->where('nip', $nip)->orWhere('nip_siakad', $nip))
|
||||
->first();
|
||||
|
||||
if (! $pegawai) {
|
||||
$this->warn("{$nip}: pegawai tidak ditemukan, dilewati.");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// listKegiatan menulis ke DB (hapus/buat remunerasi) untuk bulan tanpa p2_jf/p2_jtt walau save=false.
|
||||
// Karena itu hanya bulan yang berhak P2 (p2_jf atau p2_jtt true) yang dihitung; bulan lain dilewati
|
||||
// (nilai P2-nya memang 0) sehingga tidak ada penulisan ke DB.
|
||||
$details = ($pegawai->jabatans->first()?->detail ?? collect());
|
||||
$bulanLayak = $details->filter(fn ($d) => $d->p2_jf === true || $d->p2_jtt === true)->pluck('bulan')->sort()->values()->all();
|
||||
$bulanDilewati = $details->pluck('bulan')->diff($bulanLayak)->sort()->values()->all();
|
||||
|
||||
if ($bulanLayak === []) {
|
||||
$this->warn("{$nip} ({$pegawai->nama}): tidak ada bulan yang berhak P2 di periode ini, dilewati.");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($bulanDilewati !== []) {
|
||||
$this->line(" {$nip}: bulan ".implode(', ', $bulanDilewati).' dilewati (tanpa p2_jf/p2_jtt); dihitung bulan '.implode(', ', $bulanLayak).'.');
|
||||
}
|
||||
|
||||
try {
|
||||
$kegiatans = $service->listKegiatan($pegawai->nip, $periode, $bulanLayak, null, false);
|
||||
} catch (Exception $e) {
|
||||
$this->warn("{$nip} ({$pegawai->nama}): gagal dihitung - {$e->getMessage()}");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Jumlahkan P2 seluruh unit pembayaran pada semua bulan di periode.
|
||||
$total = ['p2_bruto' => 0.0, 'p2_pajak' => 0.0, 'p2_netto' => 0.0];
|
||||
foreach ($kegiatans ?: [] as $dataBulan) {
|
||||
foreach ($dataBulan['units'] ?? [] as $unit) {
|
||||
$total['p2_bruto'] += (float) ($unit['p2']['ratio'] ?? 0);
|
||||
$total['p2_pajak'] += (float) ($unit['p2']['tax'] ?? 0);
|
||||
$total['p2_netto'] += (float) ($unit['p2']['netto'] ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
$hasil[$pegawai->nip] = array_map(fn ($v) => $this->rapikan($v), $total);
|
||||
|
||||
$this->line(sprintf(
|
||||
'%s %-35s bruto: Rp %s | pajak: Rp %s | netto: Rp %s',
|
||||
$pegawai->nip,
|
||||
mb_substr((string) $pegawai->nama, 0, 35),
|
||||
number_format($total['p2_bruto'], 2, ',', '.'),
|
||||
number_format($total['p2_pajak'], 2, ',', '.'),
|
||||
number_format($total['p2_netto'], 2, ',', '.'),
|
||||
));
|
||||
}
|
||||
|
||||
if ($hasil === []) {
|
||||
$this->warn('Tidak ada data yang bisa disimpan.');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
if ($this->option('dry-run')) {
|
||||
$this->info('Dry-run: file JSON tidak diubah.');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
$path = resource_path("data/{$tahun}/kekurangan_p2_{$periode}.json");
|
||||
$existing = is_file($path) ? (json_decode((string) file_get_contents($path), true) ?: []) : [];
|
||||
$merged = array_replace($existing, $hasil);
|
||||
ksort($merged, SORT_STRING);
|
||||
|
||||
File::ensureDirectoryExists(dirname($path));
|
||||
File::put($path, json_encode($merged, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||
|
||||
$this->info(sprintf('✓ %d pegawai disimpan/diperbarui di %s (total %d entri)', count($hasil), $path, count($merged)));
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bulatkan 2 desimal dan buang ".0" pada bilangan bulat agar format sama dengan isi file yang sudah ada.
|
||||
*/
|
||||
private function rapikan(float $nilai): int|float
|
||||
{
|
||||
$nilai = round($nilai, 2);
|
||||
|
||||
return $nilai == floor($nilai) ? (int) $nilai : $nilai;
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ class KeseluruhanExport implements FromArray, ShouldAutoSize, WithColumnFormatti
|
||||
/**
|
||||
* Kolom setelah blok bulanan P1 (tidak ikut di-expand per bulan).
|
||||
*/
|
||||
private const TRAILING_COLUMNS = ['Jumlah P2', 'Jumlah THR', 'Jumlah R13', 'Jumlah Publikasi', 'Total'];
|
||||
private const TRAILING_COLUMNS = ['Jumlah P2', 'Jumlah THR', 'Jumlah R13', 'Jumlah Publikasi', 'Total', 'Total Pajak', 'Total Netto'];
|
||||
|
||||
private const BULAN_NAMES = [
|
||||
1 => 'Januari', 2 => 'Februari', 3 => 'Maret', 4 => 'April', 5 => 'Mei', 6 => 'Juni',
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,8 @@ class KeseluruhanExport implements FromArray, ShouldAutoSize, WithColumnFormatti
|
||||
$row['jumlah_r13'],
|
||||
$row['jumlah_publikasi'],
|
||||
$row['total'],
|
||||
$row['total_pajak'] ?? 0,
|
||||
$row['total_netto'] ?? 0,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -456,7 +456,7 @@ class RasioP2Export
|
||||
protected function getDataForUnit($unit)
|
||||
{
|
||||
// Query dengan optimalisasi
|
||||
$pegawaisQuery = Pegawai::select('nip', 'nip_siakad', 'nama', 'jenis_pegawai', 'unit_kerja_nama', 'jabatan_fungsional_id', 'jabatan_dtt_id', 'npwp', 'nomor_rekening')
|
||||
$pegawaisQuery = Pegawai::withoutGlobalScope('aktif')->select('nip', 'nip_siakad', 'nama', 'jenis_pegawai', 'unit_kerja_nama', 'jabatan_fungsional_id', 'jabatan_dtt_id', 'npwp', 'nomor_rekening')
|
||||
->whereHas('jabatan', function ($query) use ($unit) {
|
||||
$query
|
||||
->where('periode', $this->periode)
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -6,23 +6,36 @@ use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Api\AbsenRequest;
|
||||
use App\Http\Resources\Presensi\AbsenCollection;
|
||||
use App\Http\Resources\Presensi\AbsenResource;
|
||||
use App\Models\User;
|
||||
use App\Models\Verifikator\Dosen;
|
||||
use App\Models\Verifikator\Honorer;
|
||||
use App\Models\Verifikator\PengajuanPresensi;
|
||||
use App\Models\Verifikator\Tendik;
|
||||
use App\Models\Verifikator\View\Pegawai;
|
||||
use App\Services\DawaiService;
|
||||
use App\Services\VerifikasiAbsenLinkService;
|
||||
use App\Services\VerifikatorWebhookService;
|
||||
use App\Services\WhatsAppService;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Throwable;
|
||||
|
||||
class PengajuanAbsenController extends Controller
|
||||
{
|
||||
private $p;
|
||||
|
||||
private array $fileTersimpan = [];
|
||||
|
||||
private array $notifikasiTertunda = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// $this->p = Periode::where('status', true)->first()->id_periode;
|
||||
@@ -37,12 +50,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 +67,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)
|
||||
@@ -84,17 +116,183 @@ class PengajuanAbsenController extends Controller
|
||||
return new AbsenCollection($tendik->absen);
|
||||
}
|
||||
|
||||
public function store(AbsenRequest $request)
|
||||
public function store(Request $request)
|
||||
{
|
||||
if (! in_array($request->nip, ['19980513202401011', '19970812202101011'])) {
|
||||
return response()->json([
|
||||
'code' => 400,
|
||||
'status' => 'failed',
|
||||
'message' => 'Sedang proses Remunerasi, Tidak dapat mengajukan absen untuk saat ini',
|
||||
// 'message' => 'Sedang proses Maintenance, Tidak dapat mengajukan absen untuk saat ini',
|
||||
], 400);
|
||||
$batch = is_array($request->input('tanggal'));
|
||||
|
||||
set_time_limit($batch ? 600 : 120);
|
||||
|
||||
if ($batch) {
|
||||
$request->validate([
|
||||
'count_data' => 'required|integer|min:1',
|
||||
'tanggal' => 'required|array|min:1',
|
||||
'tanggal.*' => 'required',
|
||||
], [
|
||||
'count_data.required' => 'count_data wajib diisi.',
|
||||
'count_data.integer' => 'count_data harus berupa angka.',
|
||||
'count_data.min' => 'count_data minimal 1.',
|
||||
'tanggal.array' => 'Tanggal harus berupa array.',
|
||||
'tanggal.*.required' => 'Tanggal wajib diisi.',
|
||||
]);
|
||||
|
||||
$jumlahData = count($request->input('tanggal'));
|
||||
|
||||
if ((int) $request->input('count_data') !== $jumlahData) {
|
||||
return response()->json([
|
||||
'code' => 400,
|
||||
'status' => 'failed',
|
||||
'message' => "count_data ({$request->input('count_data')}) tidak sesuai dengan jumlah data yang dikirim ($jumlahData)",
|
||||
'count_data' => (int) $request->input('count_data'),
|
||||
'jumlah_data_dikirim' => $jumlahData,
|
||||
], 400);
|
||||
}
|
||||
|
||||
$daftar = [];
|
||||
foreach (array_values($request->input('tanggal')) as $tanggal) {
|
||||
$daftar[] = $this->buatSubRequest($request, $tanggal);
|
||||
}
|
||||
} else {
|
||||
if ($request->has('count_data') && (int) $request->input('count_data') !== 1) {
|
||||
return response()->json([
|
||||
'code' => 400,
|
||||
'status' => 'failed',
|
||||
'message' => "count_data ({$request->input('count_data')}) tidak sesuai dengan jumlah data yang dikirim (1)",
|
||||
'count_data' => (int) $request->input('count_data'),
|
||||
'jumlah_data_dikirim' => 1,
|
||||
], 400);
|
||||
}
|
||||
|
||||
if ($request->missing('kategori') && $request->filled('tipe_absen')) {
|
||||
$request->merge(['kategori' => $request->input('tipe_absen')]);
|
||||
}
|
||||
|
||||
$daftar = [$request];
|
||||
}
|
||||
|
||||
$total = count($daftar);
|
||||
$hasilData = [];
|
||||
$hasil = null;
|
||||
$this->fileTersimpan = [];
|
||||
$this->notifikasiTertunda = [];
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
foreach ($daftar as $index => $item) {
|
||||
$ke = $index + 1;
|
||||
|
||||
try {
|
||||
$formRequest = new AbsenRequest;
|
||||
$validator = Validator::make($item->all(), $formRequest->rules(), $formRequest->messages());
|
||||
|
||||
if ($validator->fails()) {
|
||||
if (! $batch) {
|
||||
DB::rollBack();
|
||||
|
||||
$validator->validate();
|
||||
}
|
||||
|
||||
$hasil = response()->json([
|
||||
'code' => 422,
|
||||
'status' => 'failed',
|
||||
'message' => $validator->errors()->first(),
|
||||
], 422);
|
||||
} else {
|
||||
$hasil = $this->prosesPengajuan($item);
|
||||
}
|
||||
} catch (ValidationException $e) {
|
||||
throw $e;
|
||||
} catch (Throwable $e) {
|
||||
Log::error("Pengajuan Absen data ke-$ke: ".$e->getMessage());
|
||||
|
||||
$hasil = response()->json([
|
||||
'code' => 500,
|
||||
'status' => 'failed',
|
||||
'message' => 'Gagal melakukan pengajuan absen',
|
||||
], 500);
|
||||
}
|
||||
|
||||
if ($hasil instanceof JsonResponse) {
|
||||
if (DB::transactionLevel() > 0) {
|
||||
DB::rollBack();
|
||||
}
|
||||
$this->hapusFileTersimpan();
|
||||
|
||||
if (! $batch) {
|
||||
return $hasil;
|
||||
}
|
||||
|
||||
$pesan = $hasil->getData(true)['message'] ?? 'Gagal melakukan pengajuan absen';
|
||||
$kode = $hasil->getStatusCode();
|
||||
|
||||
Log::info("Batch Pengajuan Absen dibatalkan pada data ke-$ke dari $total: $pesan");
|
||||
|
||||
return response()->json([
|
||||
'code' => $kode,
|
||||
'status' => 'failed',
|
||||
'message' => "Gagal pada data ke-$ke dari $total: $pesan. Seluruh data dibatalkan (rollback).",
|
||||
'count_data' => $total,
|
||||
'diproses' => $ke,
|
||||
'berhasil_sebelum_rollback' => $ke - 1,
|
||||
'gagal' => 1,
|
||||
'data_gagal_ke' => $ke,
|
||||
], $kode);
|
||||
}
|
||||
|
||||
$hasilData[] = $hasil['data'];
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
foreach ($this->notifikasiTertunda as $kirim) {
|
||||
$kirim();
|
||||
}
|
||||
|
||||
if (! $batch) {
|
||||
return $hasil;
|
||||
}
|
||||
|
||||
return [
|
||||
'code' => 200,
|
||||
'status' => 'success',
|
||||
'message' => "Berhasil mengajukan $total absen.",
|
||||
'count_data' => $total,
|
||||
'data' => $hasilData,
|
||||
];
|
||||
}
|
||||
|
||||
private function buatSubRequest(Request $request, mixed $tanggal): Request
|
||||
{
|
||||
$input = array_diff_key($request->input(), ['tanggal' => 1, 'count_data' => 1]) + ['tanggal' => $tanggal];
|
||||
|
||||
$sub = Request::create('/', 'POST', $input, [], $request->allFiles());
|
||||
|
||||
if ($sub->missing('kategori') && $sub->filled('tipe_absen')) {
|
||||
$sub->merge(['kategori' => $sub->input('tipe_absen')]);
|
||||
}
|
||||
|
||||
return $sub;
|
||||
}
|
||||
|
||||
private function hapusFileTersimpan(): void
|
||||
{
|
||||
foreach ($this->fileTersimpan as $path) {
|
||||
Storage::disk('public')->delete($path);
|
||||
}
|
||||
|
||||
$this->fileTersimpan = [];
|
||||
}
|
||||
|
||||
private function prosesPengajuan(Request $request): array|JsonResponse
|
||||
{
|
||||
// if (! in_array($request->nip, ['19980513202401011', '19970812202101011'])) {
|
||||
// return response()->json([
|
||||
// 'code' => 400,
|
||||
// 'status' => 'failed',
|
||||
// 'message' => 'Sedang proses Remunerasi, Tidak dapat mengajukan absen untuk saat ini',
|
||||
// // 'message' => 'Sedang proses Maintenance, Tidak dapat mengajukan absen untuk saat ini',
|
||||
// ], 400);
|
||||
// }
|
||||
|
||||
$batasBulanPengajuan = (int) date('m');
|
||||
if (date('j') < 2) {
|
||||
$batasBulanPengajuan = (int) date('m') - 1;
|
||||
@@ -194,7 +392,7 @@ class PengajuanAbsenController extends Controller
|
||||
}
|
||||
|
||||
// Validasi limit pengajuan
|
||||
if ($this->checkLimit($pegawai, $request->tanggal, $request->kategori) && in_array($request->kategori, [3, 20, 21, 24, 25])) {
|
||||
if ($this->checkLimit($pegawai, $request->tanggal, $request->kategori) && in_array($request->kategori, [3, 21, 24, 25])) {
|
||||
// Ambil nama kategori dari Dawai Service
|
||||
$statusPresensi = collect($dawaiService->listStatusPresensi());
|
||||
$kategoriStatus = $statusPresensi->firstWhere('id', (int) $request->kategori);
|
||||
@@ -244,8 +442,8 @@ class PengajuanAbsenController extends Controller
|
||||
], 400);
|
||||
}
|
||||
|
||||
// Validasi untuk kategori lupa absen (20, 24, 25)
|
||||
if (in_array($request->kategori, [20, 24, 25]) && count($presensi['presensi']) > 0 && ! in_array($presensi['presensi'][0]['status']['id'], [4, 22, 23, 24, 25])) {
|
||||
// Validasi untuk kategori lupa absen (24, 25)
|
||||
if (in_array($request->kategori, [24, 25]) && count($presensi['presensi']) > 0 && ! in_array($presensi['presensi'][0]['status']['id'], [4, 22, 23, 24, 25])) {
|
||||
Log::info("Lupa Absen: $pegawai->nama ($pegawai->nip) - $request->tanggal ($request->kategori): $request->keterangan");
|
||||
|
||||
return response()->json([
|
||||
@@ -301,6 +499,9 @@ class PengajuanAbsenController extends Controller
|
||||
// Simpan file ke storage/app/public/absen/presensi/{periode}
|
||||
$buktiFile = $request->file('file_surat') ?? $request->file('bukti');
|
||||
$filePath = $buktiFile->storeAs("absen/presensi/$periode", $namaFile, 'public');
|
||||
if ($filePath) {
|
||||
$this->fileTersimpan[] = $filePath;
|
||||
}
|
||||
|
||||
if (! $filePath) {
|
||||
Log::error("Gagal menyimpan file: $namaFile");
|
||||
@@ -315,6 +516,9 @@ class PengajuanAbsenController extends Controller
|
||||
if ($request->kategori == 2 && $request->hasFile('file_lampiran')) {
|
||||
$namaFileLampiran = uniqid().'-'.$pegawai->nip.'-lampiran.pdf';
|
||||
$filePathLampiran = $request->file('file_lampiran')->storeAs("absen/presensi/$periode", $namaFileLampiran, 'public');
|
||||
if ($filePathLampiran) {
|
||||
$this->fileTersimpan[] = $filePathLampiran;
|
||||
}
|
||||
|
||||
if (! $filePathLampiran) {
|
||||
Log::error("Gagal menyimpan file lampiran: $namaFileLampiran");
|
||||
@@ -333,7 +537,10 @@ class PengajuanAbsenController extends Controller
|
||||
|
||||
$pengajuan = PengajuanPresensi::create($absen);
|
||||
|
||||
$this->notifikasiAtasanWhatsApp($pengajuan, $pegawai, $dawaiService);
|
||||
$this->catatLog($pengajuan, 'Pengajuan Presensi Berhasil diajukan', $pegawai->nip, 'Pemohon', 'POST', $pegawai->nama);
|
||||
|
||||
$this->notifikasiTertunda[] = fn () => $this->notifikasiAtasanWhatsApp($pengajuan, $pegawai, $dawaiService);
|
||||
$this->notifikasiTertunda[] = fn () => (new VerifikatorWebhookService)->kirimIzin($pengajuan, VerifikatorWebhookService::STATUS_PENDING);
|
||||
|
||||
// Ambil nama kategori dari Dawai Service
|
||||
$statusPresensi = collect($dawaiService->listStatusPresensi());
|
||||
@@ -361,7 +568,7 @@ class PengajuanAbsenController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function batalkan(string $id)
|
||||
public function batalkan(Request $request, string $id)
|
||||
{
|
||||
try {
|
||||
$pengajuan = PengajuanPresensi::where('tipe', 'absen')
|
||||
@@ -386,6 +593,14 @@ class PengajuanAbsenController extends Controller
|
||||
$pengajuan->status = 'Diajukan';
|
||||
$pengajuan->save();
|
||||
|
||||
$this->catatLog(
|
||||
$pengajuan,
|
||||
'Pengajuan Presensi kembali diajukan',
|
||||
$request->input('nip'),
|
||||
$this->rolePelaku($request->input('nip'), $pengajuan),
|
||||
'PATCH'
|
||||
);
|
||||
|
||||
Log::info("Batalkan Pengajuan Presensi: ID $id - NIP $pengajuan->nip - Status lama: $statusLama");
|
||||
|
||||
return response()->json([
|
||||
@@ -396,7 +611,7 @@ class PengajuanAbsenController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy(string $id)
|
||||
public function destroy(Request $request, string $id)
|
||||
{
|
||||
try {
|
||||
$pengajuan = PengajuanPresensi::withTrashed()
|
||||
@@ -428,6 +643,16 @@ class PengajuanAbsenController extends Controller
|
||||
|
||||
$pengajuan->delete();
|
||||
|
||||
(new VerifikatorWebhookService)->kirimIzin($pengajuan, VerifikatorWebhookService::STATUS_DELETED);
|
||||
|
||||
$this->catatLog(
|
||||
$pengajuan,
|
||||
'Pengajuan Presensi Berhasil dihapus',
|
||||
$request->input('nip'),
|
||||
$this->rolePelaku($request->input('nip'), $pengajuan),
|
||||
'DELETE'
|
||||
);
|
||||
|
||||
Log::info("Hapus Pengajuan Presensi: ID $id - NIP $pengajuan->nip");
|
||||
|
||||
return response()->json([
|
||||
@@ -488,7 +713,7 @@ class PengajuanAbsenController extends Controller
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'code' => 400,
|
||||
'code' => 200,
|
||||
'status' => false,
|
||||
'message' => 'Pengajuan absen tidak ditemukan',
|
||||
]);
|
||||
@@ -581,10 +806,53 @@ class PengajuanAbsenController extends Controller
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kirim notifikasi WhatsApp ke atasan berisi link verifikasi (terima/tolak) pengajuan absen.
|
||||
* Kegagalan di sini tidak menggagalkan pengajuan (dicatat ke log saja).
|
||||
*/
|
||||
private function rolePelaku(?string $nipPelaku, PengajuanPresensi $pengajuan): string
|
||||
{
|
||||
if (! $nipPelaku) {
|
||||
return 'Tidak diketahui';
|
||||
}
|
||||
|
||||
return $nipPelaku === $pengajuan->nip ? 'Pemohon' : 'Atasan';
|
||||
}
|
||||
|
||||
private function catatLog(PengajuanPresensi $pengajuan, string $pesan, ?string $nipPelaku, string $role, string $method, ?string $namaPelaku = null): void
|
||||
{
|
||||
try {
|
||||
$namaPelaku ??= $nipPelaku
|
||||
? Pegawai::withoutGlobalScopes()->where('nip', $nipPelaku)->value('nama')
|
||||
: null;
|
||||
|
||||
$pengajuan->logs()->create([
|
||||
'user_id' => $nipPelaku ? User::where('nip', $nipPelaku)->value('id') : null,
|
||||
'method' => $method,
|
||||
'employee_id' => $nipPelaku,
|
||||
'employee_name' => $namaPelaku,
|
||||
'employee_role' => $role,
|
||||
'message' => $pesan,
|
||||
]);
|
||||
} catch (Throwable $th) {
|
||||
Log::error("Catat log pengajuan #$pengajuan->id gagal: ".$th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private function nomorWhatsAppPimpinan(string $nip): ?string
|
||||
{
|
||||
$noHp = Dosen::where('nip', $nip)->value('no_hp') ?: Tendik::where('nip', $nip)->value('no_hp');
|
||||
|
||||
$digit = preg_replace('/\D+/', '', (string) $noHp);
|
||||
|
||||
if ($digit === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return match (true) {
|
||||
str_starts_with($digit, '62') => $digit,
|
||||
str_starts_with($digit, '0') => '62'.substr($digit, 1),
|
||||
str_starts_with($digit, '8') => '62'.$digit,
|
||||
default => null,
|
||||
};
|
||||
}
|
||||
|
||||
private function notifikasiAtasanWhatsApp(PengajuanPresensi $pengajuan, $pegawai, DawaiService $dawaiService): void
|
||||
{
|
||||
try {
|
||||
@@ -596,14 +864,19 @@ class PengajuanAbsenController extends Controller
|
||||
return;
|
||||
}
|
||||
|
||||
$nomorTujuan = $this->nomorWhatsAppPimpinan($atasan['nip']);
|
||||
|
||||
if (! $nomorTujuan) {
|
||||
Log::error("Notifikasi WhatsApp Pengajuan Absen: nomor HP atasan (NIP {$atasan['nip']}) belum tersedia untuk pengajuan #$pengajuan->id");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$link = (new VerifikasiAbsenLinkService())->generate($pengajuan->id, $atasan['nip']);
|
||||
|
||||
$tanggalMulai = Carbon::parse($pengajuan->tanggal_mulai);
|
||||
$tanggalSelesai = Carbon::parse($pengajuan->tanggal_selesai ?? $pengajuan->tanggal_mulai);
|
||||
|
||||
// TODO: nomor WA atasan masih manual/sementara, belum ada sumber data resminya.
|
||||
$nomorTujuan = '6289698424476';
|
||||
|
||||
(new WhatsAppService())->sendPengajuanAbsenNotification(
|
||||
$nomorTujuan,
|
||||
$atasan['nama_lengkap'] ?? $atasan['nama'],
|
||||
|
||||
@@ -3,17 +3,20 @@
|
||||
namespace App\Http\Controllers\Api\VerifikasiAbsen;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use App\Models\Verifikator\PengajuanPresensi;
|
||||
use App\Models\Verifikator\View\Pegawai;
|
||||
use App\Services\DawaiService;
|
||||
use App\Services\GoogleDriveService;
|
||||
use App\Services\TteService;
|
||||
use App\Services\VerifikasiAbsenLinkService;
|
||||
use App\Services\VerifikatorWebhookService;
|
||||
use Exception;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Throwable;
|
||||
|
||||
class VerifikasiAbsenController extends Controller
|
||||
@@ -32,7 +35,11 @@ class VerifikasiAbsenController extends Controller
|
||||
|
||||
public function show(Request $request, int $id): JsonResponse
|
||||
{
|
||||
$pengajuan = PengajuanPresensi::with(['pegawai', 'notes'])->findOrFail($id);
|
||||
$pengajuan = PengajuanPresensi::with(['pegawai', 'notes'])->find($id);
|
||||
|
||||
if (! $pengajuan) {
|
||||
return $this->responsePengajuanTidakDitemukan();
|
||||
}
|
||||
|
||||
$otorisasi = $this->otorisasiAtasan($request, $pengajuan);
|
||||
|
||||
@@ -43,10 +50,43 @@ class VerifikasiAbsenController extends Controller
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'state' => $this->resolveState($pengajuan),
|
||||
'sisa_detik' => $this->linkService->sisaSesiDetik($pengajuan->id, $request->input('token')),
|
||||
'data' => $this->formatPengajuan($pengajuan),
|
||||
]);
|
||||
}
|
||||
|
||||
public function perbaruiSesi(Request $request, int $id): JsonResponse
|
||||
{
|
||||
$pengajuan = PengajuanPresensi::find($id);
|
||||
|
||||
if (! $pengajuan) {
|
||||
return $this->responsePengajuanTidakDitemukan();
|
||||
}
|
||||
|
||||
if ($this->isExpired($pengajuan)) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'state' => 'expired',
|
||||
'message' => 'Pengajuan ini sudah kadaluarsa dan tidak dapat diverifikasi lagi.',
|
||||
], 422);
|
||||
}
|
||||
|
||||
$tokenBaru = $this->linkService->perbaruiSesiJikaHabis($pengajuan->id, $request->input('token'));
|
||||
|
||||
if (! $tokenBaru) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'state' => 'unauthorized',
|
||||
'message' => 'Sesi tidak dapat diperbarui. Tautan tidak valid atau sudah kedaluwarsa.',
|
||||
], 403);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'url' => $this->linkService->url($pengajuan->id, $tokenBaru),
|
||||
]);
|
||||
}
|
||||
|
||||
public function setujui(Request $request, int $id): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
@@ -54,7 +94,11 @@ class VerifikasiAbsenController extends Controller
|
||||
'passphrase' => 'required|string',
|
||||
]);
|
||||
|
||||
$pengajuan = PengajuanPresensi::with(['pegawai', 'notes'])->findOrFail($id);
|
||||
$pengajuan = PengajuanPresensi::with(['pegawai', 'notes'])->find($id);
|
||||
|
||||
if (! $pengajuan) {
|
||||
return $this->responsePengajuanTidakDitemukan();
|
||||
}
|
||||
|
||||
$otorisasi = $this->otorisasiAtasan($request, $pengajuan);
|
||||
|
||||
@@ -68,31 +112,48 @@ class VerifikasiAbsenController extends Controller
|
||||
return $gagal;
|
||||
}
|
||||
|
||||
// File lokal dibaca langsung dari disk (bukan lewat URL /storage) supaya tidak bergantung pada symlink & HTTP ke diri sendiri.
|
||||
$sumberFile = $pengajuan->bdr_id === null
|
||||
? Storage::disk('public')->path("{$pengajuan->tipe}/presensi/{$pengajuan->periode}/{$pengajuan->getRawOriginal('file')}")
|
||||
: $pengajuan->file;
|
||||
|
||||
$dokumenTertandatangani = $this->tteService->signDokumenUser(
|
||||
$request->nik,
|
||||
$request->passphrase,
|
||||
$pengajuan->file,
|
||||
$sumberFile,
|
||||
$this->linkService->url($pengajuan->id)
|
||||
);
|
||||
|
||||
if ($dokumenTertandatangani === false) {
|
||||
$this->catatLogGagalTtd($pengajuan, $nipAtasan);
|
||||
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Gagal menandatangani dokumen. Periksa kembali NIK dan Passphrase Anda.',
|
||||
], 422);
|
||||
}
|
||||
|
||||
if (! $this->googleDriveService->uploadPdf(
|
||||
$linkDrive = $this->googleDriveService->uploadPdf(
|
||||
$dokumenTertandatangani,
|
||||
$pengajuan->nip,
|
||||
$pengajuan->pegawai?->nama ?? $pengajuan->nip,
|
||||
$pengajuan->tanggal_mulai,
|
||||
$pengajuan->kategori
|
||||
)) {
|
||||
);
|
||||
|
||||
if (! $linkDrive) {
|
||||
Log::error("Gagal mengunggah dokumen tertandatangani ke Google Drive untuk pengajuan #$id");
|
||||
}
|
||||
|
||||
if (! $this->proses($pengajuan, 'Diterima', null, $nipAtasan, (string) $request->input('token'))) {
|
||||
if (! $this->proses(
|
||||
$pengajuan,
|
||||
'Diterima',
|
||||
null,
|
||||
$nipAtasan,
|
||||
(string) $request->input('token'),
|
||||
$linkDrive ?: null,
|
||||
fn () => $this->kirimKeDawai($pengajuan, 'Diterima', null, $nipAtasan, $linkDrive ?: null)
|
||||
)) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Gagal menyetujui pengajuan absen. Silakan coba lagi.',
|
||||
@@ -113,7 +174,11 @@ class VerifikasiAbsenController extends Controller
|
||||
'catatan' => 'required|string|max:500',
|
||||
]);
|
||||
|
||||
$pengajuan = PengajuanPresensi::with(['pegawai', 'notes'])->findOrFail($id);
|
||||
$pengajuan = PengajuanPresensi::with(['pegawai', 'notes'])->find($id);
|
||||
|
||||
if (! $pengajuan) {
|
||||
return $this->responsePengajuanTidakDitemukan();
|
||||
}
|
||||
|
||||
$otorisasi = $this->otorisasiAtasan($request, $pengajuan);
|
||||
|
||||
@@ -127,7 +192,15 @@ class VerifikasiAbsenController extends Controller
|
||||
return $gagal;
|
||||
}
|
||||
|
||||
if (! $this->proses($pengajuan, 'Ditolak', $request->catatan, $nipAtasan, (string) $request->input('token'))) {
|
||||
if (! $this->proses(
|
||||
$pengajuan,
|
||||
'Ditolak',
|
||||
$request->catatan,
|
||||
$nipAtasan,
|
||||
(string) $request->input('token'),
|
||||
null,
|
||||
fn () => $this->kirimKeDawai($pengajuan, 'Ditolak', $request->catatan, $nipAtasan)
|
||||
)) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Gagal menolak pengajuan absen. Silakan coba lagi.',
|
||||
@@ -188,6 +261,9 @@ class VerifikasiAbsenController extends Controller
|
||||
'kategori' => $pengajuan->kategori,
|
||||
'keterangan' => $pengajuan->keterangan,
|
||||
'file' => $pengajuan->file,
|
||||
'file_nama' => $pengajuan->bdr_id === null ? $pengajuan->getRawOriginal('file') : null,
|
||||
'file_tte' => $pengajuan->status === 'Diterima' ? $this->linkTte($pengajuan) : null,
|
||||
'penandatangan' => $pengajuan->status === 'Diterima' ? $this->namaPenandatangan($pengajuan) : null,
|
||||
'status' => $pengajuan->status,
|
||||
'alasan' => $pengajuan->notes?->last()?->message,
|
||||
'created_at' => $pengajuan->created_at,
|
||||
@@ -195,6 +271,36 @@ class VerifikasiAbsenController extends Controller
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Link dokumen ber-TTE di Google Drive dari log persetujuan terakhir (kalau upload ke Drive berhasil).
|
||||
*/
|
||||
private function linkTte(PengajuanPresensi $pengajuan): ?string
|
||||
{
|
||||
$logs = $pengajuan->logs()->whereNotNull('after')->orderByDesc('id')->get(['after']);
|
||||
|
||||
foreach ($logs as $log) {
|
||||
$link = json_decode((string) $log->after, true)['file_tte'] ?? null;
|
||||
|
||||
if ($link) {
|
||||
return $link;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Nama atasan yang menyetujui (dan menandatangani) lewat WhatsApp, dari log persetujuan terakhir.
|
||||
*/
|
||||
private function namaPenandatangan(PengajuanPresensi $pengajuan): ?string
|
||||
{
|
||||
return $pengajuan->logs()
|
||||
->where('employee_role', 'Atasan (via WhatsApp)')
|
||||
->where('message', 'Pengajuan Presensi Berhasil diterima')
|
||||
->orderByDesc('id')
|
||||
->value('employee_name');
|
||||
}
|
||||
|
||||
private function isExpired(PengajuanPresensi $pengajuan): bool
|
||||
{
|
||||
return $pengajuan->created_at?->copy()->addDays(self::BATAS_HARI_VERIFIKASI)->isPast() ?? false;
|
||||
@@ -220,6 +326,36 @@ class VerifikasiAbsenController extends Controller
|
||||
return $hasil['nip'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Catat percobaan tanda tangan yang gagal (NIK/passphrase salah). NIK dan passphrase sengaja tidak disimpan.
|
||||
*/
|
||||
private function catatLogGagalTtd(PengajuanPresensi $pengajuan, string $nipAtasan): void
|
||||
{
|
||||
try {
|
||||
$atasan = Pegawai::withoutGlobalScopes()->where('nip', $nipAtasan)->first();
|
||||
|
||||
$pengajuan->logs()->create([
|
||||
'user_id' => User::where('nip', $nipAtasan)->value('id'),
|
||||
'method' => 'POST',
|
||||
'employee_id' => $nipAtasan,
|
||||
'employee_name' => $atasan?->nama,
|
||||
'employee_role' => 'Atasan (via WhatsApp)',
|
||||
'message' => 'Gagal menandatangani dokumen saat menyetujui via WhatsApp (NIK atau passphrase tidak sesuai)',
|
||||
]);
|
||||
} catch (Throwable $th) {
|
||||
Log::error("Catat log gagal TTD pengajuan #$pengajuan->id: ".$th->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private function responsePengajuanTidakDitemukan(): JsonResponse
|
||||
{
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'state' => 'not_found',
|
||||
'message' => 'Pengajuan ini sudah dihapus oleh pemohon atau tidak ditemukan lagi, sehingga tidak dapat diverifikasi.',
|
||||
], 404);
|
||||
}
|
||||
|
||||
private function responseTidakBerwenang(string $reason): JsonResponse
|
||||
{
|
||||
return match ($reason) {
|
||||
@@ -231,7 +367,7 @@ class VerifikasiAbsenController extends Controller
|
||||
'session_expired' => response()->json([
|
||||
'success' => false,
|
||||
'state' => 'session_expired',
|
||||
'message' => 'Sesi verifikasi ini sudah lewat 5 menit sejak tautan dibuka. Silakan minta tautan verifikasi baru.',
|
||||
'message' => 'Sesi verifikasi ini sudah berakhir. Silakan klik kembali tombol "Tinjau Pengajuan" di WhatsApp untuk membuka sesi baru.',
|
||||
], 403),
|
||||
default => response()->json([
|
||||
'success' => false,
|
||||
@@ -241,10 +377,11 @@ class VerifikasiAbsenController extends Controller
|
||||
};
|
||||
}
|
||||
|
||||
private function proses(PengajuanPresensi $pengajuan, string $status, ?string $catatan, string $nipAtasan, string $token): bool
|
||||
private function proses(PengajuanPresensi $pengajuan, string $status, ?string $catatan, string $nipAtasan, string $token, ?string $linkTte = null, ?callable $sebelumCommit = null): bool
|
||||
{
|
||||
$atasan = Pegawai::withoutGlobalScopes()->where('nip', $nipAtasan)->first();
|
||||
$verifikatorRole = 'Atasan (via WhatsApp)';
|
||||
$userId = User::where('nip', $nipAtasan)->value('id');
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
@@ -252,18 +389,19 @@ class VerifikasiAbsenController extends Controller
|
||||
$pengajuan->update(['status' => $status]);
|
||||
|
||||
$pengajuan->logs()->create([
|
||||
'user_id' => null,
|
||||
'user_id' => $userId,
|
||||
'method' => 'POST',
|
||||
'employee_id' => $nipAtasan,
|
||||
'employee_name' => $atasan?->nama ?? $pengajuan->pegawai?->nama,
|
||||
'employee_role' => $verifikatorRole,
|
||||
'message' => 'Pengajuan Presensi Berhasil '.strtolower($status).' via WhatsApp',
|
||||
'message' => 'Pengajuan Presensi Berhasil '.strtolower($status),
|
||||
'after' => $linkTte ? json_encode(['file_tte' => $linkTte]) : null,
|
||||
]);
|
||||
|
||||
if ($status === 'Ditolak') {
|
||||
$pengajuan->notes()->create([
|
||||
'type' => 'Catatan',
|
||||
'user_id' => null,
|
||||
'user_id' => $userId,
|
||||
'employee_id' => $nipAtasan,
|
||||
'employee_name' => $atasan?->nama ?? $pengajuan->pegawai?->nama,
|
||||
'employee_role' => $verifikatorRole,
|
||||
@@ -271,32 +409,21 @@ class VerifikasiAbsenController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
if ($sebelumCommit && ! $sebelumCommit()) {
|
||||
throw new Exception('Gagal mengirim hasil verifikasi ke DAWAI');
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
$this->linkService->markUsed($pengajuan->id, $token);
|
||||
|
||||
$pengajuan->refresh()->load('notes');
|
||||
|
||||
try {
|
||||
$webhookResponse = Http::timeout(5)
|
||||
->withHeaders(['X-API-Key' => config('services.verifikator_webhook.key')])
|
||||
->post(config('services.verifikator_webhook.url'), [
|
||||
'jenis' => 'izin',
|
||||
'nip' => $pengajuan->nip,
|
||||
'tanggal' => $pengajuan->tanggal_mulai,
|
||||
'kategori' => $this->mapKategoriSlug($pengajuan->getRawOriginal('kategori')),
|
||||
'status' => $status === 'Diterima' ? 'approved' : 'rejected',
|
||||
'alasan' => $catatan ?? '',
|
||||
]);
|
||||
|
||||
if ($webhookResponse->successful()) {
|
||||
Log::info("Webhook Verifikator via WhatsApp berhasil: {$pengajuan->nip} ($status)");
|
||||
} else {
|
||||
Log::warning("Webhook Verifikator via WhatsApp gagal: {$pengajuan->nip} ($status) - HTTP {$webhookResponse->status()}");
|
||||
}
|
||||
} catch (Throwable $webhookException) {
|
||||
Log::error("Webhook Verifikator via WhatsApp error: {$pengajuan->nip} ($status) - ".$webhookException->getMessage());
|
||||
}
|
||||
(new VerifikatorWebhookService)->kirimIzin(
|
||||
$pengajuan,
|
||||
$status === 'Diterima' ? VerifikatorWebhookService::STATUS_APPROVED : VerifikatorWebhookService::STATUS_REJECTED,
|
||||
$catatan
|
||||
);
|
||||
|
||||
return true;
|
||||
} catch (Throwable $th) {
|
||||
@@ -307,16 +434,8 @@ class VerifikasiAbsenController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
private function mapKategoriSlug(mixed $kategoriId): ?string
|
||||
private function kirimKeDawai(PengajuanPresensi $pengajuan, string $status, ?string $catatan, string $nipAtasan, ?string $linkTte = null): bool
|
||||
{
|
||||
return match ((int) $kategoriId) {
|
||||
2 => 'dinas',
|
||||
3 => 'terlambat',
|
||||
20 => 'lupa_absen',
|
||||
21 => 'cepat_pulang',
|
||||
24 => 'lupa_absen_masuk',
|
||||
25 => 'lupa_absen_pulang',
|
||||
default => null,
|
||||
};
|
||||
return $this->dawaiService->kirimVerifikasiPresensi($pengajuan, $status, $catatan, $nipAtasan, $linkTte);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ class RasioP2Controller extends Controller
|
||||
$unitPembayaranNama = UnitKerjaVerifikator::find($unit)?->nama ?? '-';
|
||||
|
||||
// Query dengan optimalisasi
|
||||
$pegawaisQuery = Pegawai::select('id', 'nip', 'nip_siakad', 'nama', 'jenis_pegawai', 'unit_kerja_nama', 'jabatan_fungsional_id', 'jabatan_dtt_id')
|
||||
$pegawaisQuery = Pegawai::withoutGlobalScope('aktif')->select('id', 'nip', 'nip_siakad', 'nama', 'jenis_pegawai', 'unit_kerja_nama', 'jabatan_fungsional_id', 'jabatan_dtt_id')
|
||||
->whereHas('jabatan', function ($query) use ($unit, $periode) {
|
||||
$query
|
||||
->where('periode', $periode)
|
||||
@@ -374,7 +374,7 @@ class RasioP2Controller extends Controller
|
||||
$isAdmin = $team && $team->nama === 'Admin';
|
||||
$unit = $request->boolean('gabung') ? null : ($request->unit ?? $team->unit_kerja_id ?? null);
|
||||
|
||||
$pegawai = Pegawai::where(function ($query) use ($nip) {
|
||||
$pegawai = Pegawai::withoutGlobalScope('aktif')->where(function ($query) use ($nip) {
|
||||
$query->where('nip', $nip)->orWhere('nip_siakad', $nip);
|
||||
})->first();
|
||||
|
||||
@@ -415,7 +415,7 @@ class RasioP2Controller extends Controller
|
||||
$team = Team::find(session('team_id'));
|
||||
$unit = $request->boolean('gabung') ? null : ($request->unit ?? $team->unit_kerja_id ?? null);
|
||||
|
||||
$pegawai = Pegawai::where(function ($query) use ($nip) {
|
||||
$pegawai = Pegawai::withoutGlobalScope('aktif')->where(function ($query) use ($nip) {
|
||||
$query->where('nip', $nip)->orWhere('nip_siakad', $nip);
|
||||
})->first();
|
||||
|
||||
@@ -895,7 +895,7 @@ class RasioP2Controller extends Controller
|
||||
$team = Team::find(session('team_id'));
|
||||
$unit = $request->unit ?? $team->unit_kerja_id ?? null;
|
||||
|
||||
$pegawai = Pegawai::where(function ($query) use ($nip) {
|
||||
$pegawai = Pegawai::withoutGlobalScope('aktif')->where(function ($query) use ($nip) {
|
||||
$query->where('nip', $nip)
|
||||
->orWhere('nip_siakad', $nip);
|
||||
})->first();
|
||||
@@ -978,7 +978,7 @@ class RasioP2Controller extends Controller
|
||||
|
||||
if (! empty($request->filter_nominal)) {
|
||||
// Jika nominal diisi, hitung total P2 normal terlebih dahulu
|
||||
$pegawaisQuery = Pegawai::select('id', 'nip', 'nip_siakad', 'nama', 'jenis_pegawai', 'unit_kerja_nama', 'jabatan_fungsional_id', 'jabatan_dtt_id')
|
||||
$pegawaisQuery = Pegawai::withoutGlobalScope('aktif')->select('id', 'nip', 'nip_siakad', 'nama', 'jenis_pegawai', 'unit_kerja_nama', 'jabatan_fungsional_id', 'jabatan_dtt_id')
|
||||
->whereHas('jabatan', function ($query) use ($unitKerjaId, $periode) {
|
||||
$query
|
||||
->where('periode', $periode)
|
||||
|
||||
@@ -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' : '-'))
|
||||
@@ -62,6 +66,39 @@ class KeseluruhanController extends Controller
|
||||
->make();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hapus cache rekap Keseluruhan (termasuk cache THR/R13 dari API Dawai) untuk tahun terpilih lalu
|
||||
* bangun ulang. Hanya membaca dari DB/API dan menyimpan cache — tidak menulis ke tabel remunerasi.
|
||||
*/
|
||||
public function refresh(Request $request): JsonResponse
|
||||
{
|
||||
$this->authorizeAccess();
|
||||
|
||||
set_time_limit(300);
|
||||
|
||||
$tahun = (int) ($request->tahun ?: now()->year);
|
||||
$start = microtime(true);
|
||||
|
||||
foreach ([null, 'dosen', 'tendik', 'Dosen', 'Tendik'] as $jenis) {
|
||||
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}");
|
||||
}
|
||||
|
||||
$sumberP1 = $this->normalizeSumberP1($request);
|
||||
$this->ensureSnapshotTersedia($tahun, $sumberP1);
|
||||
|
||||
$rows = $this->buildRekap($tahun, null, $sumberP1);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'tahun' => $tahun,
|
||||
'rows' => $rows->count(),
|
||||
'seconds' => round(microtime(true) - $start, 1),
|
||||
]);
|
||||
}
|
||||
|
||||
public function export(Request $request): BinaryFileResponse
|
||||
{
|
||||
$this->authorizeAccess();
|
||||
@@ -73,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 !== '') {
|
||||
@@ -82,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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,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) {
|
||||
@@ -115,14 +210,52 @@ 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_v5_'.$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_v9_'.$tahun.'_'.($jenisPegawai ?: 'semua');
|
||||
|
||||
// Cache ikut berganti bila JSON kekurangan P2 diubah.
|
||||
$mtimeP2 = collect(glob(resource_path("data/{$tahun}/kekurangan_p2_*.json")) ?: [])->map(fn ($f) => filemtime($f))->max();
|
||||
$key .= '_p2json_'.($mtimeP2 ?? 0);
|
||||
|
||||
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}"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,36 +268,70 @@ class KeseluruhanController extends Controller
|
||||
return $tahun === (int) now()->year ? (int) now()->month : 12;
|
||||
}
|
||||
|
||||
private function computeRekap(int $tahun, ?string $jenisPegawai): array
|
||||
/**
|
||||
* Snapshot P2 (JSON, hasil perhitungan read-only) untuk pegawai yang P2-nya belum tersimpan di DB.
|
||||
* Format: {"<nip>": {"p2_bruto": 0.0}}; file per tahun/periode di resources/data/{tahun}/kekurangan_p2_{periode}.json.
|
||||
*/
|
||||
private function loadP2Snapshot(int $tahun, int|string $periode): array
|
||||
{
|
||||
$path = resource_path("data/{$tahun}/kekurangan_p2_{$periode}.json");
|
||||
|
||||
if (! is_file($path)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return json_decode((string) file_get_contents($path), true) ?: [];
|
||||
}
|
||||
|
||||
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'));
|
||||
$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');
|
||||
|
||||
$p2 = collect();
|
||||
$p2Pajak = collect();
|
||||
$p2Netto = collect();
|
||||
$p2DariJson = [];
|
||||
if ($periodeSemester1) {
|
||||
$p2 = Pegawai::withoutGlobalScopes()
|
||||
$p2Rows = Pegawai::withoutGlobalScopes()
|
||||
->join('verifikator.jabatan_pegawais as jp', 'verifikator.pegawais.nip', '=', 'jp.nip')
|
||||
->join('verifikator.jabatan_pegawai_details as jpd', 'jp.id', '=', 'jpd.jabatan_pegawai_id')
|
||||
->join('verifikator.remunerasi_per_bulans as rpb', 'jpd.id', '=', 'rpb.jabatan_pegawai_detail_id')
|
||||
->select('verifikator.pegawais.nip')
|
||||
->selectRaw('SUM(rpb.p2_bruto) as total')
|
||||
->selectRaw('SUM(rpb.p2_tax) as total_pajak')
|
||||
->selectRaw('SUM(rpb.p2_netto) as total_netto')
|
||||
->whereNull('rpb.deleted_at')
|
||||
->where('jp.periode', $periodeSemester1)
|
||||
->where('jp.active', true)
|
||||
@@ -172,8 +339,23 @@ class KeseluruhanController extends Controller
|
||||
->groupBy('verifikator.pegawais.nip')
|
||||
->havingRaw('SUM(rpb.p2_bruto) > 0')
|
||||
->get()
|
||||
->keyBy(fn ($row) => $normalize($row->nip))
|
||||
->map(fn ($row) => (float) $row->total);
|
||||
->keyBy(fn ($row) => $normalize($row->nip));
|
||||
|
||||
$p2 = $p2Rows->map(fn ($row) => (float) $row->total);
|
||||
$p2Pajak = $p2Rows->map(fn ($row) => (float) $row->total_pajak);
|
||||
$p2Netto = $p2Rows->map(fn ($row) => (float) $row->total_netto);
|
||||
|
||||
// Snapshot JSON hasil perhitungan (read-only, tanpa menulis ke DB): bila pegawai ada di JSON
|
||||
// dengan P2 > 0, nilai JSON menimpa nilai dari DB (juga untuk pegawai yang belum ada di DB, mis. CPNS).
|
||||
foreach ($this->loadP2Snapshot($tahun, $periodeSemester1) as $nip => $nilai) {
|
||||
$key = $normalize($nip);
|
||||
if (($nilai['p2_bruto'] ?? 0) > 0) {
|
||||
$p2->put($key, (float) $nilai['p2_bruto']);
|
||||
$p2Pajak->put($key, (float) ($nilai['p2_pajak'] ?? 0));
|
||||
$p2Netto->put($key, (float) ($nilai['p2_netto'] ?? 0));
|
||||
$p2DariJson[$key] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. THR & 4. R13 = data eksternal (API Dawai), untuk seluruh unit sekaligus lalu di-cache
|
||||
@@ -186,6 +368,7 @@ class KeseluruhanController extends Controller
|
||||
fn () => (new DawaiService)->getDataThr($jenisPegawaiParam, $tahun, null, false)
|
||||
);
|
||||
$thr = collect($thrData)->keyBy(fn ($row) => $normalize($row['nip'] ?? ''))->map(fn ($row) => (float) ($row['total_thr'] ?? 0));
|
||||
$thrNetto = collect($thrData)->keyBy(fn ($row) => $normalize($row['nip'] ?? ''))->map(fn ($row) => (float) ($row['total_thr_setelah_pajak'] ?? 0));
|
||||
|
||||
$r13Data = Cache::remember(
|
||||
"keseluruhan_r13_{$jenisPegawaiParam}_{$tahun}",
|
||||
@@ -193,16 +376,19 @@ class KeseluruhanController extends Controller
|
||||
fn () => (new DawaiService)->getDataR13($jenisPegawaiParam, $tahun, null, false)
|
||||
);
|
||||
$r13 = collect($r13Data)->keyBy(fn ($row) => $normalize($row['nip'] ?? ''))->map(fn ($row) => (float) ($row['total_r13'] ?? 0));
|
||||
$r13Netto = collect($r13Data)->keyBy(fn ($row) => $normalize($row['nip'] ?? ''))->map(fn ($row) => (float) ($row['total_r13_setelah_pajak'] ?? 0));
|
||||
|
||||
// 5. Publikasi = seluruh periode yang namanya memuat tahun terpilih (mis. "2026 Semester 1"
|
||||
// maupun "2025/2026 Ganjil"), karena publikasi tidak terikat pada satu format periode tertentu.
|
||||
$periodeIds = Periode::where('nama', 'LIKE', "%{$tahun}%")->pluck('id_periode');
|
||||
// 5. Publikasi = hanya periode Semester 1 tahun terpilih (mis. 401 untuk 2026), sama seperti P2;
|
||||
// Semester 2 belum waktunya perhitungan dan periode Ganjil/Genap tahun sebelumnya tidak dihitung.
|
||||
$periodeIds = collect($periodeSemester1 ? [$periodeSemester1] : []);
|
||||
|
||||
$publikasiQuery = Publikasi::query()
|
||||
->whereIn('periode', $periodeIds)
|
||||
->where('poin_total', '>', 0)
|
||||
->select('nip')
|
||||
->selectRaw('SUM(biaya_remunerasi) as total');
|
||||
->selectRaw('SUM(biaya_remunerasi) as total')
|
||||
->selectRaw('SUM(COALESCE(pajak, 0)) as total_pajak')
|
||||
->selectRaw('SUM(GREATEST(biaya_remunerasi - COALESCE(pajak, 0), 0)) as total_netto');
|
||||
|
||||
if ($jenisPegawai) {
|
||||
$publikasiQuery->whereHas('pegawai', function ($q) use ($jenisPegawai) {
|
||||
@@ -210,9 +396,12 @@ class KeseluruhanController extends Controller
|
||||
});
|
||||
}
|
||||
|
||||
$publikasi = $publikasiQuery->groupBy('nip')->get()
|
||||
->keyBy(fn ($row) => $normalize($row->nip))
|
||||
->map(fn ($row) => (float) $row->total);
|
||||
$publikasiRows = $publikasiQuery->groupBy('nip')->get()
|
||||
->keyBy(fn ($row) => $normalize($row->nip));
|
||||
|
||||
$publikasi = $publikasiRows->map(fn ($row) => (float) $row->total);
|
||||
$publikasiPajak = $publikasiRows->map(fn ($row) => (float) $row->total_pajak);
|
||||
$publikasiNetto = $publikasiRows->map(fn ($row) => (float) $row->total_netto);
|
||||
|
||||
$allNips = $p1->keys()
|
||||
->merge($p2->keys())
|
||||
@@ -238,7 +427,7 @@ class KeseluruhanController extends Controller
|
||||
->get()
|
||||
->keyBy(fn ($row) => $normalize($row->nip));
|
||||
|
||||
return $allNips->map(function ($nip) use ($pegawaiInfo, $p1, $p1Bulanan, $bulanTerakhir, $p2, $thr, $r13, $publikasi, $jenisPegawai) {
|
||||
return $allNips->map(function ($nip) use ($pegawaiInfo, $p1, $p1Pajak, $p1Netto, $p1Bulanan, $bulanTerakhir, $p2, $p2Pajak, $p2Netto, $p2DariJson, $thr, $thrNetto, $r13, $r13Netto, $publikasi, $publikasiPajak, $publikasiNetto, $jenisPegawai) {
|
||||
$info = $pegawaiInfo->get($nip);
|
||||
|
||||
if (! $info) {
|
||||
@@ -256,6 +445,17 @@ class KeseluruhanController extends Controller
|
||||
$jumlahPublikasi = $publikasi->get($nip, 0.0);
|
||||
$total = $jumlahP1 + $jumlahP2 + $jumlahThr + $jumlahR13 + $jumlahPublikasi;
|
||||
|
||||
$nettoP1 = $p1Netto->get($nip, 0.0);
|
||||
$nettoP2 = $p2Netto->get($nip, 0.0);
|
||||
$nettoThr = $thrNetto->get($nip, 0.0);
|
||||
$nettoR13 = $r13Netto->get($nip, 0.0);
|
||||
$nettoPublikasi = $publikasiNetto->get($nip, 0.0);
|
||||
$pajakP1 = $p1Pajak->get($nip, 0.0);
|
||||
$pajakP2 = $p2Pajak->get($nip, 0.0);
|
||||
$pajakThr = max($jumlahThr - $nettoThr, 0.0);
|
||||
$pajakR13 = max($jumlahR13 - $nettoR13, 0.0);
|
||||
$pajakPublikasi = $publikasiPajak->get($nip, 0.0);
|
||||
|
||||
if ($total <= 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -275,10 +475,23 @@ class KeseluruhanController extends Controller
|
||||
'jumlah_p1' => $jumlahP1,
|
||||
'jumlah_p1_bulanan' => $jumlahP1Bulanan,
|
||||
'jumlah_p2' => $jumlahP2,
|
||||
'p2_sumber' => isset($p2DariJson[$nip]) ? 'json' : 'db',
|
||||
'jumlah_thr' => $jumlahThr,
|
||||
'jumlah_r13' => $jumlahR13,
|
||||
'jumlah_publikasi' => $jumlahPublikasi,
|
||||
'total' => $total,
|
||||
'pajak_p1' => $pajakP1,
|
||||
'netto_p1' => $nettoP1,
|
||||
'pajak_p2' => $pajakP2,
|
||||
'netto_p2' => $nettoP2,
|
||||
'pajak_thr' => $pajakThr,
|
||||
'netto_thr' => $nettoThr,
|
||||
'pajak_r13' => $pajakR13,
|
||||
'netto_r13' => $nettoR13,
|
||||
'pajak_publikasi' => $pajakPublikasi,
|
||||
'netto_publikasi' => $nettoPublikasi,
|
||||
'total_pajak' => $pajakP1 + $pajakP2 + $pajakThr + $pajakR13 + $pajakPublikasi,
|
||||
'total_netto' => $nettoP1 + $nettoP2 + $nettoThr + $nettoR13 + $nettoPublikasi,
|
||||
];
|
||||
})->filter()->values()->all();
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\Models\Verifikator\Periode;
|
||||
use App\Models\Verifikator\Team;
|
||||
use App\Models\Verifikator\UnitKerjaPegawai;
|
||||
use App\Services\DawaiService;
|
||||
use App\Services\VerifikatorWebhookService;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -464,6 +465,13 @@ class HonorerController extends Controller
|
||||
return response()->json(['success' => false, 'message' => $validasiWaktu['message']], 403);
|
||||
}
|
||||
|
||||
if (PengajuanPresensi::where('id', $id)->where('status', 'Diterima')->exists()) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Pengajuan yang sudah diterima tidak dapat dibatalkan',
|
||||
], 422);
|
||||
}
|
||||
|
||||
$success = $this->sekretariat([$id], 'Diajukan', null);
|
||||
|
||||
if ($success !== null) {
|
||||
@@ -505,6 +513,8 @@ class HonorerController extends Controller
|
||||
// Soft delete dengan mengisi deleted_at dengan tanggal sekarang
|
||||
$pengajuan->delete();
|
||||
|
||||
(new VerifikatorWebhookService)->kirimIzin($pengajuan, VerifikatorWebhookService::STATUS_DELETED);
|
||||
|
||||
Log::info("Pengajuan Presensi Dihapus: ID $id oleh ".Auth::user()->name);
|
||||
|
||||
return response()->json([
|
||||
@@ -561,10 +571,15 @@ class HonorerController extends Controller
|
||||
}
|
||||
|
||||
// Soft delete multiple records (hanya yang status "Diajukan")
|
||||
$dihapus = PengajuanPresensi::whereIn('id', $request->ids)->where('status', 'Diajukan')->get();
|
||||
$deletedCount = PengajuanPresensi::whereIn('id', $request->ids)
|
||||
->where('status', 'Diajukan')
|
||||
->delete();
|
||||
|
||||
foreach ($dihapus as $item) {
|
||||
(new VerifikatorWebhookService)->kirimIzin($item, VerifikatorWebhookService::STATUS_DELETED);
|
||||
}
|
||||
|
||||
Log::info("Pengajuan Presensi Dihapus (Batch): $deletedCount pengajuan oleh ".Auth::user()->name.' - IDs: '.implode(', ', $request->ids));
|
||||
|
||||
return response()->json([
|
||||
@@ -680,6 +695,13 @@ class HonorerController extends Controller
|
||||
], 422);
|
||||
}
|
||||
|
||||
if (PengajuanPresensi::whereIn('id', $request->ids)->where('status', 'Diterima')->exists()) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Pengajuan yang sudah diterima tidak dapat dibatalkan',
|
||||
], 422);
|
||||
}
|
||||
|
||||
$success = $this->sekretariat($request->ids, 'Diajukan', null);
|
||||
|
||||
if ($success !== null) {
|
||||
@@ -735,8 +757,19 @@ class HonorerController extends Controller
|
||||
Log::error("Presensi DAWAI: $pengajuan->nip ($status)");
|
||||
throw new Exception('Presensi: DAWAI ERROR');
|
||||
}
|
||||
if ($status !== 'Diajukan' && ! $this->dawaiService->kirimVerifikasiPresensi($pengajuan, $status, $catatan, Auth::user()->nip)) {
|
||||
throw new Exception('Presensi: DAWAI ERROR (siskaPengajuanPresensi)');
|
||||
}
|
||||
DB::commit();
|
||||
|
||||
if ($status !== 'Diajukan') {
|
||||
(new VerifikatorWebhookService)->kirimIzin(
|
||||
$pengajuan,
|
||||
$status === 'Diterima' ? VerifikatorWebhookService::STATUS_APPROVED : VerifikatorWebhookService::STATUS_REJECTED,
|
||||
$catatan
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
$webhookResponse = Http::timeout(5)->asMultipart()->post('http://172.16.50.94:8084/webhook/presensi', [
|
||||
['name' => 'nip', 'contents' => $pengajuan->nip],
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\Models\Verifikator\Team;
|
||||
use App\Models\Verifikator\Tendik;
|
||||
use App\Models\Verifikator\UnitKerjaPegawai;
|
||||
use App\Services\DawaiService;
|
||||
use App\Services\VerifikatorWebhookService;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -431,6 +432,13 @@ class TendikController extends Controller
|
||||
{
|
||||
BawahanHelper::authorizePengajuan($id);
|
||||
|
||||
if (PengajuanPresensi::where('id', $id)->where('status', 'Diterima')->exists()) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Pengajuan yang sudah diterima tidak dapat dibatalkan',
|
||||
], 422);
|
||||
}
|
||||
|
||||
$success = $this->sekretariat([$id], 'Diajukan', null);
|
||||
|
||||
if ($success !== null) {
|
||||
@@ -472,6 +480,8 @@ class TendikController extends Controller
|
||||
// Soft delete dengan mengisi deleted_at dengan tanggal sekarang
|
||||
$pengajuan->delete();
|
||||
|
||||
(new VerifikatorWebhookService)->kirimIzin($pengajuan, VerifikatorWebhookService::STATUS_DELETED);
|
||||
|
||||
Log::info("Pengajuan Presensi Dihapus: ID $id oleh ".Auth::user()->name);
|
||||
|
||||
return response()->json([
|
||||
@@ -528,10 +538,15 @@ class TendikController extends Controller
|
||||
}
|
||||
|
||||
// Soft delete multiple records (hanya yang status "Diajukan")
|
||||
$dihapus = PengajuanPresensi::whereIn('id', $request->ids)->where('status', 'Diajukan')->get();
|
||||
$deletedCount = PengajuanPresensi::whereIn('id', $request->ids)
|
||||
->where('status', 'Diajukan')
|
||||
->delete();
|
||||
|
||||
foreach ($dihapus as $item) {
|
||||
(new VerifikatorWebhookService)->kirimIzin($item, VerifikatorWebhookService::STATUS_DELETED);
|
||||
}
|
||||
|
||||
Log::info("Pengajuan Presensi Dihapus (Batch): $deletedCount pengajuan oleh ".Auth::user()->name.' - IDs: '.implode(', ', $request->ids));
|
||||
|
||||
return response()->json([
|
||||
@@ -637,6 +652,13 @@ class TendikController extends Controller
|
||||
], 422);
|
||||
}
|
||||
|
||||
if (PengajuanPresensi::whereIn('id', $request->ids)->where('status', 'Diterima')->exists()) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Pengajuan yang sudah diterima tidak dapat dibatalkan',
|
||||
], 422);
|
||||
}
|
||||
|
||||
$success = $this->sekretariat($request->ids, 'Diajukan', null);
|
||||
|
||||
if ($success !== null) {
|
||||
@@ -695,8 +717,19 @@ class TendikController extends Controller
|
||||
Log::error("Presensi DAWAI: $pengajuan->nip ($status)");
|
||||
throw new Exception('Presensi: DAWAI ERROR');
|
||||
}
|
||||
if ($status !== 'Diajukan' && ! $this->dawaiService->kirimVerifikasiPresensi($pengajuan, $status, $catatan, Auth::user()->nip)) {
|
||||
throw new Exception('Presensi: DAWAI ERROR (siskaPengajuanPresensi)');
|
||||
}
|
||||
DB::commit();
|
||||
|
||||
if ($status !== 'Diajukan') {
|
||||
(new VerifikatorWebhookService)->kirimIzin(
|
||||
$pengajuan,
|
||||
$status === 'Diterima' ? VerifikatorWebhookService::STATUS_APPROVED : VerifikatorWebhookService::STATUS_REJECTED,
|
||||
$catatan
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
$webhookResponse = Http::timeout(5)->asMultipart()->post('http://172.16.50.94:8084/webhook/presensi', [
|
||||
['name' => 'nip', 'contents' => $pengajuan->nip],
|
||||
|
||||
@@ -2,10 +2,53 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Verifikator\PengajuanPresensi;
|
||||
use App\Services\VerifikasiAbsenLinkService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class VerifikasiAbsenHalamanController extends Controller
|
||||
{
|
||||
public function show(int $id)
|
||||
public function __construct(
|
||||
protected VerifikasiAbsenLinkService $linkService,
|
||||
) {}
|
||||
|
||||
public function show(Request $request, int $id)
|
||||
{
|
||||
if ($request->filled('img')) {
|
||||
return $this->tampilkanFile($request, $id, (string) $request->query('img'));
|
||||
}
|
||||
|
||||
return view('verifikasi-absen.halaman', ['id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tampilkan file bukti pengajuan lewat ?token=...&img=<nama file>.
|
||||
* Hanya file milik pengajuan ini yang bisa dibuka, dengan token yang sah (tidak dibatasi sesi).
|
||||
*/
|
||||
private function tampilkanFile(Request $request, int $id, string $img)
|
||||
{
|
||||
// Hanya melihat file: cukup tautan sah, tidak dibatasi sesi (tetap bisa dibuka setelah diterima/ditolak).
|
||||
abort_unless($this->linkService->tautanSah($id, $request->query('token')), 403, 'Tautan tidak valid atau sudah kedaluwarsa.');
|
||||
|
||||
$pengajuan = PengajuanPresensi::find($id);
|
||||
|
||||
abort_unless($pengajuan, 404, 'Pengajuan tidak ditemukan.');
|
||||
|
||||
$namaFile = basename($img);
|
||||
$fileSah = array_filter([
|
||||
$pengajuan->getRawOriginal('file'),
|
||||
$pengajuan->getRawOriginal('file_lampiran'),
|
||||
]);
|
||||
|
||||
abort_unless($pengajuan->bdr_id === null && in_array($namaFile, $fileSah, true), 404);
|
||||
|
||||
$path = "{$pengajuan->tipe}/presensi/{$pengajuan->periode}/{$namaFile}";
|
||||
|
||||
abort_unless(Storage::disk('public')->exists($path), 404, 'File tidak ditemukan.');
|
||||
|
||||
return response()->file(Storage::disk('public')->path($path), [
|
||||
'Content-Disposition' => 'inline; filename="'.$namaFile.'"',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,11 @@ namespace App\Models\Rekapitulasi;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class P1 extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
protected $table = 'rekapitulasi.p1';
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -2,8 +2,13 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Verifikator\Dosen;
|
||||
use App\Models\Verifikator\PengajuanPresensi;
|
||||
use App\Models\Verifikator\Tendik;
|
||||
use Carbon\Carbon;
|
||||
use Error;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Throwable;
|
||||
@@ -200,6 +205,75 @@ class DawaiService
|
||||
return false;
|
||||
}
|
||||
|
||||
public function kirimVerifikasiPresensi(PengajuanPresensi $pengajuan, string $status, ?string $catatan, string $nipVerifikator, ?string $linkTte = null): bool
|
||||
{
|
||||
$noHp = preg_replace('/\D+/', '', (string) (Dosen::where('nip', $nipVerifikator)->value('no_hp') ?: Tendik::where('nip', $nipVerifikator)->value('no_hp')));
|
||||
$noHp = str_starts_with($noHp, '0') ? '62'.substr($noHp, 1) : $noHp;
|
||||
|
||||
$data = [
|
||||
'nip' => $pengajuan->nip,
|
||||
'tanggal_mulai' => Carbon::parse($pengajuan->tanggal_mulai)->format('Y-m-d'),
|
||||
'tanggal_selesai' => Carbon::parse($pengajuan->tanggal_selesai ?? $pengajuan->tanggal_mulai)->format('Y-m-d'),
|
||||
'keterangan' => $pengajuan->keterangan,
|
||||
'status_pengajuan_id' => $pengajuan->getRawOriginal('kategori'),
|
||||
'link_file' => ($status === 'Diterima' ? $linkTte : null) ?: $pengajuan->file,
|
||||
'status_verifikasi' => $status,
|
||||
'lokasi' => 'Indonesia',
|
||||
'no_np' => $noHp,
|
||||
];
|
||||
|
||||
if ($status === 'Ditolak') {
|
||||
$data['alasan_tolak'] = $catatan;
|
||||
}
|
||||
|
||||
if (! $this->kirimPengajuanPresensi($data)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Log::info("DAWAI siskaPengajuanPresensi berhasil: {$pengajuan->nip} ($status)");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function kirimPengajuanPresensi(array $data): bool
|
||||
{
|
||||
try {
|
||||
$multipart = [];
|
||||
foreach ($data as $name => $contents) {
|
||||
$multipart[] = ['name' => $name, 'contents' => (string) ($contents ?? '')];
|
||||
}
|
||||
|
||||
$response = $this->client->post('api/v1/siskaPengajuanPresensi', [
|
||||
'multipart' => $multipart,
|
||||
'timeout' => 15,
|
||||
]);
|
||||
|
||||
$result = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
if (is_array($result) && array_key_exists('status', $result) && ! $result['status']) {
|
||||
throw new Error($result['message'] ?? 'DAWAI menolak pengajuan presensi');
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (ClientException $e) {
|
||||
$pesan = json_decode((string) $e->getResponse()->getBody(), true)['meta']['message'] ?? '';
|
||||
|
||||
if ($e->getResponse()->getStatusCode() === 400 && str_contains(strtolower($pesan), 'sudah ada')) {
|
||||
Log::warning("DAWAI siskaPengajuanPresensi: data sudah ada di DAWAI ({$data['nip']} {$data['tanggal_mulai']}): $pesan");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Log::error('DAWAI siskaPengajuanPresensi: '.$e->getMessage());
|
||||
|
||||
return false;
|
||||
} catch (Throwable $th) {
|
||||
Log::error('DAWAI siskaPengajuanPresensi: '.$th->getMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function listJabatanFungsional(?int $id)
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -3,27 +3,23 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Verifikator\VerifikasiAbsenToken;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class VerifikasiAbsenLinkService
|
||||
{
|
||||
const TTL_MENIT_DEFAULT = 7200;
|
||||
|
||||
const SESI_MENIT = 5;
|
||||
const SESI_MENIT = 1440;
|
||||
|
||||
const PURPOSE = 'verifikasi-presensi';
|
||||
|
||||
public function generate(int $pengajuanId, string $nip, int $ttlMenit = self::TTL_MENIT_DEFAULT): array
|
||||
{
|
||||
$tokenPlaintext = Str::random(40);
|
||||
|
||||
VerifikasiAbsenToken::create([
|
||||
'pengajuan_id' => $pengajuanId,
|
||||
'nip' => $nip,
|
||||
'token' => $this->hash($tokenPlaintext),
|
||||
'purpose' => self::PURPOSE,
|
||||
'expires_at' => now()->addMinutes($ttlMenit),
|
||||
]);
|
||||
$tokenPlaintext = $this->buatToken($pengajuanId, $nip, now()->addMinutes($ttlMenit));
|
||||
|
||||
return [
|
||||
'nip' => $nip,
|
||||
@@ -76,6 +72,91 @@ class VerifikasiAbsenLinkService
|
||||
return ['ok' => true, 'nip' => $row->nip, 'reason' => null];
|
||||
}
|
||||
|
||||
/**
|
||||
* Cek token hanya sebagai bukti tautan sah (milik pengajuan ini & belum kedaluwarsa), tanpa batas sesi
|
||||
* dan tanpa memulai sesi. Dipakai untuk melihat file bukti yang tidak mengubah data.
|
||||
*/
|
||||
public function tautanSah(int $pengajuanId, ?string $token): bool
|
||||
{
|
||||
if (! $token) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$row = VerifikasiAbsenToken::where('pengajuan_id', $pengajuanId)
|
||||
->where('token', $this->hash($token))
|
||||
->where('purpose', self::PURPOSE)
|
||||
->first();
|
||||
|
||||
return $row !== null && ! now()->greaterThan($row->expires_at);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sisa detik sesi untuk token ini (0 kalau sudah habis), null kalau token tidak dikenal atau belum pernah dibuka.
|
||||
*/
|
||||
public function sisaSesiDetik(int $pengajuanId, ?string $token): ?int
|
||||
{
|
||||
if (! $token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$row = VerifikasiAbsenToken::where('pengajuan_id', $pengajuanId)
|
||||
->where('token', $this->hash($token))
|
||||
->where('purpose', self::PURPOSE)
|
||||
->first();
|
||||
|
||||
if (! $row || $row->first_accessed_at === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$berakhir = $row->first_accessed_at->copy()->addMinutes(self::SESI_MENIT);
|
||||
|
||||
return max(0, (int) now()->diffInSeconds($berakhir, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Kalau token lama sudah lewat sesi (tapi tautannya belum kedaluwarsa), buat token baru
|
||||
* untuk atasan & pengajuan yang sama. Masa berlaku tautan tidak diperpanjang.
|
||||
*
|
||||
* @return ?string Token plaintext baru, atau null kalau tidak perlu/tidak bisa diperbarui.
|
||||
*/
|
||||
public function perbaruiSesiJikaHabis(int $pengajuanId, ?string $token): ?string
|
||||
{
|
||||
if (! $token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$row = VerifikasiAbsenToken::where('pengajuan_id', $pengajuanId)
|
||||
->where('token', $this->hash($token))
|
||||
->where('purpose', self::PURPOSE)
|
||||
->first();
|
||||
|
||||
if (! $row || now()->greaterThan($row->expires_at) || $row->first_accessed_at === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! now()->greaterThan($row->first_accessed_at->copy()->addMinutes(self::SESI_MENIT))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token pengganti yang sesinya masih jalan dipakai ulang, jangan buat baru tiap tombol WA diklik.
|
||||
// Token di DB hanya berupa hash, jadi plaintext pengganti disimpan (terenkripsi) di cache selama sesinya.
|
||||
$kunciCache = "verifikasi-absen:pengganti:{$row->id}";
|
||||
|
||||
if ($tersimpan = Cache::get($kunciCache)) {
|
||||
try {
|
||||
return Crypt::decryptString($tersimpan);
|
||||
} catch (DecryptException) {
|
||||
Cache::forget($kunciCache);
|
||||
}
|
||||
}
|
||||
|
||||
$tokenBaru = $this->buatToken($pengajuanId, $row->nip, $row->expires_at);
|
||||
|
||||
Cache::put($kunciCache, Crypt::encryptString($tokenBaru), now()->addMinutes(self::SESI_MENIT));
|
||||
|
||||
return $tokenBaru;
|
||||
}
|
||||
|
||||
public function markUsed(int $pengajuanId, string $token): void
|
||||
{
|
||||
VerifikasiAbsenToken::where('pengajuan_id', $pengajuanId)
|
||||
@@ -84,6 +165,21 @@ class VerifikasiAbsenLinkService
|
||||
->update(['used_at' => now()]);
|
||||
}
|
||||
|
||||
private function buatToken(int $pengajuanId, string $nip, Carbon $expiresAt): string
|
||||
{
|
||||
$tokenPlaintext = Str::random(40);
|
||||
|
||||
VerifikasiAbsenToken::create([
|
||||
'pengajuan_id' => $pengajuanId,
|
||||
'nip' => $nip,
|
||||
'token' => $this->hash($tokenPlaintext),
|
||||
'purpose' => self::PURPOSE,
|
||||
'expires_at' => $expiresAt,
|
||||
]);
|
||||
|
||||
return $tokenPlaintext;
|
||||
}
|
||||
|
||||
private function hash(string $token): string
|
||||
{
|
||||
return hash('sha256', $token);
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Verifikator\PengajuanPresensi;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Throwable;
|
||||
|
||||
class VerifikatorWebhookService
|
||||
{
|
||||
const URL = 'http://172.16.50.94:8087/webhook/verifikator';
|
||||
|
||||
const STATUS_PENDING = 'pending';
|
||||
|
||||
const STATUS_APPROVED = 'approved';
|
||||
|
||||
const STATUS_REJECTED = 'rejected';
|
||||
|
||||
const STATUS_DELETED = 'deleted';
|
||||
|
||||
public function kirimIzin(PengajuanPresensi $pengajuan, string $status, ?string $alasan = null): bool
|
||||
{
|
||||
try {
|
||||
$response = Http::timeout(5)
|
||||
->post(self::URL, [
|
||||
'jenis' => 'izin',
|
||||
'nip' => $pengajuan->nip,
|
||||
'tanggal' => Carbon::parse($pengajuan->tanggal_mulai)->format('Y-m-d'),
|
||||
'kategori' => $this->slugKategori($pengajuan->getRawOriginal('kategori')),
|
||||
'status' => $status,
|
||||
'alasan' => $alasan ?? '',
|
||||
]);
|
||||
|
||||
if ($response->successful()) {
|
||||
Log::info("Webhook Verifikator berhasil: $pengajuan->nip ($status)");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Log::warning("Webhook Verifikator gagal: $pengajuan->nip ($status) - HTTP {$response->status()}");
|
||||
} catch (Throwable $th) {
|
||||
Log::error("Webhook Verifikator error: $pengajuan->nip ($status) - ".$th->getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function slugKategori(mixed $kategoriId): ?string
|
||||
{
|
||||
return match ((int) $kategoriId) {
|
||||
2 => 'dinas',
|
||||
3 => 'terlambat',
|
||||
21 => 'cepat_pulang',
|
||||
24 => 'lupa_absen_masuk',
|
||||
25 => 'lupa_absen_pulang',
|
||||
default => null,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
];
|
||||
@@ -41,11 +41,6 @@ return [
|
||||
'redirect' => env('GOOGLE_REDIRECT_URL', env('APP_URL') . '/auth/google/callback'),
|
||||
],
|
||||
|
||||
'verifikator_webhook' => [
|
||||
'url' => env('VERIFIKATOR_WEBHOOK_URL', 'http://172.16.50.94:8087/webhook/verifikator'),
|
||||
'key' => env('VERIFIKATOR_WEBHOOK_KEY'),
|
||||
],
|
||||
|
||||
'verifikasi_absen_wa' => [
|
||||
'url' => env('VERIFIKASI_ABSEN_WA_URL', env('APP_URL', 'http://localhost').'/verifikasi-absen'),
|
||||
],
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (Schema::connection('rekapitulasi')->hasColumn('p1', 'deleted_at')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::connection('rekapitulasi')->table('p1', function (Blueprint $table) {
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::connection('rekapitulasi')->hasColumn('p1', 'deleted_at')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::connection('rekapitulasi')->table('p1', function (Blueprint $table) {
|
||||
$table->dropSoftDeletes();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,347 @@
|
||||
{
|
||||
"196801131992032001": {
|
||||
"p2_bruto": 4936330,
|
||||
"p2_pajak": 246816.5,
|
||||
"p2_netto": 4689513.5
|
||||
},
|
||||
"196802291993032001": {
|
||||
"p2_bruto": 11615019,
|
||||
"p2_pajak": 580750.95,
|
||||
"p2_netto": 11034268.05
|
||||
},
|
||||
"196803052014091004": {
|
||||
"p2_bruto": 12094075.5,
|
||||
"p2_pajak": 604703.77,
|
||||
"p2_netto": 11489371.73
|
||||
},
|
||||
"196804012000032001": {
|
||||
"p2_bruto": 17887577.5,
|
||||
"p2_pajak": 894378.88,
|
||||
"p2_netto": 16993198.63
|
||||
},
|
||||
"196804152007012001": {
|
||||
"p2_bruto": 10354750,
|
||||
"p2_pajak": 517737.5,
|
||||
"p2_netto": 9837012.5
|
||||
},
|
||||
"196804241987021001": {
|
||||
"p2_bruto": 23308480,
|
||||
"p2_pajak": 1165424,
|
||||
"p2_netto": 22143056
|
||||
},
|
||||
"196806011987031001": {
|
||||
"p2_bruto": 5432000,
|
||||
"p2_pajak": 271600,
|
||||
"p2_netto": 5160400
|
||||
},
|
||||
"196808191996031003": {
|
||||
"p2_bruto": 13853527.5,
|
||||
"p2_pajak": 692676.38,
|
||||
"p2_netto": 13160851.13
|
||||
},
|
||||
"198006032005012002": {
|
||||
"p2_bruto": 14041210,
|
||||
"p2_pajak": 702060.5,
|
||||
"p2_netto": 13339149.5
|
||||
},
|
||||
"198410182008012002": {
|
||||
"p2_bruto": 3184142.5,
|
||||
"p2_pajak": 159207.13,
|
||||
"p2_netto": 3024935.38
|
||||
},
|
||||
"198601172012122004": {
|
||||
"p2_bruto": 8219175,
|
||||
"p2_pajak": 410958.75,
|
||||
"p2_netto": 7808216.25
|
||||
},
|
||||
"198908032022032005": {
|
||||
"p2_bruto": 3387288,
|
||||
"p2_pajak": 169364.4,
|
||||
"p2_netto": 3217923.6
|
||||
},
|
||||
"199002132025062005": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199003202025061004": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199112282025061003": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199207202025061002": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199212142025061004": {
|
||||
"p2_bruto": 11786313.6,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 11786313.6
|
||||
},
|
||||
"199301212025062001": {
|
||||
"p2_bruto": 13598877.6,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 13598877.6
|
||||
},
|
||||
"199303222025061005": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199312112025061004": {
|
||||
"p2_bruto": 13013280,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 13013280
|
||||
},
|
||||
"199312202025061004": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199312312025062006": {
|
||||
"p2_bruto": 18944832,
|
||||
"p2_pajak": 947241.6,
|
||||
"p2_netto": 17997590.4
|
||||
},
|
||||
"199403142025061006": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199403212025061001": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199411272025061004": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199412092025062006": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199501192025061004": {
|
||||
"p2_bruto": 13431564,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 13431564
|
||||
},
|
||||
"199502272025061007": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199503042025062007": {
|
||||
"p2_bruto": 12204597.6,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 12204597.6
|
||||
},
|
||||
"199503282025061008": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199504082025061005": {
|
||||
"p2_bruto": 18405264,
|
||||
"p2_pajak": 920263.2,
|
||||
"p2_netto": 17485000.8
|
||||
},
|
||||
"199505052025061004": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199506072025061004": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199506222025062004": {
|
||||
"p2_bruto": 18405264,
|
||||
"p2_pajak": 920263.2,
|
||||
"p2_netto": 17485000.8
|
||||
},
|
||||
"199510262025061003": {
|
||||
"p2_bruto": 19484400,
|
||||
"p2_pajak": 974220,
|
||||
"p2_netto": 18510180
|
||||
},
|
||||
"199512162025062009": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199512312025062006": {
|
||||
"p2_bruto": 16786560,
|
||||
"p2_pajak": 839328,
|
||||
"p2_netto": 15947232
|
||||
},
|
||||
"199603192025061007": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199604082025061006": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199605232025062010": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199608092025061005": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199609092025062010": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199610022025061003": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199611192025061007": {
|
||||
"p2_bruto": 18189436.8,
|
||||
"p2_pajak": 909471.84,
|
||||
"p2_netto": 17279964.96
|
||||
},
|
||||
"199711112025062011": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199712042025061009": {
|
||||
"p2_bruto": 18333321.6,
|
||||
"p2_pajak": 916666.08,
|
||||
"p2_netto": 17416655.52
|
||||
},
|
||||
"199804032025061004": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199804152025062009": {
|
||||
"p2_bruto": 17326128,
|
||||
"p2_pajak": 866306.4,
|
||||
"p2_netto": 16459821.6
|
||||
},
|
||||
"199805242025061008": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199806232025062007": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199808172025062009": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199809292025061010": {
|
||||
"p2_bruto": 17614404,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 17614404
|
||||
},
|
||||
"199901152025062009": {
|
||||
"p2_bruto": 16570732.8,
|
||||
"p2_pajak": 828536.64,
|
||||
"p2_netto": 15742196.16
|
||||
},
|
||||
"199909162025062013": {
|
||||
"p2_bruto": 18944832,
|
||||
"p2_pajak": 947241.6,
|
||||
"p2_netto": 17997590.4
|
||||
},
|
||||
"199910092025062015": {
|
||||
"p2_bruto": 16498790.4,
|
||||
"p2_pajak": 824939.52,
|
||||
"p2_netto": 15673850.88
|
||||
},
|
||||
"199911282025062010": {
|
||||
"p2_bruto": 0,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 0
|
||||
},
|
||||
"199912282025062007": {
|
||||
"p2_bruto": 14268132,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 14268132
|
||||
},
|
||||
"200002092025062008": {
|
||||
"p2_bruto": 18405264,
|
||||
"p2_pajak": 920263.2,
|
||||
"p2_netto": 17485000.8
|
||||
},
|
||||
"200003222025061006": {
|
||||
"p2_bruto": 14268132,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 14268132
|
||||
},
|
||||
"200006172025061004": {
|
||||
"p2_bruto": 18153465.6,
|
||||
"p2_pajak": 907673.28,
|
||||
"p2_netto": 17245792.32
|
||||
},
|
||||
"200008082025062017": {
|
||||
"p2_bruto": 16786560,
|
||||
"p2_pajak": 839328,
|
||||
"p2_netto": 15947232
|
||||
},
|
||||
"200008242025062012": {
|
||||
"p2_bruto": 16786560,
|
||||
"p2_pajak": 839328,
|
||||
"p2_netto": 15947232
|
||||
},
|
||||
"200010292025061005": {
|
||||
"p2_bruto": 18405264,
|
||||
"p2_pajak": 920263.2,
|
||||
"p2_netto": 17485000.8
|
||||
},
|
||||
"200105232025061010": {
|
||||
"p2_bruto": 13738305.6,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 13738305.6
|
||||
},
|
||||
"200107272025062014": {
|
||||
"p2_bruto": 19214616,
|
||||
"p2_pajak": 960730.8,
|
||||
"p2_netto": 18253885.2
|
||||
},
|
||||
"200109152025062009": {
|
||||
"p2_bruto": 15491596.8,
|
||||
"p2_pajak": 774579.84,
|
||||
"p2_netto": 14717016.96
|
||||
},
|
||||
"200205012025062004": {
|
||||
"p2_bruto": 13431564,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 13431564
|
||||
},
|
||||
"200205052025061010": {
|
||||
"p2_bruto": 9388152,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 9388152
|
||||
},
|
||||
"200207162025061003": {
|
||||
"p2_bruto": 12678652.8,
|
||||
"p2_pajak": 0,
|
||||
"p2_netto": 12678652.8
|
||||
}
|
||||
}
|
||||
@@ -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,8 +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-secondary" id="btnRefresh">
|
||||
</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>';
|
||||
}
|
||||
|
||||
$actionButtons .= '<button type="button" class="btn btn-sm btn-outline-secondary" id="btnRefresh">
|
||||
<i class="uil-refresh"></i>
|
||||
Refresh
|
||||
</button>';
|
||||
@@ -77,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">
|
||||
@@ -114,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 -->
|
||||
@@ -137,6 +166,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="warmCacheModal" tabindex="-1" aria-hidden="true" data-bs-backdrop="static"
|
||||
data-bs-keyboard="false">
|
||||
<div class="modal-dialog modal-sm modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body text-center p-4">
|
||||
<h6 class="mb-1">Memperbarui Data Keseluruhan</h6>
|
||||
<p class="text-muted small mb-3">Menyusun ulang rekap P1, P2, THR, R13, dan Publikasi…</p>
|
||||
<div class="progress" style="height: 14px;">
|
||||
<div id="warm-cache-bar"
|
||||
class="progress-bar progress-bar-striped progress-bar-animated bg-primary" role="progressbar"
|
||||
style="width: 0%"></div>
|
||||
</div>
|
||||
<div id="warm-cache-pct" class="fw-semibold mt-2">0%</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('js')
|
||||
@@ -164,6 +211,14 @@
|
||||
'"></i> ' + jenis.toUpperCase() + '</small>';
|
||||
}
|
||||
|
||||
// Penanda pegawai yang P2-nya diambil dari snapshot JSON, warna tosca.
|
||||
function renderCpnsTag(sumber) {
|
||||
if (sumber !== 'json') {
|
||||
return '';
|
||||
}
|
||||
return ' <small class="d-inline-block fw-bold" title="P2 diambil dari snapshot JSON" style="padding: 1px 18px 1px 6px; color: #0fb5a5; background: linear-gradient(to right, rgba(20, 184, 166, 0.25), rgba(20, 184, 166, 0)); clip-path: polygon(0 0, 100% 0, calc(100% - 20px) 100%, 0 100%);"><i class="uil-file-check-alt"></i> P2 JSON</small>';
|
||||
}
|
||||
|
||||
var table = $('#keseluruhan-table').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
@@ -176,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: [
|
||||
@@ -191,17 +247,19 @@
|
||||
return '<div>' +
|
||||
'<div class="fw-semibold">' + nama + '</div>' +
|
||||
'<div class="text-muted small font-monospace">' + nip + '</div>' +
|
||||
'<div class="mt-1">' + renderJenisPegawaiTag(row.jenis_pegawai) + '</div>' +
|
||||
'<div class="mt-1">' + renderJenisPegawaiTag(row.jenis_pegawai) + renderCpnsTag(row.p2_sumber) + '</div>' +
|
||||
'</div>';
|
||||
}
|
||||
},
|
||||
{ data: 'nama_unit', name: 'nama_unit' },
|
||||
{ data: 'jumlah_p1', name: 'jumlah_p1', className: 'text-end font-monospace', orderable: false },
|
||||
{ data: 'jumlah_p2', name: 'jumlah_p2', className: 'text-end font-monospace', orderable: false },
|
||||
{ data: 'jumlah_thr', name: 'jumlah_thr', className: 'text-end font-monospace', orderable: false },
|
||||
{ data: 'jumlah_r13', name: 'jumlah_r13', className: 'text-end font-monospace', orderable: false },
|
||||
{ data: 'jumlah_publikasi', name: 'jumlah_publikasi', className: 'text-end font-monospace', orderable: false },
|
||||
{ data: 'total', name: 'total', className: 'text-end font-monospace fw-bold', orderable: false }
|
||||
{ data: 'jumlah_p1', name: 'jumlah_p1', className: 'text-end font-monospace' },
|
||||
{ data: 'jumlah_p2', name: 'jumlah_p2', className: 'text-end font-monospace' },
|
||||
{ data: 'jumlah_thr', name: 'jumlah_thr', className: 'text-end font-monospace' },
|
||||
{ data: 'jumlah_r13', name: 'jumlah_r13', className: 'text-end font-monospace' },
|
||||
{ data: 'jumlah_publikasi', name: 'jumlah_publikasi', className: 'text-end font-monospace' },
|
||||
{ data: 'total', name: 'total', className: 'text-end font-monospace fw-bold' },
|
||||
// Kolom tersembunyi supaya pencarian tabel juga bisa memakai NIP.
|
||||
{ data: 'nip', name: 'nip', visible: false, searchable: true, orderable: false }
|
||||
],
|
||||
order: [],
|
||||
language: {
|
||||
@@ -221,10 +279,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();
|
||||
@@ -237,6 +302,51 @@
|
||||
}, false);
|
||||
});
|
||||
|
||||
$('#btnPerbaruiData').on('click', function() {
|
||||
var button = $(this);
|
||||
var modal = bootstrap.Modal.getOrCreateInstance(document.getElementById('warmCacheModal'));
|
||||
var $bar = $('#warm-cache-bar');
|
||||
var $pct = $('#warm-cache-pct');
|
||||
var pct = 0;
|
||||
|
||||
function setPct(v) {
|
||||
pct = v;
|
||||
$bar.css('width', v + '%');
|
||||
$pct.text(v + '%');
|
||||
}
|
||||
|
||||
setPct(0);
|
||||
button.prop('disabled', true);
|
||||
modal.show();
|
||||
|
||||
// Progres merangkak sampai ~90% selama menunggu server.
|
||||
var timer = setInterval(function() {
|
||||
if (pct < 90) {
|
||||
setPct(Math.min(90, pct + Math.max(1, Math.round((90 - pct) / 12))));
|
||||
}
|
||||
}, 350);
|
||||
|
||||
$.ajax({
|
||||
url: "{{ route('remunerasi.keseluruhan.refresh') }}",
|
||||
method: 'POST',
|
||||
data: { tahun: $('#filter-tahun').val(), sumber_p1: $('input[name="sumber_p1"]:checked').val() }
|
||||
}).done(function(res) {
|
||||
clearInterval(timer);
|
||||
setPct(100);
|
||||
setTimeout(function() {
|
||||
modal.hide();
|
||||
table.ajax.reload(null, false);
|
||||
showSuccess('Berhasil!', 'Data keseluruhan diperbarui - ' + (res.rows || 0) + ' pegawai (' + (res.seconds || 0) + ' detik).');
|
||||
}, 450);
|
||||
}).fail(function(xhr) {
|
||||
clearInterval(timer);
|
||||
modal.hide();
|
||||
showError('Gagal', (xhr.responseJSON && xhr.responseJSON.message) || 'Terjadi kesalahan saat memperbarui data.');
|
||||
}).always(function() {
|
||||
button.prop('disabled', false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#btn-export').on('click', function() {
|
||||
var button = $(this);
|
||||
var originalHtml = button.html();
|
||||
@@ -253,6 +363,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
@@ -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>
|
||||
@@ -5,6 +5,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Verifikasi Presensi | {{ config('app.name') }}</title>
|
||||
<link rel="shortcut icon" href="{{ asset('assets/images/logo-untan.png') }}">
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/simple-notify/dist/simple-notify.css" />
|
||||
@@ -20,9 +21,13 @@
|
||||
min-height: 100vh;
|
||||
font-family: "Inter", sans-serif;
|
||||
padding: 30px 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
max-width: 640px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
@@ -72,7 +77,9 @@
|
||||
border-color: #16a34a;
|
||||
}
|
||||
|
||||
.btn-setujui:hover {
|
||||
.btn-setujui:hover,
|
||||
.btn-setujui:focus,
|
||||
.btn-setujui:active {
|
||||
background: #15803d;
|
||||
border-color: #15803d;
|
||||
}
|
||||
@@ -82,11 +89,30 @@
|
||||
border-color: #dc2626;
|
||||
}
|
||||
|
||||
.btn-tolak:hover {
|
||||
.btn-tolak:hover,
|
||||
.btn-tolak:focus,
|
||||
.btn-tolak:active {
|
||||
background: #b91c1c;
|
||||
border-color: #b91c1c;
|
||||
}
|
||||
|
||||
.btn-setujui:disabled,
|
||||
.btn-tolak:disabled {
|
||||
color: #fff;
|
||||
opacity: 0.75;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn-setujui:disabled {
|
||||
background: #16a34a;
|
||||
border-color: #16a34a;
|
||||
}
|
||||
|
||||
.btn-tolak:disabled {
|
||||
background: #dc2626;
|
||||
border-color: #dc2626;
|
||||
}
|
||||
|
||||
.aksi-form {
|
||||
display: none;
|
||||
border-top: 1px solid #e5e7eb;
|
||||
@@ -133,6 +159,10 @@
|
||||
<span id="statusBadge" class="badge status-badge"></span>
|
||||
</div>
|
||||
|
||||
<div id="timerSesi" class="alert alert-info py-2 small d-none">
|
||||
<i class="fas fa-clock"></i> Sesi berakhir dalam <strong id="timerSisa">--:--:--</strong>
|
||||
</div>
|
||||
|
||||
<dl class="row mb-0">
|
||||
<div class="col-6">
|
||||
<dt>Nama Pemohon</dt>
|
||||
@@ -150,18 +180,18 @@
|
||||
<dt>Kategori</dt>
|
||||
<dd id="dataKategori">-</dd>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<dt>Keterangan</dt>
|
||||
<dd id="dataKeterangan">-</dd>
|
||||
</div>
|
||||
<div class="col-12" id="dataAlasanWrap" style="display:none">
|
||||
<dt>Catatan</dt>
|
||||
<dd id="dataAlasan">-</dd>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="col-6">
|
||||
<dt>Bukti</dt>
|
||||
<dd><a id="dataFile" href="#" target="_blank">Lihat file bukti <i class="fas fa-external-link-alt"></i></a></dd>
|
||||
</div>
|
||||
<div class="col-6" id="dataPenandatanganWrap" style="display:none">
|
||||
<dt>Penandatangan</dt>
|
||||
<dd id="dataPenandatangan">-</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<div id="aksiButtons" class="d-flex gap-2 mt-3">
|
||||
@@ -251,7 +281,7 @@
|
||||
$('#pesanText').text(text);
|
||||
}
|
||||
|
||||
function tampilkanDetail(data, state) {
|
||||
function tampilkanDetail(data, state, sisaDetik) {
|
||||
$('#pesanState').addClass('d-none');
|
||||
$('#detailState').removeClass('d-none');
|
||||
|
||||
@@ -259,8 +289,23 @@
|
||||
$('#dataNip').text(data.nip || '-');
|
||||
$('#dataTanggal').text(data.tanggal || '-');
|
||||
$('#dataKategori').text(data.kategori || '-');
|
||||
$('#dataKeterangan').text(data.keterangan || '-');
|
||||
$('#dataFile').attr('href', data.file || '#');
|
||||
// File bukti dibuka lewat halaman ini sendiri (?token=...&img=nama-file) supaya tidak bergantung pada /storage.
|
||||
const linkFile = data.file_nama
|
||||
? `${window.location.pathname}?token=${encodeURIComponent(token)}&img=${encodeURIComponent(data.file_nama)}`
|
||||
: (data.file || '#');
|
||||
if (data.penandatangan) {
|
||||
$('#dataPenandatangan').text(data.penandatangan);
|
||||
$('#dataPenandatanganWrap').show();
|
||||
} else {
|
||||
$('#dataPenandatanganWrap').hide();
|
||||
}
|
||||
|
||||
// Setelah diterima, bukti yang ditampilkan adalah dokumen ber-TTE di Google Drive (kalau ada).
|
||||
if (data.file_tte) {
|
||||
$('#dataFile').attr('href', data.file_tte).html('Lihat dokumen ber-TTE <i class="fas fa-external-link-alt"></i>');
|
||||
} else {
|
||||
$('#dataFile').attr('href', linkFile).html('Lihat file bukti <i class="fas fa-external-link-alt"></i>');
|
||||
}
|
||||
|
||||
const badge = statusBadgeMap[data.status] || ['bg-secondary', data.status];
|
||||
$('#statusBadge').attr('class', `badge status-badge ${badge[0]}`).text(badge[1]);
|
||||
@@ -274,7 +319,79 @@
|
||||
$('#aksiButtons').removeClass('d-none');
|
||||
} else {
|
||||
$('#aksiButtons').addClass('d-none');
|
||||
$('.aksi-form').hide().find('input, textarea').val('');
|
||||
}
|
||||
|
||||
if (state === 'pending' && typeof sisaDetik === 'number') {
|
||||
mulaiTimer(sisaDetik);
|
||||
} else {
|
||||
hentikanTimer();
|
||||
}
|
||||
}
|
||||
|
||||
let timerInterval = null;
|
||||
|
||||
function formatWaktu(detik) {
|
||||
const j = String(Math.floor(detik / 3600)).padStart(2, '0');
|
||||
const m = String(Math.floor((detik % 3600) / 60)).padStart(2, '0');
|
||||
const s = String(detik % 60).padStart(2, '0');
|
||||
return `${j}:${m}:${s}`;
|
||||
}
|
||||
|
||||
function hentikanTimer() {
|
||||
clearInterval(timerInterval);
|
||||
timerInterval = null;
|
||||
$('#timerSesi').addClass('d-none');
|
||||
}
|
||||
|
||||
function mulaiTimer(sisaDetik) {
|
||||
clearInterval(timerInterval);
|
||||
const berakhirPada = Date.now() + sisaDetik * 1000;
|
||||
|
||||
$('#timerSesi').removeClass('d-none alert-danger').addClass('alert-info');
|
||||
|
||||
const tick = function () {
|
||||
const sisa = Math.max(0, Math.ceil((berakhirPada - Date.now()) / 1000));
|
||||
$('#timerSisa').text(formatWaktu(sisa));
|
||||
$('#timerSesi').toggleClass('alert-danger', sisa <= 30).toggleClass('alert-info', sisa > 30);
|
||||
|
||||
if (sisa <= 0) {
|
||||
clearInterval(timerInterval);
|
||||
timerInterval = null;
|
||||
sesiHabis();
|
||||
}
|
||||
};
|
||||
|
||||
tick();
|
||||
timerInterval = setInterval(tick, 1000);
|
||||
}
|
||||
|
||||
function sesiHabis() {
|
||||
tampilkanPesan(
|
||||
'fa-clock',
|
||||
'Sesi verifikasi telah berakhir. Tutup halaman ini lalu klik kembali tombol "Tinjau Pengajuan" di WhatsApp untuk membuka sesi baru.',
|
||||
'text-warning'
|
||||
);
|
||||
}
|
||||
|
||||
const kunciDibuka = `verifikasi-absen-dibuka-${pengajuanId}-${token}`;
|
||||
|
||||
function sudahDibukaDiTabIni() {
|
||||
try { return sessionStorage.getItem(kunciDibuka) === '1'; } catch (e) { return true; }
|
||||
}
|
||||
|
||||
function perbaruiSesi() {
|
||||
$.ajax({
|
||||
url: `${apiBase}/perbarui-sesi?token=${encodeURIComponent(token)}`,
|
||||
method: 'POST',
|
||||
success: function (res) {
|
||||
window.location.replace(res.url);
|
||||
},
|
||||
error: function (xhr) {
|
||||
tampilkanPesan('fa-exclamation-triangle', ambilPesanError(xhr), 'text-danger');
|
||||
selesaiLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function muatData() {
|
||||
@@ -288,10 +405,18 @@
|
||||
url: `${apiBase}?token=${encodeURIComponent(token)}`,
|
||||
method: 'GET',
|
||||
success: function (res) {
|
||||
tampilkanDetail(res.data, res.state);
|
||||
try { sessionStorage.setItem(kunciDibuka, '1'); } catch (e) {}
|
||||
tampilkanDetail(res.data, res.state, res.sisa_detik);
|
||||
selesaiLoading();
|
||||
},
|
||||
error: function (xhr) {
|
||||
// Tab baru (klik tombol WA) dengan sesi habis: minta token baru.
|
||||
// Reload di tab yang sama (sudah pernah dibuka) tetap menampilkan expired.
|
||||
if (xhr.responseJSON?.state === 'session_expired' && !sudahDibukaDiTabIni()) {
|
||||
perbaruiSesi();
|
||||
return;
|
||||
}
|
||||
|
||||
const pesan = ambilPesanError(xhr);
|
||||
tampilkanPesan('fa-exclamation-triangle', pesan, 'text-danger');
|
||||
selesaiLoading();
|
||||
@@ -329,7 +454,7 @@
|
||||
e.preventDefault();
|
||||
const $btn = $(this).find('button[type=submit]');
|
||||
const originalText = $btn.text();
|
||||
$btn.prop('disabled', true).text('Memproses...');
|
||||
$btn.prop('disabled', true).html('<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>Memproses...');
|
||||
|
||||
$.ajax({
|
||||
url: `${apiBase}/setujui?token=${encodeURIComponent(token)}`,
|
||||
@@ -355,7 +480,7 @@
|
||||
e.preventDefault();
|
||||
const $btn = $(this).find('button[type=submit]');
|
||||
const originalText = $btn.text();
|
||||
$btn.prop('disabled', true).text('Memproses...');
|
||||
$btn.prop('disabled', true).html('<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>Memproses...');
|
||||
|
||||
$.ajax({
|
||||
url: `${apiBase}/tolak?token=${encodeURIComponent(token)}`,
|
||||
|
||||
+2
-1
@@ -116,7 +116,8 @@ Route::prefix('v1')->group(function () {
|
||||
Route::prefix('/verifikasi-absen')->name('verifikasi-absen.')->group(function () {
|
||||
Route::post('/link', [VerifikasiAbsenLinkController::class, 'generate'])->name('link');
|
||||
Route::get('/{id}', [VerifikasiAbsenController::class, 'show'])->name('show');
|
||||
Route::post('/{id}/setujui', [VerifikasiAbsenController::class, 'setujui'])->name('setujui');
|
||||
Route::post('/{id}/perbarui-sesi', [VerifikasiAbsenController::class, 'perbaruiSesi'])->name('perbarui-sesi');
|
||||
Route::post('/{id}/setujui',[VerifikasiAbsenController::class, 'setujui'])->name('setujui');
|
||||
Route::post('/{id}/tolak', [VerifikasiAbsenController::class, 'tolak'])->name('tolak');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -76,5 +76,6 @@ Route::middleware('permission:Baca Pembayaran')->prefix('/remunerasi')->name('re
|
||||
Route::get('/', [KeseluruhanController::class, 'index'])->name('index');
|
||||
Route::get('/data', [KeseluruhanController::class, 'data'])->name('data');
|
||||
Route::get('/export', [KeseluruhanController::class, 'export'])->name('export');
|
||||
Route::post('/refresh', [KeseluruhanController::class, 'refresh'])->name('refresh');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user