@extends('layouts.app') @section('title', 'Detail Pesanan') @section('content')

๐Ÿงพ Detail Pesanan

โ† Kembali

๐Ÿ‘ค Informasi Pemesan

Nama Pemesan {{ $pelanggan->nama_pemesan }}
Email {{ $pelanggan->email }}
No Telepon {{ $pelanggan->no_tlpn }}
Template {{ $pelanggan->template->nama_template ?? '-' }}
Harga Rp {{ number_format($pelanggan->harga, 0, ',', '.') }}
Status {{ ucfirst($pelanggan->status) }}
Kode Undangan {{ $pelanggan->kode_pelanggan }}

๐Ÿ“‹ Detail Form Pemesanan

@if($pelanggan->form && count($pelanggan->form) > 0) @php $fotoFields = []; $textFields = []; foreach ($pelanggan->form as $field => $value) { $isFoto = false; if (is_array($value)) { // jika array berisi gambar $isFoto = collect($value)->contains(function ($v) { return preg_match('/\.(jpg|jpeg|png|gif|webp)$/i', $v) || Str::startsWith($v, ['storage/', 'photos/', 'uploads/', 'images/']); }); } elseif (is_string($value)) { // jika satu gambar $isFoto = preg_match('/\.(jpg|jpeg|png|gif|webp)$/i', $value) || Str::startsWith($value, ['storage/', 'photos/', 'uploads/', 'images/']); } if ($isFoto) { $fotoFields[$field] = $value; } else { $textFields[$field] = $value; } } $orderedFields = array_merge($textFields, $fotoFields); @endphp
@foreach($orderedFields as $field => $value) @endforeach
{{ 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 {{ $field }} @endforeach
{{-- โœ… 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 {{ $field }} {{-- โœ… Jika URL biasa --}} @elseif(is_string($value) && filter_var($value, FILTER_VALIDATE_URL)) {{ $value }} {{-- โœ… Jika teks biasa --}} @else {{ $value ?: '-' }} @endif
@else

Tidak ada data form tambahan.

@endif
@endsection