diff --git a/app/Http/Controllers/PenilaiController.php b/app/Http/Controllers/PenilaiController.php
index 2461cb0..df7265e 100644
--- a/app/Http/Controllers/PenilaiController.php
+++ b/app/Http/Controllers/PenilaiController.php
@@ -52,7 +52,7 @@ class PenilaiController extends Controller
$permohonanId = $request->query('permohonanId');
$documentId = $request->query('documentId');
$jaminanId = $request->query('jaminanId');
-
+ $basicData = $this->surveyorController->getCommonData();
$permohonan = $this->surveyorController->getPermohonanJaminanId($permohonanId, $documentId, $jaminanId);
$inpeksi = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
@@ -62,7 +62,7 @@ class PenilaiController extends Controller
$forminspeksi = json_decode($inpeksi->data_form, true);
}
- return view('lpj::penilai.lampiran', compact('permohonan', 'formFoto', 'forminspeksi'));
+ return view('lpj::penilai.lampiran', compact('permohonan', 'formFoto', 'forminspeksi','basicData'));
}
public function create()
@@ -1043,7 +1043,7 @@ class PenilaiController extends Controller
if ($statusLpj) {
// $pdf = view('lpj::' . $viewLaporan, compact(
- $pdf = PDF::loadView('lpj::' . $viewLaporan, compact(
+ $pdf = PDF::loadView('lpj::' . $viewLaporan, compact(
'permohonan',
'forminspeksi',
'lpjData',
diff --git a/app/Http/Controllers/SurveyorController.php b/app/Http/Controllers/SurveyorController.php
index 7d7bfae..a913c1b 100644
--- a/app/Http/Controllers/SurveyorController.php
+++ b/app/Http/Controllers/SurveyorController.php
@@ -340,18 +340,6 @@ class SurveyorController extends Controller
{
$validatedData = $this->validateFotoRequest($request);
try {
- $log = [];
- $photoCategories = [
- 'rute_menuju_lokasi',
- 'foto_lingkungan',
- ];
-
- $lainnya = [
- 'foto_rute_lainnya' => ['foto_rute_lainnya', 'name_rute_lainnya'],
- 'foto_lantai_lainnya' => ['foto_lantai_lainnya', 'name_lantai_lainnya']
- ];
-
-
$inspeksi = Inspeksi::firstOrNew([
'permohonan_id' => $request->input('permohonan_id'),
'dokument_id' => $request->input('dokument_id')
@@ -361,62 +349,23 @@ class SurveyorController extends Controller
? json_decode($inspeksi->foto_form, true)
: [];
- $formatFotojson = $existingData;
+
+
+ if (!$this->isValidFormat($existingData)) {
+ $existingData = [];
+ }
// Upload berbagai jenis foto
- $this->handleFileUpload($request, 'rute_menuju_lokasi', $formatFotojson);
- $this->handleFileUpload($request, 'foto_lingkungan', $formatFotojson);
+ $newFoto = $this->handleFileUpload($request, 'upload_foto', $existingData);
- $this->processFotoLantaiUnit($request, $formatFotojson);
-
- if ($request->hasFile('foto_objek')) {
- $existingObjekJaminan = $formatFotojson['object_jaminan'] ?? [];
- $formatFotojson['object_jaminan'] = $this->processObjekJaminanPhotos(
- $request,
- $existingObjekJaminan
- );
- }
-
- foreach ($lainnya as $category => $fields) {
- $photoField = $fields[0];
- $nameField = $fields[1];
- $descriptionField = $fields[2] ?? null;
-
- if ($request->hasFile($photoField)) {
- $newPhotos = $this->processPhotoLainnya(
- $request,
- $fields,
- $existingData[$category] ?? []
- );
-
- $formatFotojson[$category] = $newPhotos;
- }
- }
- // // Process single files
- $singleFiles = ['foto_basement', 'foto_gerbang', 'pendamping'];
- foreach ($singleFiles as $file) {
- if ($request->hasFile($file)) {
- // Hapus file lama jika ada
- if (isset($formatFotojson[$file])) {
- $this->deleteOfFile($formatFotojson[$file]);
- }
-
- // Upload dan simpan file baru
- $formatFotojson[$file] = $this->uploadFile($request->file($file), $file);
-
- }
- }
-
- // Update record
- if (!empty($formatFotojson)) {
- $inspeksi->foto_form = json_encode($formatFotojson);
+ if (!empty($newFoto)) {
+ $inspeksi->foto_form = json_encode($existingData);
$inspeksi->save();
return response()->json([
'success' => true,
'message' => 'Data berhasil disimpan',
- 'data' => $formatFotojson,
- 'log' => $log
+ 'file' => $newFoto
], 200);
}
@@ -430,74 +379,107 @@ class SurveyorController extends Controller
}
/**
- * Process a photo
- */
- protected function processFotoLantaiUnit(Request $request, &$formatFotojson)
+ * Validasi apakah format JSON sesuai dengan yang diinginkan.
+ *
+ * @param array $data
+ * @return bool
+ */
+ private function isValidFormat($data)
{
- // Pastikan foto_lantai_unit sudah ada di formatFotojson
- if (!isset($formatFotojson['foto_lantai_unit'])) {
- $formatFotojson['foto_lantai_unit'] = [];
+ if (!isset($data['upload_foto']) || !is_array($data['upload_foto'])) {
+ return false;
}
- // Ambil nama-nama lantai dari request
- $lantaiNama = $request->input('lantai_nama', []);
-
- // Tambahan: gunakan lantai_index jika tersedia
- $lantaiIndex = $request->input('lantai_index', null);
-
- // Cek apakah ada file foto lantai yang diunggah
- $lantaiFiles = $request->file('foto_lantai_unit', []);
-
- // Proses setiap file foto lantai
- foreach ($lantaiFiles as $index => $files) {
- // Pastikan $files adalah array
- if (!is_array($files)) {
- $files = [$files];
- }
-
- // Gunakan lantai_index jika tersedia, jika tidak gunakan cara sebelumnya
- $lantaiNomor = $lantaiIndex ?? ($index + 1);
-
- // Inisialisasi array untuk lantai ini jika belum ada
- if (!isset($formatFotojson['foto_lantai_unit'][$lantaiNomor])) {
- $formatFotojson['foto_lantai_unit'][$lantaiNomor] = [];
- }
-
- foreach ($files as $fileIndex => $file) {
- // Validasi file
- if (!$file->isValid()) {
- continue; // Lewati file yang tidak valid
- }
-
-
- // Generate nama file unik
- $uniqueFileName = 'lantai_unit_' . $lantaiNomor . '_' . $fileIndex . '_' . Str::random(10) . '.' . $file->getClientOriginalExtension();
-
- // Simpan file dengan nama asli
- $path = $file->storeAs(
- 'surveyor/lantai_unit',
- $uniqueFileName . '/' . time() . '_' . $file->getClientOriginalName(),
- 'public'
- );
-
- // Buat nama foto
- $fotoName = "Foto Lantai {$lantaiNomor} - " . ($fileIndex + 1);
-
- // Tambahkan detail foto ke array
- $fotoDetail = [
- 'path' => $path,
- 'name' => $fotoName
- ];
-
- // Tambahkan ke array foto lantai unit sesuai struktur
- $formatFotojson['foto_lantai_unit'][$lantaiNomor][] = $fotoDetail;
- }
- }
-
- return $formatFotojson;
+ return true;
}
+ public function updateFoto(Request $request)
+ {
+ try {
+ // Validasi input
+ $validated = $request->validate([
+ 'permohonan_id' => 'required',
+ 'dokument_id' => 'required|string',
+ 'name' => 'required|string|max:255',
+ 'description' => 'nullable|string',
+ 'category' => 'required|string|max:255',
+ 'sub' => 'nullable|string|max:255',
+ 'path' => 'nullable|string',
+ ]);
+
+ $inspeksi = Inspeksi::firstOrNew([
+ 'permohonan_id' => $validated['permohonan_id'],
+ 'dokument_id' => $validated['dokument_id'],
+ ]);
+
+ $cleanRequestPath = str_replace('/storage/', '', $validated['path']);
+
+ $fotoForm = json_decode($inspeksi->foto_form, true) ?? [];
+
+
+ if (!isset($fotoForm['upload_foto'])) {
+ $fotoForm['upload_foto'] = [];
+ }
+
+
+ $existingIndex = null;
+ if (!empty($validated['path'])) {
+ foreach ($fotoForm['upload_foto'] as $index => $foto) {
+ if ($foto['path'] === $cleanRequestPath) {
+ $existingIndex = $index;
+ break;
+ }
+ }
+ }
+
+ // Siapkan data baru
+ $newFotoData = [
+ 'name' => $validated['name'],
+ 'description' => $validated['description'],
+ 'category' => $validated['category'],
+ 'sub' => $validated['sub'],
+ 'path' => $cleanRequestPath,
+ 'created_by' => Auth::user()->name,
+ 'created_at' => now()->toDateTimeString(),
+ 'updated_by' => Auth::user()->name,
+ 'updated_at' => now()->toDateTimeString(),
+ ];
+
+ if ($existingIndex !== null) {
+ $existingFoto = $fotoForm['upload_foto'][$existingIndex];
+ $fotoForm['upload_foto'][$existingIndex] = [
+ 'name' => $validated['name'],
+ 'description' => $validated['description'],
+ 'category' => $validated['category'],
+ 'sub' => $validated['sub'],
+ 'path' => $cleanRequestPath,
+ 'created_by' => $existingFoto['created_by'] ?? Auth::user()->name,
+ 'created_at' => $existingFoto['created_at'] ?? now()->toDateTimeString(),
+ 'updated_by' => Auth::user()->name,
+ 'updated_at' => now()->toDateTimeString(),
+ ];
+ } else {
+ $fotoForm['upload_foto'][] = $newFotoData;
+ }
+
+ // Simpan kembali data ke database
+ $inspeksi->foto_form = json_encode($fotoForm);
+ $inspeksi->save();
+
+ return response()->json([
+ 'success' => true,
+ 'message' => 'Data berhasil diperbarui.',
+ ], 200);
+
+ } catch (\Exception $e) {
+ return response()->json([
+ 'success' => false,
+ 'message' => 'Gagal memperbarui data: ' . $e->getMessage(),
+ ], 500);
+ }
+ }
+
private function handleFileUpload(Request $request, $paramName, &$formatFotojson)
{
@@ -510,45 +492,54 @@ class SurveyorController extends Controller
}
$formatFotoData = [];
+ $nomor_registrasi = $request->nomor_registrasi;
foreach ($files as $index => $file) {
-
$timestamp = time();
$originalName = $file->getClientOriginalName();
- $uniqueFileName = "{$timestamp}_{$originalName}";
-
+ $extension = $file->getClientOriginalExtension();
+ // Validasi nama file
+ if (empty($originalName)) {
+ $originalName = "file_{$timestamp}";
+ }
+ $uniqueFileName = "{$timestamp}.{$extension}";
// Simpan file
- $path = $file->storeAs("surveyor/{$paramName}", $uniqueFileName, 'public');
+ $nomor_registrasi = $request->nomor_registrasi;
+ $path = $file->storeAs("surveyor/{$paramName}/{$nomor_registrasi}", $uniqueFileName, 'public');
$fotoData = [
+ 'name' => pathinfo($originalName, PATHINFO_FILENAME),
'path' => $path,
- 'name' => ucwords(str_replace('_', ' ', $paramName)) . ' - ' . ($index + 1)
+ 'category' => 'lainnya',
+ 'sub' => null,
+ 'description' => null,
+ 'created_by' => Auth::user()->name,
+ 'created_at' => now()->toDateTimeString(),
];
$formatFotoData[] = $fotoData;
}
// Struktur JSON yang konsisten
- if (!isset($formatFotojson[$paramName][$paramName][0])) {
- $formatFotojson[$paramName] = [
- $paramName => [
- $formatFotoData
- ]
- ];
+ if (!isset($formatFotojson[$paramName])) {
+ $formatFotojson[$paramName] = $formatFotoData;
} else {
- $formatFotojson[$paramName][$paramName][0] = array_merge(
- $formatFotojson[$paramName][$paramName][0] ?? [],
+ $formatFotojson[$paramName] = array_merge(
+ $formatFotojson[$paramName] ?? [],
$formatFotoData
);
}
+
return $formatFotoData;
}
return [];
}
+
+
public function hapusFoto(Request $request)
{
try {
@@ -563,39 +554,35 @@ class SurveyorController extends Controller
);
$fotoForm = json_decode($inspeksi->foto_form, true);
- if (isset($fotoForm[$paramName][$paramName][0])) {
- // Filter foto yang akan dihapus
-
- $tes = null;
- $fotoForm[$paramName][$paramName][0] = array_values(
- array_filter(
- $fotoForm[$paramName][$paramName][0],
- function ($foto) use ($cleanRequestPath) {
- if ($foto['path'] === $cleanRequestPath) {
- // Hapus file dari storage
- \Storage::disk('public')->delete($cleanRequestPath);
- return false; // Hapus elemen ini dari array
- }
- $tes = $foto['path'];
- return true;
+ if (isset($fotoForm[$paramName]) && is_array($fotoForm[$paramName])) {
+ // Filter foto yang tidak sesuai dengan path yang akan dihapus
+ $fotoForm[$paramName] = array_values(array_filter(
+ $fotoForm[$paramName],
+ function ($foto) use ($cleanRequestPath) {
+ if ($foto['path'] === $cleanRequestPath) {
+ // Hapus file dari storage
+ \Storage::disk('public')->delete($cleanRequestPath);
+ return false;
}
- )
- );
+ return true;
+ }
+ ));
-
- // Reset array index
- $fotoForm[$paramName][$paramName][0] = array_values($fotoForm[$paramName][$paramName][0]);
-
- $inspeksi->foto_form = $fotoForm;
+ // Simpan kembali data ke database
+ $inspeksi->foto_form = json_encode($fotoForm);
$inspeksi->save();
return response()->json([
'success' => true,
- 'message' => 'Foto berhasil dihapus',
+ 'message' => 'Foto berhasil dihapus',
], 200);
}
- return response()->json(['success' => false], 400);
+ // Jika parameter tidak ditemukan
+ return response()->json([
+ 'success' => false,
+ 'message' => 'Foto atau parameter tidak ditemukan',
+ ], 400);
} catch (\Exception $e) {
return response()->json([
'success' => false,
@@ -622,37 +609,32 @@ class SurveyorController extends Controller
$fotos = $this->findFotoByParamName($fotoForm, $paramName);
- $param = $paramName == 'rute_menuju_lokasi' ? $fotos['rute_menuju_lokasi'][0] : $fotos['foto_lingkungan'][0];
$data = array_map(function ($foto) {
return [
'name' => $foto['name'] ?? 'Foto',
- 'path' => \Storage::url($foto['path']),
+ 'path' => \Storage::url($foto['path'] ?? ''),
+ 'category' => $foto['category'] ?? 'lainnya',
+ 'sub' => $foto['sub'] ?? null,
+ 'description' => $foto['description'] ?? null,
+ 'upload_by' => $foto['upload_by'] ?? null,
];
- }, $param);
+ }, $fotos);
return response()->json([
'fotos' => $data,
- 'success' => !empty($data)
+ 'success' => !empty($data),
]);
}
private function findFotoByParamName($fotoForm, $paramName)
{
// Mapping parameter name ke struktur JSON
- $paramMapping = [
- 'rute_menuju_lokasi' => ['rute_menuju_lokasi'],
- 'foto_lingkungan' => ['foto_lingkungan'],
- ];
-
- // // Traverse array menggunakan mapping
- $fotos = $fotoForm;
- if (isset($paramMapping[$paramName])) {
- foreach ($paramMapping[$paramName] as $key) {
- $fotos = $fotos[$key] ?? [];
- }
+ if (isset($fotoForm[$paramName]) && is_array($fotoForm[$paramName])) {
+ return $fotoForm[$paramName]; // Kembalikan array foto jika ditemukan
}
- return is_array($fotos) ? $fotos : [];
+ // Jika parameter tidak ditemukan atau bukan array, kembalikan array kosong
+ return [];
}
@@ -784,38 +766,7 @@ class SurveyorController extends Controller
], 404);
}
- private function processPhotoLainnya(Request $request, array $fields, array $existingPhotos = [])
- {
- $result = $existingPhotos; // Start with existing photos
- $photoField = $fields[0];
- $nameField = $fields[1];
- $descriptionField = $fields[2] ?? null;
- if ($request->hasFile($photoField)) {
- $newFiles = $request->file($photoField, []);
- $newNames = $request->input($nameField, []);
- $newDescriptions = $descriptionField ? $request->input($descriptionField, []) : [];
-
- // Process each new file
- foreach ($newFiles as $key => $file) {
- // Create new photo entry
- $newPhotoEntry = [
- $nameField => $newNames[$key] ?? '', // Use new name if provided
- $photoField => $this->uploadFile($file, $photoField . '.' . $key)
- ];
-
- // Add description if field exists
- if ($descriptionField) {
- $newPhotoEntry[$descriptionField] = $newDescriptions[$key] ?? '';
- }
-
- // Add to result
- $result[] = $newPhotoEntry;
- }
- }
-
- return $result;
- }
private function generateUniqueFileName($file, $prefix = '')
{
@@ -839,27 +790,8 @@ class SurveyorController extends Controller
return $request->validate([
'permohonan_id' => 'required',
'dokument_id' => 'required',
- 'pendamping' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
- 'foto_objek.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
- 'name_objek.*' => 'required|string|max:255',
-
- 'name_lingkungan.*' => 'required|string|max:255',
+ 'nomor_registrasi' => 'required',
'foto_rute.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
- 'name_rute.*' => 'required|string|max:255',
- 'lantai.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
-
- 'name_rute_lainnya.*' => 'nullable|string',
- 'foto_rute_lainnya.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
- 'foto_lantai_lainnya.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
- 'name_lantai_lainnya.*' => 'nullable|string|max:255',
- 'foto_basement.*' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
- 'name_basement.*' => 'nullable|string|max:255',
- 'foto_gerbang' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
- 'name_gerbang' => 'nullable|string|max:255',
-
-
- 'name_lantai_unit' => 'array',
-
]);
}
@@ -1487,6 +1419,8 @@ class SurveyorController extends Controller
'permohonan_id' => 'required|exists:permohonan,id',
'type' => 'required|string',
'dokument_id' => 'required',
+ 'name_foto_objek' => 'nullable|string',
+ 'nomor_registrasi' => 'required|string',
'foto_objek' => 'nullable|image|max:'.$maxSize,
'foto_objek_pembanding.*' => 'nullable|image|max:'.$maxSize,
]);
@@ -1502,43 +1436,7 @@ class SurveyorController extends Controller
$objekPenilaian = $this->formatObjekPenilaian($request);
}
if ($request->hasFile('foto_objek')) {
- $newFoto = $this->handleupdateOrDeleteFile(
- $request->file('foto_objek'),
- $request['type'] = 'pembanding',
- 'objek_penilaian'
- );
-
- // Update foto_form
- $inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))
- ->where('dokument_id', $request->input('dokument_id'))
- ->first();
-
- if ($inspeksi) {
- $fotoForm = json_decode($inspeksi->foto_form, true) ?: [];
- if (!isset($fotoForm['object_jaminan'])) {
- $fotoForm['object_jaminan'] = [];
- }
- if (empty($fotoForm['object_jaminan'])) {
- $fotoForm['object_jaminan'][] = [
- 'name_objek' => 'Tampak Depan Objek',
- 'foto_objek' => $newFoto,
- 'deskripsi_objek' => ''
- ];
- } else {
- // Update objek pertama dalam array object_jaminan
- $fotoForm['object_jaminan'][0]['foto_objek'] = $newFoto;
-
- // Tambahkan nama dan deskripsi jika belum ada
- if (!isset($fotoForm['object_jaminan'][0]['name_objek'])) {
- $fotoForm['object_jaminan'][0]['name_objek'] = 'Tampak Depan Objek';
- }
- }
-
-
- $inspeksi->foto_form = json_encode($fotoForm);
- $inspeksi->save();
- }
-
+ $newFoto = $this->handleEditTampakDepan($request);
$objekPenilaian['foto_objek'] = $newFoto;
}
@@ -1571,7 +1469,75 @@ class SurveyorController extends Controller
}
}
+ public function handleEditTampakDepan(Request $request)
+ {
+ $nomor_registrasi = $request->nomor_registrasi;
+
+ // Ambil data inspeksi
+ $inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))
+ ->where('dokument_id', $request->input('dokument_id'))
+ ->firstOrFail();
+
+ // Bersihkan path dari request
+ $cleanRequestPath = str_replace('/storage/', '', $request['path']);
+
+ // Ambil foto_form dari inspeksi
+ $fotoForm = json_decode($inspeksi->foto_form, true) ?? [];
+ $fotoForm['upload_foto'] = $fotoForm['upload_foto'] ?? [];
+
+ $existingIndex = null;
+ if (!empty($request['path'])) {
+ foreach ($fotoForm['upload_foto'] as $index => $foto) {
+ if ($foto['path'] === $cleanRequestPath) {
+ $existingIndex = $index;
+ break;
+ }
+ }
+ }
+
+ if ($request->hasFile('foto_objek')) {
+ $file = $request->file('foto_objek');
+ $timestamp = time();
+ $originalName = $file->getClientOriginalName();
+ $extension = $file->getClientOriginalExtension();
+
+ // Validasi nama file
+ if (empty($originalName)) {
+ $originalName = "file_{$timestamp}";
+ }
+ $uniqueFileName = "{$timestamp}.{$extension}";
+
+ // Simpan file ke penyimpanan publik
+ $path = $file->storeAs("surveyor/upload_foto/{$nomor_registrasi}", $uniqueFileName, 'public');
+
+ // Data baru untuk foto
+ $newFotoData = [
+ 'name' => $originalName,
+ 'description' => null,
+ 'category' => 'Tampak Depan',
+ 'sub' => null,
+ 'path' => $path,
+ 'created_by' => Auth::user()->name,
+ 'created_at' => now()->toDateTimeString(),
+ 'updated_by' => Auth::user()->name,
+ 'updated_at' => now()->toDateTimeString(),
+ ];
+
+ // Update atau tambahkan data baru
+ if ($existingIndex !== null) {
+ $fotoForm['upload_foto'][$existingIndex] = $newFotoData;
+ } else {
+ $fotoForm['upload_foto'][] = $newFotoData;
+ }
+
+ // Simpan kembali data ke database
+ $inspeksi->foto_form = json_encode($fotoForm);
+ $inspeksi->save();
+
+ return $path;
+ }
+ }
/**
* Form inspeksi.
@@ -1707,6 +1673,7 @@ class SurveyorController extends Controller
$permohonan = $this->getPermohonanJaminanId($id, $dokumentId, $jaminanId);
+
$surveyor = $id;
$branches = Branch::all();
$provinces = Province::all();
@@ -2342,7 +2309,8 @@ class SurveyorController extends Controller
'perkerasanJalan' => PerkerasanJalan::all(),
'terletakDiArea' => TerletakArea::all(),
'tujuanPenilaian' => TujuanPenilaian::all(),
- 'perizinan' => Perizinan::all()
+ 'perizinan' => Perizinan::all(),
+ 'foto' => FotoObjekJaminan::all()
];
}
diff --git a/resources/views/penilai/components/analisa/apartement-kantor.blade.php b/resources/views/penilai/components/analisa/apartement-kantor.blade.php
new file mode 100644
index 0000000..77b57c5
--- /dev/null
+++ b/resources/views/penilai/components/analisa/apartement-kantor.blade.php
@@ -0,0 +1,82 @@
+
+
+
+
+ @php
+ $cekLuas = isset($forminspeksi['luas_unit']['tidak sesuai'])
+ ? 'tidak sesuai'
+ : 'sesuai';
+
+ $luas = $forminspeksi['luas_unit'][$cekLuas] ?? null;
+ @endphp
+ | Luas Unit |
+ : |
+ {{ $luas ?? '' }} |
+
+
+ | Bentuk Unit |
+ : |
+
+ @php
+ $bentukUnit = $forminspeksi['bentuk_unit'] ?? [];
+ @endphp
+
+ @if (!empty($bentukUnit))
+ {{ implode(', ', $bentukUnit) }}
+ @else
+ -
+ @endif
+ |
+
+
+ | Kondisi Unit |
+ : |
+
+ @php
+ $bentukUnit = $forminspeksi['kondisi_unit'] ?? [];
+ @endphp
+
+ @if (!empty($bentukUnit))
+ {{ implode(', ', $bentukUnit) }}
+ @else
+ -
+ @endif
+ |
+
+
+ | Posisi Unit |
+ : |
+
+ @php
+ $bentukUnit = $forminspeksi['posisi_unit'] ?? [];
+ @endphp
+
+ @if (!empty($bentukUnit))
+ {{ implode(', ', $bentukUnit) }}
+ @else
+ -
+ @endif
+ |
+
+
+ | View Unit |
+ : |
+
+ @php
+ $bentukUnit = $forminspeksi['view'] ?? [];
+ @endphp
+
+ @if (!empty($bentukUnit))
+ {{ implode(', ', $bentukUnit) }}
+ @else
+ -
+ @endif
+ |
+
+
diff --git a/resources/views/penilai/components/analisa/bangunan.blade.php b/resources/views/penilai/components/analisa/bangunan.blade.php
new file mode 100644
index 0000000..b78af1c
--- /dev/null
+++ b/resources/views/penilai/components/analisa/bangunan.blade.php
@@ -0,0 +1,145 @@
+
+
+ |
+ ANALISA BANGUNAN
+ |
+
+
+
+
+ | Luas Bangunan |
+ : |
+
+ @php
+ $luasTanahBangunan =
+ $forminspeksi['bangunan']['luas_tanah_bagunan'];
+
+ $output = !empty($luasTanahBangunan['sesuai'])
+ ? $luasTanahBangunan['sesuai']
+ : (!empty($luasTanahBangunan['tidak sesuai'])
+ ? $luasTanahBangunan['tidak sesuai']
+ : '-');
+ @endphp
+
+ {{ $output }} m2
+ |
+
+
+
+ | Jenis Bangunan |
+ : |
+
+ @php
+ $jenisBangunan =
+ $forminspeksi['bangunan']['jenis_bangunan'] ?? [];
+ @endphp
+
+ @if (!empty($jenisBangunan))
+ {{ implode(', ', $jenisBangunan) }}
+ @else
+ -
+ @endif
+ |
+
+
+ | Kondisi Bangunan |
+ : |
+
+ @php
+ $kondisiBangunan =
+ $forminspeksi['bangunan']['kondisi_bangunan'] ?? [];
+ @endphp
+
+ @if (!empty($kondisiBangunan))
+ {{ implode(', ', $kondisiBangunan) }}
+ @else
+ -
+ @endif
+ |
+
+
+ | Sifat Bangunan |
+ : |
+
+
+ @php
+ $sifatBangunan =
+ $forminspeksi['bangunan']['sifat_bangunan'][0] ?? '-';
+ $sifatBangunanInput =
+ $forminspeksi['bangunan']['sifat_bangunan_input'];
+
+ // Filter input yang tidak null
+ $inputTambahan = array_filter($sifatBangunanInput, function (
+ $value,
+ ) {
+ return $value !== null && $value !== '';
+ });
+
+ // Gabungkan sifat bangunan dengan input tambahan
+ $output = $sifatBangunan;
+
+ if (!empty($inputTambahan)) {
+ $output .= ' (' . implode(', ', $inputTambahan) . ')';
+ }
+ @endphp
+
+ {{ $output }}
+ |
+
+
+ @if (isset($forminspeksi['bangunan']['spesifikasi_bangunan']) && count($forminspeksi['bangunan']['spesifikasi_bangunan']) > 0)
+ @foreach ($forminspeksi['bangunan']['spesifikasi_bangunan'] as $bangunanIndex => $bangunan)
+ @if (count($forminspeksi['bangunan']['spesifikasi_bangunan']) > 1)
+
+ | Spesifikasi Bangunan {{ $bangunanIndex + 1 }} |
+
+ @else
+
+ | Spesifikasi Bangunan |
+
+ @endif
+
+ @if (isset($basicData['spekKategoriBangunan']))
+ @foreach ($basicData['spekKategoriBangunan'] as $index => $spesifikasi)
+ @if (!empty($spesifikasi->name))
+
+ | {{ $spesifikasi->name }} |
+ : |
+
+ @php
+ $selectedValue = null;
+ $lainnyaValue = null;
+
+ if (isset($bangunan['spek_kategori_bangunan'][$spesifikasi->name])) {
+ $selectedValues = $bangunan['spek_kategori_bangunan'][$spesifikasi->name];
+
+ // Ambil nilai pertama (bukan key) dari array
+ $selectedValue = array_values(array_filter($selectedValues, function ($key) {
+ return $key !== 'lainnya'; // Filter key lainnya
+ }, ARRAY_FILTER_USE_KEY))[0] ?? null;
+
+ $lainnyaValue = $selectedValues['lainnya'] ?? null;
+ }
+ @endphp
+
+ @if ($selectedValue)
+
+ {{ $selectedValue }}
+ @if ($selectedValue === 'Lainnya' && $lainnyaValue)
+ : {{ $lainnyaValue }}
+ @endif
+
+ @else
+ —
+ @endif
+ |
+
+ @endif
+ @endforeach
+ @endif
+ @endforeach
+@endif
+
+
+
+
diff --git a/resources/views/penilai/components/analisa/fakta.blade.php b/resources/views/penilai/components/analisa/fakta.blade.php
new file mode 100644
index 0000000..c5fc218
--- /dev/null
+++ b/resources/views/penilai/components/analisa/fakta.blade.php
@@ -0,0 +1,104 @@
+
+
+ |
+ ANALISA FAKTA
+ |
+
+
+
+
+
+
+ | Faktor Positif |
+ : |
+
+ @isset($forminspeksi['fakta']['fakta_positif'])
+
+ @foreach ($forminspeksi['fakta']['fakta_positif'] as $key => $item)
+
+ | {!! nl2br(e($item)) !!} |
+
+ @endforeach
+
+ @endisset
+ |
+
+
+ {{-- Faktor Negatif --}}
+
+ | Faktor Negatif |
+ : |
+
+ @php
+ $faktaNegatif = $forminspeksi['fakta']['fakta_negatif'] ?? [];
+ $faktaNegatifFiltered = is_array($faktaNegatif)
+ ? array_filter($faktaNegatif, function ($item) {
+ return !empty(trim($item));
+ })
+ : [];
+ @endphp
+
+ @if (!empty($faktaNegatifFiltered))
+
+ @foreach ($faktaNegatifFiltered as $key => $item)
+
+ | {!! nl2br(e($item)) !!} |
+
+ @endforeach
+
+ @else
+ Tidak ada faktor negatif yang teridentifikasi.
+ @endif
+ |
+
+
+ @if (!empty($forminspeksi['fakta']['rute_menuju']))
+
+ | Rute Menuju |
+ : |
+
+ {!! nl2br(e($forminspeksi['fakta']['rute_menuju'] ?? '')) !!}
+ |
+
+ @endif
+
+ @if (!empty($forminspeksi['fakta']['batas_batas_input']))
+
+ | Batas batas |
+ : |
+
+ @foreach ($forminspeksi['fakta']['batas_batas_input'] ?? [] as $arah => $batas)
+ @if ($batas)
+ - {{ $arah }} : {{ $batas }}
+ @endif
+ @endforeach
+ |
+
+ @endif
+
+ @if (!empty($forminspeksi['fakta']['kondisi_lingkungan']))
+
+ | Kondisi Lingkungan |
+ : |
+
+ @foreach ($forminspeksi['fakta']['kondisi_lingkungan'] ?? [] as $kondisi)
+ {!! nl2br(e($kondisi)) !!}
+ @endforeach
+ |
+
+ @endif
+ @if (!empty($forminspeksi['fakta']['informasi_dokument']))
+
+ | Informasi Lain terkait
+ Dokumen |
+ : |
+
+ @foreach ($forminspeksi['fakta']['informasi_dokument'] ?? [] as $informasi)
+ {!! nl2br(e($informasi)) !!}
+ @endforeach
+ |
+
+ @endif
+
+
+
diff --git a/resources/views/penilai/components/analisa/informasi.blade.php b/resources/views/penilai/components/analisa/informasi.blade.php
new file mode 100644
index 0000000..28501fc
--- /dev/null
+++ b/resources/views/penilai/components/analisa/informasi.blade.php
@@ -0,0 +1,55 @@
+
+
+ | Informasi Dinas Tata Ruang
+ |
+ : |
+
+ @php
+ $informasi = [
+ 'peruntukan',
+ 'kdb',
+ 'kdh',
+ 'gsb',
+ 'max_lantai',
+ 'klb',
+ 'gss',
+ 'pelebaran_jalan',
+ 'nama_petugas',
+ ];
+ @endphp
+
+ @foreach ($informasi as $key)
+ @if (isset($forminspeksi['fakta'][$key]) && $forminspeksi['fakta'][$key] !== '-')
+ - {{ ucfirst(str_replace('_', ' ', $key)) }}:
+ {{ $forminspeksi['fakta'][$key] }}
+ @endif
+ @endforeach
+
+ |
+
+
+ @if (!empty($forminspeksi['fakta']['keterangan']))
+
+ | Catatan yang Perlu
+ Diperhatikan |
+ : |
+
+ @php
+ $keterangan = $forminspeksi['fakta']['keterangan'] ?? '';
+ if (is_array($keterangan)) {
+ $keterangan = implode(', ', array_filter($keterangan));
+ }
+ @endphp
+
+ @if (!empty($keterangan))
+
+
+ | {!! nl2br(e($keterangan)) !!} |
+
+
+
+ @endif
+ |
+
+ @endif
+
diff --git a/resources/views/penilai/components/analisa/lingkungan.blade.php b/resources/views/penilai/components/analisa/lingkungan.blade.php
new file mode 100644
index 0000000..f68cd54
--- /dev/null
+++ b/resources/views/penilai/components/analisa/lingkungan.blade.php
@@ -0,0 +1,129 @@
+
+
+ |
+ ANALISA LINGKUNGAN
+ |
+
+
+
+
+ @php
+ $lingkungan = $forminspeksi['lingkungan'];
+ $fasilitas = $lingkungan['fasilitas_dekat_object'] ?? [];
+ $fasilitasInput = $lingkungan['fasilitas_dekat_object_input'] ?? [];
+ @endphp
+
+
+ | Jarak Jalan Utama |
+ : |
+ {{ $lingkungan['jarak_jalan_utama'] ?? '-' }} m |
+
+
+ | Jalan Lingkungan |
+ : |
+ {{ $lingkungan['jalan_linkungan'] ?? '-' }} m |
+
+
+ | Jarak CBD |
+ : |
+ {{ $lingkungan['jarak_cbd_point'] ?? '-' }} m
+ ({{ $lingkungan['nama_cbd_point'] ?? '-' }}) |
+
+
+ | Lebar Perkerasan Jalan |
+ : |
+ {{ $lingkungan['lebar_perkerasan_jalan'] ?? '-' }} m |
+
+
+ | Perkerasan Jalan |
+ :
+ |
+
+ {{ implode(', ', $lingkungan['perkerasan_jalan']['perkerasan_jalan'] ?? ['-']) }}
+ |
+
+
+
+ | Lalu Lintas |
+ : |
+ {{ implode(', ', $lingkungan['lalu_lintas'] ?? ['-']) }}
+ |
+
+
+ | Golongan Masyarakat Sekitar |
+ : |
+ {{ implode(', ', $lingkungan['gol_mas_sekitar'] ?? ['-']) }}
+ |
+
+
+ | Tingkat Keramaian |
+ : |
+
+ {{ implode(', ', $lingkungan['tingkat_keramaian'] ?? ['-']) }}
+ |
+
+
+ | Terletak di Area |
+ : |
+
+ {{ implode(', ', $lingkungan['terletak_diarea']['terletak_diarea'] ?? ['-']) }}
+ |
+
+
+ | Kondisi Bangunan Sekitar |
+ : |
+ {{ $lingkungan['kondisi_bagunan_disekitar_lokasi'] ?? '-' }}
+ |
+
+
+ | Sifat Bangunan Sekitar |
+ : |
+ {{ $lingkungan['sifat_bagunan_disekitar_lokasi'] ?? '-' }}
+ |
+
+
+ @if ($lingkungan['dekat_makam'] == 'ya')
+
+ | Dekat Makam |
+ : |
+ Ya, Jarak {{ $lingkungan['jarak_makam'] ?? '-' }} m
+ ({{ $lingkungan['nama_makam'] ?? '-' }})
+ |
+
+ @endif
+
+ @if ($lingkungan['dekat_tps'] == 'ya')
+
+ | Dekat TPS |
+ : |
+ Ya, Jarak {{ $lingkungan['jarak_tps'] ?? '-' }} m
+ ({{ $lingkungan['nama_tps'] ?? '-' }}) |
+
+ @endif
+
+
+ | Daerah |
+ : |
+
+ {{ implode(', ', $lingkungan['merupakan_daerah'] ?? ['-']) }}
+ |
+
+
+ @if (!empty($fasilitas))
+
+ | Fasilitas Dekat Objek |
+ : |
+
+ @foreach ($fasilitas as $fas)
+ {{ $fas }}
+ @if (isset($fasilitasInput[$fas]))
+ ({{ $fasilitasInput[$fas] }})
+ @endif
+ @if (!$loop->last)
+ ,
+ @endif
+ @endforeach
+ |
+
+ @endif
+
diff --git a/resources/views/penilai/components/analisa/tanah.blade.php b/resources/views/penilai/components/analisa/tanah.blade.php
new file mode 100644
index 0000000..980a755
--- /dev/null
+++ b/resources/views/penilai/components/analisa/tanah.blade.php
@@ -0,0 +1,148 @@
+
+
+ |
+ ANALISA TANAH
+ |
+
+
+
+
+
+ @php
+ $cekLuas = isset($forminspeksi['tanah']['luas_tanah']['tidak sesuai']) ? 'tidak sesuai' : 'sesuai';
+
+ $luas = $forminspeksi['tanah']['luas_tanah'][$cekLuas] ?? null;
+ @endphp
+ | Luas Tanah |
+ : |
+ {{ $luas ?? '' }} |
+
+
+ @php
+ $cekMataAngin = isset($forminspeksi['tanah']['hadap_mata_angin']['tidak sesuai'])
+ ? 'tidak sesuai'
+ : 'sesuai';
+
+ $Arah = $forminspeksi['tanah']['hadap_mata_angin'][$cekMataAngin] ?? null;
+ @endphp
+ | Hadap Mata Angin |
+ : |
+ {{ $Arah ?? '' }} |
+
+
+ | Bentuk Tanah |
+ : |
+
+ @php
+ $bentukTanah = isset($forminspeksi['tanah']['bentuk_tanah']['bentuk_tanah'])
+ ? $forminspeksi['tanah']['bentuk_tanah']['bentuk_tanah']
+ : [];
+ $lainnya = isset($forminspeksi['tanah']['bentuk_tanah']['lainnya'])
+ ? $forminspeksi['tanah']['bentuk_tanah']['lainnya']
+ : null;
+ @endphp
+
+ {{ !empty($bentukTanah) ? implode(', ', $bentukTanah) : 'Data tidak tersedia' }}
+
+ @if (in_array('Lainnya', $bentukTanah) && $lainnya)
+ ({{ $lainnya }})
+ @endif
+ |
+
+
+
+ | Kontur Tanah |
+ : |
+
+ @php
+ $konturTanah = $forminspeksi['tanah']['kontur_tanah'] ?? [];
+ @endphp
+
+ @if (!empty($konturTanah))
+ {{ implode(', ', $konturTanah) }}
+ @else
+ -
+ @endif
+ |
+
+
+ | Beda Ketinggian dengan Jalan |
+ : |
+
+ @php
+ $ketinggianTanah = $forminspeksi['tanah']['ketinggian_tanah'];
+ $ketinggian = $ketinggianTanah['ketinggian'][0] ?? '-';
+ $lebihTinggi = $ketinggianTanah['lebih_tinggi'];
+ $lebihRendah = $ketinggianTanah['lebih_rendah'];
+ @endphp
+
+ {{ $ketinggian }}
+ @if ($ketinggian === 'Lebih Tinggi' && $lebihTinggi !== null)
+ (Ketinggian: {{ $lebihTinggi }} cm)
+ @elseif($ketinggian === 'Lebih Rendah' && $lebihRendah !== null)
+ (Kerendahan: {{ $lebihRendah }} cm)
+ @endif
+ |
+
+
+
+ | Kontur Jalan Depan Objek |
+ : |
+
+ {{ $forminspeksi['tanah']['kontur_jalan'] == 'menurun' ? 'Menurun' : 'Rata' }}
+ |
+
+
+ | Posisi Kavling |
+ : |
+
+ @php
+ $posisiKavling = isset($forminspeksi['tanah']['posisi_kavling']['posisi_kavling'])
+ ? $forminspeksi['tanah']['posisi_kavling']['posisi_kavling']
+ : [];
+ $lainnya = isset($forminspeksi['tanah']['posisi_kavling']['lainnya'])
+ ? $forminspeksi['tanah']['posisi_kavling']['lainnya']
+ : null;
+ @endphp
+
+ {{ !empty($posisiKavling) ? implode(', ', $posisiKavling) : '' }}
+
+ @if (in_array('Lainnya', $posisiKavling) && $lainnya)
+ ({{ $lainnya }})
+ @endif
+ |
+
+
+
+
+ | Tusuk Sate |
+ : |
+
+ {{ $forminspeksi['tanah']['tusuk_sate'] == 'yes' ? 'Ya' : 'Tidak' }}
+ |
+
+
+ | Lockland |
+ : |
+
+ {{ $forminspeksi['tanah']['lockland'] == 'yes' ? 'Ya' : 'Tidak' }}
+ |
+
+
+ | Kondisi Fisik Tanah |
+ : |
+
+ @php
+ $kondisiFisikTanah = $forminspeksi['tanah']['kondisi_fisik_tanah']['kondisi_fisik_tanah'][0] ?? '-';
+ $lainnya = $forminspeksi['tanah']['kondisi_fisik_tanah']['lainnya'];
+ @endphp
+
+ {{ $kondisiFisikTanah }}
+ @if ($kondisiFisikTanah === 'Lainnya' && $lainnya)
+ ({{ $lainnya }})
+ @endif
+ |
+
+
+
+
diff --git a/resources/views/penilai/components/footer.blade.php b/resources/views/penilai/components/footer.blade.php
new file mode 100644
index 0000000..84e9a94
--- /dev/null
+++ b/resources/views/penilai/components/footer.blade.php
@@ -0,0 +1,34 @@
+
+
+