update view laporan di so

This commit is contained in:
majid
2024-12-28 07:27:00 +07:00
parent 2005f546c5
commit 9a24751f65
4 changed files with 18 additions and 26 deletions

View File

@@ -650,7 +650,7 @@ class PenilaiController extends Controller
try {
if ($statusLpj) {
return view('lpj::' . $viewLaporan, compact(
$html= view('lpj::' . $viewLaporan, compact(
'permohonan',
'forminspeksi',
'lpjData',
@@ -664,6 +664,9 @@ class PenilaiController extends Controller
'nomorLaporan'
))->render();
return response($html, 200)->header('Content-Type', 'text/html');
} else {
$pdf = PDF::loadView('lpj::' . $viewLaporan, compact(
'permohonan',

View File

@@ -319,13 +319,15 @@ class SurveyorController extends Controller
$newPhotos = $this->processPhotoCategory(
$request,
$fields,
$existingData[$category] ?? []
$existingData[$category] ?? [],
$category // Pass category to the function
);
$formatFotojson[$category] = $newPhotos;
}
}
// Process single files
$singleFiles = ['foto_basement', 'foto_gerbang', 'pendamping'];
foreach ($singleFiles as $file) {
@@ -351,13 +353,19 @@ class SurveyorController extends Controller
/**
* Process a photo category and its subcategories
*/
private function processPhotoCategory(Request $request, array $fields, array $existingPhotos = [])
private function processPhotoCategory(Request $request, array $fields, array $existingPhotos = [], $category = null)
{
$result = $existingPhotos; // Start with existing photos
$photoField = $fields[0];
$nameField = $fields[1];
$descriptionField = $fields[2] ?? null;
if ($category === 'object_jaminan') {
// If it's 'object_jaminan', do not overwrite existing photos, just add new ones
$existingPhotos = $existingPhotos ?: [];
$result = $existingPhotos;
}
if ($request->hasFile($photoField)) {
$newFiles = $request->file($photoField, []);
$newNames = $request->input($nameField, []);
@@ -367,7 +375,7 @@ class SurveyorController extends Controller
foreach ($newFiles as $key => $file) {
// Create new photo entry
$newPhotoEntry = [
$nameField => $newNames[$key] ?? '', // Use new name if provided
$nameField => $newNames[$key] ?? '',
$photoField => $this->uploadFile($file, $photoField . '.' . $key)
];
@@ -384,6 +392,7 @@ class SurveyorController extends Controller
return $result;
}
public function replaceFotoLantaiUnit(Request $request)
{
// Pastikan foto lantai unit ada dalam request