# LEDGER — Antibiotics Management screen (LIS)

**Feature:** موديول إدارة المضادات الحيوية (شاشة CRUD للمعمل)
**Date:** 2026-07-15 · **Install:** moonui · BE `hazemdev` · FE `hazemdev` · dev `moonui_dev_be`
**Source plan:** https://moonui.elbaset.com/his-analysis/antibiotics-management-plan.html (approved, "start immediately")
**Owner acceptance:** owner opens `/app/lab/antibiotics` (nav → المعمل → المضادات الحيوية), sees the 312-row catalog in a searchable table, can Add / Edit / Disable an antibiotic, and the change reflects in the culture AST picker.

## Decisions (owner defaults — do NOT re-litigate)
- **Backend is DONE** (verified): table `lab_antibiotics`, CRUD `GET/POST/PUT/DELETE /lis/antibiotics` in `LabNewTypesController`, perms `lis.antibiotics.view`/`lis.antibiotics.manage`, FE service `lis-antibiotic.service.ts` (list/listAll/create/update/delete), model `lis-antibiotic.model.ts`. Only the FE screen + wiring is missing.
- **Disable over delete** for used items (soft-delete exists); the trash action does a soft delete.
- **Unique code per company** — add to BE validation (WP3).
- **drug_class free-text** for MVP (no fixed list).
- Mirror the existing `specimen-types` CRUD screen (`features/lis/specimen-types/`).
- Fable emergency-only (owner). Codex per WP; native review if Codex blocked by bwrap.

## WP table
| WP | Scope (one dense line) | Repo | Depends | Review | Migration? | Status | Commits |
|----|------------------------|------|---------|--------|-----------|--------|---------|
| WP1+2 | FE component `features/lis/antibiotics/` (table+search+filter+add/edit dialog+soft-delete) + wiring (routes standalone+embedded, nav, i18n); consumes existing `LisAntibioticService`; mirror `specimen-types` | FE | — | Codex/native | no | ✅ done | FE `8731fad` — ng build green; native review clean (route+perm `lis.antibiotics` ✅, embedded+nav `pi pi-shield` ✅, 22 LIS.ANTIBIOTICS i18n ×2 + NAV ✅, uses existing service, manage-gated actions ✅). Client-side search/filter over listAll() (312 rows). No FE CHANGELOG (BE-side). |
| WP3 | BE: unique-code-per-company in store/update validation (`LabNewTypesController`) + grant `lis.antibiotics.view/manage` to lab-manager roles (seeder). Small. | BE | — | Codex/native | no (validation+seeder only) | ✅ done | BE `7cd96cb25` — Rule::unique (company scope + whereNull deleted_at + ignore on update) in store/update; role grant `RolePermissionSeeder:1157-58` (idempotent, seeded on dev). Pest **5 pass/16 assert** (dup-same-co 422, cross-co OK, self-edit OK, rename-collision 422, lab_manager holds both perms). ⚠️ agent finished work but forgot to commit → committed natively. No migration (validation-level unique). |

> Note: WP1+WP2 merged into one FE dispatch (component + its own wiring = one natural deliverable). WP3 is BE (different repo) → runs concurrently with the FE WP (safe: separate repos, no shared files).

## DAG / serialization
- WP1 → WP2 sequential (WP2 wires the WP1 component). Both FE.
- WP3 is BE and independent of WP1/WP2 — but run sequentially (one writer per repo; small) to keep the ledger clean.

## Baseline
- FE `ng build` green (session baseline, last bundle main-6V24WGZJ.js area). BE Pest: LIS suite — antibiotics CRUD already exists; WP3 adds a unique rule + seeder grant, run its touched tests.

## Deferrals
- (empty)

## Phase C — FINISH ✅ (2026-07-15)
All WPs done. FE `8731fad` + BE `7cd96cb25` + CHANGELOG `356271af6`. ng build green; Pest 5 pass. RESUME rewritten as end-state. 2 bilingual CHANGELOG bullets (screen + unique-code). ⛔ NOT deployed/merged — owner runs `/fullpush`.
