diff --git a/app/Http/Controllers/PenilaiController.php b/app/Http/Controllers/PenilaiController.php
index 1671b12..e35b519 100644
--- a/app/Http/Controllers/PenilaiController.php
+++ b/app/Http/Controllers/PenilaiController.php
@@ -661,7 +661,7 @@ class PenilaiController extends Controller
try {
if ($statusLpj) {
- return view('lpj::' . $viewLaporan, compact(
+ $html= view('lpj::' . $viewLaporan, compact(
'permohonan',
'forminspeksi',
'lpjData',
@@ -675,6 +675,9 @@ class PenilaiController extends Controller
'nomorLaporan'
))->render();
+ return response($html, 200)->header('Content-Type', 'text/html');
+
+
} else {
$pdf = PDF::loadView('lpj::' . $viewLaporan, compact(
'permohonan',
diff --git a/app/Http/Controllers/SurveyorController.php b/app/Http/Controllers/SurveyorController.php
index ec6516d..6766f7a 100644
--- a/app/Http/Controllers/SurveyorController.php
+++ b/app/Http/Controllers/SurveyorController.php
@@ -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
diff --git a/resources/views/penilaian/laporan-so.blade.php b/resources/views/penilaian/laporan-so.blade.php
index b952403..a8a86e6 100644
--- a/resources/views/penilaian/laporan-so.blade.php
+++ b/resources/views/penilaian/laporan-so.blade.php
@@ -19,7 +19,8 @@
-
+
+
diff --git a/resources/views/surveyor/components/foto.blade.php b/resources/views/surveyor/components/foto.blade.php
index 9eddfa3..c22e624 100644
--- a/resources/views/surveyor/components/foto.blade.php
+++ b/resources/views/surveyor/components/foto.blade.php
@@ -764,27 +764,6 @@
const formElement = $('#formFoto')[0];
const formData = new FormData(formElement);
- const lantaiInputs = document.querySelectorAll('.lantai-input');
- lantaiInputs.forEach((input, index) => {
- const files = input.files;
- if (files.length > 0) {
- // Gunakan dot notation sesuai Laravel
- Array.from(files).forEach((file, fileIndex) => {
- formData.append(`foto_lantai_unit.${index}`, file);
-
- // Nama lantai unit
- const namaLantai = document.querySelector(`[name="name_lantai_unit.${index}"]`);
- if (namaLantai && namaLantai.value) {
- formData.append(`name_lantai_unit.${index}`, namaLantai.value);
- }
- });
- }
- });
-
-
-
-
-
$.ajax({
url: '{{ route('surveyor.storeFoto') }}',
type: 'POST',