update check id button submit
This commit is contained in:
@@ -311,8 +311,8 @@ class PenilaiController extends Controller
|
|||||||
|
|
||||||
$data = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
$data = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first();
|
||||||
|
|
||||||
// return view('lpj::component.kertas-kerja', compact('data'));
|
return view('lpj::component.kertas-kerja', compact('data'));
|
||||||
return Excel::download(new KertasKerjaExport($data), 'kertas-kerja.xlsx');
|
// return Excel::download(new KertasKerjaExport($data), 'kertas-kerja.xlsx');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -478,7 +478,7 @@ class SurveyorController extends Controller
|
|||||||
$dataPembanding = json_decode($inspeksi->data_pembanding, true);
|
$dataPembanding = json_decode($inspeksi->data_pembanding, true);
|
||||||
|
|
||||||
// Get jenis jaminan to check if it needs denah
|
// 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(
|
$isTanahBangunan = !in_array(
|
||||||
strtoupper($jenisJaminan->name ?? ''),
|
strtoupper($jenisJaminan->name ?? ''),
|
||||||
['KAPAL', 'PESAWAT', 'KENDARAAN', 'ALAT BERAT']
|
['KAPAL', 'PESAWAT', 'KENDARAAN', 'ALAT BERAT']
|
||||||
|
|||||||
@@ -470,15 +470,6 @@
|
|||||||
$fotoTypes = ['foto_gistaru', 'foto_bhumi', 'foto_argis_region', 'foto_tempat'];
|
$fotoTypes = ['foto_gistaru', 'foto_bhumi', 'foto_argis_region', 'foto_tempat'];
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@php
|
|
||||||
$imagePath = $dataform['foto_gistaru'];
|
|
||||||
@endphp
|
|
||||||
<img
|
|
||||||
src="{{ asset('public/' . $imagePath) }}"
|
|
||||||
alt=""
|
|
||||||
class="max-w-full h-auto mx-auto"
|
|
||||||
|
|
||||||
>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-4 gap-4">
|
<div class="grid grid-cols-4 gap-4">
|
||||||
@forelse ($fotoTypes as $type)
|
@forelse ($fotoTypes as $type)
|
||||||
@@ -487,19 +478,19 @@
|
|||||||
$imagePath = $dataform[$type];
|
$imagePath = $dataform[$type];
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
{{-- @if ($imagePath && Storage::exists($imagePath)) --}}
|
@if ($imagePath && Storage::exists($imagePath))
|
||||||
<img
|
<img
|
||||||
src="{{ asset('public/' . $imagePath) }}"
|
src="{{ asset('storage/' . $imagePath) }}"
|
||||||
alt="{{ $type }}"
|
alt="{{ $type }}"
|
||||||
class="max-w-full h-auto mx-auto"
|
class="max-w-full h-auto mx-auto"
|
||||||
onerror="this.src='{{ asset('default-image.png') }}'"
|
onerror="this.src='{{ asset('default-image.png') }}'"
|
||||||
>
|
>
|
||||||
<p class="mt-2 text-sm">{{ Str::title(str_replace('_', ' ', $type)) }}</p>
|
<p class="mt-2 text-sm">{{ Str::title(str_replace('_', ' ', $type)) }}</p>
|
||||||
{{-- @else
|
@else
|
||||||
<div class="bg-gray-200 p-4 text-center">
|
<div class="bg-gray-200 p-4 text-center">
|
||||||
<p>Tidak ada gambar</p>
|
<p>Tidak ada gambar</p>
|
||||||
</div>
|
</div>
|
||||||
@endif --}}
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@empty
|
@empty
|
||||||
<p>Tidak ada tipe foto yang tersedia</p>
|
<p>Tidak ada tipe foto yang tersedia</p>
|
||||||
@@ -536,74 +527,12 @@
|
|||||||
|
|
||||||
<h4 class="mt-6">FOTO OBJEK</h4>
|
<h4 class="mt-6">FOTO OBJEK</h4>
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
||||||
<div class="grid grid-cols-4 gap-4">
|
|
||||||
@forelse ($validImages as $image)
|
|
||||||
<div class="text-center">
|
|
||||||
<img
|
|
||||||
src="{{ asset('storage/' . $image) }}"
|
|
||||||
alt="Foto Survey"
|
|
||||||
class="w-full h-64 object-cover"
|
|
||||||
onerror="this.src='{{ asset('default-image.png') }}'"
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
@empty
|
|
||||||
<div class="col-span-4 text-center bg-gray-200 p-4">
|
|
||||||
<p>Tidak ada foto objek yang tersedia</p>
|
|
||||||
</div>
|
|
||||||
@endforelse
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
@@ -611,6 +540,8 @@
|
|||||||
</html>
|
</html>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const data = @json($dataFoto);
|
const data = @json($dataform);
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user