diff --git a/app/Http/Controllers/Perhitungan/PaguController.php b/app/Http/Controllers/Perhitungan/PaguController.php
index 2109a091..56a0da59 100644
--- a/app/Http/Controllers/Perhitungan/PaguController.php
+++ b/app/Http/Controllers/Perhitungan/PaguController.php
@@ -6,17 +6,25 @@ use App\Exports\PaguExport;
use App\Helpers\JabatanPegawaiTambahanHelper;
use App\Http\Controllers\Controller;
use App\Models\Verifikator\Pagu;
+use App\Models\Verifikator\PaguRiwayat;
use App\Models\Verifikator\Rekapitulasi;
use App\Models\Verifikator\UnitKerja;
+use App\Services\PaguMutasiService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
use Illuminate\View\View;
+use InvalidArgumentException;
use Maatwebsite\Excel\Facades\Excel;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Yajra\DataTables\Facades\DataTables;
class PaguController extends Controller
{
+ public function __construct(private PaguMutasiService $mutasiService)
+ {
+ }
+
public function index(Request $request): View
{
if ($faculty = JabatanPegawaiTambahanHelper::getPimpinanFakultasInfo(auth()->user()->nip)) {
@@ -33,8 +41,9 @@ class PaguController extends Controller
$paguSemester1 = (float) ($pagu->pagu_smt1 ?? 0);
$paguSemester2 = (float) ($pagu->pagu_smt2 ?? 0);
$totalPagu = $paguSemester1 + $paguSemester2;
+ $riwayats = $pagu ? $pagu->riwayats()->orderByDesc('id')->get() : collect();
- return view('perhitungan.pagu.fakultas', compact('title', 'faculty', 'facultyName', 'year', 'periodes', 'pagu', 'paguSemester1', 'paguSemester2', 'totalPagu'));
+ return view('perhitungan.pagu.fakultas', compact('title', 'faculty', 'facultyName', 'year', 'periodes', 'pagu', 'paguSemester1', 'paguSemester2', 'totalPagu', 'riwayats'));
}
abort_if(! auth()->user()->canAny(['Baca Pagu', 'Tambah Pagu', 'Ubah Pagu', 'Hapus Pagu']), 403);
@@ -173,9 +182,27 @@ class PaguController extends Controller
return 'Rp '.number_format($sisaPagu, 0, ',', '.');
})
- ->addColumn('action', function ($row) use ($canUbah, $canHapus) {
+ ->addColumn('action', function ($row) use ($canUbah, $canHapus, $showQuestionMark) {
$items = '';
+ if (! $showQuestionMark) {
+ $items .= '
+
+
+ Riwayat Saldo
+
+ ';
+ }
+
+ if ($canUbah) {
+ $items .= '
+
+
+ Tambah / Kurangi Saldo
+
+ ';
+ }
+
if ($canUbah) {
$items .= '
@@ -300,11 +327,108 @@ class PaguController extends Controller
'pagu_smt2.required' => 'Pagu Semester 2 wajib diisi.',
]);
- $record->update($request->only(['unit_pembayaran_id', 'tahun', 'pagu', 'pagu_smt1', 'pagu_smt2']));
+ $sebelum = [1 => (float) $record->pagu_smt1, 2 => (float) $record->pagu_smt2];
+
+ DB::transaction(function () use ($request, $record, $sebelum) {
+ $record->update($request->only(['unit_pembayaran_id', 'tahun', 'pagu', 'pagu_smt1', 'pagu_smt2']));
+
+ foreach ([1, 2] as $semester) {
+ $this->mutasiService->catatSelisih($record, $semester, $sebelum[$semester], (float) $record->{'pagu_smt'.$semester}, 'Perubahan melalui Edit Pagu');
+ }
+ });
return response()->json(['success' => true, 'message' => 'Data pagu berhasil diperbarui.']);
}
+ public function mutasi(Request $request, string $pagu): JsonResponse
+ {
+ abort_if(! auth()->user()->can('Ubah Pagu'), 403);
+
+ $record = Pagu::findOrFail($pagu);
+
+ $request->validate([
+ 'semester' => 'required|integer|in:1,2',
+ 'jenis' => 'required|in:'.PaguRiwayat::JENIS_PENAMBAHAN.','.PaguRiwayat::JENIS_PENGURANGAN,
+ 'jumlah' => 'required|numeric|gt:0',
+ 'keterangan' => 'nullable|string|max:255',
+ ], [
+ 'semester.required' => 'Semester wajib dipilih.',
+ 'semester.in' => 'Semester tidak valid.',
+ 'jenis.required' => 'Jenis mutasi wajib dipilih.',
+ 'jenis.in' => 'Jenis mutasi tidak valid.',
+ 'jumlah.required' => 'Jumlah wajib diisi.',
+ 'jumlah.numeric' => 'Jumlah harus berupa angka.',
+ 'jumlah.gt' => 'Jumlah harus lebih dari 0.',
+ ]);
+
+ try {
+ $riwayat = $this->mutasiService->catat(
+ $record,
+ (int) $request->semester,
+ $request->jenis,
+ (float) $request->jumlah,
+ $request->keterangan
+ );
+ } catch (InvalidArgumentException $e) {
+ return response()->json(['success' => false, 'message' => $e->getMessage()], 422);
+ }
+
+ $label = $riwayat->jenis === PaguRiwayat::JENIS_PENAMBAHAN ? 'ditambahkan' : 'dikurangi';
+
+ return response()->json(['success' => true, 'message' => 'Saldo pagu semester '.$riwayat->semester.' berhasil '.$label.'.']);
+ }
+
+ public function riwayat(Request $request, string $pagu): JsonResponse
+ {
+ abort_if(! auth()->user()->can('Baca Pagu'), 403);
+
+ $record = Pagu::findOrFail($pagu);
+ if ($faculty = JabatanPegawaiTambahanHelper::getPimpinanFakultasInfo(auth()->user()->nip)) {
+ abort_unless((int) $record->unit_pembayaran_id === (int) $faculty->unit_kerja_id, 403);
+ }
+ abort_if($this->isPaguMasked(), 403);
+
+ $request->validate(['semester' => 'nullable|integer|in:1,2']);
+
+ $rows = $record->riwayats()
+ ->when($request->filled('semester'), fn ($q) => $q->where('semester', $request->semester))
+ ->orderByDesc('id')
+ ->get()
+ ->map(fn (PaguRiwayat $r) => [
+ 'tanggal' => $r->created_at?->format('d/m/Y H:i'),
+ 'semester' => $r->semester,
+ 'jenis' => $r->jenis,
+ 'jumlah' => $r->jumlah,
+ 'saldo_sebelum' => $r->saldo_sebelum,
+ 'saldo_sesudah' => $r->saldo_sesudah,
+ 'keterangan' => $r->keterangan,
+ 'oleh' => $r->created_by_nama,
+ ]);
+
+ return response()->json([
+ 'unit_kerja' => $record->unitKerja?->nama,
+ 'tahun' => $record->tahun,
+ 'pagu_smt1' => (float) $record->pagu_smt1,
+ 'pagu_smt2' => (float) $record->pagu_smt2,
+ 'data' => $rows,
+ ]);
+ }
+
+ /**
+ * Pengguna hanya-baca dengan akses unit fakultas tertentu tidak boleh melihat nominal pagu.
+ */
+ private function isPaguMasked(): bool
+ {
+ if (auth()->user()->canAny(['Tambah Pagu', 'Ubah Pagu', 'Hapus Pagu'])) {
+ return false;
+ }
+
+ $activeTeam = auth()->user()->teams()->wherePivot('active', 1)->first() ?? auth()->user()->teams()->first();
+ $pivotIds = $activeTeam ? $activeTeam->teamUnitKerjas()->pluck('unit_kerja_id')->toArray() : [];
+
+ return ! empty($pivotIds) && ! in_array(null, $pivotIds, true);
+ }
+
public function destroy(string $id): JsonResponse
{
abort_if(! auth()->user()->can('Hapus Pagu'), 403);
diff --git a/app/Http/Controllers/Verifikasi/PengajuanAktivitas/PelayananController.php b/app/Http/Controllers/Verifikasi/PengajuanAktivitas/PelayananController.php
deleted file mode 100644
index 11082bb5..00000000
--- a/app/Http/Controllers/Verifikasi/PengajuanAktivitas/PelayananController.php
+++ /dev/null
@@ -1,731 +0,0 @@
-aktivitasService = $aktivitasService;
- }
-
- public function index()
- {
- $title = 'Pengajuan Aktivitas Pelayanan';
-
- return view('verifikasi.pengajuan-aktivitas.pelayanan.index', compact('title'));
- }
-
- public function data(Request $request)
- {
- // Ambil team aktif user dengan relasi unitKerja
- $team = Team::with('unitKerja')->find(session('team_id'));
-
- // Menggunakan NIP dari user yang sedang login atau dari request
- $response = $this->aktivitasService->getPengajuanSk();
-
- // Jika service mengembalikan false atau response tidak valid
- if ($response === false || ! is_array($response) || ! isset($response['success']) || ! $response['success']) {
- return DataTables::of(collect([]))
- ->addIndexColumn()
- ->addColumn('nip', function () {
- return '-';
- })
- ->addColumn('nama_pengaju', function () {
- return '-';
- })
- ->addColumn('unit_kerja', function () {
- return '-';
- })
- ->addColumn('jumlah_pengajuan', function () {
- return '0';
- })
- ->addColumn('total_poin', function () {
- return '0';
- })
- ->addColumn('status_ringkas', function () {
- return 'Tidak ada data';
- })
- ->addColumn('action', function () {
- return '-';
- })
- ->rawColumns(['status_ringkas', 'action'])
- ->make(true);
- }
-
- // Ambil data dari response API
- $data = $response['data'] ?? [];
-
- // Filter berdasarkan team dan unit_kerja_id
- if ($team) {
- // Ambil nama unit_kerja dari team jika unit_kerja_id 1-9
- $teamUnitKerja = null;
- if ($team->unit_kerja_id >= 1 && $team->unit_kerja_id <= 9 && $team->unitKerja) {
- $teamUnitKerja = strtolower($team->unitKerja->nama ?? '');
- }
-
- $data = array_filter($data, function ($item) use ($team, $teamUnitKerja) {
- $unitKerjaName = strtolower($item['unit_kerja'] ?? '');
- $isFakultas = strpos($unitKerjaName, 'fakultas') !== false;
-
- // Team dengan unit_kerja_id 1-9: tampilkan data sesuai unit_kerja mereka saja
- if ($team->unit_kerja_id >= 1 && $team->unit_kerja_id <= 9) {
- // Cocokkan nama unit_kerja dari data dengan nama unit_kerja team
- if ($teamUnitKerja) {
- return $unitKerjaName === $teamUnitKerja;
- }
-
- // Fallback: jika tidak ada nama unit_kerja, tampilkan semua fakultas
- return $isFakultas;
- }
-
- // Team selain unit_kerja_id 1-9
- if ($team->unit_kerja_id === 0 || $team->unit_kerja_id > 9 || $team->unit_kerja_id === null) {
- // Jika team adalah "Verifikator Universitas"
- if (stripos($team->nama, 'Verifikator Universitas') !== false) {
- // Tampilkan data selain Fakultas
- return ! $isFakultas;
- }
-
- // Jika team adalah "Admin"
- if (stripos($team->nama, 'Admin') !== false) {
- // Tampilkan semua data
- return true;
- }
- }
-
- // Default: tampilkan data
- return true;
- });
- }
-
- // Filter berdasarkan status jika ada
- $statusFilter = $request->status ?? null;
- if ($statusFilter !== null && $statusFilter !== 'semua' && $statusFilter !== '') {
- $data = array_filter($data, function ($item) use ($statusFilter) {
- $itemStatus = strtolower($item['status'] ?? '');
-
- return $itemStatus === strtolower($statusFilter);
- });
- }
-
- // Kelompokkan data berdasarkan NIP atau nama_pengaju
- $groupedData = [];
- foreach ($data as $item) {
- $nip = $item['nip'] ?? 'unknown';
-
- if (! isset($groupedData[$nip])) {
- $groupedData[$nip] = [
- 'nip' => $nip,
- 'nama_pengaju' => $item['nama_pengaju'] ?? '-',
- 'unit_kerja' => $item['unit_kerja'] ?? '-',
- 'pengajuan' => [],
- 'total_poin_keseluruhan' => 0,
- ];
- }
-
- // Tambahkan pengajuan ke grup
- $groupedData[$nip]['pengajuan'][] = $item;
- $groupedData[$nip]['total_poin_keseluruhan'] += $item['total_poin'] ?? 0;
- }
-
- // Convert ke collection
- $groupedCollection = collect(array_values($groupedData));
-
- return DataTables::of($groupedCollection)
- ->addIndexColumn()
- ->addColumn('nip', function ($row) {
- return $row['nip'];
- })
- ->addColumn('nama_pengaju', function ($row) {
- return $row['nama_pengaju'];
- })
- ->addColumn('unit_kerja', function ($row) {
- return $row['unit_kerja'];
- })
- ->addColumn('jumlah_pengajuan', function ($row) {
- return count($row['pengajuan']);
- })
- ->addColumn('total_poin', function ($row) {
- return number_format($row['total_poin_keseluruhan'], 2, '.', '');
- })
- ->addColumn('status_ringkas', function ($row) {
- // Hitung status dari semua pengajuan
- $statuses = array_count_values(array_map(function ($p) {
- return strtolower($p['status'] ?? 'pending');
- }, $row['pengajuan']));
-
- $badges = '';
- if (isset($statuses['diajukan']) || isset($statuses['pending'])) {
- $count = ($statuses['diajukan'] ?? 0) + ($statuses['pending'] ?? 0);
- $badges .= ''.$count.' Diajukan';
- }
- if (isset($statuses['diterima']) || isset($statuses['approved'])) {
- $count = ($statuses['diterima'] ?? 0) + ($statuses['approved'] ?? 0);
- $badges .= ''.$count.' Diterima';
- }
- if (isset($statuses['ditolak']) || isset($statuses['rejected'])) {
- $count = ($statuses['ditolak'] ?? 0) + ($statuses['rejected'] ?? 0);
- $badges .= ''.$count.' Ditolak';
- }
-
- return $badges ?: '-';
- })
- ->addColumn('action', function ($row) {
- // Tombol untuk redirect ke halaman detail
- $nip = $row['nip'];
- $btn = '
- Detail
- ';
-
- return $btn;
- })
- ->rawColumns(['status_ringkas', 'action'])
- ->make(true);
- }
-
- public function detail($nip)
- {
- // Cek periode verifikasi Pengajuan Aktivitas terlebih dahulu
- $periode = Periode::where('status', true)->first();
- if ($periode && ! $periode->canVerifyPengajuanAktivitas() && Auth::user()->id != 1) {
- $errorMessage = $periode->getPengajuanAktivitasVerificationErrorMessage();
- if (request()->ajax()) {
- return response()->json([
- 'success' => false,
- 'message' => $errorMessage ?: 'Periode Verifikasi Pengajuan Aktivitas telah Selesai.',
- ], 422);
- }
-
- return redirect()->route('pengajuan-aktivitas.pelayanan.index')
- ->with('info', $errorMessage ?: 'Periode Verifikasi Pengajuan Aktivitas telah Selesai.');
- }
-
- $title = 'Detail Pengajuan Aktivitas';
-
- return view('verifikasi.pengajuan-aktivitas.pelayanan.detail', compact('title', 'nip'));
- }
-
- public function detailData(Request $request, $nip)
- {
- // Ambil team aktif user dengan relasi unitKerja
- $team = Team::with('unitKerja')->find(session('team_id'));
-
- // Ambil semua data pengajuan
- $response = $this->aktivitasService->getPengajuanSk();
-
- // Jika service mengembalikan false atau response tidak valid
- if ($response === false || ! is_array($response) || ! isset($response['success']) || ! $response['success']) {
- return DataTables::of(collect([]))
- ->addIndexColumn()
- ->addColumn('kode_pengajuan', function () {
- return '-';
- })
- ->addColumn('jenis_aktivitas', function () {
- return '-';
- })
- ->addColumn('tanggal', function () {
- return '-';
- })
- ->addColumn('total_poin', function () {
- return '0';
- })
- ->addColumn('status', function () {
- return 'Tidak ada data';
- })
- ->addColumn('action', function () {
- return '-';
- })
- ->rawColumns(['status', 'action'])
- ->with('total_poin_keseluruhan', 0)
- ->make(true);
- }
-
- // Ambil data dari response API
- $allData = $response['data'] ?? [];
-
- // Filter berdasarkan team dan unit_kerja_id
- if ($team) {
- // Ambil nama unit_kerja dari team jika unit_kerja_id 1-9
- $teamUnitKerja = null;
- if ($team->unit_kerja_id >= 1 && $team->unit_kerja_id <= 9 && $team->unitKerja) {
- $teamUnitKerja = strtolower($team->unitKerja->nama ?? '');
- }
-
- $allData = array_filter($allData, function ($item) use ($team, $teamUnitKerja) {
- $unitKerjaName = strtolower($item['unit_kerja'] ?? '');
- $isFakultas = strpos($unitKerjaName, 'fakultas') !== false;
-
- // Team dengan unit_kerja_id 1-9: tampilkan data sesuai unit_kerja mereka saja
- if ($team->unit_kerja_id >= 1 && $team->unit_kerja_id <= 9) {
- // Cocokkan nama unit_kerja dari data dengan nama unit_kerja team
- if ($teamUnitKerja) {
- return $unitKerjaName === $teamUnitKerja;
- }
-
- // Fallback: jika tidak ada nama unit_kerja, tampilkan semua fakultas
- return $isFakultas;
- }
-
- // Team selain unit_kerja_id 1-9
- if ($team->unit_kerja_id === 0 || $team->unit_kerja_id > 9 || $team->unit_kerja_id === null) {
- // Jika team adalah "Verifikator Universitas"
- if (stripos($team->nama, 'Verifikator Universitas') !== false) {
- // Tampilkan data selain Fakultas
- return ! $isFakultas;
- }
-
- // Jika team adalah "Admin"
- if (stripos($team->nama, 'Admin') !== false) {
- // Tampilkan semua data
- return true;
- }
- }
-
- // Default: tampilkan data
- return true;
- });
- }
-
- // Filter hanya untuk NIP yang diminta
- $filteredData = array_filter($allData, function ($item) use ($nip) {
- return ($item['nip'] ?? '') === $nip;
- });
-
- // Hitung total poin keseluruhan
- $totalPoinKeseluruhan = array_sum(array_column($filteredData, 'total_poin'));
-
- return DataTables::of(collect($filteredData))
- ->addIndexColumn()
- ->addColumn('kode_pengajuan', function ($row) {
- return 'SK-'.str_pad($row['id'], 4, '0', STR_PAD_LEFT);
- })
- ->addColumn('jenis_aktivitas', function ($row) {
- $totalHari = $row['total_hari'] ?? 0;
- $totalPoin = number_format($row['total_poin'] ?? 0, 2, '.', '');
-
- return "Pengajuan SK Lembur ({$totalHari} hari, {$totalPoin} poin)";
- })
- ->addColumn('skpl', function ($row) {
- $id = $row['id'];
- $fileUrl = $row['file_url'] ?? null;
- $hasSkpl = isset($row['tanggal_lembur']) && is_array($row['tanggal_lembur']) && count($row['tanggal_lembur']) > 0;
-
- if ($hasSkpl && $fileUrl) {
- // SKPL tersedia dengan file PDF
- return '';
- } else {
- return '';
- }
- })
- ->addColumn('tanggal', function ($row) {
- if (isset($row['tanggal_lembur']) && is_array($row['tanggal_lembur']) && count($row['tanggal_lembur']) > 0) {
- // Ambil tanggal pertama dan terakhir dari array tanggal_lembur
- $tanggalLembur = array_column($row['tanggal_lembur'], 'tanggal');
- sort($tanggalLembur);
-
- if (count($tanggalLembur) === 1) {
- return Carbon::parse($tanggalLembur[0])->format('d/m/Y');
- } else {
- $tanggalAwal = Carbon::parse($tanggalLembur[0])->format('d/m/Y');
- $tanggalAkhir = Carbon::parse(end($tanggalLembur))->format('d/m/Y');
-
- return $tanggalAwal.' - '.$tanggalAkhir;
- }
- }
-
- return '-';
- })
- ->addColumn('jam_masuk', function ($row) {
- if (isset($row['tanggal_lembur']) && is_array($row['tanggal_lembur']) && count($row['tanggal_lembur']) > 0) {
- // Ambil jam masuk pertama dari array tanggal_lembur
- $jamMasuk = $row['tanggal_lembur'][0]['mulai_lembur'] ?? null;
- if ($jamMasuk) {
- // Format jam masuk (HH:MM)
- return Carbon::parse($jamMasuk)->format('H:i:s');
- }
- }
-
- return '-';
- })
- ->addColumn('jam_selesai', function ($row) {
- if (isset($row['tanggal_lembur']) && is_array($row['tanggal_lembur']) && count($row['tanggal_lembur']) > 0) {
- // Ambil jam selesai terakhir dari array tanggal_lembur
- $lastIndex = count($row['tanggal_lembur']) - 1;
- $jamSelesai = $row['tanggal_lembur'][$lastIndex]['selesai_lembur'] ?? null;
- if ($jamSelesai) {
- // Format jam selesai (HH:MM)
- return Carbon::parse($jamSelesai)->format('H:i:s');
- }
- }
-
- return '-';
- })
- ->addColumn('total_waktu', function ($row) {
- if (isset($row['tanggal_lembur']) && is_array($row['tanggal_lembur']) && count($row['tanggal_lembur']) > 0) {
- // Hitung total waktu dari semua hari lembur
- $totalDetik = 0;
- foreach ($row['tanggal_lembur'] as $lembur) {
- $totalWaktu = $lembur['total_waktu'] ?? null;
- if ($totalWaktu) {
- // Parse format HH:MM:SS ke detik
- $parts = explode(':', $totalWaktu);
- $totalDetik += ($parts[0] * 3600) + ($parts[1] * 60) + ($parts[2] ?? 0);
- }
- }
-
- if ($totalDetik > 0) {
- // Format kembali ke H:i:s
- $jam = floor($totalDetik / 3600);
- $menit = floor(($totalDetik % 3600) / 60);
- $detik = $totalDetik % 60;
-
- return sprintf('%02d:%02d:%02d', $jam, $menit, $detik);
- }
- }
-
- return '-';
- })
- ->addColumn('total_poin', function ($row) {
- return number_format($row['total_poin'] ?? 0, 2, '.', '');
- })
- ->addColumn('status', function ($row) {
- $status = $row['status'] ?? 'pending';
- $class = '';
- $statusText = '';
-
- switch (strtolower($status)) {
- case 'approved':
- case 'diterima':
- $class = 'badge bg-success';
- $statusText = 'Diterima';
- break;
- case 'rejected':
- case 'ditolak':
- $class = 'badge bg-danger';
- $statusText = 'Ditolak';
- break;
- case 'pending':
- case 'diajukan':
- $class = 'badge bg-warning text-dark';
- $statusText = 'Diajukan';
- break;
- case 'dibatalkan':
- $class = 'badge bg-secondary';
- $statusText = 'Dibatalkan';
- break;
- default:
- $class = 'badge bg-secondary';
- $statusText = ucfirst($status);
- }
-
- return ''.$statusText.'';
- })
- ->addColumn('action', function ($row) {
- $id = $row['id'];
- $fileUrl = $row['file_url'] ?? null;
- $status = strtolower($row['status'] ?? '');
-
- // Format tanggal lembur untuk ditampilkan
- $tanggalLemburFormatted = '-';
- $jamMasukFormatted = '-';
- $jamSelesaiFormatted = '-';
- $totalWaktuFormatted = '-';
-
- if (isset($row['tanggal_lembur']) && is_array($row['tanggal_lembur']) && count($row['tanggal_lembur']) > 0) {
- $tanggalLembur = array_column($row['tanggal_lembur'], 'tanggal');
- sort($tanggalLembur);
-
- if (count($tanggalLembur) === 1) {
- $tanggalLemburFormatted = Carbon::parse($tanggalLembur[0])->format('Y-m-d');
- } else {
- $tanggalAwal = Carbon::parse($tanggalLembur[0])->format('Y-m-d');
- $tanggalAkhir = Carbon::parse(end($tanggalLembur))->format('Y-m-d');
- $tanggalLemburFormatted = $tanggalAwal.' - '.$tanggalAkhir;
- }
-
- // Format jam masuk dan jam selesai
- $jamMasuk = $row['tanggal_lembur'][0]['mulai_lembur'] ?? null;
- if ($jamMasuk) {
- $jamMasukFormatted = Carbon::parse($jamMasuk)->format('H:i:s');
- }
-
- $lastIndex = count($row['tanggal_lembur']) - 1;
- $jamSelesai = $row['tanggal_lembur'][$lastIndex]['selesai_lembur'] ?? null;
- if ($jamSelesai) {
- $jamSelesaiFormatted = Carbon::parse($jamSelesai)->format('H:i:s');
- }
-
- // Hitung total waktu
- $totalDetik = 0;
- foreach ($row['tanggal_lembur'] as $lembur) {
- $totalWaktu = $lembur['total_waktu'] ?? null;
- if ($totalWaktu) {
- $parts = explode(':', $totalWaktu);
- $totalDetik += ($parts[0] * 3600) + ($parts[1] * 60) + ($parts[2] ?? 0);
- }
- }
- if ($totalDetik > 0) {
- $jam = floor($totalDetik / 3600);
- $menit = floor(($totalDetik % 3600) / 60);
- $totalWaktuFormatted = sprintf('%02d:%02d', $jam, $menit);
- }
- }
-
- $actions = '
-
-
';
-
- return $actions;
- })
- ->rawColumns(['skpl', 'status', 'action'])
- ->with('total_poin_keseluruhan', number_format($totalPoinKeseluruhan, 2, '.', ''))
- ->make(true);
- }
-
- public function verifikasi(Request $request, $id)
- {
- $request->validate([
- 'status' => 'required|in:diterima,ditolak,dibatalkan',
- 'catatan' => 'nullable|string|max:500',
- 'nip' => 'required|string',
- 'tanggal' => 'required',
- 'jam_masuk' => 'required',
- 'jam_selesai' => 'required',
- 'total_waktu' => 'required',
- ]);
-
- // Kirim verifikasi ke service eksternal
- $response = $this->aktivitasService->verifikasiPengajuan(
- $id,
- $request->status,
- $request->catatan
- );
-
- if ($response === false) {
- return response()->json([
- 'success' => false,
- 'message' => 'Gagal menghubungi service verifikasi',
- ], 500);
- }
-
- if (! is_array($response)) {
- return response()->json([
- 'success' => false,
- 'message' => 'Response dari service tidak valid',
- ], 500);
- }
-
- if (! isset($response['success'])) {
- return response()->json([
- 'success' => false,
- 'message' => 'Format response dari service tidak sesuai',
- ], 500);
- }
-
- if (! $response['success']) {
- return response()->json([
- 'success' => false,
- 'message' => $response['message'] ?? 'Verifikasi gagal dari service',
- ], 500);
- }
-
- try {
- // Cek jika tanggal adalah range atau single
- $dates = [];
- if (strpos($request->tanggal, ' - ') !== false) {
- // Range tanggal
- [$start, $end] = explode(' - ', $request->tanggal);
- $startDate = Carbon::createFromFormat('d/m/Y', trim($start));
- $endDate = Carbon::createFromFormat('d/m/Y', trim($end));
-
- for ($date = $startDate->copy(); $date->lte($endDate); $date->addDay()) {
- $dates[] = $date->format('Y-m-d');
- }
- } else {
- // Single tanggal
- $dates[] = Carbon::createFromFormat('d/m/Y', $request->tanggal)->format('Y-m-d');
- }
-
- // Hitung Poin sekali
- $poin = $this->hitungPoin($request->total_waktu);
-
- // Buat record untuk setiap tanggal
- foreach ($dates as $tanggal) {
- PengajuanAktivitas::updateOrCreate(
- [
- 'id_aktivitas' => $id,
- 'nip' => $request->nip,
- 'tanggal' => $tanggal,
- ],
- [
- 'periode' => 398,
- 'status' => $request->status,
- 'jam_masuk' => $request->jam_masuk,
- 'jam_pulang' => $request->jam_selesai,
- 'total_waktu' => $request->total_waktu,
- 'poin' => $poin,
- 'keterangan' => $request->catatan,
- ]
- );
- }
- } catch (Exception $e) {
- Log::error('Error saving local verification record: '.$e->getMessage());
-
- return response()->json([
- 'success' => false,
- 'message' => 'Verifikasi berhasil di service, tetapi gagal menyimpan ke database lokal: '.$e->getMessage(),
- ], 500);
- }
-
- return response()->json([
- 'success' => true,
- 'message' => $response['message'] ?? 'Berhasil melakukan verifikasi pengajuan',
- ]);
- }
-
- public function proxyPdf(Request $request)
- {
- $url = $request->query('url');
-
- if (! $url) {
- abort(400, 'URL parameter is required');
- }
-
- $parsed = parse_url($url);
-
- // Hanya izinkan scheme http/https
- if (! isset($parsed['scheme']) || ! in_array(strtolower($parsed['scheme']), ['http', 'https'])) {
- abort(400, 'Invalid URL scheme');
- }
-
- // Hanya izinkan host dari server aktivitas
- $allowedHost = '172.16.40.177';
- $allowedPort = 8023;
- $host = strtolower($parsed['host'] ?? '');
- $port = $parsed['port'] ?? null;
-
- if ($host !== $allowedHost) {
- abort(403, 'URL host not allowed');
- }
-
- if ($port !== null && (int) $port !== $allowedPort) {
- abort(403, 'URL port not allowed');
- }
-
- // Pastikan path hanya berisi karakter yang aman (tidak ada path traversal)
- $path = $parsed['path'] ?? '';
- if (str_contains($path, '..') || str_contains($path, "\0")) {
- abort(400, 'Invalid URL path');
- }
-
- try {
- $client = new Client([
- 'timeout' => 15,
- 'connect_timeout' => 5,
- ]);
- $response = $client->get($url);
-
- $contentType = $response->getHeaderLine('Content-Type');
- if (! str_contains($contentType, 'application/pdf') && ! str_contains($contentType, 'application/octet-stream')) {
- abort(415, 'Response is not a PDF file');
- }
-
- return response($response->getBody())
- ->header('Content-Type', 'application/pdf')
- ->header('Content-Disposition', 'inline; filename="document.pdf"')
- ->header('Cache-Control', 'no-cache, no-store, must-revalidate')
- ->header('Pragma', 'no-cache')
- ->header('Expires', '0');
- } catch (Exception $e) {
- abort(404, 'PDF not found');
- }
- }
-
- public function hitungPoin($totalWaktu)
- {
- // Ambil Base Poin dari Rubrik
- $poinRubrik = RubrikDetail::where('rubrik_id', 841)->where('pelaksana_id', 3)->first();
-
- // Parse totalWaktu dalam format HH:MM:SS
- $parts = explode(':', $totalWaktu);
- $jam = isset($parts[0]) ? (int) $parts[0] : 0;
- $menit = isset($parts[1]) ? (int) $parts[1] : 0;
- $detik = isset($parts[2]) ? (int) $parts[2] : 0;
-
- // Hitung total jam
- $totalHours = $jam + ($menit / 60) + ($detik / 3600);
-
- // Hitung poin: total jam * nilai dari rubrik
- return round($totalHours * $poinRubrik->nilai, 2);
- }
-}
diff --git a/app/Models/Verifikator/Pagu.php b/app/Models/Verifikator/Pagu.php
index 98b5ac74..8522748a 100644
--- a/app/Models/Verifikator/Pagu.php
+++ b/app/Models/Verifikator/Pagu.php
@@ -23,4 +23,9 @@ class Pagu extends Model
{
return $this->belongsTo(UnitKerja::class, 'unit_pembayaran_id', 'id');
}
+
+ public function riwayats()
+ {
+ return $this->hasMany(PaguRiwayat::class, 'pagu_id', 'id');
+ }
}
diff --git a/app/Models/Verifikator/PaguRiwayat.php b/app/Models/Verifikator/PaguRiwayat.php
new file mode 100644
index 00000000..97b86657
--- /dev/null
+++ b/app/Models/Verifikator/PaguRiwayat.php
@@ -0,0 +1,36 @@
+ 'float',
+ 'saldo_sebelum' => 'float',
+ 'saldo_sesudah' => 'float',
+ ];
+
+ public function pagu()
+ {
+ return $this->belongsTo(Pagu::class, 'pagu_id', 'id');
+ }
+}
diff --git a/app/Models/Verifikator/PengajuanAktivitas.php b/app/Models/Verifikator/PengajuanAktivitas.php
deleted file mode 100644
index f57aea42..00000000
--- a/app/Models/Verifikator/PengajuanAktivitas.php
+++ /dev/null
@@ -1,28 +0,0 @@
- 'datetime',
'tst_verifikasi_pengajuan_presensi' => 'datetime',
'status_verifikasi_pengajuan_presensi' => 'boolean',
- 'tmt_verifikasi_pengajuan_aktivitas' => 'datetime',
- 'tst_verifikasi_pengajuan_aktivitas' => 'datetime',
- 'status_verifikasi_pengajuan_aktivitas' => 'boolean',
'tmt_verifikasi_skp' => 'datetime',
'tst_verifikasi_skp' => 'datetime',
'status_verifikasi_skp' => 'boolean'
@@ -265,59 +259,6 @@ class Periode extends Model
return null;
}
- /**
- * Mengecek apakah verifikasi Pengajuan Aktivitas dapat dilakukan
- *
- * @return bool
- */
- public function canVerifyPengajuanAktivitas(): bool
- {
- // Jika status verifikasi false, langsung return false
- if (!$this->status_verifikasi_pengajuan_aktivitas) {
- return false;
- }
-
- // Jika status true, cek apakah berada di range tanggal & jam
- $now = now();
-
- if ($this->tmt_verifikasi_pengajuan_aktivitas && $this->tst_verifikasi_pengajuan_aktivitas) {
- return $now->between(
- $this->tmt_verifikasi_pengajuan_aktivitas,
- $this->tst_verifikasi_pengajuan_aktivitas
- );
- }
-
- // Jika tanggal tidak diset tapi status true, return true
- return true;
- }
-
- /**
- * Mendapatkan pesan error ketika verifikasi Pengajuan Aktivitas tidak dapat dilakukan
- *
- * @return string|null
- */
- public function getPengajuanAktivitasVerificationErrorMessage(): ?string
- {
- if (!$this->status_verifikasi_pengajuan_aktivitas) {
- return 'Verifikasi Pengajuan Aktivitas belum dibuka';
- }
-
- $now = now();
-
- if ($this->tmt_verifikasi_pengajuan_aktivitas && $now->isBefore($this->tmt_verifikasi_pengajuan_aktivitas)) {
- return 'Verifikasi Pengajuan Aktivitas belum dimulai. Periode verifikasi: ' .
- $this->tmt_verifikasi_pengajuan_aktivitas->format('d/m/Y H:i:s') . ' - ' .
- $this->tst_verifikasi_pengajuan_aktivitas->format('d/m/Y H:i:s');
- }
-
- if ($this->tst_verifikasi_pengajuan_aktivitas && $now->isAfter($this->tst_verifikasi_pengajuan_aktivitas)) {
- return 'Periode verifikasi Pengajuan Aktivitas telah selesai pada ' .
- $this->tst_verifikasi_pengajuan_aktivitas->format('d/m/Y H:i:s');
- }
-
- return null;
- }
-
/**
* Mengecek apakah verifikasi SKP dapat dilakukan
*
diff --git a/app/Services/PaguMutasiService.php b/app/Services/PaguMutasiService.php
new file mode 100644
index 00000000..68a7ebf6
--- /dev/null
+++ b/app/Services/PaguMutasiService.php
@@ -0,0 +1,77 @@
+id)->lockForUpdate()->firstOrFail();
+ $kolom = 'pagu_smt'.$semester;
+ $sebelum = (float) ($locked->{$kolom} ?? 0);
+ $sesudah = $jenis === PaguRiwayat::JENIS_PENAMBAHAN ? $sebelum + $jumlah : $sebelum - $jumlah;
+
+ if ($sesudah < 0) {
+ throw new InvalidArgumentException('Pengurangan melebihi saldo pagu semester '.$semester.'.');
+ }
+
+ $locked->update([$kolom => $sesudah]);
+ $pagu->setAttribute($kolom, $sesudah);
+
+ return $this->simpanRiwayat($locked, $semester, $jenis, $jumlah, $sebelum, $sesudah, $keterangan);
+ });
+ }
+
+ /**
+ * Catat selisih saldo semester yang sudah diubah langsung (mis. lewat Edit Pagu).
+ */
+ public function catatSelisih(Pagu $pagu, int $semester, float $sebelum, float $sesudah, ?string $keterangan = null): ?PaguRiwayat
+ {
+ $selisih = $sesudah - $sebelum;
+ if (abs($selisih) < 0.005) {
+ return null;
+ }
+
+ $jenis = $selisih > 0 ? PaguRiwayat::JENIS_PENAMBAHAN : PaguRiwayat::JENIS_PENGURANGAN;
+
+ return $this->simpanRiwayat($pagu, $semester, $jenis, abs($selisih), $sebelum, $sesudah, $keterangan);
+ }
+
+ private function simpanRiwayat(Pagu $pagu, int $semester, string $jenis, float $jumlah, float $sebelum, float $sesudah, ?string $keterangan): PaguRiwayat
+ {
+ $user = auth()->user();
+
+ return PaguRiwayat::create([
+ 'pagu_id' => $pagu->id,
+ 'unit_pembayaran_id' => $pagu->unit_pembayaran_id,
+ 'tahun' => $pagu->tahun,
+ 'semester' => $semester,
+ 'jenis' => $jenis,
+ 'jumlah' => $jumlah,
+ 'saldo_sebelum' => $sebelum,
+ 'saldo_sesudah' => $sesudah,
+ 'keterangan' => $keterangan,
+ 'created_by_nip' => $user?->nip,
+ 'created_by_nama' => $user?->name,
+ ]);
+ }
+}
diff --git a/database/migrations/2026_10_25_120000_create_pagu_riwayats_table.php b/database/migrations/2026_10_25_120000_create_pagu_riwayats_table.php
new file mode 100644
index 00000000..5293ebf8
--- /dev/null
+++ b/database/migrations/2026_10_25_120000_create_pagu_riwayats_table.php
@@ -0,0 +1,34 @@
+id();
+ $table->unsignedBigInteger('pagu_id');
+ $table->integer('unit_pembayaran_id');
+ $table->integer('tahun');
+ $table->unsignedTinyInteger('semester');
+ $table->string('jenis', 20);
+ $table->decimal('jumlah', 20, 2);
+ $table->decimal('saldo_sebelum', 20, 2);
+ $table->decimal('saldo_sesudah', 20, 2);
+ $table->string('keterangan')->nullable();
+ $table->string('created_by_nip')->nullable();
+ $table->string('created_by_nama')->nullable();
+ $table->timestamps();
+ $table->index(['pagu_id', 'semester']);
+ $table->index(['unit_pembayaran_id', 'tahun']);
+ });
+ }
+
+ public function down(): void
+ {
+ Schema::dropIfExists('verifikator.pagu_riwayats');
+ }
+};
diff --git a/database/migrations/2026_10_26_100000_drop_pengajuan_aktivitas_table.php b/database/migrations/2026_10_26_100000_drop_pengajuan_aktivitas_table.php
new file mode 100644
index 00000000..f93b4d52
--- /dev/null
+++ b/database/migrations/2026_10_26_100000_drop_pengajuan_aktivitas_table.php
@@ -0,0 +1,34 @@
+id();
+ $table->string('nip')->nullable();
+ $table->string('periode')->nullable();
+ $table->date('tanggal')->nullable();
+ $table->time('jam_masuk')->nullable();
+ $table->time('jam_pulang')->nullable();
+ $table->time('total_waktu')->nullable();
+ $table->decimal('poin')->nullable()->default(0);
+ $table->string('keterangan')->nullable();
+ $table->string('status')->nullable();
+ $table->string('file')->nullable();
+ $table->timestamp('created_at')->nullable();
+ $table->timestamp('updated_at')->nullable();
+ $table->timestamp('deleted_at')->nullable();
+ $table->integer('id_aktivitas')->nullable();
+ });
+ }
+};
diff --git a/database/migrations/2026_10_26_110000_drop_pengajuan_aktivitas_columns_from_periodes_table.php b/database/migrations/2026_10_26_110000_drop_pengajuan_aktivitas_columns_from_periodes_table.php
new file mode 100644
index 00000000..b1691d37
--- /dev/null
+++ b/database/migrations/2026_10_26_110000_drop_pengajuan_aktivitas_columns_from_periodes_table.php
@@ -0,0 +1,28 @@
+dropColumn([
+ 'tmt_verifikasi_pengajuan_aktivitas',
+ 'tst_verifikasi_pengajuan_aktivitas',
+ 'status_verifikasi_pengajuan_aktivitas',
+ ]);
+ });
+ }
+
+ public function down(): void
+ {
+ Schema::table('verifikator.periodes', function (Blueprint $table) {
+ $table->timestamp('tmt_verifikasi_pengajuan_aktivitas')->nullable();
+ $table->timestamp('tst_verifikasi_pengajuan_aktivitas')->nullable();
+ $table->boolean('status_verifikasi_pengajuan_aktivitas')->nullable();
+ });
+ }
+};
diff --git a/resources/css/app.css b/resources/css/app.css
index 5397da14..09d4ebce 100644
--- a/resources/css/app.css
+++ b/resources/css/app.css
@@ -312,7 +312,6 @@ body[data-leftbar-compact-mode="condensed"] #main-content-wrapper {
.side-nav-item.si-sk.menuitem-active > .side-nav-link,
.side-nav-item.si-tri-dharma.menuitem-active > .side-nav-link,
.side-nav-item.si-laporan-kegiatan.menuitem-active > .side-nav-link,
-.side-nav-item.si-pengajuan-aktivitas.menuitem-active > .side-nav-link,
.side-nav-item.si-skp.menuitem-active > .side-nav-link,
.side-nav-item.si-pleno-penunjang.menuitem-active > .side-nav-link,
.side-nav-item.si-remunerasi.menuitem-active > .side-nav-link,
@@ -332,7 +331,6 @@ body[data-leftbar-compact-mode="condensed"] #main-content-wrapper {
.side-nav-item.si-sk.menuitem-active > .side-nav-link *,
.side-nav-item.si-tri-dharma.menuitem-active > .side-nav-link *,
.side-nav-item.si-laporan-kegiatan.menuitem-active > .side-nav-link *,
-.side-nav-item.si-pengajuan-aktivitas.menuitem-active > .side-nav-link *,
.side-nav-item.si-skp.menuitem-active > .side-nav-link *,
.side-nav-item.si-pleno-penunjang.menuitem-active > .side-nav-link *,
.side-nav-item.si-remunerasi.menuitem-active > .side-nav-link *,
diff --git a/resources/views/layouts/header.blade.php b/resources/views/layouts/header.blade.php
index d1e2228f..1022d703 100644
--- a/resources/views/layouts/header.blade.php
+++ b/resources/views/layouts/header.blade.php
@@ -224,7 +224,6 @@
.side-nav-item.si-sk.menuitem-active > .side-nav-link,
.side-nav-item.si-tri-dharma.menuitem-active > .side-nav-link,
.side-nav-item.si-laporan-kegiatan.menuitem-active > .side-nav-link,
- .side-nav-item.si-pengajuan-aktivitas.menuitem-active > .side-nav-link,
.side-nav-item.si-skp.menuitem-active > .side-nav-link,
.side-nav-item.si-pleno-penunjang.menuitem-active > .side-nav-link,
.side-nav-item.si-remunerasi.menuitem-active > .side-nav-link,
@@ -244,7 +243,6 @@
.side-nav-item.si-sk.menuitem-active > .side-nav-link *,
.side-nav-item.si-tri-dharma.menuitem-active > .side-nav-link *,
.side-nav-item.si-laporan-kegiatan.menuitem-active > .side-nav-link *,
- .side-nav-item.si-pengajuan-aktivitas.menuitem-active > .side-nav-link *,
.side-nav-item.si-skp.menuitem-active > .side-nav-link *,
.side-nav-item.si-pleno-penunjang.menuitem-active > .side-nav-link *,
.side-nav-item.si-remunerasi.menuitem-active > .side-nav-link *,
diff --git a/resources/views/layouts/sidebar.blade.php b/resources/views/layouts/sidebar.blade.php
index 44188739..d473d50f 100644
--- a/resources/views/layouts/sidebar.blade.php
+++ b/resources/views/layouts/sidebar.blade.php
@@ -33,8 +33,6 @@
'Baca Penunjang',
'Baca Presensi',
'Baca Presensi Honorer',
- 'Baca
- Pengajuan Aktivitas',
'Baca SKP',
'Baca BA',
])
@@ -365,27 +363,6 @@
@endif
- {{-- @canany(['Baca Pengajuan Aktivitas'])
-
-
-
- Pengajuan Aktivitas
-
-
-
-
- @endcanany --}}
-
@canany(['Baca Pengajuan SKP', 'Pengajuan SKP', 'Baca Verifikasi SKP', 'Verifikasi SKP'])
diff --git a/resources/views/manajemen/limit/mengajar/show.blade.php b/resources/views/manajemen/limit/mengajar/show.blade.php
index c88f8cd0..f5a7dc5b 100644
--- a/resources/views/manajemen/limit/mengajar/show.blade.php
+++ b/resources/views/manajemen/limit/mengajar/show.blade.php
@@ -161,10 +161,10 @@
diff --git a/resources/views/manajemen/limit/penunjang/index.blade.php b/resources/views/manajemen/limit/penunjang/index.blade.php
index d688eb0c..f5d674c7 100644
--- a/resources/views/manajemen/limit/penunjang/index.blade.php
+++ b/resources/views/manajemen/limit/penunjang/index.blade.php
@@ -74,8 +74,8 @@
diff --git a/resources/views/manajemen/periode/index.blade.php b/resources/views/manajemen/periode/index.blade.php
index 1a159d1b..2fc96065 100644
--- a/resources/views/manajemen/periode/index.blade.php
+++ b/resources/views/manajemen/periode/index.blade.php
@@ -95,8 +95,8 @@
diff --git a/resources/views/manajemen/permission/index.blade.php b/resources/views/manajemen/permission/index.blade.php
index 43b5281c..3e895f1d 100644
--- a/resources/views/manajemen/permission/index.blade.php
+++ b/resources/views/manajemen/permission/index.blade.php
@@ -98,8 +98,8 @@
diff --git a/resources/views/manajemen/rubrik/kategori/index.blade.php b/resources/views/manajemen/rubrik/kategori/index.blade.php
index 4007e528..cd038d21 100644
--- a/resources/views/manajemen/rubrik/kategori/index.blade.php
+++ b/resources/views/manajemen/rubrik/kategori/index.blade.php
@@ -95,8 +95,8 @@
diff --git a/resources/views/manajemen/rubrik/syarat/index.blade.php b/resources/views/manajemen/rubrik/syarat/index.blade.php
index 5db8f558..eb85ac01 100644
--- a/resources/views/manajemen/rubrik/syarat/index.blade.php
+++ b/resources/views/manajemen/rubrik/syarat/index.blade.php
@@ -75,8 +75,8 @@
diff --git a/resources/views/perhitungan/pagu/fakultas.blade.php b/resources/views/perhitungan/pagu/fakultas.blade.php
index 8947d185..ce72247c 100644
--- a/resources/views/perhitungan/pagu/fakultas.blade.php
+++ b/resources/views/perhitungan/pagu/fakultas.blade.php
@@ -50,6 +50,41 @@
@if(! $pagu)
Data pagu semester untuk tahun {{ $year }} belum tersedia.
@endif
+
+
Riwayat Saldo Pagu
+
Penambahan dan pengurangan saldo pagu Semester 1 dan Semester 2 tahun {{ $year }}.
+
+
+
+
+ | Tanggal |
+ Semester |
+ Jenis |
+ Jumlah |
+ Saldo Sebelum |
+ Saldo Sesudah |
+ Keterangan |
+
+
+
+ @forelse($riwayats as $r)
+ @php $tambah = $r->jenis === 'penambahan'; @endphp
+
+ | {{ $r->created_at?->format('d/m/Y H:i') }} |
+ {{ $r->semester }} |
+ {{ $tambah ? 'Penambahan' : 'Pengurangan' }} |
+ {{ $tambah ? '+' : '-' }} Rp {{ number_format($r->jumlah, 0, ',', '.') }} |
+ Rp {{ number_format($r->saldo_sebelum, 0, ',', '.') }} |
+ Rp {{ number_format($r->saldo_sesudah, 0, ',', '.') }} |
+ {{ $r->keterangan }} |
+
+ @empty
+ | Belum ada riwayat penambahan atau pengurangan saldo. |
+ @endforelse
+
+
+
+
Data pagu sesuai fakultas pada jabatan tugas tambahan Anda.
@endsection
diff --git a/resources/views/perhitungan/pagu/index.blade.php b/resources/views/perhitungan/pagu/index.blade.php
index 2f93e0a6..9ad39a1f 100644
--- a/resources/views/perhitungan/pagu/index.blade.php
+++ b/resources/views/perhitungan/pagu/index.blade.php
@@ -130,7 +130,7 @@
Tahun |
Pagu Smt 1 |
Pagu Smt 2 |
- @if($canUbah || $canHapus)
+ @if($canUbah || $canHapus || !$showQuestionMark)
Aksi |
@endif
@@ -197,14 +197,119 @@
@endif
+
+ @if($canUbah)
+
+
+ @endif
+
+ @if(!$showQuestionMark)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | Tanggal |
+ Semester |
+ Jenis |
+ Jumlah |
+ Saldo Sebelum |
+ Saldo Sesudah |
+ Keterangan |
+ Oleh |
+
+
+
+
+
+
+
+
+
+ @endif
@endsection
@section('js')
@@ -215,8 +320,8 @@
const canTambah = {{ $canTambah ? 'true' : 'false' }};
const canUbah = {{ $canUbah ? 'true' : 'false' }};
const canHapus = {{ $canHapus ? 'true' : 'false' }};
- const showAksi = canUbah || canHapus;
const showQuestionMark = {{ $showQuestionMark ? 'true' : 'false' }};
+ const showAksi = canUbah || canHapus || !showQuestionMark;
const hideJumlahCards = {{ $hideJumlahCards ? 'true' : 'false' }};
const currentYear = '{{ date("Y") }}';
@@ -291,6 +396,44 @@
}
}
+ // Handle riwayat saldo
+ $(document).on('click', '.riwayat-btn', function() {
+ riwayatPaguId = $(this).data('id');
+ $('#riwayat_semester').val('');
+ loadRiwayat();
+ new bootstrap.Modal(document.getElementById('riwayatModal')).show();
+ });
+
+ $('#riwayat_semester').on('change', loadRiwayat);
+
+ // Handle tambah / kurangi saldo
+ if (canUbah) {
+ $(document).on('click', '.mutasi-btn', function() {
+ let id = $(this).data('id');
+
+ $.ajax({
+ url: "{{ route('pagu.show', ':id') }}".replace(':id', id),
+ type: 'GET',
+ success: function(data) {
+ $('#mutasiForm')[0].reset();
+ $('#mutasiForm .is-invalid').removeClass('is-invalid');
+ $('#mutasiForm .invalid-feedback').text('');
+ $('#mutasi_pagu_id').val(data.id);
+ $('#mutasiInfo').text('Saldo saat ini - Smt 1: ' + formatRp(data.pagu_smt1) + ' | Smt 2: ' + formatRp(data.pagu_smt2));
+ new bootstrap.Modal(document.getElementById('mutasiModal')).show();
+ },
+ error: function() {
+ showAlert('error', 'Gagal memuat data pagu.');
+ }
+ });
+ });
+
+ $('#mutasiForm').on('submit', function(e) {
+ e.preventDefault();
+ submitMutasi();
+ });
+ }
+
// Handle delete button
if (canHapus) {
$(document).on('click', '.delete-btn', function() {
@@ -382,6 +525,99 @@
});
});
+ function formatRp(value) {
+ return 'Rp ' + (Number(value) || 0).toLocaleString('id-ID');
+ }
+
+ function escapeHtml(text) {
+ return $('').text(text == null ? '' : text).html();
+ }
+
+ let riwayatPaguId = null;
+
+ function loadRiwayat() {
+ $('#riwayatBody').html('
| Memuat... |
');
+
+ $.ajax({
+ url: "{{ route('pagu.riwayat', ':id') }}".replace(':id', riwayatPaguId),
+ data: { semester: $('#riwayat_semester').val() },
+ success: function(res) {
+ $('#riwayatModalLabel').text('Riwayat Saldo Pagu - ' + (res.unit_kerja || '') + ' (' + res.tahun + ')');
+ $('#riwayatSaldoSmt1').text(formatRp(res.pagu_smt1));
+ $('#riwayatSaldoSmt2').text(formatRp(res.pagu_smt2));
+
+ if (!res.data.length) {
+ $('#riwayatBody').html('| Belum ada riwayat penambahan atau pengurangan saldo. |
');
+ return;
+ }
+
+ let rows = res.data.map(function(r) {
+ let tambah = r.jenis === 'penambahan';
+ return '' +
+ '| ' + escapeHtml(r.tanggal) + ' | ' +
+ '' + r.semester + ' | ' +
+ '' + (tambah ? 'Penambahan' : 'Pengurangan') + ' | ' +
+ '' + (tambah ? '+' : '-') + ' ' + formatRp(r.jumlah) + ' | ' +
+ '' + formatRp(r.saldo_sebelum) + ' | ' +
+ '' + formatRp(r.saldo_sesudah) + ' | ' +
+ '' + escapeHtml(r.keterangan) + ' | ' +
+ '' + escapeHtml(r.oleh) + ' | ' +
+ '
';
+ });
+ $('#riwayatBody').html(rows.join(''));
+ },
+ error: function() {
+ $('#riwayatBody').html('| Gagal memuat riwayat. |
');
+ }
+ });
+ }
+
+ function submitMutasi() {
+ let id = $('#mutasi_pagu_id').val();
+
+ $.ajax({
+ url: "{{ route('pagu.mutasi', ':id') }}".replace(':id', id),
+ type: 'POST',
+ data: {
+ _token: '{{ csrf_token() }}',
+ semester: $('#mutasi_semester').val(),
+ jenis: $('#mutasi_jenis').val(),
+ jumlah: $('#mutasi_jumlah').val(),
+ keterangan: $('#mutasi_keterangan').val(),
+ },
+ beforeSend: function() {
+ $('#mutasiSubmitBtn').prop('disabled', true).text('Menyimpan...');
+ $('#mutasiForm .is-invalid').removeClass('is-invalid');
+ $('#mutasiForm .invalid-feedback').text('');
+ },
+ success: function(response) {
+ if (response.success) {
+ bootstrap.Modal.getInstance(document.getElementById('mutasiModal')).hide();
+ table.ajax.reload();
+ loadSummary();
+ showAlert('success', response.message);
+ }
+ },
+ error: function(xhr) {
+ if (xhr.status === 422 && xhr.responseJSON && xhr.responseJSON.errors) {
+ $.each(xhr.responseJSON.errors, function(key, value) {
+ let field = $('#mutasiForm [name="' + key + '"]');
+ field.addClass('is-invalid');
+ field.siblings('.invalid-feedback').text(value[0]);
+ });
+ } else {
+ let msg = (xhr.responseJSON && xhr.responseJSON.message)
+ ? xhr.responseJSON.message
+ : 'Terjadi kesalahan saat menyimpan data.';
+ showAlert('error', msg);
+ }
+ },
+ complete: function() {
+ $('#mutasiSubmitBtn').prop('disabled', false).text('Simpan');
+ }
+ });
+ }
+
function loadSummary() {
if (!hasBacaPagu) {
return;
diff --git a/resources/views/perhitungan/pleno-penunjang/rasio-p2/index.blade.php b/resources/views/perhitungan/pleno-penunjang/rasio-p2/index.blade.php
index 2a79ec8c..cf47f298 100644
--- a/resources/views/perhitungan/pleno-penunjang/rasio-p2/index.blade.php
+++ b/resources/views/perhitungan/pleno-penunjang/rasio-p2/index.blade.php
@@ -263,10 +263,10 @@
diff --git a/resources/views/perhitungan/remunerasi/publikasi/index.blade.php b/resources/views/perhitungan/remunerasi/publikasi/index.blade.php
index 0a8f14ff..3af70226 100644
--- a/resources/views/perhitungan/remunerasi/publikasi/index.blade.php
+++ b/resources/views/perhitungan/remunerasi/publikasi/index.blade.php
@@ -311,10 +311,10 @@
diff --git a/resources/views/verifikasi-absen/halaman.blade.php b/resources/views/verifikasi-absen/halaman.blade.php
index fbace867..24024fbd 100644
--- a/resources/views/verifikasi-absen/halaman.blade.php
+++ b/resources/views/verifikasi-absen/halaman.blade.php
@@ -225,8 +225,8 @@
-
+
@@ -237,8 +237,8 @@
-
+
diff --git a/resources/views/verifikasi/berita-acara/index.blade.php b/resources/views/verifikasi/berita-acara/index.blade.php
index 4e00cefa..64a6ec94 100644
--- a/resources/views/verifikasi/berita-acara/index.blade.php
+++ b/resources/views/verifikasi/berita-acara/index.blade.php
@@ -94,10 +94,10 @@
diff --git a/resources/views/verifikasi/pengajuan-aktivitas/pelayanan/detail.blade.php b/resources/views/verifikasi/pengajuan-aktivitas/pelayanan/detail.blade.php
deleted file mode 100644
index a046b0d3..00000000
--- a/resources/views/verifikasi/pengajuan-aktivitas/pelayanan/detail.blade.php
+++ /dev/null
@@ -1,627 +0,0 @@
-@extends('layouts.main')
-
-@section('breadcrumb')
-
- - Verifikasi
- - Pengajuan Aktivitas
- - Pelayanan
- - {{ $title }}
-
-@endsection
-
-@section('content')
-
-
-
-
-
-
-
-
-
- | NIP |
- - |
-
-
- | Nama Pengaju |
- - |
-
-
- | Unit Kerja |
- - |
-
-
- | Jumlah Pengajuan |
- - |
-
-
- | Total Poin Keseluruhan |
- - |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Berikut adalah daftar pengajuan aktivitas pelayanan dari pengaju
- ini
-
-
-
-
-
-
-
-
- | No |
- SKPL |
- Tanggal Aktivitas Lembur |
- Jam Masuk |
- Jam Selesai |
- Total Waktu |
- Total Poin |
- Status |
- Aksi |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@endsection
-
-@section('js')
-
-@endsection
diff --git a/resources/views/verifikasi/pengajuan-aktivitas/pelayanan/index.blade.php b/resources/views/verifikasi/pengajuan-aktivitas/pelayanan/index.blade.php
deleted file mode 100644
index 35ce0a82..00000000
--- a/resources/views/verifikasi/pengajuan-aktivitas/pelayanan/index.blade.php
+++ /dev/null
@@ -1,566 +0,0 @@
-@extends('layouts.main')
-
-@section('breadcrumb')
-
- - Verifikasi
- - Pengajuan Aktivitas
- - {{ $title }}
-
-@endsection
-
-@section('content')
-
-
-
-
- @include('components.datatable-header', [
- 'title' => 'Daftar Pengajuan Aktivitas Pelayanan',
- 'description' =>
- 'Berikut adalah daftar pengajuan aktivitas pelayanan yang dikelompokkan berdasarkan nama pengaju',
- ])
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
-
-
-
-
-
-
- | No |
- NIP |
- Nama Pengaju |
- Unit Kerja |
- Jumlah Pengajuan |
- Total Poin |
- Status |
- Aksi |
-
-
-
-
-
-
-
-
-
-
-
- | No |
- NIP |
- Nama Pengaju |
- Unit Kerja |
- Jumlah Pengajuan |
- Total Poin |
- Status |
- Aksi |
-
-
-
-
-
-
-
-
-
-
-
- | No |
- NIP |
- Nama Pengaju |
- Unit Kerja |
- Jumlah Pengajuan |
- Total Poin |
- Status |
- Aksi |
-
-
-
-
-
-
-
-
-
-
-
- | No |
- NIP |
- Nama Pengaju |
- Unit Kerja |
- Jumlah Pengajuan |
- Total Poin |
- Status |
- Aksi |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@endsection
-
-@section('js')
-
-@endsection
diff --git a/resources/views/verifikasi/tri-dharma/bawahan/index.blade.php b/resources/views/verifikasi/tri-dharma/bawahan/index.blade.php
index d346f521..a6290f41 100644
--- a/resources/views/verifikasi/tri-dharma/bawahan/index.blade.php
+++ b/resources/views/verifikasi/tri-dharma/bawahan/index.blade.php
@@ -161,10 +161,10 @@
diff --git a/routes/prefix/pagu.php b/routes/prefix/pagu.php
index 0bc7521b..bcc70fdb 100644
--- a/routes/prefix/pagu.php
+++ b/routes/prefix/pagu.php
@@ -9,6 +9,8 @@ Route::prefix('/pagu')->name('pagu.')->group(function () {
Route::get('/summary', [PaguController::class, 'getSummary'])->name('summary');
Route::get('/export', [PaguController::class, 'export'])->name('export');
Route::post('/', [PaguController::class, 'store'])->name('store');
+ Route::get('/{pagu}/riwayat', [PaguController::class, 'riwayat'])->name('riwayat');
+ Route::post('/{pagu}/mutasi', [PaguController::class, 'mutasi'])->name('mutasi');
Route::get('/{pagu}', [PaguController::class, 'show'])->name('show');
Route::put('/{pagu}', [PaguController::class, 'update'])->name('update');
Route::delete('/{pagu}', [PaguController::class, 'destroy'])->name('destroy');
diff --git a/routes/prefix/pengajuan-aktivitas.php b/routes/prefix/pengajuan-aktivitas.php
deleted file mode 100644
index 31318487..00000000
--- a/routes/prefix/pengajuan-aktivitas.php
+++ /dev/null
@@ -1,15 +0,0 @@
-prefix('/pengajuan-aktivitas')->name('pengajuan-aktivitas.')->group(function () {
- Route::prefix('/pelayanan')->name('pelayanan.')->group(function () {
- Route::get('/', [PelayananController::class, 'index'])->name('index');
- Route::get('/data', [PelayananController::class, 'data'])->name('data');
- Route::get('/detail/{nip}', [PelayananController::class, 'detail'])->name('detail');
- Route::get('/detail/{nip}/data', [PelayananController::class, 'detailData'])->name('detail.data');
- Route::post('/{id}/verifikasi', [PelayananController::class, 'verifikasi'])->name('verifikasi');
- Route::get('/proxy-pdf', [PelayananController::class, 'proxyPdf'])->name('proxy-pdf');
- });
-});
diff --git a/routes/web.php b/routes/web.php
index cc017621..5fb99b3b 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -40,7 +40,6 @@ Route::middleware('auth')->group(function () {
include __DIR__.'/prefix/tri-dharma.php';
include __DIR__.'/prefix/laporan-kegiatan.php';
include __DIR__.'/prefix/pengajuan-presensi.php';
- include __DIR__.'/prefix/pengajuan-aktivitas.php';
include __DIR__.'/prefix/skp.php';
include __DIR__.'/prefix/berita-acara.php';
include __DIR__.'/prefix/pleno-penunjang.php';