# WP6 — Master Production Schedule lines → the shared line-items component

**Repo:** FE (`/home/moonui2/public_html/moon-erp`) · **Branch:** `hazemdev2` · **Depends on WP4/WP5** · **BE change:** none

## Goal

`src/app/features/production/mps/` is the **one Production grid whose shape is a document line**:
product · period · quantity · source · delete. Convert it to the full shared grid
`src/app/shared/components/transaction-line-items/transaction-line-items.component.ts` — the same
component the sales/purchase documents use — so it inherits reorder, resize, hide, and the shared
product cell for free.

This is the proof-of-concept conversion: it is the cheapest one, and it is the template for judging
whether further full conversions are worth it.

## The one real cost: signals → `FormArray`

`TransactionLineItemsComponent` takes `@Input({required:true}) items!: FormArray`. The MPS screen
currently holds its lines in a **signal array**, not a reactive form. Converting that state is the
bulk of this WP.

- Read how a converted screen does it (`src/app/features/sales/...` order/invoice screens are the
  canonical callers) — mirror the `FormArray` construction, the descriptor, and the `docKey` input.
- Every place that reads or writes the lines signal must move to the `FormArray` — add-line,
  delete-line, the save payload builder, any validation, any computed total. **Grep for every
  reference before you start**; a missed reader silently reads a stale empty array.
- Keep the submitted payload **identical**. Verify by comparing the built payload before and after
  for the same input, and say how you verified it.

## docKey

**`production.mps`** — registered by WP4. If a registry field key does not match the real control
name, fix the registry and say so in your report.

## Acceptance criteria

1. Add / edit / delete an MPS line works exactly as before, including validation messages.
2. The product cell is the shared product search (so it shows `name — customer — code` and matches on
   the toll customer's name, like every other Production screen).
3. Header drag reorders, edge drag resizes, both persist company-wide and survive reload.
   If this grid renders inside a dialog, confirm the resize works there (WP4's fix).
4. Non-locked columns hide from the Documents settings screen; `product_id`, `period`, `quantity`
   stay locked.
5. Saving an unchanged schedule produces a payload identical to before this WP.
6. `npx ng build --base-href /app/` green; `npx tsc --noEmit` no new errors.

## If it turns out not to fit

If, on reading the real screen, the conversion needs the shared component to grow a new cell type or
a new capability, **stop and report** rather than modifying the shared template — 12 live screens
depend on it. Falling back to `TxColumnLayout` over the existing cells (the WP5 approach) is an
acceptable outcome; say so clearly and do that instead. Delivering column control matters more than
which mechanism delivers it.

## Environment / rules

- ⛔ **NEVER** `git checkout` / `restore` / `stash` on `src/assets/i18n/ar.json` or `en.json`.
  Additive edits only; a new key goes in BOTH files.
- **Do NOT deploy to `/app`** — the orchestrator deploys.
- `chown moonui2:moonui2` every edited file. Commit on `hazemdev2`, conventional. **No push, no merge.**
- moonui2 ONLY — never `/home/moonui`. Never print a git remote URL.

## Out of scope

Other Production screens · changing the MPS backend contract · modifying
`TransactionLineItemsComponent` itself.
