From cbf54353f4af6e890705c826fabec83ad5877920 Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Thu, 23 Oct 2025 16:59:47 +0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(slik):=20Tambahkan=20halaman=20index?= =?UTF-8?q?=20SLIK=20untuk=20admin=20kredit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Tambah halaman index SLIK di modul admin kredit untuk manajemen data Sistem Layanan Informasi Keuangan - Buat tabel data dengan kolom: Sandi Bank, Tahun, No Rekening, CIF, Nama Debitur, Kolektibilitas, Fasilitas, Nilai Agunan, dan Status - Implementasi pencarian keyword serta filter tahun, bulan, dan status agunan - Tambahkan tombol aksi 'Detail' untuk melihat data lengkap - Tambahkan fitur import dari Excel (.xlsx/.xls/.csv) dengan validasi format & file size ≤ 10MB - Tambahkan fitur export Excel berdasarkan filter aktif - Tambahkan tombol download template Excel untuk panduan format import - Implementasi fungsi truncate/hapus semua data SLIK dengan modal konfirmasi - Tambahkan validasi kombinasi unik (sandi bank, tahun, bulan, no rekening) untuk update data otomatis - Gunakan KTDataTable dengan server-side processing, layout responsif, dan scroll horizontal - Tambahkan modal import & modal konfirmasi hapus - Tambahkan breadcrumbs, event listener untuk pencarian/filter, dan CSRF protection - Implementasi validasi keamanan file upload dan pesan error/success --- app/Services/PreviewLaporanService.php | 47 +++++++++++++++++++++----- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/app/Services/PreviewLaporanService.php b/app/Services/PreviewLaporanService.php index 6a2f525..9a5b795 100644 --- a/app/Services/PreviewLaporanService.php +++ b/app/Services/PreviewLaporanService.php @@ -205,16 +205,47 @@ class PreviewLaporanService $statusLpj = 1; if($tipeLaporan->status === 'memo' && $permohonan->mig_permohonan){ - $path = $formFoto['upload_foto'][0]['path'] ?? null; - if (!$path) { - return response()->json(['error' => 'File path not found'], 404); + $paths = $formFoto['upload_foto'] ?? null; + + if (!is_array($paths) || empty($paths)) { + return response()->json(['error' => 'No files to download'], 404); } - $fullPath = storage_path('app/public/' . $path); - if (!file_exists($fullPath)) { - return response()->json(['error' => 'File not found on disk'], 404); + + $files = []; + foreach ($paths as $path) { + if (!$path['path']) { + continue; + } + $fullPath = storage_path('app/public/' . $path['path']); + if (!file_exists($fullPath)) { + continue; + } + $files[] = $fullPath; } - //surveyor/2025/SEPTEMBER/02092025/252485/252485_148913105540_1.pdf - return response()->download($fullPath); + + if (empty($files)) { + return response()->json(['error' => 'No valid files found'], 404); + } + + // For single file, download directly + if (count($files) === 1) { + return response()->download($files[0]); + } + + // For multiple files, create zip and download + $zipName = 'photos_' . time() . '.zip'; + $zipPath = storage_path('app/public/' . $zipName); + + $zip = new \ZipArchive(); + if ($zip->open($zipPath, \ZipArchive::CREATE) === true) { + foreach ($files as $file) { + $zip->addFile($file, basename($file)); + } + $zip->close(); + return response()->download($zipPath)->deleteFileAfterSend(true); + } + + return response()->json(['error' => 'Failed to create zip file'], 500); } try { $pdf = $this->generatePDF($viewLaporan, compact(