diff --git a/backend-baru/resources/views/admin/pelanggans/show.blade.php b/backend-baru/resources/views/admin/pelanggans/show.blade.php index 4099e56..d650d9c 100644 --- a/backend-baru/resources/views/admin/pelanggans/show.blade.php +++ b/backend-baru/resources/views/admin/pelanggans/show.blade.php @@ -69,64 +69,115 @@ -
| - {{ ucwords(str_replace('_', ' ', $field)) }} - | -
- @if(is_array($value))
- {{ implode(', ', $value) }}
+ @if($pelanggan->form && count($pelanggan->form) > 0)
+ @php
+ $fotoFields = [];
+ $textFields = [];
- {{-- ✅ Jika value adalah path atau URL gambar --}}
- @elseif(
- is_string($value) &&
- (preg_match('/\.(jpg|jpeg|png|gif|webp)$/i', $value)
- || Str::startsWith($value, ['storage/', 'uploads/', 'images/']))
- )
- @php
- // Cek apakah gambar disimpan di storage Laravel
- $imageUrl = Str::startsWith($value, ['http://', 'https://'])
- ? $value
- : asset($value);
- @endphp
+ foreach ($pelanggan->form as $field => $value) {
+ $isFoto = false;
-
- |
-
|---|
Tidak ada data form tambahan.
- @endif -| + {{ ucwords(str_replace('_', ' ', $field)) }} + | +
+ {{-- ✅ Jika value adalah array (banyak foto) --}}
+ @if(is_array($value))
+
+ @foreach($value as $img)
+ @php
+ if (Str::startsWith($img, ['http://', 'https://'])) {
+ $imageUrl = $img;
+ } elseif (Str::startsWith($img, ['storage/', 'public/'])) {
+ $imageUrl = asset($img);
+ } elseif (Str::startsWith($img, 'photos/')) {
+ $imageUrl = asset('storage/' . $img);
+ } else {
+ $imageUrl = asset('storage/' . $img);
+ }
+ @endphp
+
+
+ {{-- ✅ Jika gambar tunggal --}}
+ @elseif(
+ is_string($value) &&
+ (preg_match('/\.(jpg|jpeg|png|gif|webp)$/i', $value)
+ || Str::startsWith($value, ['storage/', 'uploads/', 'images/', 'photos/']))
+ )
+ @php
+ if (Str::startsWith($value, ['http://', 'https://'])) {
+ $imageUrl = $value;
+ } elseif (Str::startsWith($value, ['storage/', 'public/'])) {
+ $imageUrl = asset($value);
+ } elseif (Str::startsWith($value, 'photos/')) {
+ $imageUrl = asset('storage/' . $value);
+ } else {
+ $imageUrl = asset('storage/' . $value);
+ }
+ @endphp
+
+ |
+
|---|
Tidak ada data form tambahan.
+ @endif +