{{--
Upload New Document — docs/wireframes-v12/add-upload-document.html
(the card at ~lines 79-217), CR-15 §3.2.
## Shape
ONE `.card`: a Reference section, a Document Details section with an "Add
More" button and a repeater, a Remark Notes section, and the footer. That is
the wireframe's own structure, section for section.
## This screen and bookings/documents.blade.php are NOT twins
They draw the same wireframe page and they are not a create/edit pair, so
recipe §9's twin rule does not apply and TwinViewParityTest is deliberately
NOT extended to cover them (CR-15 §4.4). The reason is that the two screens
answer different questions: the booking tab is reached FROM one booking and
one person, both fixed before the page is drawn, and its Customer control is
therefore a fixed display (CR-8 decision D11); this screen is reached from a
listing and its Customer control is a remote select2 over every confirmed
booking. Pairing them would assert that two different forms have the same
fields, which they must not.
What they DO share is the field names — `documents[i][customer_doc_type_id]`,
`documents[i][file]`, `customer_id`, `remarks` — because both write the same
rows through the same service, and this screen adds `booking_id` because it
is the one thing the tab gets from its URL.
## Deliberate differences from the wireframe
* **The Customer select is a remote select2** (decision D17), where v12
hardcodes six customers. The option label is the client's own format,
built server-side by CustomerDocumentBookingSearchController::label().
* **The Booking Type chip is revealed by choosing a customer**, which IS
the wireframe's behaviour (its `showBookingType()` does the same) — kept,
where the booking tab's version is always visible because there is
nothing to choose.
* **The "all uploaded" message after the chip is new** (decision D11), and
so is hiding the Document Details and Remark sections behind it. The
wireframe has no such state because its data is mock; a real person whose
booking type asks for four documents and who has all four has nothing to
upload, and a form that lets them try would be a form that only the
server could refuse.
* **The wireframe's eleven hard-coded document types are mock data.** The
real list is the CR-7 pivot, narrowed to active types mapped to the
booking's booking type, minus what the selected person already holds
(decision D18) and minus what the other rows have chosen (decision D12).
* **The wireframe's Row 2 is not drawn as a second row.** It exists to show
what a chosen file looks like, and that state is reproduced INSIDE every
row instead — see partials/document-row.blade.php.
* **Add More disappears at ten rows** (StoreCustomerDocumentRequest::MAX_ROWS),
which the wireframe's own `addDocRow()` never limits.
## No lang file (CR-15 §0.3)
Every string on this screen is written here, on the client's instruction —
including the ones the client module puts on screen, which come in through
one JSON `data-strings` attribute rather than living in Javascript.
## The screen's initial state is SERVER-rendered, always
No `change` event fires on a freshly drawn page, so the form module never
runs there. A rejected submit therefore comes back with the booking still
selected, the co-applicants listed, the chip showing and the rows carrying
their chosen types — all of it rendered here from `old()` and from the
controller's `$selectedBooking` / `$cascade`. That is CR-5 §15.4's lesson and
the reason this file is longer than the wireframe's markup.
The file inputs are the one thing that cannot come back: a browser will not
let a server refill a file input, so on a rejected submit the error renders
and the control comes back empty. The copy says so rather than pretending
otherwise.
--}}
@extends('layouts.app')
@section('title', 'Upload New Document')
@section('breadcrumbs')