feat(editor): editor prestatii unificat in modal - un select, un rand de chips (PRD 5.23)

Inlocuieste cele 3 controale de asociere cod RAR cu un singur rand de chips
+ un singur select care adauga instant la change. Stare = un hidden chips_state
JSON versionat; post_form_chips redus la 2 actiuni (add/remove). Optgroup
Sugestii (fuzzy/k-NN) + optiune "Nu se declara la RAR" in select, cu tinta
implicita evidentiata si placeholder care o numeste. exclus persistat prin
payload_json (treapta noua de precedenta in resolve_prestatii, round-trip complet).

Siguranta: itemii exclusi sunt scosi din payload la momentul trimiterii
(worker split_prestatii_excluse inainte de build_rar_payload + filtru defensiv),
ca sa nu ajunga NICIODATA la RAR ca codPrestatie:null.

Suita: 1680 passed, 1 skipped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-07-08 15:45:34 +00:00
parent 0bc618763e
commit 56ebe1f7cb
20 changed files with 2839 additions and 552 deletions

View File

@@ -33,6 +33,16 @@ def _cod(p: object) -> str | None:
return str(cod).strip().upper() if cod else None
def _declarabil(p: object) -> bool:
"""Un item pleaca la RAR doar daca are cod si nu e adnotat exclus.
Filtru no-op pentru payload deja ingustat la declarabile; sarit ca ultima
plasa de siguranta — un item fara cod nu produce niciodata {codPrestatie: null}.
"""
exclus = p.get("exclus") if isinstance(p, dict) else getattr(p, "exclus", None)
return not exclus and _cod(p) is not None
def build_rar_payload(prezentare: dict[str, Any]) -> dict[str, Any]:
"""Mapeaza o prezentare interna (snake_case) -> payload exact pentru RAR postPrezentare."""
payload: dict[str, Any] = {
@@ -46,6 +56,7 @@ def build_rar_payload(prezentare: dict[str, Any]) -> dict[str, Any]:
"prestatii": [
{"codPrestatie": _cod(p), "idPrezentare": None}
for p in (prezentare.get("prestatii") or [])
if _declarabil(p)
],
"sistemReparat": prezentare.get("sistem_reparat") or "null",
"status": "FINALIZATA",