From a9d91732082ebdb0eea6dd790554ec8924e91824 Mon Sep 17 00:00:00 2001 From: majid Date: Fri, 20 Dec 2024 14:54:18 +0700 Subject: [PATCH] update check id button submit --- app/Http/Controllers/PenilaiController.php | 4 +- app/Http/Controllers/SurveyorController.php | 2 +- .../views/component/kertas-kerja.blade.php | 87 ++----------------- 3 files changed, 12 insertions(+), 81 deletions(-) diff --git a/app/Http/Controllers/PenilaiController.php b/app/Http/Controllers/PenilaiController.php index ca0e74f..38ccedc 100644 --- a/app/Http/Controllers/PenilaiController.php +++ b/app/Http/Controllers/PenilaiController.php @@ -311,8 +311,8 @@ class PenilaiController extends Controller $data = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first(); - // return view('lpj::component.kertas-kerja', compact('data')); - return Excel::download(new KertasKerjaExport($data), 'kertas-kerja.xlsx'); + return view('lpj::component.kertas-kerja', compact('data')); + // return Excel::download(new KertasKerjaExport($data), 'kertas-kerja.xlsx'); } diff --git a/app/Http/Controllers/SurveyorController.php b/app/Http/Controllers/SurveyorController.php index e730a54..2d1be44 100644 --- a/app/Http/Controllers/SurveyorController.php +++ b/app/Http/Controllers/SurveyorController.php @@ -478,7 +478,7 @@ class SurveyorController extends Controller $dataPembanding = json_decode($inspeksi->data_pembanding, true); // Get jenis jaminan to check if it needs denah - $jenisJaminan = JenisJaminan::find($inspeksi->jenis_jaminan_id); + $jenisJaminan = JenisJaminan::find($inspeksi->dokument_id); $isTanahBangunan = !in_array( strtoupper($jenisJaminan->name ?? ''), ['KAPAL', 'PESAWAT', 'KENDARAAN', 'ALAT BERAT'] diff --git a/resources/views/component/kertas-kerja.blade.php b/resources/views/component/kertas-kerja.blade.php index 195bc23..2562c70 100644 --- a/resources/views/component/kertas-kerja.blade.php +++ b/resources/views/component/kertas-kerja.blade.php @@ -470,15 +470,6 @@ $fotoTypes = ['foto_gistaru', 'foto_bhumi', 'foto_argis_region', 'foto_tempat']; @endphp -@php - $imagePath = $dataform['foto_gistaru']; - @endphp -
@forelse ($fotoTypes as $type) @@ -487,19 +478,19 @@ $imagePath = $dataform[$type]; @endphp - {{-- @if ($imagePath && Storage::exists($imagePath)) --}} + @if ($imagePath && Storage::exists($imagePath)) {{ $type }}

{{ Str::title(str_replace('_', ' ', $type)) }}

- {{-- @else + @else

Tidak ada gambar

- @endif --}} + @endif
@empty

Tidak ada tipe foto yang tersedia

@@ -536,74 +527,12 @@

FOTO OBJEK

-@php - // Fungsi untuk mengumpulkan foto dengan pengecekan yang aman - function collectSafeImages($data, $paths = []) { - if (!is_array($data)) { - return $paths; - } - - foreach ($data as $key => $value) { - if (is_array($value)) { - // Jika array memiliki kunci foto - if (isset($value['foto_rute'])) { - $paths[] = $value['foto_rute']; - } - if (isset($value['foto_objek'])) { - $paths[] = $value['foto_objek']; - } - if (isset($value['foto_lingkungan'])) { - $paths[] = $value['foto_lingkungan']; - } - if (isset($value['foto_lantai_unit'])) { - $paths[] = $value['foto_lantai_unit']; - } - - // Rekursif untuk nested array - $paths = collectSafeImages($value, $paths); - } elseif (is_string($value) && strpos($value, 'foto_') !== false) { - $paths[] = $value; - } - } - - return $paths; - } - - // Decode foto form dengan penanganan error - try { - $dataFoto = json_decode($data->foto_form, true) ?? []; - } catch (Exception $e) { - $dataFoto = []; - } - - // Kumpulkan foto - $images = collectSafeImages($dataFoto); - - // Filter foto yang valid - $validImages = array_filter($images, function($image) { - return $image && Storage::exists($image); - }) -@endphp -
- @forelse ($validImages as $image) -
- Foto Survey -
- @empty -
-

Tidak ada foto objek yang tersedia

-
- @endforelse -
+ + @@ -611,6 +540,8 @@