{{-- The Document Verified section of the two cancellation form twins — docs/wireframes-v12/add-cancellation.html:159-195 and the byte-identical block in edit-cancellation.html:151-187. @include('cancellations.partials.document-verified', [ 'selectedStage' => $selectedStage, // CancellationStage|null 'verified' => $verified, // list ]) ## Why this one block is shared when the twins are not CR-9 §0.6 asks for separate create and edit blade files "sharing partials where sensible", and this is the block where it is: the section is ~40 lines of markup driven entirely by CancellationStage — two cards, two panels and seven checkboxes whose text, numbering and grouping all come out of documents() — and both wireframes draw it identically, character for character. The bookings module drew the same line in the same place: its twins duplicate every field and share co-owner-block.blade.php, because a block generated from a loop has no wording of its own to drift. ## The stage checkboxes Two `` sharing ONE name, each carrying its enum value — which is how the wireframe's two independent-looking cards submit the single `stage` field CancellationRequest validates. They are **mutually exclusive and one is required**, in the client's own words: "User can only checked single option ... From this two option one need to checked before cancellation proceed". nrems-cancellation-form.js enforces the exclusivity; the server enforces required + enum on every submit regardless of whether any Javascript ran. Radio buttons would have been the honest control for "one of two", and they are deliberately not used: the client drew checkboxes, the cards are the client's design, and a radio cannot be un-picked once picked — which matters on the edit screen, where a user who ticked the wrong stage would otherwise have no way back to "neither" before choosing again. ## Why the hidden panel's boxes are `disabled` and not just hidden Both panels' checkboxes post as `verified_docs[]`, so a box left ticked in the panel the user switched AWAY from would still be submitted — and it would often survive validation, because the Before list's numbers 1-3 are all valid numbers in the After list too. The result would be a cancellation recorded against three documents nobody verified, and no layer could detect it: the numbers are in range and the stage is real. `disabled` closes that, in the markup, before any script runs: a disabled control is not submitted at all. The server renders the non-selected panel disabled on first paint (including after a validation error, where `old()` decides which panel that is) and the module flips `hidden` and `disabled` together whenever the user changes cards. Ticks are preserved rather than cleared, so switching stage and switching back does not lose the user's work. ## Escaping Every string here comes from CancellationStage::documents(), which is a constant of the application, and every one still goes out through `{{ }}`. There is no raw output in this file. The item numbers are the array keys, not part of the text, so the list cannot end up with two "3."s in it. No lang file (CR-9 §0.1): the helper line and the panel titles are written here. --}} @php /** @var \App\Enums\CancellationStage|null $selectedStage */ /** @var list $verified */ // Fully qualified rather than imported: a `use` statement in a Blade file is // a file-scoped compile-time directive inside a template that gets included, // and the house style everywhere else in this application is the FQN at the // call site. bookings/create.blade.php does the same with Occupation. $stages = \App\Enums\CancellationStage::cases(); @endphp
Document Verified
{{-- The wireframe's helper line, verbatim. --}}
Select the cancellation stage and verify applicable documents.
{{-- The errors for `stage` and for the checklist are rendered here rather than by : the controls are a pair of checkbox cards and a list of boxes inside them, and there is no single field the shared shell could hang either message under. Read through form_error_message(), the same helper the shell uses — so the second call also picks up `verified_docs.3`, which is where validateVerifiedDocs() puts its message (that helper falls back to `{name}.*`). Same classes, same id shape, so both look like every other inline error on the form. --}} @php $stageError = form_error_message('stage'); $docsError = form_error_message('verified_docs'); @endphp @if ($stageError !== null)
{{ $stageError }}
@endif @if ($docsError !== null)
{{ $docsError }}
@endif
@foreach ($stages as $stage) @php $isSelected = $selectedStage === $stage; $panelId = 'can_stage_panel_'.$stage->value; @endphp @endforeach