{{-- The Company Document Requisition Form as it is filled in: laid out the way the issued CDRF prints, but with every line a control — the four header fields, a tick box, quantity and remarks on each document, and a name and date under each of the four sign-offs. Kept out of the app chrome so the bare element styling below cannot reach anything else, and so whoever is filling it in sees the sheet rather than a screen full of form rows. The saved form prints from cdrf/print.blade.php. --}} @php use App\Models\DocumentRequisition; $logo = asset('img/gintell-logo.jpg'); $logoExists = is_file(public_path('img/gintell-logo.jpg')); $isNew = ! $requisition->exists; $action = $isNew ? route('proposals.cdrf.store', $proposal) : route('proposals.cdrf.update', [$proposal, $requisition]); // What is on screen: what was typed and rejected, else what is stored. $value = fn (string $field, $fallback = null) => old($field, $fallback ?? $requisition->{$field}); $date = function (string $field) use ($requisition) { $stored = $requisition->{$field}; return old($field, $stored ? $stored->format('Y-m-d') : ''); }; $item = function (string $key) use ($requisition) { $stored = $requisition->item($key); if (old('document') !== null) { $stored['ticked'] = in_array($key, (array) old('document', []), true); $stored['quantity'] = (string) (old('quantity')[$key] ?? ''); $stored['remarks'] = (string) (old('remarks')[$key] ?? ''); $stored['label'] = (string) old('other_label', ''); } return $stored; }; @endphp