@push('scripts') @php $customerJson = $customers->map(function ($c) { return [ 'id' => (string) $c->id, 'name' => trim($c->first_name . ' ' . $c->last_name), 'first_name' => $c->first_name, 'last_name' => $c->last_name, 'phone' => $c->phone ?? '', 'email' => $c->email ?? '', 'gender' => $c->gender, 'national_id' => $c->national_id, 'birth_date' => $c->birth_date ? $c->birth_date->format('Y-m-d') : null ]; })->values(); $preSelId = (string) (old('customer_id', $preselectedCustomer?->id ?? '')); @endphp @endpush