{{-- E-post, Telefon and Egna fält of Skapa mottagare / Ändra mottagare (#2957 slice 4b, card #3018). Params: $receiver_props (the company's templates, in order), $receiver (null on create). Field names are the ones ReceiverController reads: email, phone, template[i][...], newfield (not read, kept). After a validation error the custom fields come back from old('template'), as before. --}} @php $receiver = $receiver ?? null; $hasComplaint = $receiver !== null && $receiver->complaints->isNotEmpty(); $propValues = $receiver !== null ? $receiver->props->pluck('data', 'receiver_prop_template_id') : collect(); $duplicateId = session('duplicate_id'); $oldTemplates = old('template'); $rows = ! empty($oldTemplates) ? collect($oldTemplates)->map(fn ($prop) => [ 'screen_name' => $prop['screen_name'] ?? '', 'name' => $prop['name'] ?? '', 'order' => $prop['order'] ?? '', 'value' => $prop['value'] ?? '', 'id' => $prop['id'] ?? '', ]) : $receiver_props->map(fn ($prop) => [ 'screen_name' => $prop->screen_name, 'name' => $prop->name, 'order' => $prop->order, 'value' => $propValues->get($prop->id, ''), 'id' => $prop->id, ]); @endphp @if ($receiver !== null)
@if ($duplicateId && $errors->has($field))
{{ __('receiver.form.whatisfields') }}