PRD 5.16 — propagare design finalizata (system font stack, fara IBM Plex self-hostat): - US-001/002/008: tokeni --font-ui/--font-mono (system stack) + scala --fs-*; zero @font-face si zero /static/fonts/; landing aliniat la acelasi stack - US-003: RAR online = dot compact in antet + meniu burger; banda rosie DOAR pe blocat (invariant zero-silent-failures pastrat) - US-010: antet "ROMFAST AUTOPASS" + nume service + /login brandeit 2 coloane + badge plan; meniu burger cu separatoare; gate strict pe is_authenticated - US-011: selector tema pill icon+eticheta (reuse THEMES) - US-004/005/006/007: bug-fix editor prestatii (picker cod+denumire, add_extra in mod operatii, cod ales se salveaza fara "+", Renunta inchide via closest) - US-012/013: landing Autentificare->/login; wizard import colapsat + 4 pasi pe tokeni - fix VERIFY E2E: contoare duplicate pe 390px (inline display:flex batea @media) -> CSS + test-lock PRD 5.17 — tipuri de cont + trial Pro 30z + enforcement DUR: - US-001/002/008: accounts.tier + trial_until (migrare aditiva defensiva); app/plans.py sursa unica (PLANS, FREE_MONTHLY_LIMIT=60, effective_tier(now injectabil), monthly_usage, CONSUMED_STATUSES); create_account trial Pro 30z; CLI set-tier (protejat id=1, audit) - US-003/004/005: enforce volum 60/luna INAINTE de build_key pe ambele canale (PLAN_LIMITA_LUNARA, 3 niveluri + log_event); gate API Pro+ (PLAN_FARA_API 403 actionabil); valideaza/nomenclator raman permise; downgrade lazy; flag AUTOPASS_ENFORCE_PLANS (kill-switch) - US-006: badge plan antet + linie burger + consum N/60 + warn>=80% + 6 stari + copy RO pluralizat + banner one-time trial->Gratuit + pagina Cont Regresie: 1380 passed, 0 failed, 1 deselected (live). E2E browser pe 390/1280 confirmat. Backend trimitere (worker/masina stari/idempotenta/contract RAR) NEATINS. Lucrul 5.18 (corpus kNN) ramane separat, necomis. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
232 lines
11 KiB
HTML
232 lines
11 KiB
HTML
{#
|
||
_chips_prestatii.html — sectiunea de prestatii chips (E4, server-driven via /form-chips).
|
||
|
||
Re-randata de endpoint-ul /form-chips la fiecare add/remove de chip.
|
||
Inclusa si din _form_editare.html pentru randarea initiala.
|
||
|
||
Starea chip-urilor traieste in input-uri hidden din form (NU in DB mid-edit).
|
||
Fiecare operatie are un picker propriu cand e nemapata (E4 binding op<->cod).
|
||
Reveal odometru initial semnalat prin data-has-r-odo="true" si chip-warn pe R-ODO/I-ODO.
|
||
|
||
Context vars (toate cu defaults):
|
||
prestatii_chips — list of {cod_prestatie, cod_op_service, denumire}
|
||
nomenclator_rar — list of {cod_prestatie, nume_prestatie} pentru picker
|
||
has_r_odo — True daca orice chip e R-ODO sau I-ODO (server-computed)
|
||
form_chips_url — URL pentru HTMX; default '/form-chips'
|
||
chips_section_id — ID div (default 'chips-section')
|
||
csrf_token — CSRF (trecut prin hx-include din form parinte)
|
||
#}
|
||
{% set _chips_url = form_chips_url or '/form-chips' %}
|
||
{% set _sec_id = chips_section_id or 'chips-section' %}
|
||
{% set _chips = prestatii_chips or [] %}
|
||
{% set _has_ops = _chips | selectattr('cod_op_service') | list | length > 0 %}
|
||
{# US-009: chips_submission_id e setat din _detaliu_ctx cand chips sunt randate in modalul de detaliu.
|
||
Lipseste cand _chips_prestatii.html e rerandat via /form-chips (stateless, fara submission). #}
|
||
{% set _sub_id = chips_submission_id if chips_submission_id is defined else none %}
|
||
|
||
<div id="{{ _sec_id }}" data-has-r-odo="{{ 'true' if has_r_odo else 'false' }}"
|
||
aria-live="polite" aria-label="Prestatii cod RAR">
|
||
|
||
{# ===== Input-uri hidden pentru starea curenta a chip-urilor =====
|
||
TOATE itemele emit 3 hidden inputs (cod poate fi "" pentru unmapped).
|
||
Paralele index-by-index: cod_prestatie[i], chip_op_service[i], chip_denumire[i].
|
||
Filtrate la submit de post_corectie_trimitere (coduri goale = neschimbate). #}
|
||
{% for chip in _chips %}
|
||
<input type="hidden" name="cod_prestatie" value="{{ chip.cod_prestatie or '' }}">
|
||
<input type="hidden" name="chip_op_service" value="{{ chip.cod_op_service or '' }}">
|
||
<input type="hidden" name="chip_denumire" value="{{ chip.denumire or '' }}">
|
||
{% endfor %}
|
||
|
||
<div class="camp-slim" style="margin-bottom:8px;">
|
||
<label>Prestatii — cod RAR pe fiecare operatie</label>
|
||
|
||
{% if _has_ops %}
|
||
{# ===== Mod operatii: UN picker PE operatie (E4 binding) ===== #}
|
||
{% for chip in _chips %}
|
||
{% if chip.cod_op_service %}
|
||
{% set _is_warn = chip.cod_prestatie in ('R-ODO', 'I-ODO') %}
|
||
{% set _nemapat = not chip.cod_prestatie %}
|
||
<div class="op-row {% if _nemapat %}op-row-warn{% endif %}" style="margin-bottom:6px;">
|
||
<span class="op-row-name">
|
||
{{ chip.cod_op_service }}
|
||
{% if chip.denumire and chip.denumire != chip.cod_op_service %}
|
||
<span class="muted" style="font-weight:400;font-size:11px;"> — {{ chip.denumire }}</span>
|
||
{% endif %}
|
||
{% if _nemapat %}
|
||
<span style="color:var(--warn);font-size:10px;font-weight:400;"> · lipsa cod</span>
|
||
{% endif %}
|
||
</span>
|
||
<span style="display:flex;align-items:center;gap:8px;">
|
||
{% if chip.cod_prestatie %}
|
||
{# ===== Operatie mapata: chip cu × ===== #}
|
||
<span class="chip {% if _is_warn %}chip-warn{% endif %}"
|
||
aria-label="Prestatie {{ chip.cod_prestatie }} adaugata pentru {{ chip.cod_op_service }}">
|
||
{{ chip.cod_prestatie }}
|
||
<button type="button" class="chip-del"
|
||
hx-post="{{ _chips_url }}"
|
||
hx-include="closest form"
|
||
hx-target="#{{ _sec_id }}"
|
||
hx-swap="outerHTML"
|
||
hx-vals='{"chips_action":"remove","chips_remove_index":{{ loop.index0 }}}'
|
||
aria-label="Sterge codul {{ chip.cod_prestatie }} pentru {{ chip.cod_op_service }}">
|
||
×
|
||
</button>
|
||
</span>
|
||
{# US-009: "salveaza ca regula op->cod" — apare doar cand submission_id e cunoscut
|
||
(in modalul de detaliu, nu la re-randarea stateless via /form-chips).
|
||
Reuse EXACT save_mapping + reresolve_account via endpoint dedicat.
|
||
hx-include="closest form" propaga csrf_token din form-ul parinte. #}
|
||
<span id="save-rule-slot-{{ loop.index0 }}" class="save-rule-slot">
|
||
{% if _sub_id and chip.cod_op_service and chip.cod_prestatie %}
|
||
<button type="button"
|
||
style="font-size:10px;color:var(--muted);background:none;border:none;cursor:pointer;text-decoration:underline;padding:0;margin-left:4px;line-height:1;"
|
||
hx-post="/trimitere/{{ _sub_id }}/salveaza-regula-chip"
|
||
hx-include="closest form"
|
||
hx-target="#detaliu-modal-body"
|
||
hx-swap="innerHTML"
|
||
hx-vals='{"salveaza_op":{{ chip.cod_op_service | tojson }},"salveaza_cod":{{ chip.cod_prestatie | tojson }}}'
|
||
aria-label="Salveaza regula {{ chip.cod_op_service }} -> {{ chip.cod_prestatie }}">
|
||
salveaza ca regula
|
||
</button>
|
||
{% endif %}
|
||
</span>
|
||
{% else %}
|
||
{# ===== Operatie nemapata: picker galben cu "alege cod RAR" ===== #}
|
||
<select name="chips_add_cod_{{ loop.index0 }}"
|
||
id="picker-op-{{ loop.index0 }}"
|
||
aria-label="Alege cod RAR pentru {{ chip.cod_op_service }}"
|
||
style="min-width:160px;font-size:11px;height:26px;">
|
||
<option value="">— alege cod RAR —</option>
|
||
{% for n in (nomenclator_rar or []) %}
|
||
<option value="{{ n.cod_prestatie }}">{{ n.cod_prestatie }} — {{ n.nume_prestatie }}</option>
|
||
{% endfor %}
|
||
</select>
|
||
<button type="button"
|
||
class="add-code"
|
||
hx-post="{{ _chips_url }}"
|
||
hx-include="closest form"
|
||
hx-target="#{{ _sec_id }}"
|
||
hx-swap="outerHTML"
|
||
hx-vals='{"chips_action":"add","chips_add_op_index":{{ loop.index0 }}}'
|
||
aria-label="Adauga cod RAR pentru {{ chip.cod_op_service }}">
|
||
+ Adauga
|
||
</button>
|
||
{% endif %}
|
||
</span>
|
||
</div>
|
||
{% endif %}
|
||
{% endfor %}
|
||
|
||
{# ===== US-005 (5.16): Chips extra + picker '+ Adauga alta operatie / cod RAR' in mod operatii ===== #}
|
||
{# Chips extra: cod_op_service gol, cod_prestatie setat — afisate flat cu × (reuse remove_flat) #}
|
||
<div class="chips" role="group" aria-label="Coduri RAR suplimentare" style="margin-top:4px;">
|
||
{% for chip in _chips %}
|
||
{% if not chip.cod_op_service and chip.cod_prestatie %}
|
||
{% set _is_warn_extra = chip.cod_prestatie in ('R-ODO', 'I-ODO') %}
|
||
<span class="chip {% if _is_warn_extra %}chip-warn{% endif %}"
|
||
aria-label="Cod RAR suplimentar {{ chip.cod_prestatie }}">
|
||
{{ chip.cod_prestatie }}
|
||
<button type="button" class="chip-del"
|
||
hx-post="{{ _chips_url }}"
|
||
hx-include="closest form"
|
||
hx-target="#{{ _sec_id }}"
|
||
hx-swap="outerHTML"
|
||
hx-vals='{"chips_action":"remove_flat","chips_remove_cod":"{{ chip.cod_prestatie }}"}'
|
||
aria-label="Sterge codul suplimentar {{ chip.cod_prestatie }}">×</button>
|
||
</span>
|
||
{% endif %}
|
||
{% endfor %}
|
||
</div>
|
||
{% if nomenclator_rar %}
|
||
<span style="display:inline-flex;align-items:center;gap:4px;margin-top:4px;">
|
||
<select name="chips_add_cod_flat"
|
||
aria-label="Adauga cod RAR suplimentar"
|
||
style="min-width:160px;font-size:11px;height:26px;border:1px dashed color-mix(in srgb,var(--accent) 55%,var(--line));border-radius:5px;background:transparent;color:var(--accent);">
|
||
<option value="">+ Adauga alta operatie / cod RAR</option>
|
||
{% for n in nomenclator_rar %}
|
||
<option value="{{ n.cod_prestatie }}">{{ n.cod_prestatie }} — {{ n.nume_prestatie }}</option>
|
||
{% endfor %}
|
||
</select>
|
||
<button type="button"
|
||
class="add-code"
|
||
hx-post="{{ _chips_url }}"
|
||
hx-include="closest form"
|
||
hx-target="#{{ _sec_id }}"
|
||
hx-swap="outerHTML"
|
||
hx-vals='{"chips_action":"add_extra"}'
|
||
aria-label="Adauga cod RAR suplimentar la trimitere">
|
||
+
|
||
</button>
|
||
</span>
|
||
{% else %}
|
||
{# T-D1/T-E5 (5.16): empty state in mod operatii cand nomenclatorul lipseste #}
|
||
<div class="chips-nom-gol" style="font-size:11px;color:var(--warn);padding:4px 0;margin-top:4px;">
|
||
Nomenclator indisponibil — adaugarea de coduri suplimentare nu e posibila.
|
||
</div>
|
||
{% endif %}
|
||
{% if chips_extra_error %}
|
||
{# T-C1/T-E4 (5.16): semnal vizibil cand add_extra are select gol sau cod invalid #}
|
||
<div class="chips-extra-error" style="font-size:11px;color:var(--err);padding:2px 0;" role="alert">
|
||
Selecteaza un cod RAR din lista inainte de a adauga.
|
||
</div>
|
||
{% endif %}
|
||
|
||
{% else %}
|
||
{# ===== Mod plat: lista de coduri libere (corectie pura, fara op_service) ===== #}
|
||
<div class="chips" role="group" aria-label="Coduri RAR selectate">
|
||
{% for chip in _chips %}
|
||
{% if chip.cod_prestatie %}
|
||
{% set _is_warn_flat = chip.cod_prestatie in ('R-ODO', 'I-ODO') %}
|
||
<span class="chip {% if _is_warn_flat %}chip-warn{% endif %}"
|
||
aria-label="Prestatie {{ chip.cod_prestatie }}">
|
||
{{ chip.cod_prestatie }}
|
||
<button type="button" class="chip-del"
|
||
hx-post="{{ _chips_url }}"
|
||
hx-include="closest form"
|
||
hx-target="#{{ _sec_id }}"
|
||
hx-swap="outerHTML"
|
||
hx-vals='{"chips_action":"remove_flat","chips_remove_cod":"{{ chip.cod_prestatie }}"}'
|
||
aria-label="Sterge codul {{ chip.cod_prestatie }}">×</button>
|
||
</span>
|
||
{% endif %}
|
||
{% endfor %}
|
||
{# Picker adaugare cod nou in mod plat #}
|
||
{% if nomenclator_rar %}
|
||
<span style="display:inline-flex;align-items:center;gap:4px;">
|
||
<select name="chips_add_cod_flat"
|
||
aria-label="Adauga cod RAR nou"
|
||
style="font-size:11px;height:22px;border:1px dashed color-mix(in srgb,var(--accent) 55%,var(--line));border-radius:5px;background:transparent;color:var(--accent);">
|
||
<option value="">+ cod</option>
|
||
{% for n in nomenclator_rar %}
|
||
<option value="{{ n.cod_prestatie }}">{{ n.cod_prestatie }} — {{ n.nume_prestatie }}</option>
|
||
{% endfor %}
|
||
</select>
|
||
<button type="button"
|
||
class="add-code"
|
||
hx-post="{{ _chips_url }}"
|
||
hx-include="closest form"
|
||
hx-target="#{{ _sec_id }}"
|
||
hx-swap="outerHTML"
|
||
hx-vals='{"chips_action":"add_flat"}'
|
||
aria-label="Adauga cod RAR selectat in lista">
|
||
+
|
||
</button>
|
||
</span>
|
||
{% else %}
|
||
{# T-D1/T-E5 (5.16): empty state in mod plat cand nomenclatorul lipseste #}
|
||
<div class="chips-nom-gol" style="font-size:11px;color:var(--warn);padding:4px 0;">
|
||
Nomenclator indisponibil — nu se pot adauga coduri RAR momentan.
|
||
</div>
|
||
{% endif %}
|
||
</div>
|
||
{% endif %}
|
||
|
||
{# Hint discret fara chips (debut) #}
|
||
{% if not _chips %}
|
||
<div style="font-size:10px;color:var(--muted);padding:4px 0;">
|
||
Niciun cod RAR inca — alege din picker (sus) sau adauga prin mapare.
|
||
</div>
|
||
{% endif %}
|
||
</div>
|
||
</div>
|