perbaikan upload foto dan print out rap, standard dan resume
This commit is contained in:
@@ -318,6 +318,7 @@ class PenilaiController extends Controller
|
||||
$provinces = Province::all();
|
||||
$permohonan = $this->surveyorController->getPermohonanJaminanId($permohonanId, $documentId, $jaminanId);
|
||||
$noLpRAP = $this->generateNoLaporan($permohonan, $documentId, 'rap');
|
||||
$basicData = $this->surveyorController->getCommonData();
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
||||
Penilai::updateOrCreate(
|
||||
[
|
||||
@@ -340,7 +341,7 @@ class PenilaiController extends Controller
|
||||
$rap = json_decode($resume->rap, true);
|
||||
}
|
||||
|
||||
return view('lpj::penilai.components.rap-penilai', compact('permohonan', 'rap', 'provinces', 'forminspeksi', 'noLpRAP'));
|
||||
return view('lpj::penilai.components.rap-penilai', compact('permohonan', 'rap', 'provinces', 'forminspeksi', 'noLpRAP','basicData'));
|
||||
}
|
||||
|
||||
|
||||
@@ -374,7 +375,7 @@ class PenilaiController extends Controller
|
||||
});
|
||||
}
|
||||
|
||||
$query->whereRaw('LOWER(status) IN (?, ?, ?)', ['assign','done', 'proses-laporan']);
|
||||
$query->whereRaw('LOWER(status) IN (?, ?, ?, ?, ?)', ['assign','done', 'proses-laporan', 'paparan', 'proses-paparan']);
|
||||
|
||||
if (!Auth::user()->hasRole('administrator')) {
|
||||
$query->whereHas('penilaian.userPenilai', function ($q) {
|
||||
@@ -905,6 +906,7 @@ class PenilaiController extends Controller
|
||||
try {
|
||||
|
||||
if ($statusLpj) {
|
||||
// $pdf = view('lpj::' . $viewLaporan, compact(
|
||||
$pdf = PDF::loadView('lpj::' . $viewLaporan, compact(
|
||||
'permohonan',
|
||||
'forminspeksi',
|
||||
@@ -922,7 +924,7 @@ class PenilaiController extends Controller
|
||||
'tanggalLaporan',
|
||||
'rap'
|
||||
));
|
||||
|
||||
// return $pdf;
|
||||
$pdf->setPaper('A4', 'portrait');
|
||||
return $pdf->stream();
|
||||
} else {
|
||||
|
||||
@@ -277,7 +277,7 @@ class SurveyorController extends Controller
|
||||
|
||||
if ($request->hasFile('foto_denah') && isset($request->file('foto_denah')[$index])) {
|
||||
$file = $request->file('foto_denah')[$index];
|
||||
$denahItem['foto_denah'] = $this->uploadFile($file, $request->nomor_registrasi);
|
||||
$denahItem['foto_denah'] = $this->uploadFile($file, 'foto_denah');
|
||||
} elseif (isset($existingDenahs[$index]['foto_denah'])) {
|
||||
$denahItem['foto_denah'] = $existingDenahs[$index]['foto_denah'];
|
||||
}
|
||||
@@ -382,7 +382,7 @@ class SurveyorController extends Controller
|
||||
}
|
||||
|
||||
// Upload dan simpan file baru
|
||||
$formatFotojson[$file] = $this->uploadFile($request->file($file), $request->nomor_registrasi);
|
||||
$formatFotojson[$file] = $this->uploadFile($request->file($file), $file);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -455,7 +455,7 @@ class SurveyorController extends Controller
|
||||
|
||||
// Simpan file dengan nama asli
|
||||
$path = $file->storeAs(
|
||||
'surveyor/' . $request->nomor_registrasi . '/foto_lantai_unit',
|
||||
'surveyor/lantai_unit',
|
||||
$uniqueFileName . '/' . time() . '_' . $file->getClientOriginalName(),
|
||||
'public'
|
||||
);
|
||||
@@ -493,12 +493,13 @@ class SurveyorController extends Controller
|
||||
|
||||
foreach ($files as $index => $file) {
|
||||
|
||||
$fileExtension = $file->extension();
|
||||
$originalName = time() . '_' . $request->nomor_registrasi . '.' . $fileExtension;
|
||||
$timestamp = time();
|
||||
$originalName = $file->getClientOriginalName();
|
||||
$uniqueFileName = "{$timestamp}_{$originalName}";
|
||||
|
||||
|
||||
// Simpan file
|
||||
$path = $file->storeAs("surveyor/{$request->nomor_registrasi}", $originalName, 'public');
|
||||
$path = $file->storeAs("surveyor/{$paramName}", $uniqueFileName, 'public');
|
||||
|
||||
$fotoData = [
|
||||
'path' => $path,
|
||||
@@ -656,7 +657,7 @@ class SurveyorController extends Controller
|
||||
// Buat entri baru untuk file yang diunggah
|
||||
$newPhotoEntry = [
|
||||
$nameField => $newNames[$key],
|
||||
$photoField => $this->uploadFile($file, $request->nomor_registrasi),
|
||||
$photoField => $this->uploadFile($file, $photoField . '.' . $key),
|
||||
$descriptionField => $newDescriptions[$key] ?? '',
|
||||
];
|
||||
|
||||
@@ -780,7 +781,7 @@ class SurveyorController extends Controller
|
||||
// Create new photo entry
|
||||
$newPhotoEntry = [
|
||||
$nameField => $newNames[$key] ?? '', // Use new name if provided
|
||||
$photoField => $this->uploadFile($file, $request->nomor_registrasi)
|
||||
$photoField => $this->uploadFile($file, $photoField . '.' . $key)
|
||||
];
|
||||
|
||||
// Add description if field exists
|
||||
@@ -2620,9 +2621,8 @@ class SurveyorController extends Controller
|
||||
if ($request->hasFile($fileKey)) {
|
||||
$file = $request->file($fileKey);
|
||||
if ($file->isValid()) {
|
||||
$fileExtension = $file->extension();
|
||||
$fileName = time() . '_' . $request->nomor_registrasi . '.' . $fileExtension;
|
||||
$path = $file->storeAs("public/surveyor/{$request->nomor_registrasi}", $fileName);
|
||||
$fileName = time() . '_' . $file->getClientOriginalName();
|
||||
$path = $file->storeAs("public/surveyor/{$request->type}", $fileName);
|
||||
|
||||
if ($path === false) {
|
||||
throw new Exception("Failed to store file for {$fileKey}");
|
||||
@@ -3097,8 +3097,7 @@ class SurveyorController extends Controller
|
||||
throw new Exception("Invalid file upload for {$type}");
|
||||
}
|
||||
|
||||
$fileExtension = $file->extension();
|
||||
$fileName = time() . '_' . $type . '.' . $fileExtension;
|
||||
$fileName = time() . '_' . $file->getClientOriginalName();
|
||||
$path = $file->storeAs("public/surveyor/{$type}", $fileName);
|
||||
|
||||
if ($path === false) {
|
||||
|
||||
Reference in New Issue
Block a user