# WP3 — R&D product pickers → the shared product search

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

## Goal

`src/app/features/production/rnd/` is the **only** Production screen that still picks products with
a plain dropdown instead of the shared search. It eagerly loads the **entire product catalogue**
through a paginator that fetches 25 rows per request, filters client-side, and — if the request
fails — **swallows the error and leaves the list silently empty**.

Replace its product picker(s) with `<app-product-search>`
(`src/app/shared/components/product-search/product-search.component.ts`), which every other
Production screen already uses (boms, batches, consignment, mps, orders, routing, toll, tools).

## Why it matters beyond consistency

The shared search was upgraded this week: it now displays **`اسم الصنف — اسم العميل — الكود`** and
matches on the toll customer's name server-side. R&D is invisible to that improvement while it uses
its own dropdown — and on a catalogue with thousands of toll materials, two items legitimately share
a name across customers.

## What to build

1. Find every product picker in the R&D screen (there are **two**; confirm by reading the component
   + template rather than trusting this count).
2. Replace each with `<app-product-search>`, wired to the same form control / signal the dropdown
   fed. Read how a neighbouring Production screen (`boms.component.html` is the closest match) binds
   it and follow that exact usage — do not invent a new binding style.
3. Remove the now-dead full-catalogue preload and its state (the `listAll()` call, the products
   array, the client-side filter). **If any other part of the screen still reads that array, keep
   the load and say so in your report** — do not break a second feature to tidy this one.
4. Keep the empty-error-swallow from silently returning: if a remaining load can still fail, surface
   it the way the screen surfaces its other errors (PrimeNG `MessageService`), don't add a new pattern.

## Acceptance criteria

1. Both R&D product pickers are `<app-product-search>` and select the same value shape the form
   expects (verify the submitted payload key/type did not change — a picker that returns an object
   where the form wants an id is a silent break).
2. No full-catalogue preload remains on this screen for the picker's sake.
3. `npx ng build --base-href /app/` is green and `npx tsc --noEmit` reports no new errors.
4. RTL/Arabic labels render via existing i18n keys; **no new key is invented** unless genuinely
   needed — and if one is, add it to **both** `src/assets/i18n/ar.json` and `en.json`.

## ⛔ Hard rule on the i18n files

**NEVER** run `git checkout` / `git restore` / `git stash` on `src/assets/i18n/ar.json` or `en.json`.
They were destroyed once that way. Edit them additively only.

## Environment / rules

- Build: `cd /home/moonui2/public_html/moon-erp && npx ng build --base-href /app/`. Builds are
  pre-authorized — run them without asking. **Do not deploy to `/app`** — the orchestrator deploys.
- Commit on `hazemdev2`, conventional (`refactor(production): …`). **Do not push, do not merge.**
- `chown moonui2:moonui2` every file you edit.
- moonui2 ONLY — never touch `/home/moonui`.

## Out of scope

Any line-grid / column-layout work (WP4–WP8) · other Production screens · the shared search
component itself.
