# WP6 — FE: per-row warehouse + consignor pickers in the production issue dialog

## Goal
In the production-order material-issue dialog, let the user pick, PER material row: the source warehouse (own OR consignment) and — when the chosen warehouse is a consignment (امانات) warehouse — the specific customer (consignor) whose أمانة to draw from. Send `warehouse_id` + `owner_partner_id` per line to the BE (WP3/WP4 already consume them). Keep the dialog-level warehouse as the per-row default.

## Exact files (FE = /home/moonui2/public_html/moon-erp)
- `src/app/features/production/orders/production-orders.component.ts`:
  - `IssueLineRow` (~:76-91) — add optional `warehouse_id?: number | null` and `owner_partner_id?: number | null` per row.
  - `buildIssueLines()` (~:1007-1025) — initialize each row's `warehouse_id` to null (⇒ inherit dialog warehouse) and `owner_partner_id` to null.
  - The submit request builder (~:1179-1205) — for each line, include `warehouse_id` and `owner_partner_id` ONLY when set (send null/omit otherwise so OFF-path payload is unchanged).
  - Load a warehouses list (reuse the existing warehouse service; you already have the dialog-level warehouse options) and a customers/partners list (reuse the partner service used elsewhere, e.g. the toll customer picker at html:851 / a consignor list). A per-row `p-select` for warehouse; a per-row customer `p-select` shown only when the selected warehouse `is_consignment`.
  - The FE must know which warehouses are consignment — the warehouse model/list should carry `is_consignment` (verify; if the FE warehouse list already includes it, use it; else the customer picker can show whenever a non-default warehouse is chosen — but prefer keying on is_consignment).
- `src/app/features/production/orders/production-orders.component.html`:
  - In the issue-lines row loop (~:606) add a per-row warehouse picker + a per-row consignor picker (visible only for a consignment warehouse). Keep the dialog-level warehouse picker (~:581-586) as the default/fallback.
- i18n: add keys (ar + en) for the new column headers/labels (e.g. `PRODUCTION.LINE_WAREHOUSE`, `PRODUCTION.LINE_CONSIGNOR`, a hint that consignor draws from customer stock).

## BE contract (WP3/WP4/WP5 landed)
- Per line the BE accepts `warehouse_id` (nullable, company-scoped) + `owner_partner_id` (nullable, company-scoped): NULL ⇒ derive as today; 0 ⇒ own; >0 ⇒ that customer's consignment (off-book, no WIP). A consignor line requires a consignment warehouse + sufficient consignment on-hand or the BE returns a clean 422 (WP4) — surface that message to the user.
- When issuing over-plan (ISS-9105), the BE returns a 200 `{issued, held}`; each held element now ALSO carries `warehouse_id` + `owner_partner_id` (WP5 echo). **WP5-LOW:** the echo is per-material first-wins — if a material had MIXED per-line routing it's lossy. Simplest robust handling: when re-issuing a held material, the FE re-sends the routing from ITS OWN dialog row state (which has the exact per-line input), not just the echo. Keep the per-row routing in the component state so a held re-issue reproduces it.

## Acceptance
- Each issue row has a warehouse picker (defaulting to the dialog warehouse) and, for a consignment warehouse, a consignor (customer) picker.
- Issuing with per-row routing sends warehouse_id + owner_partner_id per line; the BE routes accordingly (own → WIP; consignor → that customer's أمانة, no WIP).
- A consignor line with insufficient consignment shows the BE's 422 message clearly.
- OFF-path: leaving all rows on the default warehouse + no consignor sends no per-line fields (or nulls) → identical to today.
- `ng build` green.

## Tests
Angular skipTests — gate is `npx ng build --base-href /app/` green + manual/e2e on /app after deploy.

## Flags
FE only. Conventional commit `feat(production): per-line warehouse + consignor pickers on material issue (ISS-2026-9166)` on hazemdev2. Do NOT deploy or touch main.

## Out of scope
- Any BE change. Phase 2 (create-issue-from-production-order).
