fix(surveyor/penilai):perbaikkan pengambilan key luas unit dan handle foto di informasi

This commit is contained in:
majid
2025-04-16 21:34:24 +07:00
parent a38b09d1a8
commit c2c998e48c
3 changed files with 31 additions and 23 deletions

View File

@@ -67,19 +67,21 @@
}
// Filter fotoTypes untuk memastikan hanya yang memiliki imagePath valid
$validPhotoTypes = array_filter($fotoTypes, function ($type) use ($forminspeksi) {
return isset($forminspeksi[$type]) && file_exists(storage_path('app/public/' . $forminspeksi[$type]));
return isset($forminspeksi[$type]) && !empty($forminspeksi[$type]) && is_string($forminspeksi[$type]);
});
@endphp
@foreach ($validPhotoTypes as $type)
@php
$imagePath = $forminspeksi[$type] ?? null;
$imageUrl = is_string($imagePath) ? asset('storage/' . $imagePath) : null;
@endphp
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
<tr>
<td style="20%"> {{ $customLabels[$type] ?? '' }}</td>
<td width="1%" style="vertical-align: top;"></td>
<td style="width: 79%">
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $imagePath }}"
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $imageUrl }}"
style="max-height: 400px; height: auto; max-width: 100%;">
</td>
</tr>