✨(slik): Tambahkan halaman index SLIK untuk admin kredit
- 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
This commit is contained in:
@@ -205,16 +205,47 @@ class PreviewLaporanService
|
|||||||
$statusLpj = 1;
|
$statusLpj = 1;
|
||||||
|
|
||||||
if($tipeLaporan->status === 'memo' && $permohonan->mig_permohonan){
|
if($tipeLaporan->status === 'memo' && $permohonan->mig_permohonan){
|
||||||
$path = $formFoto['upload_foto'][0]['path'] ?? null;
|
$paths = $formFoto['upload_foto'] ?? null;
|
||||||
if (!$path) {
|
|
||||||
return response()->json(['error' => 'File path not found'], 404);
|
if (!is_array($paths) || empty($paths)) {
|
||||||
|
return response()->json(['error' => 'No files to download'], 404);
|
||||||
}
|
}
|
||||||
$fullPath = storage_path('app/public/' . $path);
|
|
||||||
|
$files = [];
|
||||||
|
foreach ($paths as $path) {
|
||||||
|
if (!$path['path']) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$fullPath = storage_path('app/public/' . $path['path']);
|
||||||
if (!file_exists($fullPath)) {
|
if (!file_exists($fullPath)) {
|
||||||
return response()->json(['error' => 'File not found on disk'], 404);
|
continue;
|
||||||
}
|
}
|
||||||
//surveyor/2025/SEPTEMBER/02092025/252485/252485_148913105540_1.pdf
|
$files[] = $fullPath;
|
||||||
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 {
|
try {
|
||||||
$pdf = $this->generatePDF($viewLaporan, compact(
|
$pdf = $this->generatePDF($viewLaporan, compact(
|
||||||
|
|||||||
Reference in New Issue
Block a user