Penambahan Sementara Pengajuan Presensi WhatsApp
This commit is contained in:
@@ -264,8 +264,6 @@ class CheckPegawaiBaruCommand extends Command
|
||||
*/
|
||||
private function updatePegawai(array $newDosen, array $newTendik, DawaiService $dawaiService): void
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
$insertedDosen = 0;
|
||||
$updatedDosen = 0;
|
||||
@@ -296,7 +294,7 @@ class CheckPegawaiBaruCommand extends Command
|
||||
|
||||
foreach ($newDosen as $dosen) {
|
||||
try {
|
||||
$result = $this->insertDosen($dosen, $dawaiService, $periode, $dosenMap, $tendikMap, $dosenByIdDawai);
|
||||
$result = DB::transaction(fn () => $this->insertDosen($dosen, $dawaiService, $periode, $dosenMap, $tendikMap, $dosenByIdDawai));
|
||||
|
||||
match ($result) {
|
||||
'inserted' => $insertedDosen++,
|
||||
@@ -335,7 +333,7 @@ class CheckPegawaiBaruCommand extends Command
|
||||
|
||||
foreach ($newTendik as $tendik) {
|
||||
try {
|
||||
$result = $this->insertTendik($tendik, $dawaiService, $periode, $dosenMap, $tendikMap, $tendikByIdDawai);
|
||||
$result = DB::transaction(fn () => $this->insertTendik($tendik, $dawaiService, $periode, $dosenMap, $tendikMap, $tendikByIdDawai));
|
||||
|
||||
match ($result) {
|
||||
'inserted' => $insertedTendik++,
|
||||
@@ -366,8 +364,6 @@ class CheckPegawaiBaruCommand extends Command
|
||||
}
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
$this->newLine();
|
||||
$this->info('========== HASIL PROSES ==========');
|
||||
$this->info("Total dosen baru ditambahkan: {$insertedDosen}");
|
||||
@@ -387,7 +383,6 @@ class CheckPegawaiBaruCommand extends Command
|
||||
}
|
||||
$this->info('Proses selesai!');
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
$this->error('Terjadi error saat proses: '.$e->getMessage());
|
||||
Log::error('Error saat proses pegawai', [
|
||||
'error' => $e->getMessage(),
|
||||
@@ -615,6 +610,7 @@ class CheckPegawaiBaruCommand extends Command
|
||||
'tubel_kembali' => ($dosen['detail']['status'] ?? '') === 'tubel' ? $validateDate($dosen['detail']['tst'] ?? null) : null,
|
||||
'npwp' => $dosen['npwp'] ?? $existing->npwp,
|
||||
'nomor_rekening' => $dosen['nomor_rekening'] ?? $existing->nomor_rekening,
|
||||
'no_hp' => $dosen['privasi']['no_hp'] ?? $existing->no_hp,
|
||||
]);
|
||||
|
||||
return $nipChanged ? 'nip_changed' : 'updated';
|
||||
@@ -653,6 +649,7 @@ class CheckPegawaiBaruCommand extends Command
|
||||
'wafat' => ($dosen['detail']['status'] ?? '') === 'wafat' ? now()->format('Y-m-d') : null,
|
||||
'npwp' => $dosen['npwp'] ?? null,
|
||||
'nomor_rekening' => $dosen['nomor_rekening'] ?? null,
|
||||
'no_hp' => $dosen['privasi']['no_hp'] ?? null,
|
||||
]);
|
||||
|
||||
return $changedType ? 'changed_type' : 'inserted';
|
||||
@@ -732,6 +729,7 @@ class CheckPegawaiBaruCommand extends Command
|
||||
'tubel_kembali' => ($tendik['detail']['status'] ?? '') === 'tubel' ? $validateDate($tendik['detail']['tst'] ?? null) : null,
|
||||
'npwp' => $tendik['npwp'] ?? $existing->npwp,
|
||||
'nomor_rekening' => $tendik['nomor_rekening'] ?? $existing->nomor_rekening,
|
||||
'no_hp' => $tendik['privasi']['no_hp'] ?? $existing->no_hp,
|
||||
]);
|
||||
|
||||
return $nipChanged ? 'nip_changed' : 'updated';
|
||||
@@ -770,6 +768,7 @@ class CheckPegawaiBaruCommand extends Command
|
||||
'wafat' => ($tendik['detail']['status'] ?? '') === 'wafat' ? now()->format('Y-m-d') : null,
|
||||
'npwp' => $tendik['npwp'] ?? null,
|
||||
'nomor_rekening' => $tendik['nomor_rekening'] ?? null,
|
||||
'no_hp' => $tendik['privasi']['no_hp'] ?? null,
|
||||
]);
|
||||
|
||||
return $changedType ? 'changed_type' : 'inserted';
|
||||
|
||||
@@ -10,11 +10,14 @@ use App\Models\Verifikator\Honorer;
|
||||
use App\Models\Verifikator\PengajuanPresensi;
|
||||
use App\Models\Verifikator\Tendik;
|
||||
use App\Services\DawaiService;
|
||||
use App\Services\VerifikasiAbsenLinkService;
|
||||
use App\Services\WhatsAppService;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Throwable;
|
||||
|
||||
class PengajuanAbsenController extends Controller
|
||||
{
|
||||
@@ -83,14 +86,14 @@ class PengajuanAbsenController extends Controller
|
||||
|
||||
public function store(AbsenRequest $request)
|
||||
{
|
||||
// if (! in_array($request->nip, ['19980513202401011', '19970812202101011'])) {
|
||||
// return response()->json([
|
||||
// 'code' => 400,
|
||||
// 'status' => 'failed',
|
||||
// 'message' => 'Sedang proses Remunerasi, Tidak dapat mengajukan absen untuk saat ini',
|
||||
// // 'message' => 'Sedang proses Maintenance, Tidak dapat mengajukan absen untuk saat ini',
|
||||
// ], 400);
|
||||
// }
|
||||
if (! in_array($request->nip, ['19980513202401011', '19970812202101011'])) {
|
||||
return response()->json([
|
||||
'code' => 400,
|
||||
'status' => 'failed',
|
||||
'message' => 'Sedang proses Remunerasi, Tidak dapat mengajukan absen untuk saat ini',
|
||||
// 'message' => 'Sedang proses Maintenance, Tidak dapat mengajukan absen untuk saat ini',
|
||||
], 400);
|
||||
}
|
||||
|
||||
$batasBulanPengajuan = (int) date('m');
|
||||
if (date('j') < 2) {
|
||||
@@ -311,6 +314,8 @@ class PengajuanAbsenController extends Controller
|
||||
|
||||
$pengajuan = PengajuanPresensi::create($absen);
|
||||
|
||||
$this->notifikasiAtasanWhatsApp($pengajuan, $pegawai, $dawaiService);
|
||||
|
||||
// Ambil nama kategori dari Dawai Service
|
||||
$statusPresensi = collect($dawaiService->listStatusPresensi());
|
||||
$kategoriStatus = $statusPresensi->firstWhere('id', (int) $request->kategori);
|
||||
@@ -556,4 +561,43 @@ class PengajuanAbsenController extends Controller
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kirim notifikasi WhatsApp ke atasan berisi link verifikasi (terima/tolak) pengajuan absen.
|
||||
* Kegagalan di sini tidak menggagalkan pengajuan (dicatat ke log saja).
|
||||
*/
|
||||
private function notifikasiAtasanWhatsApp(PengajuanPresensi $pengajuan, $pegawai, DawaiService $dawaiService): void
|
||||
{
|
||||
try {
|
||||
$atasan = $dawaiService->getListBawahan($pengajuan->nip)['data']['atasan'][0] ?? null;
|
||||
|
||||
if (! $atasan || empty($atasan['nip'])) {
|
||||
Log::error("Notifikasi WhatsApp Pengajuan Absen: atasan tidak ditemukan untuk NIP $pengajuan->nip");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$link = (new VerifikasiAbsenLinkService())->generate($pengajuan->id, $atasan['nip']);
|
||||
|
||||
$tanggalMulai = Carbon::parse($pengajuan->tanggal_mulai);
|
||||
$tanggalSelesai = Carbon::parse($pengajuan->tanggal_selesai ?? $pengajuan->tanggal_mulai);
|
||||
|
||||
// TODO: nomor WA atasan masih manual/sementara, belum ada sumber data resminya.
|
||||
$nomorTujuan = '6289698424476';
|
||||
|
||||
(new WhatsAppService())->sendPengajuanAbsenNotification(
|
||||
$nomorTujuan,
|
||||
$atasan['nama_lengkap'] ?? $atasan['nama'],
|
||||
$pegawai->nama,
|
||||
$pengajuan->nip,
|
||||
max($tanggalMulai->diffInDays($tanggalSelesai), 1),
|
||||
$tanggalMulai->format('d-m-Y'),
|
||||
$tanggalSelesai->format('d-m-Y'),
|
||||
$pengajuan->keterangan ?: '-',
|
||||
$link['button_param']
|
||||
);
|
||||
} catch (Throwable $th) {
|
||||
Log::error('Notifikasi WhatsApp Pengajuan Absen : '.$th->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\VerifikasiAbsen;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Verifikator\PengajuanPresensi;
|
||||
use App\Services\DawaiService;
|
||||
use App\Services\VerifikasiAbsenLinkService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class LinkController extends Controller
|
||||
{
|
||||
private DawaiService $dawaiService;
|
||||
|
||||
public function __construct(
|
||||
protected VerifikasiAbsenLinkService $linkService,
|
||||
) {
|
||||
$this->dawaiService = new DawaiService('http://172.16.40.128/');
|
||||
}
|
||||
|
||||
public function generate(Request $request): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
'pengajuan_id' => 'required|integer',
|
||||
'nip' => 'required|string',
|
||||
]);
|
||||
|
||||
$pengajuan = PengajuanPresensi::find($request->pengajuan_id);
|
||||
|
||||
if (! $pengajuan) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Pengajuan tidak ditemukan.',
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (! $this->dawaiService->isAtasanDari($request->nip, $pengajuan->nip)) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'NIP tersebut bukan atasan dari pemohon pengajuan ini.',
|
||||
], 422);
|
||||
}
|
||||
|
||||
$link = $this->linkService->generate($pengajuan->id, $request->nip);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'data' => $link,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,16 @@ namespace App\Http\Controllers\Lainnya\VerifikasiAbsen;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Verifikator\PengajuanPresensi;
|
||||
use App\Models\Verifikator\View\Pegawai;
|
||||
use App\Services\DawaiService;
|
||||
use App\Services\GoogleDriveService;
|
||||
use App\Services\TteService;
|
||||
use App\Services\VerifikasiAbsenLinkService;
|
||||
use Exception;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -18,59 +22,129 @@ use Throwable;
|
||||
|
||||
class VerifikasiAbsenController extends Controller
|
||||
{
|
||||
public function __construct(protected DawaiService $dawaiService) {}
|
||||
const BATAS_HARI_VERIFIKASI = 5;
|
||||
|
||||
public function showSetujui(int $id): View|RedirectResponse
|
||||
private DawaiService $dawaiService;
|
||||
|
||||
public function __construct(
|
||||
protected TteService $tteService,
|
||||
protected GoogleDriveService $googleDriveService,
|
||||
protected VerifikasiAbsenLinkService $linkService,
|
||||
) {
|
||||
$this->dawaiService = new DawaiService('http://172.16.40.128/');
|
||||
}
|
||||
|
||||
public function show(Request $request, int $id): View|RedirectResponse|Response
|
||||
{
|
||||
$pengajuan = PengajuanPresensi::with('pegawai')->findOrFail($id);
|
||||
|
||||
$nipAtasan = $this->otorisasiAtasan($request, $pengajuan);
|
||||
|
||||
if ($nipAtasan === false) {
|
||||
return $this->tidakBerwenang();
|
||||
}
|
||||
|
||||
if ($pengajuan->status !== 'Diajukan') {
|
||||
return redirect()->route('verifikasi-absen.sudah-diproses', $id);
|
||||
}
|
||||
|
||||
$title = 'Setujui Pengajuan Absen';
|
||||
if ($this->isExpired($pengajuan)) {
|
||||
return redirect()->route('verifikasi-absen.kadaluarsa', $id);
|
||||
}
|
||||
|
||||
return view('lainnya.verifikasi-absen.setujui', compact('title', 'pengajuan'));
|
||||
$title = 'Verifikasi Pengajuan Absen';
|
||||
$nip = $nipAtasan;
|
||||
$expires = $request->input('expires');
|
||||
$signature = $request->input('signature');
|
||||
|
||||
return view('lainnya.verifikasi-absen.show', compact('title', 'pengajuan', 'nip', 'expires', 'signature'));
|
||||
}
|
||||
|
||||
public function setujui(Request $request, int $id): RedirectResponse
|
||||
public function setujui(Request $request, int $id): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
'nik' => 'required|string',
|
||||
'passphrase' => 'required|string',
|
||||
]);
|
||||
|
||||
$pengajuan = PengajuanPresensi::findOrFail($id);
|
||||
|
||||
$nipAtasan = $this->otorisasiAtasan($request, $pengajuan);
|
||||
|
||||
if ($nipAtasan === false) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Anda tidak berwenang memverifikasi pengajuan ini.',
|
||||
], 403);
|
||||
}
|
||||
|
||||
if ($pengajuan->status !== 'Diajukan') {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Pengajuan ini sudah diproses sebelumnya.',
|
||||
], 422);
|
||||
}
|
||||
|
||||
if ($this->isExpired($pengajuan)) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Pengajuan ini sudah kadaluarsa dan tidak dapat diverifikasi lagi.',
|
||||
], 422);
|
||||
}
|
||||
|
||||
$dokumenTertandatangani = $this->tteService->signDokumenUser(
|
||||
$request->nik,
|
||||
$request->passphrase,
|
||||
$pengajuan->file,
|
||||
route('verifikasi-absen.show', $id)
|
||||
);
|
||||
|
||||
if ($dokumenTertandatangani === false) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Gagal menandatangani dokumen. Periksa kembali NIK dan Passphrase Anda.',
|
||||
], 422);
|
||||
}
|
||||
|
||||
$fileName = "pengajuan-presensi-{$pengajuan->nip}-{$pengajuan->id}.pdf";
|
||||
|
||||
if (! $this->googleDriveService->uploadPdf($dokumenTertandatangani, $fileName)) {
|
||||
Log::error("Gagal mengunggah dokumen tertandatangani ke Google Drive untuk pengajuan #$id");
|
||||
}
|
||||
|
||||
$success = $this->proses([$id], 'Diterima', null, $nipAtasan);
|
||||
|
||||
if ($success) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Pengajuan absen berhasil disetujui.',
|
||||
'redirect' => route('verifikasi-absen.berhasil-disetujui', $id),
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Gagal menyetujui pengajuan absen. Silakan coba lagi.',
|
||||
], 500);
|
||||
}
|
||||
|
||||
public function berhasilDisetujui(int $id): View|RedirectResponse
|
||||
{
|
||||
$pengajuan = PengajuanPresensi::with('pegawai')->findOrFail($id);
|
||||
|
||||
if ($pengajuan->status === 'Diajukan') {
|
||||
return redirect()->route('verifikasi-absen.show', $id);
|
||||
}
|
||||
|
||||
if ($pengajuan->status !== 'Diterima') {
|
||||
return redirect()->route('verifikasi-absen.sudah-diproses', $id);
|
||||
}
|
||||
|
||||
$success = $this->proses([$id], 'Diterima', null);
|
||||
|
||||
if ($success) {
|
||||
return redirect()->route('verifikasi-absen.berhasil-disetujui', $id);
|
||||
}
|
||||
|
||||
return back()->with('error', 'Gagal menyetujui pengajuan absen. Silakan coba lagi.');
|
||||
}
|
||||
|
||||
public function berhasilDisetujui(int $id): View
|
||||
{
|
||||
$pengajuan = PengajuanPresensi::with('pegawai')->findOrFail($id);
|
||||
$title = 'Berhasil Menyetujui Pengajuan Absen';
|
||||
|
||||
return view('lainnya.verifikasi-absen.berhasil-disetujui', compact('title', 'pengajuan'));
|
||||
}
|
||||
|
||||
public function showTolak(int $id): View|RedirectResponse
|
||||
{
|
||||
$pengajuan = PengajuanPresensi::with('pegawai')->findOrFail($id);
|
||||
|
||||
if ($pengajuan->status !== 'Diajukan') {
|
||||
return redirect()->route('verifikasi-absen.sudah-diproses', $id);
|
||||
}
|
||||
|
||||
$title = 'Tolak Pengajuan Absen';
|
||||
|
||||
return view('lainnya.verifikasi-absen.tolak', compact('title', 'pengajuan'));
|
||||
}
|
||||
|
||||
public function tolak(Request $request, int $id): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
@@ -79,6 +153,15 @@ class VerifikasiAbsenController extends Controller
|
||||
|
||||
$pengajuan = PengajuanPresensi::findOrFail($id);
|
||||
|
||||
$nipAtasan = $this->otorisasiAtasan($request, $pengajuan);
|
||||
|
||||
if ($nipAtasan === false) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Anda tidak berwenang memverifikasi pengajuan ini.',
|
||||
], 403);
|
||||
}
|
||||
|
||||
if ($pengajuan->status !== 'Diajukan') {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
@@ -86,12 +169,20 @@ class VerifikasiAbsenController extends Controller
|
||||
], 422);
|
||||
}
|
||||
|
||||
$success = $this->proses([$id], 'Ditolak', $request->catatan);
|
||||
if ($this->isExpired($pengajuan)) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Pengajuan ini sudah kadaluarsa dan tidak dapat diverifikasi lagi.',
|
||||
], 422);
|
||||
}
|
||||
|
||||
$success = $this->proses([$id], 'Ditolak', $request->catatan, $nipAtasan);
|
||||
|
||||
if ($success) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Pengajuan absen berhasil ditolak.',
|
||||
'redirect' => route('verifikasi-absen.berhasil-ditolak', $id),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -101,16 +192,97 @@ class VerifikasiAbsenController extends Controller
|
||||
], 500);
|
||||
}
|
||||
|
||||
public function sudahDiproses(int $id): View
|
||||
public function berhasilDitolak(int $id): View|RedirectResponse
|
||||
{
|
||||
$pengajuan = PengajuanPresensi::with(['pegawai', 'notes'])->findOrFail($id);
|
||||
|
||||
if ($pengajuan->status === 'Diajukan') {
|
||||
return redirect()->route('verifikasi-absen.show', $id);
|
||||
}
|
||||
|
||||
if ($pengajuan->status !== 'Ditolak') {
|
||||
return redirect()->route('verifikasi-absen.sudah-diproses', $id);
|
||||
}
|
||||
|
||||
$title = 'Berhasil Menolak Pengajuan Absen';
|
||||
|
||||
return view('lainnya.verifikasi-absen.berhasil-ditolak', compact('title', 'pengajuan'));
|
||||
}
|
||||
|
||||
public function sudahDiproses(int $id): View|RedirectResponse
|
||||
{
|
||||
$pengajuan = PengajuanPresensi::with('pegawai')->findOrFail($id);
|
||||
|
||||
if ($pengajuan->status === 'Diajukan') {
|
||||
return redirect()->route(
|
||||
$this->isExpired($pengajuan) ? 'verifikasi-absen.kadaluarsa' : 'verifikasi-absen.show',
|
||||
$id
|
||||
);
|
||||
}
|
||||
|
||||
$title = 'Pengajuan Sudah Diproses';
|
||||
|
||||
return view('lainnya.verifikasi-absen.sudah-diproses', compact('title', 'pengajuan'));
|
||||
}
|
||||
|
||||
private function proses(array $ids, string $status, ?string $catatan): bool
|
||||
public function kadaluarsa(int $id): View|RedirectResponse
|
||||
{
|
||||
$pengajuan = PengajuanPresensi::with('pegawai')->findOrFail($id);
|
||||
|
||||
if ($pengajuan->status !== 'Diajukan') {
|
||||
return redirect()->route('verifikasi-absen.sudah-diproses', $id);
|
||||
}
|
||||
|
||||
if (! $this->isExpired($pengajuan)) {
|
||||
return redirect()->route('verifikasi-absen.show', $id);
|
||||
}
|
||||
|
||||
$title = 'Pengajuan Kadaluarsa';
|
||||
|
||||
return view('lainnya.verifikasi-absen.kadaluarsa', compact('title', 'pengajuan'));
|
||||
}
|
||||
|
||||
private function isExpired(PengajuanPresensi $pengajuan): bool
|
||||
{
|
||||
return $pengajuan->created_at?->copy()->addDays(self::BATAS_HARI_VERIFIKASI)->isPast() ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validasi bahwa request membawa nip+expires+signature yang valid (dari tautan WhatsApp)
|
||||
* DAN nip tersebut benar-benar atasan dari pegawai pemilik pengajuan.
|
||||
* Return NIP atasan yang tervalidasi, atau false kalau tidak berwenang.
|
||||
*/
|
||||
private function otorisasiAtasan(Request $request, PengajuanPresensi $pengajuan): string|false
|
||||
{
|
||||
$nip = $request->input('nip');
|
||||
$expires = $request->input('expires');
|
||||
$signature = $request->input('signature');
|
||||
|
||||
if (! $this->linkService->verify($pengajuan->id, $nip, $expires, $signature)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $this->dawaiService->isAtasanDari($nip, $pengajuan->nip)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $nip;
|
||||
}
|
||||
|
||||
private function tidakBerwenang(): Response
|
||||
{
|
||||
$title = 'Tidak Berwenang';
|
||||
|
||||
return response()->view('lainnya.verifikasi-absen.tidak-berwenang', compact('title'), 403);
|
||||
}
|
||||
|
||||
private function proses(array $ids, string $status, ?string $catatan, ?string $nipAtasan = null): bool
|
||||
{
|
||||
// Diproses tanpa sesi login (diakses langsung dari tautan WhatsApp),
|
||||
// sehingga identitas verifikator diambil dari NIP atasan yang tervalidasi (bukan Auth::user()).
|
||||
$atasan = $nipAtasan ? Pegawai::withoutGlobalScopes()->where('nip', $nipAtasan)->first() : null;
|
||||
$verifikatorRole = 'Atasan (via WhatsApp)';
|
||||
|
||||
try {
|
||||
$pengajuans = PengajuanPresensi::whereIn('id', $ids)->get();
|
||||
|
||||
@@ -120,50 +292,53 @@ class VerifikasiAbsenController extends Controller
|
||||
$pengajuan->update(['status' => $status]);
|
||||
|
||||
$pengajuan->logs()->create([
|
||||
'user_id' => Auth::id(),
|
||||
'user_id' => null,
|
||||
'method' => 'POST',
|
||||
'employee_id' => Auth::user()->nip,
|
||||
'employee_name' => Auth::user()->name,
|
||||
'employee_role' => 'Verifikator',
|
||||
'employee_id' => $nipAtasan ?? $pengajuan->nip,
|
||||
'employee_name' => $atasan?->nama ?? $pengajuan->pegawai?->nama,
|
||||
'employee_role' => $verifikatorRole,
|
||||
'message' => 'Pengajuan Presensi Berhasil ' . strtolower($status) . ' via WhatsApp',
|
||||
]);
|
||||
|
||||
if ($status === 'Ditolak') {
|
||||
$pengajuan->notes()->create([
|
||||
'type' => 'Catatan',
|
||||
'user_id' => Auth::id(),
|
||||
'employee_id' => Auth::user()->nip,
|
||||
'employee_name' => Auth::user()->name,
|
||||
'employee_role' => 'Verifikator',
|
||||
'user_id' => null,
|
||||
'employee_id' => $nipAtasan ?? $pengajuan->nip,
|
||||
'employee_name' => $atasan?->nama ?? $pengajuan->pegawai?->nama,
|
||||
'employee_role' => $verifikatorRole,
|
||||
'message' => $catatan,
|
||||
]);
|
||||
}
|
||||
|
||||
$dawai = $this->dawaiService->verifikasiUsulanPresensi(
|
||||
$pengajuan->nip,
|
||||
[$pengajuan->tanggal_mulai],
|
||||
$this->mapStatus($status),
|
||||
$pengajuan->getRawOriginal('kategori')
|
||||
);
|
||||
// $dawai = $this->dawaiService->verifikasiUsulanPresensi(
|
||||
// $pengajuan->nip,
|
||||
// [$pengajuan->tanggal_mulai],
|
||||
// $this->mapStatus($status),
|
||||
// $pengajuan->getRawOriginal('kategori'),
|
||||
// 'whatsapp',
|
||||
// $verifikatorRole
|
||||
// );
|
||||
|
||||
if (! $dawai) {
|
||||
Log::error("Presensi DAWAI via WhatsApp: $pengajuan->nip ($status)");
|
||||
throw new Exception('Presensi: DAWAI ERROR');
|
||||
}
|
||||
// if (! $dawai) {
|
||||
// Log::error("Presensi DAWAI via WhatsApp: $pengajuan->nip ($status)");
|
||||
// throw new Exception('Presensi: DAWAI ERROR');
|
||||
// }
|
||||
|
||||
DB::commit();
|
||||
|
||||
try {
|
||||
Http::timeout(5)->asMultipart()->post('http://172.16.50.94:8084/webhook/presensi', [
|
||||
['name' => 'nip', 'contents' => $pengajuan->nip],
|
||||
['name' => 'tanggal[]', 'contents' => $pengajuan->tanggal_mulai],
|
||||
['name' => 'kategori', 'contents' => (string) $pengajuan->getRawOriginal('kategori')],
|
||||
['name' => 'username', 'contents' => Auth::user()->nip],
|
||||
['name' => 'name', 'contents' => Auth::user()->name],
|
||||
]);
|
||||
} catch (Throwable $webhookException) {
|
||||
Log::error("Webhook Presensi via WhatsApp error: {$pengajuan->nip} ($status) - " . $webhookException->getMessage());
|
||||
}
|
||||
// try {
|
||||
// Http::timeout(5)->asMultipart()->post('http://172.16.50.94:8084/webhook/presensi', [
|
||||
// ['name' => 'jenis', 'contents' => 'izin],
|
||||
// ['name' => 'nip', 'contents' => $pengajuan->nip],
|
||||
// ['name' => 'tanggal[]', 'contents' => $pengajuan->tanggal_mulai],
|
||||
// ['name' => 'kategori', 'contents' => (string) $pengajuan->getRawOriginal('kategori')],
|
||||
// ['name' => 'username', 'contents' => 'whatsapp'],
|
||||
// ['name' => 'name', 'contents' => $verifikatorRole],
|
||||
// ]);
|
||||
// } catch (Throwable $webhookException) {
|
||||
// Log::error("Webhook Presensi via WhatsApp error: {$pengajuan->nip} ($status) - " . $webhookException->getMessage());
|
||||
// }
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -39,6 +39,7 @@ class Dosen extends Model
|
||||
'wafat',
|
||||
'npwp',
|
||||
'nomor_rekening',
|
||||
'no_hp',
|
||||
];
|
||||
|
||||
public function kegiatanPenunjangs()
|
||||
|
||||
@@ -43,6 +43,7 @@ class Tendik extends Model
|
||||
'wafat',
|
||||
'npwp',
|
||||
'nomor_rekening',
|
||||
'no_hp',
|
||||
];
|
||||
|
||||
public function kegiatanPenunjangs()
|
||||
|
||||
@@ -56,6 +56,13 @@ class DawaiService
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function isAtasanDari(string $nipAtasan, string $nipBawahan): bool
|
||||
{
|
||||
$bawahan = $this->getListBawahan($nipAtasan)['data']['bawahan'] ?? [];
|
||||
|
||||
return in_array($nipBawahan, array_column($bawahan, 'nip'), true);
|
||||
}
|
||||
|
||||
public function isVerifikatorTriDharma(string $nip)
|
||||
{
|
||||
try {
|
||||
@@ -88,7 +95,7 @@ class DawaiService
|
||||
public function listPegawai(string $nip = '', string $jenisPegawai = '', string $email = ''): array
|
||||
{
|
||||
try {
|
||||
$response = $this->client->get("api/v1/pegawai?jenis_pegawai=$jenisPegawai&nip=$nip&email=$email&asn=true&pensiun=0&wafat=0&mutkel=0&nonaktif=0");
|
||||
$response = $this->client->get("api/v1/pegawai?jenis_pegawai=$jenisPegawai&nip=$nip&email=$email&asn=true&pensiun=0&wafat=0&mutkel=0&nonaktif=0&privasi=true");
|
||||
$data = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
return $data;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Throwable;
|
||||
|
||||
class GoogleDriveService
|
||||
{
|
||||
// TODO: isi path credentials service account (JSON) & folder ID tujuan setelah tersedia.
|
||||
private string $credentialsPath = '';
|
||||
|
||||
private string $folderId = '';
|
||||
|
||||
public function uploadPdf(string $content, string $fileName): string|false
|
||||
{
|
||||
if (! $this->credentialsPath || ! $this->folderId) {
|
||||
Log::error("GoogleDriveService: belum dikonfigurasi, upload '$fileName' dilewati.");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
// TODO: implementasi upload pakai google/apiclient setelah credentials tersedia.
|
||||
} catch (Throwable $th) {
|
||||
Log::error('GoogleDriveService uploadPdf : '.$th->getMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Throwable;
|
||||
|
||||
class TteService
|
||||
{
|
||||
private string $baseUrl = 'http://118.98.229.146';
|
||||
|
||||
private string $username = '9702946';
|
||||
|
||||
private string $password = 'DsC1-G0cP-Pbk8-qYxE';
|
||||
|
||||
public function signDokumenUser(string $nik, string $passphrase, string $filePath, string $linkQr): string|false
|
||||
{
|
||||
try {
|
||||
$query = http_build_query([
|
||||
'nik' => $nik,
|
||||
'passphrase' => $passphrase,
|
||||
'tampilan' => 'invisible',
|
||||
'halaman' => 'terakhir',
|
||||
'image' => 'false',
|
||||
'xAxis' => 43.63,
|
||||
'yAxis' => 28.71,
|
||||
'width' => 550.78,
|
||||
'height' => 130.88,
|
||||
'reason' => 'Dokumen ditandatangani secara elektronik Universitas Tanjungpura',
|
||||
'location' => 'Universitas Tanjungpura',
|
||||
'linkQR' => $linkQr,
|
||||
]);
|
||||
|
||||
$response = Http::withBasicAuth($this->username, $this->password)
|
||||
->timeout(60)
|
||||
->attach('file', file_get_contents($filePath), basename($filePath))
|
||||
->post("{$this->baseUrl}/api/sign/pdf?{$query}");
|
||||
} catch (Throwable $th) {
|
||||
Log::error('TTE signDokumenUser : '.$th->getMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $response->successful()) {
|
||||
Log::error("TTE signDokumenUser gagal: HTTP {$response->status()} - {$response->body()}");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $response->body();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
class VerifikasiAbsenLinkService
|
||||
{
|
||||
const TTL_MENIT_DEFAULT = 7200; // 5 hari, selaras dengan batas kadaluarsa pengajuan
|
||||
|
||||
public function generate(int $pengajuanId, string $nip, int $ttlMenit = self::TTL_MENIT_DEFAULT): array
|
||||
{
|
||||
$expires = now()->addMinutes($ttlMenit)->timestamp;
|
||||
$signature = $this->hash($pengajuanId, $nip, $expires);
|
||||
|
||||
return [
|
||||
'nip' => $nip,
|
||||
'expires' => $expires,
|
||||
'signature' => $signature,
|
||||
'url' => route('verifikasi-absen.show', [
|
||||
'id' => $pengajuanId,
|
||||
'nip' => $nip,
|
||||
'expires' => $expires,
|
||||
'signature' => $signature,
|
||||
]),
|
||||
// Suffix untuk parameter tombol URL template WhatsApp (domain sudah baku di template).
|
||||
'button_param' => "{$pengajuanId}?nip={$nip}&expires={$expires}&signature={$signature}",
|
||||
];
|
||||
}
|
||||
|
||||
public function verify(int $pengajuanId, ?string $nip, mixed $expires, ?string $signature): bool
|
||||
{
|
||||
if (! $nip || ! $expires || ! $signature) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((int) $expires < now()->timestamp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$expected = $this->hash($pengajuanId, $nip, (int) $expires);
|
||||
|
||||
return hash_equals($expected, $signature);
|
||||
}
|
||||
|
||||
private function hash(int $pengajuanId, string $nip, int $expires): string
|
||||
{
|
||||
return hash_hmac('sha256', "{$pengajuanId}|{$nip}|{$expires}", config('app.key'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Throwable;
|
||||
|
||||
class WhatsAppService
|
||||
{
|
||||
private string $baseUrl = 'https://chat.api.co.id';
|
||||
|
||||
private string $token = 'apicoid_live_7J0vmW5Sbk2dBBAEIEDtdc4tG4fOswy3Seblz_nKZqk';
|
||||
|
||||
public function sendPengajuanAbsenNotification(
|
||||
string $nomorTujuan,
|
||||
string $namaAtasan,
|
||||
string $namaPemohon,
|
||||
string $nipPemohon,
|
||||
int $jumlahHari,
|
||||
string $tanggalMulai,
|
||||
string $tanggalSelesai,
|
||||
string $keterangan,
|
||||
string $link
|
||||
): bool {
|
||||
try {
|
||||
$response = Http::withToken($this->token)
|
||||
->post("{$this->baseUrl}/api/v1/public/messages/send", [
|
||||
'phone_number' => $nomorTujuan,
|
||||
'channel' => 'whatsapp',
|
||||
'message_type' => 'template',
|
||||
'template' => [
|
||||
'name' => 'pengajuan_absen',
|
||||
'language' => ['code' => 'id'],
|
||||
'components' => [
|
||||
[
|
||||
'type' => 'body',
|
||||
'parameters' => [
|
||||
['type' => 'text', 'text' => $namaAtasan],
|
||||
['type' => 'text', 'text' => $namaPemohon],
|
||||
['type' => 'text', 'text' => $nipPemohon],
|
||||
['type' => 'text', 'text' => (string) $jumlahHari],
|
||||
['type' => 'text', 'text' => $tanggalMulai],
|
||||
['type' => 'text', 'text' => $tanggalSelesai],
|
||||
['type' => 'text', 'text' => $keterangan],
|
||||
],
|
||||
],
|
||||
[
|
||||
'type' => 'button',
|
||||
'sub_type' => 'url',
|
||||
'index' => '0',
|
||||
'parameters' => [
|
||||
['type' => 'text', 'text' => $link],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
} catch (Throwable $th) {
|
||||
Log::error('WhatsApp sendPengajuanAbsenNotification : '.$th->getMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $response->successful()) {
|
||||
Log::error("WhatsApp sendPengajuanAbsenNotification gagal: HTTP {$response->status()} - {$response->body()}");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Definisi view verifikator.pegawais (union dosens + tendiks) yang bergantung
|
||||
* pada kolom no_hp, sehingga harus di-drop sebelum ALTER dan dibuat ulang setelahnya.
|
||||
*/
|
||||
private string $viewDefinition = <<<'SQL'
|
||||
CREATE VIEW verifikator.pegawais AS
|
||||
SELECT dosens.id,
|
||||
dosens.nip,
|
||||
dosens.nip_siakad,
|
||||
dosens.nip_sk,
|
||||
dosens.sk,
|
||||
dosens.status_nip,
|
||||
dosens.nama,
|
||||
'dosen'::text AS jenis_pegawai,
|
||||
dosens.no_hp,
|
||||
dosens.unit_kerja_id,
|
||||
dosens.unit_kerja_nama,
|
||||
dosens.pendidikan_terakhir,
|
||||
dosens.prodi_id,
|
||||
dosens.tubel_berangkat,
|
||||
dosens.tubel_kembali,
|
||||
dosens.pensiun,
|
||||
dosens.wafat,
|
||||
dosens.jabatan_fungsional_id,
|
||||
dosens.jabatan_fungsional_nama,
|
||||
dosens.jabatan_dtt_id,
|
||||
dosens.jabatan_dtt_nama,
|
||||
dosens.jabatan_dtt_tanggal_berlaku,
|
||||
dosens.jabatan_dtt_tanggal_berakhir,
|
||||
dosens.npwp,
|
||||
dosens.nomor_rekening
|
||||
FROM verifikator.dosens
|
||||
UNION
|
||||
SELECT tendiks.id,
|
||||
tendiks.nip,
|
||||
tendiks.nip_siakad,
|
||||
tendiks.nip_sk,
|
||||
tendiks.sk,
|
||||
tendiks.status_nip,
|
||||
tendiks.nama,
|
||||
'tendik'::text AS jenis_pegawai,
|
||||
tendiks.no_hp,
|
||||
tendiks.unit_kerja_id,
|
||||
tendiks.unit_kerja_nama,
|
||||
tendiks.pendidikan_terakhir,
|
||||
NULL::bigint AS prodi_id,
|
||||
tendiks.tubel_berangkat,
|
||||
tendiks.tubel_kembali,
|
||||
tendiks.pensiun,
|
||||
tendiks.wafat,
|
||||
tendiks.jabatan_fungsional_id,
|
||||
tendiks.jabatan_fungsional_nama,
|
||||
tendiks.jabatan_dtt_id,
|
||||
tendiks.jabatan_dtt_nama,
|
||||
tendiks.jabatan_dtt_tanggal_berlaku,
|
||||
tendiks.jabatan_dtt_tanggal_berakhir,
|
||||
tendiks.npwp,
|
||||
tendiks.nomor_rekening
|
||||
FROM verifikator.tendiks
|
||||
SQL;
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement('DROP VIEW IF EXISTS verifikator.pegawais');
|
||||
|
||||
Schema::table('verifikator.dosens', function (Blueprint $table) {
|
||||
$table->string('no_hp', 20)->nullable()->change();
|
||||
});
|
||||
|
||||
Schema::table('verifikator.tendiks', function (Blueprint $table) {
|
||||
$table->string('no_hp', 20)->nullable()->change();
|
||||
});
|
||||
|
||||
DB::statement($this->viewDefinition);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
DB::statement('DROP VIEW IF EXISTS verifikator.pegawais');
|
||||
|
||||
Schema::table('verifikator.dosens', function (Blueprint $table) {
|
||||
$table->string('no_hp', 13)->nullable()->change();
|
||||
});
|
||||
|
||||
Schema::table('verifikator.tendiks', function (Blueprint $table) {
|
||||
$table->string('no_hp', 13)->nullable()->change();
|
||||
});
|
||||
|
||||
DB::statement($this->viewDefinition);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Definisi view verifikator.pegawais (union dosens + tendiks) yang bergantung
|
||||
* pada kolom no_hp, sehingga harus di-drop sebelum ALTER dan dibuat ulang setelahnya.
|
||||
*/
|
||||
private string $viewDefinition = <<<'SQL'
|
||||
CREATE VIEW verifikator.pegawais AS
|
||||
SELECT dosens.id,
|
||||
dosens.nip,
|
||||
dosens.nip_siakad,
|
||||
dosens.nip_sk,
|
||||
dosens.sk,
|
||||
dosens.status_nip,
|
||||
dosens.nama,
|
||||
'dosen'::text AS jenis_pegawai,
|
||||
dosens.no_hp,
|
||||
dosens.unit_kerja_id,
|
||||
dosens.unit_kerja_nama,
|
||||
dosens.pendidikan_terakhir,
|
||||
dosens.prodi_id,
|
||||
dosens.tubel_berangkat,
|
||||
dosens.tubel_kembali,
|
||||
dosens.pensiun,
|
||||
dosens.wafat,
|
||||
dosens.jabatan_fungsional_id,
|
||||
dosens.jabatan_fungsional_nama,
|
||||
dosens.jabatan_dtt_id,
|
||||
dosens.jabatan_dtt_nama,
|
||||
dosens.jabatan_dtt_tanggal_berlaku,
|
||||
dosens.jabatan_dtt_tanggal_berakhir,
|
||||
dosens.npwp,
|
||||
dosens.nomor_rekening
|
||||
FROM verifikator.dosens
|
||||
UNION
|
||||
SELECT tendiks.id,
|
||||
tendiks.nip,
|
||||
tendiks.nip_siakad,
|
||||
tendiks.nip_sk,
|
||||
tendiks.sk,
|
||||
tendiks.status_nip,
|
||||
tendiks.nama,
|
||||
'tendik'::text AS jenis_pegawai,
|
||||
tendiks.no_hp,
|
||||
tendiks.unit_kerja_id,
|
||||
tendiks.unit_kerja_nama,
|
||||
tendiks.pendidikan_terakhir,
|
||||
NULL::bigint AS prodi_id,
|
||||
tendiks.tubel_berangkat,
|
||||
tendiks.tubel_kembali,
|
||||
tendiks.pensiun,
|
||||
tendiks.wafat,
|
||||
tendiks.jabatan_fungsional_id,
|
||||
tendiks.jabatan_fungsional_nama,
|
||||
tendiks.jabatan_dtt_id,
|
||||
tendiks.jabatan_dtt_nama,
|
||||
tendiks.jabatan_dtt_tanggal_berlaku,
|
||||
tendiks.jabatan_dtt_tanggal_berakhir,
|
||||
tendiks.npwp,
|
||||
tendiks.nomor_rekening
|
||||
FROM verifikator.tendiks
|
||||
SQL;
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement('DROP VIEW IF EXISTS verifikator.pegawais');
|
||||
|
||||
Schema::table('verifikator.dosens', function (Blueprint $table) {
|
||||
$table->string('no_hp', 100)->nullable()->change();
|
||||
});
|
||||
|
||||
Schema::table('verifikator.tendiks', function (Blueprint $table) {
|
||||
$table->string('no_hp', 100)->nullable()->change();
|
||||
});
|
||||
|
||||
DB::statement($this->viewDefinition);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
DB::statement('DROP VIEW IF EXISTS verifikator.pegawais');
|
||||
|
||||
Schema::table('verifikator.dosens', function (Blueprint $table) {
|
||||
$table->string('no_hp', 20)->nullable()->change();
|
||||
});
|
||||
|
||||
Schema::table('verifikator.tendiks', function (Blueprint $table) {
|
||||
$table->string('no_hp', 20)->nullable()->change();
|
||||
});
|
||||
|
||||
DB::statement($this->viewDefinition);
|
||||
}
|
||||
};
|
||||
@@ -36,7 +36,26 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p class="text-muted small">Anda dapat menutup halaman ini.</p>
|
||||
<p class="text-muted small" id="countdown-text">Halaman akan ditutup dalam <strong id="countdown">5</strong> detik...</p>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('js')
|
||||
<script>
|
||||
let seconds = 5;
|
||||
const countdownEl = document.getElementById('countdown');
|
||||
const timer = setInterval(() => {
|
||||
seconds--;
|
||||
if (countdownEl) { countdownEl.textContent = seconds; }
|
||||
|
||||
if (seconds <= 0) {
|
||||
clearInterval(timer);
|
||||
window.close();
|
||||
setTimeout(() => {
|
||||
document.getElementById('countdown-text').textContent = 'Silakan tutup tab ini secara manual.';
|
||||
}, 500);
|
||||
}
|
||||
}, 1000);
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
@extends('layouts.action')
|
||||
|
||||
@section('content')
|
||||
<div class="card border shadow-sm">
|
||||
<div class="card-body p-4 text-center">
|
||||
<div class="avatar-lg mx-auto mb-3">
|
||||
<span class="avatar-title rounded-circle bg-danger text-white display-5">
|
||||
<i class="uil-times"></i>
|
||||
</span>
|
||||
</div>
|
||||
<h4 class="text-danger mb-1">Berhasil Ditolak!</h4>
|
||||
<p class="text-muted mb-4">Pengajuan absen telah berhasil ditolak.</p>
|
||||
|
||||
<div class="table-responsive text-start mb-4">
|
||||
<table class="table table-sm table-bordered">
|
||||
<tr>
|
||||
<th width="140" class="bg-light">NIP</th>
|
||||
<td>{{ $pengajuan->nip }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Nama</th>
|
||||
<td>{{ $pengajuan->pegawai?->nama ?? '-' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Tanggal</th>
|
||||
<td>{{ \Carbon\Carbon::parse($pengajuan->tanggal_mulai)->translatedFormat('d F Y') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Kategori</th>
|
||||
<td>{{ $pengajuan->kategori }}</td>
|
||||
</tr>
|
||||
@if ($pengajuan->notes?->last())
|
||||
<tr>
|
||||
<th class="bg-light">Alasan Penolakan</th>
|
||||
<td>{{ $pengajuan->notes->last()->message }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<th class="bg-light">Status</th>
|
||||
<td><span class="badge bg-danger rounded-pill fs-6 px-2 py-1">Ditolak</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p class="text-muted small" id="countdown-text">Halaman akan ditutup dalam <strong id="countdown">5</strong> detik...</p>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('js')
|
||||
<script>
|
||||
let seconds = 5;
|
||||
const countdownEl = document.getElementById('countdown');
|
||||
const timer = setInterval(() => {
|
||||
seconds--;
|
||||
if (countdownEl) { countdownEl.textContent = seconds; }
|
||||
|
||||
if (seconds <= 0) {
|
||||
clearInterval(timer);
|
||||
window.close();
|
||||
setTimeout(() => {
|
||||
document.getElementById('countdown-text').textContent = 'Silakan tutup tab ini secara manual.';
|
||||
}, 500);
|
||||
}
|
||||
}, 1000);
|
||||
</script>
|
||||
@endsection
|
||||
@@ -0,0 +1,48 @@
|
||||
@extends('layouts.action')
|
||||
|
||||
@section('content')
|
||||
<div class="card border shadow-sm">
|
||||
<div class="card-body p-4 text-center">
|
||||
<div class="avatar-lg mx-auto mb-3">
|
||||
<span class="avatar-title rounded-circle bg-secondary-subtle text-secondary display-5">
|
||||
<i class="uil-history"></i>
|
||||
</span>
|
||||
</div>
|
||||
<h4 class="mb-1">Pengajuan Kadaluarsa</h4>
|
||||
<p class="text-muted mb-4">
|
||||
Tautan verifikasi ini sudah melewati batas waktu {{ \App\Http\Controllers\Lainnya\VerifikasiAbsen\VerifikasiAbsenController::BATAS_HARI_VERIFIKASI }} hari sejak pengajuan dibuat, sehingga tidak dapat diproses lagi.
|
||||
</p>
|
||||
|
||||
<div class="table-responsive text-start mb-4">
|
||||
<table class="table table-sm table-bordered">
|
||||
<tr>
|
||||
<th width="140" class="bg-light">NIP</th>
|
||||
<td>{{ $pengajuan->nip }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Nama</th>
|
||||
<td>{{ $pengajuan->pegawai?->nama ?? '-' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Tanggal</th>
|
||||
<td>{{ \Carbon\Carbon::parse($pengajuan->tanggal_mulai)->translatedFormat('d F Y') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Kategori</th>
|
||||
<td>{{ $pengajuan->kategori }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Diajukan Pada</th>
|
||||
<td>{{ $pengajuan->created_at?->translatedFormat('d F Y, H:i') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Status</th>
|
||||
<td><span class="badge bg-secondary rounded-pill fs-6 px-2 py-1">Kadaluarsa</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p class="text-muted small">Silakan hubungi bagian kepegawaian untuk memproses pengajuan ini secara manual. Anda dapat menutup halaman ini.</p>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -1,73 +0,0 @@
|
||||
@extends('layouts.action')
|
||||
|
||||
@section('content')
|
||||
<div class="card border shadow-sm">
|
||||
<div class="card-body p-4">
|
||||
<div class="text-center mb-4">
|
||||
<div class="avatar-lg mx-auto mb-3">
|
||||
<span class="avatar-title rounded-circle bg-success-subtle text-success display-5">
|
||||
<i class="uil-check-circle"></i>
|
||||
</span>
|
||||
</div>
|
||||
<h4 class="mb-1">Setujui Pengajuan Absen</h4>
|
||||
<p class="text-muted mb-0">Pastikan data di bawah sudah benar sebelum menyetujui.</p>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive mb-4">
|
||||
<table class="table table-sm table-bordered">
|
||||
<tr>
|
||||
<th width="140" class="bg-light">NIP</th>
|
||||
<td>{{ $pengajuan->nip }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Nama</th>
|
||||
<td>{{ $pengajuan->pegawai?->nama ?? '-' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Tanggal</th>
|
||||
<td>{{ \Carbon\Carbon::parse($pengajuan->tanggal_mulai)->translatedFormat('d F Y') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Kategori</th>
|
||||
<td>{{ $pengajuan->kategori }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Keterangan</th>
|
||||
<td>{{ $pengajuan->keterangan ?: '-' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Bukti</th>
|
||||
<td>
|
||||
<a href="{{ $pengajuan->file }}" target="_blank" class="btn btn-sm btn-outline-primary">
|
||||
<i class="uil-file-alt me-1"></i> Lihat PDF
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<form action="{{ route('verifikasi-absen.setujui', $pengajuan->id) }}" method="POST">
|
||||
@csrf
|
||||
<div class="d-grid gap-2">
|
||||
<button type="submit" class="btn btn-success btn-lg" id="btn-setujui">
|
||||
<i class="uil-check me-1"></i> Setujui Pengajuan
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('js')
|
||||
<script>
|
||||
document.getElementById('btn-setujui').addEventListener('click', function(e) {
|
||||
if (!confirm('Apakah Anda yakin ingin menyetujui pengajuan absen ini?')) {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
this.disabled = true;
|
||||
this.innerHTML = '<span class="spinner-border spinner-border-sm me-1"></span> Memproses...';
|
||||
this.closest('form').submit();
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@@ -0,0 +1,324 @@
|
||||
@extends('layouts.action')
|
||||
|
||||
@section('content')
|
||||
<div class="text-center mb-4">
|
||||
<div class="avatar-lg mx-auto mb-3">
|
||||
<span class="avatar-title rounded-circle bg-primary-subtle text-primary display-5">
|
||||
<i class="uil-clipboard-notes"></i>
|
||||
</span>
|
||||
</div>
|
||||
<h4 class="mb-1">Verifikasi Pengajuan Absen</h4>
|
||||
<p class="text-muted mb-0">Periksa data di bawah, lalu pilih Setujui atau Tolak.</p>
|
||||
</div>
|
||||
|
||||
<!-- Tampilan PDF Bukti -->
|
||||
<div class="card border shadow-sm mb-3">
|
||||
<div class="card-header bg-light">
|
||||
<h6 class="mb-0"><i class="uil-file-alt me-1"></i> Bukti Pengajuan</h6>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<iframe
|
||||
src="{{ $pengajuan->file }}"
|
||||
style="width: 100%; height: 420px; border: none; display: block;"
|
||||
title="Bukti Pengajuan">
|
||||
</iframe>
|
||||
</div>
|
||||
<div class="card-footer bg-light text-end py-2">
|
||||
<a href="{{ $pengajuan->file }}" target="_blank" class="btn btn-sm btn-outline-primary">
|
||||
<i class="uil-external-link-alt me-1"></i> Buka di Tab Baru
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Detail Pengajuan -->
|
||||
<div class="card border shadow-sm mb-3">
|
||||
<div class="card-header bg-light">
|
||||
<h6 class="mb-0"><i class="uil-info-circle me-1"></i> Detail Pengajuan</h6>
|
||||
</div>
|
||||
<div class="card-body p-3">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-bordered mb-0">
|
||||
<tr>
|
||||
<th width="140" class="bg-light">NIP</th>
|
||||
<td>{{ $pengajuan->nip }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Nama</th>
|
||||
<td>{{ $pengajuan->pegawai?->nama ?? '-' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Tanggal</th>
|
||||
<td>{{ \Carbon\Carbon::parse($pengajuan->tanggal_mulai)->translatedFormat('d F Y') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Kategori</th>
|
||||
<td>{{ $pengajuan->kategori }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Keterangan</th>
|
||||
<td>{{ $pengajuan->keterangan ?: '-' }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Aksi -->
|
||||
<div class="card border shadow-sm">
|
||||
<div class="card-body p-4">
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-success btn-lg flex-fill" data-bs-toggle="modal" data-bs-target="#modal-setujui">
|
||||
<i class="uil-check me-1"></i> Setujui
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger btn-lg flex-fill" data-bs-toggle="modal" data-bs-target="#modal-tolak">
|
||||
<i class="uil-times me-1"></i> Tolak
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Setujui -->
|
||||
<div class="modal fade" id="modal-setujui" tabindex="-1" data-bs-backdrop="static" data-bs-keyboard="false" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-success text-white">
|
||||
<h5 class="modal-title text-white">
|
||||
<i class="uil-check-circle me-1"></i> Setujui Pengajuan
|
||||
</h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="text-muted">Dokumen akan ditandatangani secara elektronik menggunakan NIK dan Passphrase TTE Anda.</p>
|
||||
<div class="mb-3">
|
||||
<label for="nik" class="form-label fw-semibold">
|
||||
NIK <span class="text-danger">*</span>
|
||||
</label>
|
||||
<input type="text" id="nik" class="form-control" placeholder="Masukkan NIK Anda" autocomplete="off">
|
||||
<div id="nik-error" class="text-danger small mt-1" style="display: none !important;">
|
||||
NIK wajib diisi.
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-0">
|
||||
<label for="passphrase" class="form-label fw-semibold">
|
||||
Passphrase <span class="text-danger">*</span>
|
||||
</label>
|
||||
<div class="input-group">
|
||||
<input type="password" id="passphrase" class="form-control" placeholder="Masukkan Passphrase TTE Anda" autocomplete="off">
|
||||
<button type="button" class="btn btn-outline-secondary" id="btn-toggle-passphrase" tabindex="-1">
|
||||
<i class="uil-eye" id="icon-toggle-passphrase"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div id="passphrase-error" class="text-danger small mt-1" style="display: none !important;">
|
||||
Passphrase wajib diisi.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-success" id="btn-setujui">
|
||||
<i class="uil-check me-1"></i> Ya, Setujui
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Tolak -->
|
||||
<div class="modal fade" id="modal-tolak" tabindex="-1" data-bs-backdrop="static" data-bs-keyboard="false" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-danger text-white">
|
||||
<h5 class="modal-title text-white">
|
||||
<i class="uil-times-circle me-1"></i> Tolak Pengajuan
|
||||
</h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<label for="catatan" class="form-label fw-semibold">
|
||||
Alasan Penolakan <span class="text-danger">*</span>
|
||||
</label>
|
||||
<textarea
|
||||
id="catatan"
|
||||
class="form-control"
|
||||
rows="4"
|
||||
maxlength="500"
|
||||
placeholder="Tuliskan alasan penolakan pengajuan absen ini..."
|
||||
></textarea>
|
||||
<div class="d-flex justify-content-between mt-1">
|
||||
<div id="catatan-error" class="text-danger small" style="display: none !important;">
|
||||
Alasan penolakan wajib diisi.
|
||||
</div>
|
||||
<small class="text-muted ms-auto"><span id="char-count">0</span>/500</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" id="btn-tolak">
|
||||
<i class="uil-check me-1"></i> Ya, Tolak
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('js')
|
||||
<script>
|
||||
const otorisasi = {
|
||||
nip: @json($nip),
|
||||
expires: @json($expires),
|
||||
signature: @json($signature),
|
||||
};
|
||||
|
||||
const nikInput = document.getElementById('nik');
|
||||
const passphraseInput = document.getElementById('passphrase');
|
||||
const nikError = document.getElementById('nik-error');
|
||||
const passphraseError = document.getElementById('passphrase-error');
|
||||
const modalSetujuiEl = document.getElementById('modal-setujui');
|
||||
const modalSetujui = new bootstrap.Modal(modalSetujuiEl);
|
||||
const iconTogglePassphrase = document.getElementById('icon-toggle-passphrase');
|
||||
|
||||
document.getElementById('btn-toggle-passphrase').addEventListener('click', function() {
|
||||
const isHidden = passphraseInput.type === 'password';
|
||||
passphraseInput.type = isHidden ? 'text' : 'password';
|
||||
iconTogglePassphrase.className = isHidden ? 'uil-eye-slash' : 'uil-eye';
|
||||
});
|
||||
|
||||
nikInput.addEventListener('input', function() {
|
||||
if (this.value.trim()) {
|
||||
nikError.style.setProperty('display', 'none', 'important');
|
||||
}
|
||||
});
|
||||
|
||||
passphraseInput.addEventListener('input', function() {
|
||||
if (this.value.trim()) {
|
||||
passphraseError.style.setProperty('display', 'none', 'important');
|
||||
}
|
||||
});
|
||||
|
||||
modalSetujuiEl.addEventListener('hidden.bs.modal', function() {
|
||||
nikInput.value = '';
|
||||
passphraseInput.value = '';
|
||||
passphraseInput.type = 'password';
|
||||
iconTogglePassphrase.className = 'uil-eye';
|
||||
nikError.style.setProperty('display', 'none', 'important');
|
||||
passphraseError.style.setProperty('display', 'none', 'important');
|
||||
});
|
||||
|
||||
document.getElementById('btn-setujui').addEventListener('click', function() {
|
||||
const nik = nikInput.value.trim();
|
||||
const passphrase = passphraseInput.value.trim();
|
||||
let valid = true;
|
||||
|
||||
if (!nik) {
|
||||
nikError.style.removeProperty('display');
|
||||
valid = false;
|
||||
}
|
||||
if (!passphrase) {
|
||||
passphraseError.style.removeProperty('display');
|
||||
valid = false;
|
||||
}
|
||||
if (! valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
const btn = this;
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = '<span class="spinner-border spinner-border-sm me-1"></span> Menandatangani...';
|
||||
|
||||
fetch('{{ route('verifikasi-absen.setujui', $pengajuan->id) }}', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
nik: nik,
|
||||
passphrase: passphrase,
|
||||
...otorisasi
|
||||
}),
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
window.location.href = data.redirect;
|
||||
} else {
|
||||
modalSetujui.hide();
|
||||
alert(data.message || 'Terjadi kesalahan. Silakan coba lagi.');
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = '<i class="uil-check me-1"></i> Ya, Setujui';
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
modalSetujui.hide();
|
||||
alert('Terjadi kesalahan koneksi. Silakan coba lagi.');
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = '<i class="uil-check me-1"></i> Ya, Setujui';
|
||||
});
|
||||
});
|
||||
|
||||
const catatanInput = document.getElementById('catatan');
|
||||
const charCount = document.getElementById('char-count');
|
||||
const catatanError = document.getElementById('catatan-error');
|
||||
const modalTolakEl = document.getElementById('modal-tolak');
|
||||
const modalTolak = new bootstrap.Modal(modalTolakEl);
|
||||
|
||||
catatanInput.addEventListener('input', function() {
|
||||
charCount.textContent = this.value.length;
|
||||
if (this.value.trim()) {
|
||||
catatanError.style.setProperty('display', 'none', 'important');
|
||||
}
|
||||
});
|
||||
|
||||
modalTolakEl.addEventListener('hidden.bs.modal', function() {
|
||||
catatanInput.value = '';
|
||||
charCount.textContent = '0';
|
||||
catatanError.style.setProperty('display', 'none', 'important');
|
||||
});
|
||||
|
||||
document.getElementById('btn-tolak').addEventListener('click', function() {
|
||||
const catatan = catatanInput.value.trim();
|
||||
|
||||
if (!catatan) {
|
||||
catatanError.style.removeProperty('display');
|
||||
catatanInput.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
const btn = this;
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = '<span class="spinner-border spinner-border-sm me-1"></span> Memproses...';
|
||||
|
||||
fetch('{{ route('verifikasi-absen.tolak', $pengajuan->id) }}', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
catatan: catatan,
|
||||
...otorisasi
|
||||
}),
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
window.location.href = data.redirect;
|
||||
} else {
|
||||
modalTolak.hide();
|
||||
alert(data.message || 'Terjadi kesalahan. Silakan coba lagi.');
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = '<i class="uil-check me-1"></i> Ya, Tolak';
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
modalTolak.hide();
|
||||
alert('Terjadi kesalahan koneksi. Silakan coba lagi.');
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = '<i class="uil-check me-1"></i> Ya, Tolak';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@@ -0,0 +1,18 @@
|
||||
@extends('layouts.action')
|
||||
|
||||
@section('content')
|
||||
<div class="card border shadow-sm">
|
||||
<div class="card-body p-4 text-center">
|
||||
<div class="avatar-lg mx-auto mb-3">
|
||||
<span class="avatar-title rounded-circle bg-danger-subtle text-danger display-5">
|
||||
<i class="uil-lock-alt"></i>
|
||||
</span>
|
||||
</div>
|
||||
<h4 class="mb-1">Tidak Berwenang</h4>
|
||||
<p class="text-muted mb-0">
|
||||
Tautan ini tidak valid, sudah kedaluwarsa, atau Anda bukan atasan dari pegawai pemohon.
|
||||
Silakan hubungi bagian kepegawaian jika Anda merasa ini keliru.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -1,224 +0,0 @@
|
||||
@extends('layouts.action')
|
||||
|
||||
@section('content')
|
||||
<!-- Tampilan PDF Bukti -->
|
||||
<div class="card border shadow-sm mb-3">
|
||||
<div class="card-header bg-light">
|
||||
<h6 class="mb-0"><i class="uil-file-alt me-1"></i> Bukti Pengajuan</h6>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<iframe
|
||||
src="{{ $pengajuan->file }}"
|
||||
style="width: 100%; height: 420px; border: none; display: block;"
|
||||
title="Bukti Pengajuan">
|
||||
</iframe>
|
||||
</div>
|
||||
<div class="card-footer bg-light text-end py-2">
|
||||
<a href="{{ $pengajuan->file }}" target="_blank" class="btn btn-sm btn-outline-primary">
|
||||
<i class="uil-external-link-alt me-1"></i> Buka di Tab Baru
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Detail Pengajuan -->
|
||||
<div class="card border shadow-sm mb-3">
|
||||
<div class="card-header bg-light">
|
||||
<h6 class="mb-0"><i class="uil-info-circle me-1"></i> Detail Pengajuan</h6>
|
||||
</div>
|
||||
<div class="card-body p-3">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-bordered mb-0">
|
||||
<tr>
|
||||
<th width="140" class="bg-light">NIP</th>
|
||||
<td>{{ $pengajuan->nip }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Nama</th>
|
||||
<td>{{ $pengajuan->pegawai?->nama ?? '-' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Tanggal</th>
|
||||
<td>{{ \Carbon\Carbon::parse($pengajuan->tanggal_mulai)->translatedFormat('d F Y') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Kategori</th>
|
||||
<td>{{ $pengajuan->kategori }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg-light">Keterangan</th>
|
||||
<td>{{ $pengajuan->keterangan ?: '-' }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Form Penolakan -->
|
||||
<div class="card border shadow-sm">
|
||||
<div class="card-header bg-light">
|
||||
<h6 class="mb-0 text-danger"><i class="uil-times-circle me-1"></i> Form Penolakan</h6>
|
||||
</div>
|
||||
<div class="card-body p-4">
|
||||
<div class="mb-3">
|
||||
<label for="catatan" class="form-label fw-semibold">
|
||||
Alasan Penolakan <span class="text-danger">*</span>
|
||||
</label>
|
||||
<textarea
|
||||
id="catatan"
|
||||
class="form-control"
|
||||
rows="4"
|
||||
maxlength="500"
|
||||
placeholder="Tuliskan alasan penolakan pengajuan absen ini..."
|
||||
></textarea>
|
||||
<div class="d-flex justify-content-between mt-1">
|
||||
<div id="catatan-error" class="text-danger small" style="display: none !important;">
|
||||
Alasan penolakan wajib diisi.
|
||||
</div>
|
||||
<small class="text-muted ms-auto"><span id="char-count">0</span>/500</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-danger flex-fill" id="btn-tolak">
|
||||
<i class="uil-times me-1"></i> Tolak
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" id="btn-batal" onclick="window.close()">
|
||||
Batal
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Konfirmasi Tolak -->
|
||||
<div class="modal fade" id="modal-konfirmasi" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-danger">
|
||||
<i class="uil-exclamation-triangle me-1"></i> Konfirmasi Penolakan
|
||||
</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="mb-1">Apakah Anda yakin ingin <strong>menolak</strong> pengajuan absen ini?</p>
|
||||
<p class="text-muted small mb-0">Alasan: <span id="preview-catatan" class="fst-italic"></span></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Tidak</button>
|
||||
<button type="button" class="btn btn-danger" id="btn-konfirmasi-tolak">
|
||||
<i class="uil-check me-1"></i> Ya, Tolak
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('js')
|
||||
<script>
|
||||
const pengajuanId = {{ $pengajuan->id }};
|
||||
const catatanInput = document.getElementById('catatan');
|
||||
const charCount = document.getElementById('char-count');
|
||||
const catatanError = document.getElementById('catatan-error');
|
||||
const modalKonfirmasi = new bootstrap.Modal(document.getElementById('modal-konfirmasi'));
|
||||
|
||||
catatanInput.addEventListener('input', function() {
|
||||
charCount.textContent = this.value.length;
|
||||
if (this.value.trim()) {
|
||||
catatanError.style.setProperty('display', 'none', 'important');
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('btn-tolak').addEventListener('click', function() {
|
||||
const catatan = catatanInput.value.trim();
|
||||
|
||||
if (!catatan) {
|
||||
catatanError.style.removeProperty('display');
|
||||
catatanInput.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById('preview-catatan').textContent = catatan;
|
||||
modalKonfirmasi.show();
|
||||
});
|
||||
|
||||
document.getElementById('btn-konfirmasi-tolak').addEventListener('click', function() {
|
||||
const catatan = catatanInput.value.trim();
|
||||
const btn = this;
|
||||
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = '<span class="spinner-border spinner-border-sm me-1"></span> Memproses...';
|
||||
|
||||
fetch('{{ route('verifikasi-absen.tolak', $pengajuan->id) }}', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
catatan: catatan
|
||||
}),
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
modalKonfirmasi.hide();
|
||||
|
||||
if (data.success) {
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = '<i class="uil-check me-1"></i> Ya, Tolak';
|
||||
|
||||
showSuccessAlert();
|
||||
} else {
|
||||
alert(data.message || 'Terjadi kesalahan. Silakan coba lagi.');
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = '<i class="uil-check me-1"></i> Ya, Tolak';
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
modalKonfirmasi.hide();
|
||||
alert('Terjadi kesalahan koneksi. Silakan coba lagi.');
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = '<i class="uil-check me-1"></i> Ya, Tolak';
|
||||
});
|
||||
});
|
||||
|
||||
function showSuccessAlert() {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.style.cssText = `
|
||||
position: fixed; inset: 0; background: rgba(0,0,0,0.5);
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
z-index: 9999;
|
||||
`;
|
||||
overlay.innerHTML = `
|
||||
<div style="background: #fff; border-radius: 12px; padding: 32px 40px; text-align: center; max-width: 360px; width: 90%;">
|
||||
<div style="width: 64px; height: 64px; background: #dcfce7; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;">
|
||||
<svg width="32" height="32" fill="none" viewBox="0 0 24 24">
|
||||
<path stroke="#16a34a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"/>
|
||||
</svg>
|
||||
</div>
|
||||
<h5 style="color: #16a34a; margin-bottom: 8px;">Berhasil Ditolak!</h5>
|
||||
<p style="color: #6b7280; margin-bottom: 16px; font-size: 0.9rem;">Pengajuan absen telah berhasil ditolak.</p>
|
||||
<p style="color: #9ca3af; font-size: 0.8rem;" id="countdown-text">Halaman akan ditutup dalam <strong id="countdown">3</strong> detik...</p>
|
||||
</div>
|
||||
`;
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
let seconds = 3;
|
||||
const timer = setInterval(() => {
|
||||
seconds--;
|
||||
const el = document.getElementById('countdown');
|
||||
if (el) { el.textContent = seconds; }
|
||||
|
||||
if (seconds <= 0) {
|
||||
clearInterval(timer);
|
||||
window.close();
|
||||
// Fallback jika window.close() diblokir browser
|
||||
setTimeout(() => {
|
||||
overlay.querySelector('p[id="countdown-text"]').textContent = 'Silakan tutup tab ini secara manual.';
|
||||
}, 500);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
@@ -17,6 +17,7 @@ use App\Http\Controllers\Api\Remunerasi\PoinController as RemunerasiPoinControll
|
||||
use App\Http\Controllers\Api\Remunerasi\RemunerasiController;
|
||||
use App\Http\Controllers\Api\Remunerasi\SKPController;
|
||||
use App\Http\Controllers\Api\RubrikController;
|
||||
use App\Http\Controllers\Api\VerifikasiAbsen\LinkController as VerifikasiAbsenLinkController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
@@ -110,4 +111,8 @@ Route::prefix('v1')->group(function () {
|
||||
Route::get('/poin', [RemunerasiPoinController::class, 'index']);
|
||||
Route::get('/skp', [SKPController::class, 'index']);
|
||||
});
|
||||
|
||||
Route::prefix('/verifikasi-absen')->name('verifikasi-absen.')->group(function () {
|
||||
Route::post('/link', [VerifikasiAbsenLinkController::class, 'generate'])->name('link');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,10 +4,11 @@ use App\Http\Controllers\Lainnya\VerifikasiAbsen\VerifikasiAbsenController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::prefix('/verifikasi-absen')->name('verifikasi-absen.')->group(function () {
|
||||
Route::get('/setujui/{id}', [VerifikasiAbsenController::class, 'showSetujui'])->name('show-setujui');
|
||||
Route::post('/setujui/{id}', [VerifikasiAbsenController::class, 'setujui'])->name('setujui');
|
||||
Route::get('/berhasil-disetujui/{id}', [VerifikasiAbsenController::class, 'berhasilDisetujui'])->name('berhasil-disetujui');
|
||||
Route::get('/tolak/{id}', [VerifikasiAbsenController::class, 'showTolak'])->name('show-tolak');
|
||||
Route::post('/tolak/{id}', [VerifikasiAbsenController::class, 'tolak'])->name('tolak');
|
||||
Route::get('/sudah-diproses/{id}', [VerifikasiAbsenController::class, 'sudahDiproses'])->name('sudah-diproses');
|
||||
Route::get('/{id}', [VerifikasiAbsenController::class, 'show'])->name('show');
|
||||
Route::post('/{id}/setujui', [VerifikasiAbsenController::class, 'setujui'])->name('setujui');
|
||||
Route::post('/{id}/tolak', [VerifikasiAbsenController::class, 'tolak'])->name('tolak');
|
||||
Route::get('/{id}/berhasil-disetujui', [VerifikasiAbsenController::class, 'berhasilDisetujui'])->name('berhasil-disetujui');
|
||||
Route::get('/{id}/berhasil-ditolak', [VerifikasiAbsenController::class, 'berhasilDitolak'])->name('berhasil-ditolak');
|
||||
Route::get('/{id}/sudah-diproses', [VerifikasiAbsenController::class, 'sudahDiproses'])->name('sudah-diproses');
|
||||
Route::get('/{id}/kadaluarsa', [VerifikasiAbsenController::class, 'kadaluarsa'])->name('kadaluarsa');
|
||||
});
|
||||
|
||||
+3
-1
@@ -26,8 +26,10 @@ Route::get('/auth/google/callback', [OauthController::class, 'callback'])->name(
|
||||
// Jurnal Routes
|
||||
Route::get('/jurnal', [JurnalController::class, 'index']);
|
||||
|
||||
// Verifikasi Absen via WhatsApp — terpisah dari autentikasi (diakses langsung dari tautan WhatsApp)
|
||||
include __DIR__.'/prefix/verifikasi-absen.php';
|
||||
|
||||
Route::middleware('auth')->group(function () {
|
||||
include __DIR__.'/prefix/verifikasi-absen.php';
|
||||
include __DIR__.'/prefix/profil.php';
|
||||
include __DIR__.'/prefix/dashboard.php';
|
||||
include __DIR__.'/prefix/pagu.php';
|
||||
|
||||
Reference in New Issue
Block a user