Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8963668618 | |||
| c21910fb7c | |||
| 11d7ed7eb1 | |||
| d01d4b090c | |||
| c10cdf39ca | |||
| 6672f34adc | |||
| 70c796d230 | |||
| 1d58c66a7a | |||
| a1462095a7 | |||
| dcf57bcfdc | |||
| 05ab6fee35 | |||
| 16571fdffc | |||
| f2aeb9c695 | |||
| 261fa7ff8f |
@@ -85,7 +85,7 @@ PERIODE_VERIFIKATOR=395
|
|||||||
VERIFIKATOR_WEBHOOK_URL=http://172.16.50.94:8087/webhook/verifikator
|
VERIFIKATOR_WEBHOOK_URL=http://172.16.50.94:8087/webhook/verifikator
|
||||||
VERIFIKATOR_WEBHOOK_KEY=
|
VERIFIKATOR_WEBHOOK_KEY=
|
||||||
|
|
||||||
VERIFIKASI_ABSEN_WA_URL=http://verifikasi-presensi-whatsapp.test
|
VERIFIKASI_ABSEN_WA_URL=http://verifikator-untan.test/verifikasi-absen
|
||||||
|
|
||||||
GOOGLE_DRIVE_FOLDER_ID=0AJQK-NMrB4b_Uk9PVA
|
GOOGLE_DRIVE_FOLDER_ID=0AJQK-NMrB4b_Uk9PVA
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -85,7 +85,7 @@ PERIODE_VERIFIKATOR=395
|
|||||||
VERIFIKATOR_WEBHOOK_URL=http://172.16.50.94:8087/webhook/verifikator
|
VERIFIKATOR_WEBHOOK_URL=http://172.16.50.94:8087/webhook/verifikator
|
||||||
VERIFIKATOR_WEBHOOK_KEY=
|
VERIFIKATOR_WEBHOOK_KEY=
|
||||||
|
|
||||||
VERIFIKASI_ABSEN_WA_URL=http://verifikasi-presensi-whatsapp.test
|
VERIFIKASI_ABSEN_WA_URL=http://verifikator-untan.test/verifikasi-absen
|
||||||
|
|
||||||
GOOGLE_DRIVE_FOLDER_ID=
|
GOOGLE_DRIVE_FOLDER_ID=
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,152 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
class KeseluruhanExport implements FromArray, ShouldAutoSize, WithColumnFormatting, WithCustomValueBinder, WithEvents, WithMapping
|
||||||
|
{
|
||||||
|
use ForcesTextColumns;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Jumlah kolom tetap di depan (No., Nama, NIP, Jenis Pegawai, Unit Kerja) sebelum kolom
|
||||||
|
* bulanan P1 dimulai.
|
||||||
|
*/
|
||||||
|
private const FIXED_COLUMNS = ['No.', 'Nama', 'NIP', 'Jenis Pegawai', 'Unit Kerja'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 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;
|
||||||
|
|
||||||
|
protected function nipColumns(): array
|
||||||
|
{
|
||||||
|
return ['C'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __construct(int $tahun, ?string $jenisPegawai, mixed $unit)
|
||||||
|
{
|
||||||
|
$controller = app(KeseluruhanController::class);
|
||||||
|
|
||||||
|
$this->rows = $controller->getRekapRows($tahun, $jenisPegawai, $unit);
|
||||||
|
$this->bulanTerakhir = $controller->getBulanTerakhir($tahun);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function array(): array
|
||||||
|
{
|
||||||
|
return $this->rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function map($row): array
|
||||||
|
{
|
||||||
|
static $no = 0;
|
||||||
|
$no++;
|
||||||
|
|
||||||
|
$bulananValues = [];
|
||||||
|
for ($bulan = 1; $bulan <= $this->bulanTerakhir; $bulan++) {
|
||||||
|
$bulananValues[] = $row['jumlah_p1_bulanan'][$bulan] ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_merge([
|
||||||
|
$no,
|
||||||
|
$row['nama'],
|
||||||
|
$row['nip'],
|
||||||
|
$row['jenis_pegawai'] === 'dosen' ? 'Dosen' : ($row['jenis_pegawai'] === 'tendik' ? 'Tendik' : '-'),
|
||||||
|
$row['nama_unit'],
|
||||||
|
], $bulananValues, [
|
||||||
|
$row['jumlah_p2'],
|
||||||
|
$row['jumlah_thr'],
|
||||||
|
$row['jumlah_r13'],
|
||||||
|
$row['jumlah_publikasi'],
|
||||||
|
$row['total'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function columnFormats(): array
|
||||||
|
{
|
||||||
|
$accountingFormat = '_("Rp"\ * #,##0.00_);_("Rp"\ * \-#,##0.00_);_("Rp"\ * "-"??_);_(@_)';
|
||||||
|
$fixedCount = count(self::FIXED_COLUMNS);
|
||||||
|
$lastIndex = $fixedCount + $this->bulanTerakhir + count(self::TRAILING_COLUMNS);
|
||||||
|
|
||||||
|
$formats = ['C' => '@'];
|
||||||
|
for ($i = $fixedCount + 1; $i <= $lastIndex; $i++) {
|
||||||
|
$formats[Coordinate::stringFromColumnIndex($i)] = $accountingFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $formats;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data (via array()+map()) ditulis mulai baris 1 karena export ini sengaja tidak memakai
|
||||||
|
* WithHeadings biasa. Di sini baris 1-2 disisipkan di atasnya untuk header 2 tingkat: baris 1
|
||||||
|
* berisi label grup ("Jumlah P1 (Januari - Sekarang)" yang di-merge selebar kolom bulanannya,
|
||||||
|
* dan label lain yang di-merge vertikal 2 baris), baris 2 berisi nama tiap bulan.
|
||||||
|
*/
|
||||||
|
public function registerEvents(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
AfterSheet::class => function (AfterSheet $event) {
|
||||||
|
$sheet = $event->sheet->getDelegate();
|
||||||
|
$sheet->insertNewRowBefore(1, 2);
|
||||||
|
|
||||||
|
$fixedCount = count(self::FIXED_COLUMNS);
|
||||||
|
|
||||||
|
foreach (self::FIXED_COLUMNS as $i => $label) {
|
||||||
|
$col = Coordinate::stringFromColumnIndex($i + 1);
|
||||||
|
$sheet->setCellValue($col.'1', $label);
|
||||||
|
$sheet->mergeCells($col.'1:'.$col.'2');
|
||||||
|
}
|
||||||
|
|
||||||
|
$p1StartCol = Coordinate::stringFromColumnIndex($fixedCount + 1);
|
||||||
|
$p1EndCol = Coordinate::stringFromColumnIndex($fixedCount + $this->bulanTerakhir);
|
||||||
|
$sheet->setCellValue($p1StartCol.'1', 'Jumlah P1 (Januari - Sekarang)');
|
||||||
|
$sheet->mergeCells($p1StartCol.'1:'.$p1EndCol.'1');
|
||||||
|
|
||||||
|
for ($bulan = 1; $bulan <= $this->bulanTerakhir; $bulan++) {
|
||||||
|
$col = Coordinate::stringFromColumnIndex($fixedCount + $bulan);
|
||||||
|
$sheet->setCellValue($col.'2', self::BULAN_NAMES[$bulan]);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (self::TRAILING_COLUMNS as $i => $label) {
|
||||||
|
$col = Coordinate::stringFromColumnIndex($fixedCount + $this->bulanTerakhir + $i + 1);
|
||||||
|
$sheet->setCellValue($col.'1', $label);
|
||||||
|
$sheet->mergeCells($col.'1:'.$col.'2');
|
||||||
|
}
|
||||||
|
|
||||||
|
$lastCol = Coordinate::stringFromColumnIndex($fixedCount + $this->bulanTerakhir + count(self::TRAILING_COLUMNS));
|
||||||
|
$sheet->getStyle('A1:'.$lastCol.'2')->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,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,272 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Perhitungan\Remunerasi;
|
||||||
|
|
||||||
|
use App\Exports\KeseluruhanExport;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Rekapitulasi\P1;
|
||||||
|
use App\Models\Verifikator\Periode;
|
||||||
|
use App\Models\Verifikator\Publikasi;
|
||||||
|
use App\Models\Verifikator\UnitKerja;
|
||||||
|
use App\Models\Verifikator\View\Pegawai;
|
||||||
|
use App\Services\DawaiService;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class KeseluruhanController extends Controller
|
||||||
|
{
|
||||||
|
private function authorizeAccess(): void
|
||||||
|
{
|
||||||
|
abort_unless(auth()->user()->hasRole('Superuser'), 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(): View
|
||||||
|
{
|
||||||
|
$this->authorizeAccess();
|
||||||
|
|
||||||
|
$title = 'Keseluruhan';
|
||||||
|
|
||||||
|
return view('perhitungan.remunerasi.keseluruhan.index', compact('title'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function data(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$this->authorizeAccess();
|
||||||
|
|
||||||
|
$tahun = (int) ($request->tahun ?: now()->year);
|
||||||
|
$jenisPegawai = $request->jenis_pegawai ?: null;
|
||||||
|
$unit = $request->unit;
|
||||||
|
|
||||||
|
$rows = collect($this->getRekapRows($tahun, $jenisPegawai, $unit));
|
||||||
|
|
||||||
|
return DataTables::of($rows)
|
||||||
|
->editColumn('jenis_pegawai', fn ($row) => $row['jenis_pegawai'] === 'dosen' ? 'Dosen' : ($row['jenis_pegawai'] === 'tendik' ? 'Tendik' : '-'))
|
||||||
|
->editColumn('jumlah_p1', fn ($row) => 'Rp. '.number_format($row['jumlah_p1'], 2, ',', '.'))
|
||||||
|
->editColumn('jumlah_p2', fn ($row) => 'Rp. '.number_format($row['jumlah_p2'], 2, ',', '.'))
|
||||||
|
->editColumn('jumlah_thr', fn ($row) => 'Rp. '.number_format($row['jumlah_thr'], 2, ',', '.'))
|
||||||
|
->editColumn('jumlah_r13', fn ($row) => 'Rp. '.number_format($row['jumlah_r13'], 2, ',', '.'))
|
||||||
|
->editColumn('jumlah_publikasi', fn ($row) => 'Rp. '.number_format($row['jumlah_publikasi'], 2, ',', '.'))
|
||||||
|
->editColumn('total', fn ($row) => 'Rp. '.number_format($row['total'], 2, ',', '.'))
|
||||||
|
->with([
|
||||||
|
'jumlahPegawai' => $rows->count(),
|
||||||
|
'totalKeseluruhan' => number_format($rows->sum('total'), 2, ',', '.'),
|
||||||
|
])
|
||||||
|
->make();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function export(Request $request): BinaryFileResponse
|
||||||
|
{
|
||||||
|
$this->authorizeAccess();
|
||||||
|
|
||||||
|
set_time_limit(300);
|
||||||
|
|
||||||
|
$tahun = (int) ($request->tahun ?: now()->year);
|
||||||
|
$jenisPegawai = $request->jenis_pegawai ?: null;
|
||||||
|
$unit = $request->unit;
|
||||||
|
|
||||||
|
$unitName = '_Semua_Unit_Kerja';
|
||||||
|
if ($unit !== null && $unit !== '') {
|
||||||
|
$unitKerja = UnitKerja::find((int) $unit === 99 ? 0 : (int) $unit);
|
||||||
|
if ($unitKerja) {
|
||||||
|
$unitName = '_'.str_replace(['/', ' ', '.'], '_', $unitKerja->nama);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$filename = "Remunerasi_Keseluruhan_{$tahun}{$unitName}.xlsx";
|
||||||
|
|
||||||
|
return Excel::download(new KeseluruhanExport($tahun, $jenisPegawai, $unit), $filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bangun daftar rekap per pegawai (Pegawai, Unit Kerja, Jumlah P1/P2/THR/R13/Publikasi) untuk
|
||||||
|
* tahun terpilih. Dipakai bersama oleh data() (DataTables) dan KeseluruhanExport supaya kedua
|
||||||
|
* sisi (tampilan web & export Excel) selalu konsisten.
|
||||||
|
*/
|
||||||
|
public function getRekapRows(int $tahun, ?string $jenisPegawai, mixed $unit): array
|
||||||
|
{
|
||||||
|
$rows = $this->buildRekap($tahun, $jenisPegawai);
|
||||||
|
|
||||||
|
if ($unit !== null && $unit !== '') {
|
||||||
|
$unitBucket = (int) $unit;
|
||||||
|
$rows = $rows->filter(function ($row) use ($unitBucket) {
|
||||||
|
if ($unitBucket === 99) {
|
||||||
|
return $row['unit_kerja_id'] === null || ! in_array((int) $row['unit_kerja_id'], range(1, 9), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int) $row['unit_kerja_id'] === $unitBucket;
|
||||||
|
})->values();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rows->sortBy('nama', SORT_NATURAL | SORT_FLAG_CASE)->values()->all();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildRekap(int $tahun, ?string $jenisPegawai): Collection
|
||||||
|
{
|
||||||
|
$cacheKey = 'remunerasi_keseluruhan_v2_'.$tahun.'_'.($jenisPegawai ?: 'semua');
|
||||||
|
|
||||||
|
return collect(Cache::remember($cacheKey, now()->addHours(6), fn () => $this->computeRekap($tahun, $jenisPegawai)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bulan terakhir yang diikutkan dalam akumulasi P1 "Januari - Sekarang": bulan berjalan kalau
|
||||||
|
* tahun yang dipilih adalah tahun sekarang, atau Desember kalau tahun yang dipilih sudah lewat.
|
||||||
|
* Dipakai bersama oleh computeRekap() dan KeseluruhanExport supaya jumlah kolom bulanan konsisten.
|
||||||
|
*/
|
||||||
|
public function getBulanTerakhir(int $tahun): int
|
||||||
|
{
|
||||||
|
return $tahun === (int) now()->year ? (int) now()->month : 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function computeRekap(int $tahun, ?string $jenisPegawai): 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));
|
||||||
|
|
||||||
|
$p1 = $p1Rows->map(fn ($rows) => (float) $rows->sum('gaji_yang_dibayarkan'));
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
if ($periodeSemester1) {
|
||||||
|
$p2 = 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')
|
||||||
|
->whereNull('rpb.deleted_at')
|
||||||
|
->where('jp.periode', $periodeSemester1)
|
||||||
|
->when($jenisPegawai, fn ($q) => $q->where('jpd.jenis_pegawai', $jenisPegawai))
|
||||||
|
->groupBy('verifikator.pegawais.nip')
|
||||||
|
->havingRaw('SUM(rpb.p2_bruto) > 0')
|
||||||
|
->get()
|
||||||
|
->keyBy(fn ($row) => $normalize($row->nip))
|
||||||
|
->map(fn ($row) => (float) $row->total);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. THR & 4. R13 = data eksternal (API Dawai), untuk seluruh unit sekaligus lalu di-cache
|
||||||
|
// per hari seperti pola THRController/R13Controller.
|
||||||
|
$jenisPegawaiParam = $jenisPegawai ?? '';
|
||||||
|
|
||||||
|
$thrData = Cache::remember(
|
||||||
|
"keseluruhan_thr_{$jenisPegawaiParam}_{$tahun}",
|
||||||
|
now()->addDay(),
|
||||||
|
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));
|
||||||
|
|
||||||
|
$r13Data = Cache::remember(
|
||||||
|
"keseluruhan_r13_{$jenisPegawaiParam}_{$tahun}",
|
||||||
|
now()->addDay(),
|
||||||
|
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));
|
||||||
|
|
||||||
|
// 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');
|
||||||
|
|
||||||
|
$publikasiQuery = Publikasi::query()
|
||||||
|
->whereIn('periode', $periodeIds)
|
||||||
|
->where('poin_total', '>', 0)
|
||||||
|
->select('nip')
|
||||||
|
->selectRaw('SUM(biaya_remunerasi) as total');
|
||||||
|
|
||||||
|
if ($jenisPegawai) {
|
||||||
|
$publikasiQuery->whereHas('pegawai', function ($q) use ($jenisPegawai) {
|
||||||
|
$q->withoutGlobalScopes()->where('jenis_pegawai', $jenisPegawai);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$publikasi = $publikasiQuery->groupBy('nip')->get()
|
||||||
|
->keyBy(fn ($row) => $normalize($row->nip))
|
||||||
|
->map(fn ($row) => (float) $row->total);
|
||||||
|
|
||||||
|
$allNips = $p1->keys()
|
||||||
|
->merge($p2->keys())
|
||||||
|
->merge($thr->keys())
|
||||||
|
->merge($r13->keys())
|
||||||
|
->merge($publikasi->keys())
|
||||||
|
->unique()
|
||||||
|
->values();
|
||||||
|
|
||||||
|
if ($allNips->isEmpty()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$pegawaiInfo = Pegawai::withoutGlobalScopes()
|
||||||
|
->leftJoin('verifikator.unit_kerja_pegawais as ukp', 'verifikator.pegawais.unit_kerja_id', '=', 'ukp.id')
|
||||||
|
->select([
|
||||||
|
'verifikator.pegawais.nip',
|
||||||
|
'verifikator.pegawais.nama',
|
||||||
|
'verifikator.pegawais.jenis_pegawai',
|
||||||
|
'verifikator.pegawais.unit_kerja_id',
|
||||||
|
'ukp.nama as nama_unit',
|
||||||
|
])
|
||||||
|
->get()
|
||||||
|
->keyBy(fn ($row) => $normalize($row->nip));
|
||||||
|
|
||||||
|
return $allNips->map(function ($nip) use ($pegawaiInfo, $p1, $p1Bulanan, $bulanTerakhir, $p2, $thr, $r13, $publikasi, $jenisPegawai) {
|
||||||
|
$info = $pegawaiInfo->get($nip);
|
||||||
|
|
||||||
|
if (! $info) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($jenisPegawai && strtolower((string) $info->jenis_pegawai) !== strtolower($jenisPegawai)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$jumlahP1 = $p1->get($nip, 0.0);
|
||||||
|
$jumlahP2 = $p2->get($nip, 0.0);
|
||||||
|
$jumlahThr = $thr->get($nip, 0.0);
|
||||||
|
$jumlahR13 = $r13->get($nip, 0.0);
|
||||||
|
$jumlahPublikasi = $publikasi->get($nip, 0.0);
|
||||||
|
$total = $jumlahP1 + $jumlahP2 + $jumlahThr + $jumlahR13 + $jumlahPublikasi;
|
||||||
|
|
||||||
|
if ($total <= 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$bulananNip = $p1Bulanan->get($nip);
|
||||||
|
$jumlahP1Bulanan = [];
|
||||||
|
for ($bulan = 1; $bulan <= $bulanTerakhir; $bulan++) {
|
||||||
|
$jumlahP1Bulanan[$bulan] = $bulananNip?->get($bulan, 0.0) ?? 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'nip' => ltrim($info->nip ?? $nip, "'"),
|
||||||
|
'nama' => $info->nama ?? '-',
|
||||||
|
'jenis_pegawai' => strtolower($info->jenis_pegawai ?? ''),
|
||||||
|
'unit_kerja_id' => $info->unit_kerja_id,
|
||||||
|
'nama_unit' => $info->nama_unit ?? '-',
|
||||||
|
'jumlah_p1' => $jumlahP1,
|
||||||
|
'jumlah_p1_bulanan' => $jumlahP1Bulanan,
|
||||||
|
'jumlah_p2' => $jumlahP2,
|
||||||
|
'jumlah_thr' => $jumlahThr,
|
||||||
|
'jumlah_r13' => $jumlahR13,
|
||||||
|
'jumlah_publikasi' => $jumlahPublikasi,
|
||||||
|
'total' => $total,
|
||||||
|
];
|
||||||
|
})->filter()->values()->all();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
class VerifikasiAbsenHalamanController extends Controller
|
||||||
|
{
|
||||||
|
public function show(int $id)
|
||||||
|
{
|
||||||
|
return view('verifikasi-absen.halaman', ['id' => $id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -47,7 +47,7 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
'verifikasi_absen_wa' => [
|
'verifikasi_absen_wa' => [
|
||||||
'url' => env('VERIFIKASI_ABSEN_WA_URL', 'http://verifikasi-presensi-whatsapp.test'),
|
'url' => env('VERIFIKASI_ABSEN_WA_URL', env('APP_URL', 'http://localhost').'/verifikasi-absen'),
|
||||||
],
|
],
|
||||||
|
|
||||||
'google_drive' => [
|
'google_drive' => [
|
||||||
|
|||||||
@@ -553,6 +553,15 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@endrole
|
@endrole
|
||||||
|
|
||||||
|
@role('Superuser')
|
||||||
|
<li class="li-remunerasi-keseluruhan">
|
||||||
|
<a href="{{ route('remunerasi.keseluruhan.index') }}">
|
||||||
|
<i class="uil-layer-group" style="margin-right: 3px; font-size:18px"></i>
|
||||||
|
<span> Keseluruhan </span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endrole
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -0,0 +1,281 @@
|
|||||||
|
@extends('layouts.main')
|
||||||
|
|
||||||
|
@section('breadcrumb')
|
||||||
|
<ol class="breadcrumb m-0">
|
||||||
|
<li class="breadcrumb-item"><a href="javascript:void(0);">Perhitungan</a></li>
|
||||||
|
<li class="breadcrumb-item"><a href="javascript:void(0);">Remunerasi</a></li>
|
||||||
|
<li class="breadcrumb-item active" aria-current="page">{{ $title }}</li>
|
||||||
|
</ol>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<!-- Summary Card -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 col-md-6">
|
||||||
|
<div class="card border">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="flex-shrink-0">
|
||||||
|
<div class="bg-primary text-white rounded-2 p-2">
|
||||||
|
<i class="uil-coins fs-4"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex-grow-1 ms-3">
|
||||||
|
<h6 class="text-muted mb-1">Total Keseluruhan</h6>
|
||||||
|
<h4 class="mb-0" id="totalKeseluruhanDisplay">-</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-6">
|
||||||
|
<div class="card border">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="flex-shrink-0">
|
||||||
|
<div class="bg-success text-white rounded-2 p-2">
|
||||||
|
<i class="uil-users-alt fs-4"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex-grow-1 ms-3">
|
||||||
|
<h6 class="text-muted mb-1">Jumlah Pegawai</h6>
|
||||||
|
<h4 class="mb-0" id="jumlahPegawaiDisplay">-</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Table -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card border">
|
||||||
|
<div class="card-body">
|
||||||
|
@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">
|
||||||
|
<i class="uil-refresh"></i>
|
||||||
|
Refresh
|
||||||
|
</button>';
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@include('components.datatable-header', [
|
||||||
|
'title' => 'Rekap Keseluruhan Remunerasi',
|
||||||
|
'description' => 'Rekap Jumlah P1, P2, THR, R13, dan Publikasi per pegawai',
|
||||||
|
'actionButton' => $actionButtons,
|
||||||
|
])
|
||||||
|
|
||||||
|
<!-- Filter Section -->
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<label for="filter-jenis-pegawai" class="form-label">Jenis Pegawai</label>
|
||||||
|
<select name="jenis_pegawai" id="filter-jenis-pegawai" class="form-select select2" data-placeholder="Semua Jenis">
|
||||||
|
<option value=""></option>
|
||||||
|
<option value="dosen">Dosen</option>
|
||||||
|
<option value="tendik">Tendik</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<label for="filter-unit" class="form-label">Unit Kerja</label>
|
||||||
|
<select name="unit" id="filter-unit" class="form-select select2" data-placeholder="Semua Unit Kerja">
|
||||||
|
<option value=""></option>
|
||||||
|
<option value="99">Universitas</option>
|
||||||
|
<option value="1">Fakultas Hukum</option>
|
||||||
|
<option value="2">Fakultas Ekonomi dan Bisnis</option>
|
||||||
|
<option value="3">Fakultas Pertanian</option>
|
||||||
|
<option value="4">Fakultas Teknik</option>
|
||||||
|
<option value="5">Fakultas Ilmu Sosial dan Ilmu Politik</option>
|
||||||
|
<option value="6">Fakultas Keguruan dan Ilmu Pendidikan</option>
|
||||||
|
<option value="7">Fakultas Kehutanan</option>
|
||||||
|
<option value="8">Fakultas Matematika dan Ilmu Pengetahuan Alam</option>
|
||||||
|
<option value="9">Fakultas Kedokteran</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<label for="filter-tahun" class="form-label">Tahun</label>
|
||||||
|
<select name="tahun" id="filter-tahun" class="form-select select2" data-placeholder="Pilih Tahun">
|
||||||
|
@for ($year = date('Y'); $year >= 2025; $year--)
|
||||||
|
<option value="{{ $year }}" {{ $year == date('Y') ? 'selected' : '' }}>{{ $year }}</option>
|
||||||
|
@endfor
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Tabel Data -->
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered w-100 dt-styled" id="keseluruhan-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Pegawai</th>
|
||||||
|
<th>Unit Kerja</th>
|
||||||
|
<th class="text-center">Jumlah P1</th>
|
||||||
|
<th class="text-center">Jumlah P2</th>
|
||||||
|
<th class="text-center">Jumlah THR</th>
|
||||||
|
<th class="text-center">Jumlah R13</th>
|
||||||
|
<th class="text-center">Jumlah Publikasi</th>
|
||||||
|
<th class="text-center">Total</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('js')
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
function renderRupiah(data) {
|
||||||
|
if (!data) {
|
||||||
|
return 'Rp. 0,00';
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderJenisPegawaiTag(jenis) {
|
||||||
|
var config = {
|
||||||
|
'Dosen': { color: 'var(--ct-primary)', rgb: 'var(--ct-primary-rgb)', icon: 'uil-user-graduate' },
|
||||||
|
'Tendik': { color: '#fd7e14', rgb: '253, 126, 20', icon: 'uil-briefcase-alt' }
|
||||||
|
};
|
||||||
|
var c = config[jenis];
|
||||||
|
if (!c) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return '<small class="d-inline-block fw-bold" style="padding: 1px 18px 1px 6px; color: ' +
|
||||||
|
c.color + '; background: linear-gradient(to right, rgba(' + c.rgb + ', 0.25), rgba(' + c.rgb +
|
||||||
|
', 0)); clip-path: polygon(0 0, 100% 0, calc(100% - 20px) 100%, 0 100%);"><i class="' + c.icon +
|
||||||
|
'"></i> ' + jenis.toUpperCase() + '</small>';
|
||||||
|
}
|
||||||
|
|
||||||
|
var table = $('#keseluruhan-table').DataTable({
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
|
autoWidth: false,
|
||||||
|
ajax: {
|
||||||
|
url: "{{ route('remunerasi.keseluruhan.data') }}",
|
||||||
|
data: function(d) {
|
||||||
|
d.jenis_pegawai = $('#filter-jenis-pegawai').val();
|
||||||
|
d.unit = $('#filter-unit').val();
|
||||||
|
d.tahun = $('#filter-tahun').val();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
data: 'nama',
|
||||||
|
name: 'nama',
|
||||||
|
render: function(data, type, row) {
|
||||||
|
if (type !== 'display') {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
var nama = data || '-';
|
||||||
|
var nip = row.nip || '-';
|
||||||
|
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>';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ 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 }
|
||||||
|
],
|
||||||
|
order: [],
|
||||||
|
language: {
|
||||||
|
processing: "<div class='spinner'></div> Sedang Memuat...",
|
||||||
|
},
|
||||||
|
drawCallback: function(settings) {
|
||||||
|
var api = this.api();
|
||||||
|
var response = api.ajax.json();
|
||||||
|
|
||||||
|
if (response && response.totalKeseluruhan !== undefined) {
|
||||||
|
$('#totalKeseluruhanDisplay').text('Rp ' + response.totalKeseluruhan);
|
||||||
|
$('#jumlahPegawaiDisplay').text(response.jumlahPegawai + ' orang');
|
||||||
|
} else {
|
||||||
|
$('#totalKeseluruhanDisplay').text('Rp 0');
|
||||||
|
$('#jumlahPegawaiDisplay').text('0 orang');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#filter-jenis-pegawai, #filter-unit, #filter-tahun').on('change', function() {
|
||||||
|
table.draw();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btnRefresh').on('click', function() {
|
||||||
|
var button = $(this);
|
||||||
|
var originalText = button.html();
|
||||||
|
|
||||||
|
button.prop('disabled', true).html('<i class="uil-sync uil-spin"></i> Refreshing...');
|
||||||
|
|
||||||
|
table.ajax.reload(function() {
|
||||||
|
button.prop('disabled', false).html(originalText);
|
||||||
|
showSuccess('Berhasil!', 'Data berhasil direfresh');
|
||||||
|
}, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btn-export').on('click', function() {
|
||||||
|
var button = $(this);
|
||||||
|
var originalHtml = button.html();
|
||||||
|
|
||||||
|
var params = [];
|
||||||
|
var jenisPegawai = $('#filter-jenis-pegawai').val();
|
||||||
|
var unit = $('#filter-unit').val();
|
||||||
|
var tahun = $('#filter-tahun').val();
|
||||||
|
|
||||||
|
if (jenisPegawai) { params.push('jenis_pegawai=' + jenisPegawai); }
|
||||||
|
if (unit) { params.push('unit=' + unit); }
|
||||||
|
if (tahun) { params.push('tahun=' + tahun); }
|
||||||
|
|
||||||
|
var url = "{{ route('remunerasi.keseluruhan.export') }}";
|
||||||
|
if (params.length > 0) {
|
||||||
|
url += '?' + params.join('&');
|
||||||
|
}
|
||||||
|
|
||||||
|
button.prop('disabled', true).html('<i class="uil-sync uil-spin"></i> Exporting...');
|
||||||
|
|
||||||
|
fetch(url)
|
||||||
|
.then(function(response) {
|
||||||
|
if (!response.ok) { throw new Error('gagal'); }
|
||||||
|
var filename = 'remunerasi_keseluruhan.xlsx';
|
||||||
|
var disposition = response.headers.get('Content-Disposition');
|
||||||
|
if (disposition) {
|
||||||
|
var match = disposition.match(/filename[^;=\n]*=['"]?([^'"\n]+)['"]?/);
|
||||||
|
if (match) { filename = match[1]; }
|
||||||
|
}
|
||||||
|
return response.blob().then(function(blob) {
|
||||||
|
return { blob: blob, filename: filename };
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.then(function(data) {
|
||||||
|
var downloadUrl = URL.createObjectURL(data.blob);
|
||||||
|
var a = document.createElement('a');
|
||||||
|
a.href = downloadUrl;
|
||||||
|
a.download = data.filename;
|
||||||
|
a.style.display = 'none';
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
document.body.removeChild(a);
|
||||||
|
URL.revokeObjectURL(downloadUrl);
|
||||||
|
button.prop('disabled', false).html(originalHtml);
|
||||||
|
showSuccess('Berhasil!', 'File Excel berhasil didownload');
|
||||||
|
})
|
||||||
|
.catch(function() {
|
||||||
|
button.prop('disabled', false).html(originalHtml);
|
||||||
|
showError('Gagal', 'Terjadi kesalahan saat export Excel');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endsection
|
||||||
@@ -0,0 +1,383 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="id">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Verifikasi Presensi | {{ config('app.name') }}</title>
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"
|
||||||
|
rel="stylesheet">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1d4ed8 100%);
|
||||||
|
min-height: 100vh;
|
||||||
|
font-family: "Inter", sans-serif;
|
||||||
|
padding: 30px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
max-width: 640px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
border: none;
|
||||||
|
border-radius: 16px;
|
||||||
|
box-shadow: 0 20px 40px rgba(30, 58, 138, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-header {
|
||||||
|
background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1d4ed8 100%);
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 16px 16px 0 0 !important;
|
||||||
|
padding: 24px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-header img {
|
||||||
|
height: 48px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-body {
|
||||||
|
padding: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
dt {
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
dd {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-badge {
|
||||||
|
font-size: 13px;
|
||||||
|
padding: 6px 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-setujui {
|
||||||
|
background: #16a34a;
|
||||||
|
border-color: #16a34a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-setujui:hover {
|
||||||
|
background: #15803d;
|
||||||
|
border-color: #15803d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-tolak {
|
||||||
|
background: #dc2626;
|
||||||
|
border-color: #dc2626;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-tolak:hover {
|
||||||
|
background: #b91c1c;
|
||||||
|
border-color: #b91c1c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksi-form {
|
||||||
|
display: none;
|
||||||
|
border-top: 1px solid #e5e7eb;
|
||||||
|
margin-top: 20px;
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#loadingState {
|
||||||
|
text-align: center;
|
||||||
|
padding: 60px 20px;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#loadingState .fa-spinner {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="wrapper">
|
||||||
|
<div id="loadingState">
|
||||||
|
<i class="fas fa-spinner fa-spin"></i>
|
||||||
|
<p class="mt-3">Memuat data pengajuan...</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card d-none" id="mainCard">
|
||||||
|
<div class="card-header">
|
||||||
|
<img src="{{ asset('assets/images/logo-untan.png') }}" alt="untan">
|
||||||
|
<h5 class="mb-0">Verifikasi Presensi</h5>
|
||||||
|
<small>Universitas Tanjungpura</small>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div id="pesanState" class="d-none">
|
||||||
|
<div class="text-center py-4">
|
||||||
|
<i id="pesanIcon" class="fas fa-info-circle fa-3x text-secondary mb-3"></i>
|
||||||
|
<p id="pesanText" class="mb-0"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="detailState" class="d-none">
|
||||||
|
<div class="d-flex justify-content-between align-items-start mb-3">
|
||||||
|
<h6 class="mb-0">Detail Pengajuan</h6>
|
||||||
|
<span id="statusBadge" class="badge status-badge"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<dl class="row mb-0">
|
||||||
|
<div class="col-6">
|
||||||
|
<dt>Nama Pemohon</dt>
|
||||||
|
<dd id="dataNama">-</dd>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<dt>NIP</dt>
|
||||||
|
<dd id="dataNip">-</dd>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<dt>Tanggal</dt>
|
||||||
|
<dd id="dataTanggal">-</dd>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<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">
|
||||||
|
<dt>Bukti</dt>
|
||||||
|
<dd><a id="dataFile" href="#" target="_blank">Lihat file bukti <i class="fas fa-external-link-alt"></i></a></dd>
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<div id="aksiButtons" class="d-flex gap-2 mt-3">
|
||||||
|
<button type="button" class="btn btn-setujui text-white flex-fill" id="btnBukaSetujui">
|
||||||
|
<i class="fas fa-check"></i> Setujui
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-tolak text-white flex-fill" id="btnBukaTolak">
|
||||||
|
<i class="fas fa-times"></i> Tolak
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form id="formSetujui" class="aksi-form">
|
||||||
|
<h6>Setujui & Tanda Tangani Dokumen</h6>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">NIK</label>
|
||||||
|
<input type="text" class="form-control" name="nik" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Passphrase</label>
|
||||||
|
<input type="password" class="form-control" name="passphrase" required>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-2">
|
||||||
|
<button type="submit" class="btn btn-setujui text-white flex-fill">Kirim Persetujuan</button>
|
||||||
|
<button type="button" class="btn btn-outline-secondary batal-aksi">Batal</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form id="formTolak" class="aksi-form">
|
||||||
|
<h6>Tolak Pengajuan</h6>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Catatan Penolakan</label>
|
||||||
|
<textarea class="form-control" name="catatan" rows="3" maxlength="500" required></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-2">
|
||||||
|
<button type="submit" class="btn btn-tolak text-white flex-fill">Kirim Penolakan</button>
|
||||||
|
<button type="button" class="btn btn-outline-secondary batal-aksi">Batal</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/simple-notify/dist/simple-notify.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const pengajuanId = {{ (int) $id }};
|
||||||
|
const token = new URLSearchParams(window.location.search).get('token');
|
||||||
|
const apiBase = "{{ url('/api/v1/verifikasi-absen') }}/" + pengajuanId;
|
||||||
|
|
||||||
|
function showNotification(status, title, text) {
|
||||||
|
new Notify({
|
||||||
|
status,
|
||||||
|
title,
|
||||||
|
text,
|
||||||
|
effect: 'fade',
|
||||||
|
speed: 300,
|
||||||
|
showIcon: true,
|
||||||
|
showCloseButton: true,
|
||||||
|
autoclose: true,
|
||||||
|
autotimeout: status === 'error' ? 5000 : 3000,
|
||||||
|
type: 'outline',
|
||||||
|
position: 'right top',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function ambilPesanError(xhr) {
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(xhr.responseText);
|
||||||
|
return data.message || 'Terjadi kesalahan. Silakan coba lagi.';
|
||||||
|
} catch (e) {
|
||||||
|
return 'Terjadi kesalahan. Silakan coba lagi.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const statusBadgeMap = {
|
||||||
|
'Diajukan': ['bg-warning text-dark', 'Menunggu Verifikasi'],
|
||||||
|
'Diterima': ['bg-success', 'Diterima'],
|
||||||
|
'Ditolak': ['bg-danger', 'Ditolak'],
|
||||||
|
};
|
||||||
|
|
||||||
|
function tampilkanPesan(icon, text, colorClass) {
|
||||||
|
$('#pesanState').removeClass('d-none');
|
||||||
|
$('#detailState').addClass('d-none');
|
||||||
|
$('#pesanIcon').attr('class', `fas ${icon} fa-3x mb-3 ${colorClass}`);
|
||||||
|
$('#pesanText').text(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
function tampilkanDetail(data, state) {
|
||||||
|
$('#pesanState').addClass('d-none');
|
||||||
|
$('#detailState').removeClass('d-none');
|
||||||
|
|
||||||
|
$('#dataNama').text(data.nama || '-');
|
||||||
|
$('#dataNip').text(data.nip || '-');
|
||||||
|
$('#dataTanggal').text(data.tanggal || '-');
|
||||||
|
$('#dataKategori').text(data.kategori || '-');
|
||||||
|
$('#dataKeterangan').text(data.keterangan || '-');
|
||||||
|
$('#dataFile').attr('href', data.file || '#');
|
||||||
|
|
||||||
|
const badge = statusBadgeMap[data.status] || ['bg-secondary', data.status];
|
||||||
|
$('#statusBadge').attr('class', `badge status-badge ${badge[0]}`).text(badge[1]);
|
||||||
|
|
||||||
|
if (data.alasan) {
|
||||||
|
$('#dataAlasanWrap').show();
|
||||||
|
$('#dataAlasan').text(data.alasan);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state === 'pending') {
|
||||||
|
$('#aksiButtons').removeClass('d-none');
|
||||||
|
} else {
|
||||||
|
$('#aksiButtons').addClass('d-none');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function muatData() {
|
||||||
|
if (!token) {
|
||||||
|
tampilkanPesan('fa-ban', 'Tautan tidak valid: token tidak ditemukan.', 'text-danger');
|
||||||
|
selesaiLoading();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: `${apiBase}?token=${encodeURIComponent(token)}`,
|
||||||
|
method: 'GET',
|
||||||
|
success: function (res) {
|
||||||
|
tampilkanDetail(res.data, res.state);
|
||||||
|
selesaiLoading();
|
||||||
|
},
|
||||||
|
error: function (xhr) {
|
||||||
|
const pesan = ambilPesanError(xhr);
|
||||||
|
tampilkanPesan('fa-exclamation-triangle', pesan, 'text-danger');
|
||||||
|
selesaiLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function selesaiLoading() {
|
||||||
|
$('#loadingState').addClass('d-none');
|
||||||
|
$('#mainCard').removeClass('d-none');
|
||||||
|
}
|
||||||
|
|
||||||
|
function tutupForm() {
|
||||||
|
$('.aksi-form').slideUp(150, function () {
|
||||||
|
$(this).hide();
|
||||||
|
});
|
||||||
|
$('#aksiButtons').removeClass('d-none');
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#btnBukaSetujui').on('click', function () {
|
||||||
|
$('#aksiButtons').addClass('d-none');
|
||||||
|
$('#formTolak').hide();
|
||||||
|
$('#formSetujui').show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btnBukaTolak').on('click', function () {
|
||||||
|
$('#aksiButtons').addClass('d-none');
|
||||||
|
$('#formSetujui').hide();
|
||||||
|
$('#formTolak').show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.batal-aksi').on('click', tutupForm);
|
||||||
|
|
||||||
|
$('#formSetujui').on('submit', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const $btn = $(this).find('button[type=submit]');
|
||||||
|
const originalText = $btn.text();
|
||||||
|
$btn.prop('disabled', true).text('Memproses...');
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: `${apiBase}/setujui?token=${encodeURIComponent(token)}`,
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
nik: $(this).find('[name=nik]').val(),
|
||||||
|
passphrase: $(this).find('[name=passphrase]').val(),
|
||||||
|
},
|
||||||
|
success: function (res) {
|
||||||
|
showNotification('success', 'Berhasil', res.message);
|
||||||
|
tampilkanDetail(res.data, res.state);
|
||||||
|
},
|
||||||
|
error: function (xhr) {
|
||||||
|
showNotification('error', 'Gagal', ambilPesanError(xhr));
|
||||||
|
},
|
||||||
|
complete: function () {
|
||||||
|
$btn.prop('disabled', false).text(originalText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#formTolak').on('submit', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const $btn = $(this).find('button[type=submit]');
|
||||||
|
const originalText = $btn.text();
|
||||||
|
$btn.prop('disabled', true).text('Memproses...');
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: `${apiBase}/tolak?token=${encodeURIComponent(token)}`,
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
catatan: $(this).find('[name=catatan]').val(),
|
||||||
|
},
|
||||||
|
success: function (res) {
|
||||||
|
showNotification('success', 'Berhasil', res.message);
|
||||||
|
tampilkanDetail(res.data, res.state);
|
||||||
|
},
|
||||||
|
error: function (xhr) {
|
||||||
|
showNotification('error', 'Gagal', ambilPesanError(xhr));
|
||||||
|
},
|
||||||
|
complete: function () {
|
||||||
|
$btn.prop('disabled', false).text(originalText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
muatData();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Http\Controllers\Perhitungan\Remunerasi\DewasController;
|
use App\Http\Controllers\Perhitungan\Remunerasi\DewasController;
|
||||||
|
use App\Http\Controllers\Perhitungan\Remunerasi\KeseluruhanController;
|
||||||
use App\Http\Controllers\Perhitungan\Remunerasi\P1Controller;
|
use App\Http\Controllers\Perhitungan\Remunerasi\P1Controller;
|
||||||
use App\Http\Controllers\Perhitungan\Remunerasi\P2Controller;
|
use App\Http\Controllers\Perhitungan\Remunerasi\P2Controller;
|
||||||
use App\Http\Controllers\Perhitungan\Remunerasi\PoinController;
|
use App\Http\Controllers\Perhitungan\Remunerasi\PoinController;
|
||||||
@@ -70,4 +71,10 @@ Route::middleware('permission:Baca Pembayaran')->prefix('/remunerasi')->name('re
|
|||||||
Route::prefix('/dewas')->name('dewas.')->group(function () {
|
Route::prefix('/dewas')->name('dewas.')->group(function () {
|
||||||
Route::get('/', [DewasController::class, 'index'])->name('index');
|
Route::get('/', [DewasController::class, 'index'])->name('index');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::prefix('/keseluruhan')->name('keseluruhan.')->group(function () {
|
||||||
|
Route::get('/', [KeseluruhanController::class, 'index'])->name('index');
|
||||||
|
Route::get('/data', [KeseluruhanController::class, 'data'])->name('data');
|
||||||
|
Route::get('/export', [KeseluruhanController::class, 'export'])->name('export');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use App\Http\Controllers\Auth\LoginController;
|
|||||||
use App\Http\Controllers\Auth\OauthController;
|
use App\Http\Controllers\Auth\OauthController;
|
||||||
use App\Http\Controllers\CaptchaController;
|
use App\Http\Controllers\CaptchaController;
|
||||||
use App\Http\Controllers\JurnalController;
|
use App\Http\Controllers\JurnalController;
|
||||||
|
use App\Http\Controllers\VerifikasiAbsenHalamanController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
@@ -26,6 +27,11 @@ Route::get('/auth/google/callback', [OauthController::class, 'callback'])->name(
|
|||||||
// Jurnal Routes
|
// Jurnal Routes
|
||||||
Route::get('/jurnal', [JurnalController::class, 'index']);
|
Route::get('/jurnal', [JurnalController::class, 'index']);
|
||||||
|
|
||||||
|
// Halaman Verifikasi Presensi via WhatsApp (publik, otorisasi lewat token di query string)
|
||||||
|
Route::get('/verifikasi-absen/{id}', [VerifikasiAbsenHalamanController::class, 'show'])
|
||||||
|
->where('id', '[0-9]+')
|
||||||
|
->name('verifikasi-absen.halaman');
|
||||||
|
|
||||||
Route::middleware('auth')->group(function () {
|
Route::middleware('auth')->group(function () {
|
||||||
include __DIR__.'/prefix/profil.php';
|
include __DIR__.'/prefix/profil.php';
|
||||||
include __DIR__.'/prefix/dashboard.php';
|
include __DIR__.'/prefix/dashboard.php';
|
||||||
|
|||||||
Reference in New Issue
Block a user