- base.html @media(max-width:767px): clasa .tabel-card (card per rand) scopata SEPARAT de .tabel-trimiteri 5.8; reguli formular full-width + butoane >=44px scopate pe #card-cont / #form-test-cheie / #filtre-jurnal (marker US-007) - _mapari.html: tabel-card + data-eticheta pe toate 4 tabelele; override select in card local (evita batalia de specificitate cu stilul inline) - _integrare.html: id=form-test-cheie (ancora de scope pe formularul de test) - R12 per-tabel: Mapari=card; Jurnal/Nomenclator/Admin=.tablewrap scroll contained; Cont/Integrare=fara tabele (doar formulare) - tests: +3 (tabele clasa responsive, formulare full-width, regresie carduri 5.8) - suita: 838 passed, 1 deselected - prd.json US-007 passes=true + notes; progress.txt Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
358 lines
16 KiB
HTML
358 lines
16 KiB
HTML
{% import '_macros.html' as ui %}
|
|
<div id="mapari-section">
|
|
<style>
|
|
/* Selectul de cod RAR e principalul vinovat de latimea tabelelor de mapari. Il limitam ca
|
|
tabelul sa incapa in card fara scroll orizontal -> coloana Actiuni (kebab) ramane vizibila. */
|
|
#mapari-section td select { width:100%; max-width:240px; min-width:150px; }
|
|
/* US-007 (R12): in card per rand (sub 767px) selectul/inputurile umplu cardul. */
|
|
@media (max-width:767px) {
|
|
#mapari-section td select, #mapari-section td input[type=text] { max-width:none; min-width:0; }
|
|
}
|
|
</style>
|
|
|
|
{% if message %}
|
|
<div class="flash" style="margin-bottom:12px;">{{ message }}</div>
|
|
{% endif %}
|
|
|
|
<!-- ============================================================ -->
|
|
<!-- Sectiunea 1: De rezolvat (operatii needs_mapping) -->
|
|
<!-- ============================================================ -->
|
|
<div class="card">
|
|
{# US-005 (5.5): antet standard + link Ajutor ca <details> nativ (fara JS). Toata proza
|
|
care inainte se repeta inline (scopul maparilor, Auto/Manual) traieste acum AICI,
|
|
o singura data, ascunsa implicit. #}
|
|
<h2 style="font-size:15px; margin:0 0 8px;">De rezolvat</h2>
|
|
<details class="ajutor-mapari" style="margin:0 0 12px;">
|
|
<summary class="cardlink" style="display:inline-flex; color:var(--accent); cursor:pointer; padding:4px 0;">Ajutor</summary>
|
|
<div class="muted" style="font-size:13px; margin-top:8px; max-width:680px;">
|
|
Maparile leaga o operatie din softul tau (cod intern ROAAUTO) de un cod RAR oficial.
|
|
Operatiile necunoscute raman blocate in <span class="s-needs_mapping">needs_mapping</span>
|
|
si NU pleaca la RAR pana le mapezi. Sugestiile (%) vin din potrivire fuzzy pe denumire —
|
|
verifica-le inainte sa salvezi. <strong>In coada</strong>: <strong>Auto</strong> = la
|
|
urmatoarele fisiere cu aceasta operatie randurile intra automat in coada;
|
|
<strong>Manual</strong> = raman pentru verificare, nimic nu pleaca la RAR pana confirmi.
|
|
La schimbarea unui cod, submission-urile blocate pe acea operatie se re-rezolva automat.
|
|
</div>
|
|
</details>
|
|
|
|
{% if not pending %}
|
|
<div class="empty">
|
|
Nicio operatie nemapata — tot ce a venit s-a tradus in coduri RAR.
|
|
<a href="/?tab=acasa">Importa un fisier nou</a> daca vrei sa adaugi prezentari.
|
|
</div>
|
|
{% else %}
|
|
<div data-dt="10">
|
|
<div class="dt-tools">
|
|
<input type="search" data-dt-search class="dt-search"
|
|
placeholder="Cauta operatie sau cod..." aria-label="Cauta in operatiile de rezolvat">
|
|
</div>
|
|
<div class="tablewrap tabel-card">
|
|
<table>
|
|
<thead><tr>
|
|
<th>Operatie</th>
|
|
<th>Sugestii</th>
|
|
<th>Cod RAR</th>
|
|
<th>In coada</th>
|
|
<th></th>
|
|
</tr></thead>
|
|
<tbody>
|
|
{% for e in pending %}
|
|
{% set top = e.suggestions[0] if e.suggestions else None %}
|
|
{% set preselect = top.cod_prestatie if (top and top.score >= 60) else '' %}
|
|
{# data-dt-row = haystack de cautare (randul contine un <select> cu tot nomenclatorul). #}
|
|
<tr data-dt-row="{{ e.cod_op_service }} {{ e.denumire or '' }}
|
|
{%- for s in e.suggestions[:3] %} {{ s.cod_prestatie }}{% endfor %}">
|
|
<td data-eticheta="Operatie">
|
|
<form id="map-rez-{{ loop.index }}" hx-post="/mapari" hx-target="#mapari-section" hx-swap="outerHTML">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token or '' }}">
|
|
<input type="hidden" name="cod_op_service" value="{{ e.cod_op_service }}">
|
|
</form>
|
|
<div><strong>{{ e.cod_op_service }}</strong>
|
|
<span class="pill" title="submission-uri blocate">{{ e.blocked }} blocate</span></div>
|
|
<div class="muted">{{ e.denumire or '(fara denumire)' }}</div>
|
|
</td>
|
|
<td class="muted" style="font-size:12px;" data-eticheta="Sugestii">
|
|
{% if e.suggestions %}
|
|
{% for s in e.suggestions[:3] %}
|
|
<span class="sugg">{{ s.cod_prestatie }} ({{ s.score|round|int }}%)</span>{% if not loop.last %}, {% endif %}
|
|
{% endfor %}
|
|
{% else %}—{% endif %}
|
|
</td>
|
|
<td data-eticheta="Cod RAR">
|
|
<select name="cod_prestatie" form="map-rez-{{ loop.index }}" required
|
|
aria-label="Cod RAR pentru {{ e.cod_op_service }}">
|
|
<option value="">— alege cod RAR —</option>
|
|
{% for n in nomenclator %}
|
|
<option value="{{ n.cod_prestatie }}" {% if n.cod_prestatie == preselect %}selected{% endif %}>
|
|
{{ n.cod_prestatie }} — {{ n.nume_prestatie }}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</td>
|
|
<td data-eticheta="In coada">
|
|
{{ ui.autosend_toggle(form_id="map-rez-" ~ loop.index, checked=True) }}
|
|
</td>
|
|
<td>
|
|
<button type="submit" form="map-rez-{{ loop.index }}">Salveaza</button>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="dt-empty" data-dt-empty style="display:none;">Nicio operatie nu se potriveste cautarii.</div>
|
|
<div class="dt-pager" data-dt-pager></div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- ============================================================ -->
|
|
<!-- Sectiunea 2: Mapari operatii salvate (operations_mapping) -->
|
|
<!-- ============================================================ -->
|
|
<div class="card">
|
|
<h2 style="font-size:15px; margin:0 0 12px;">Mapari operatii salvate</h2>
|
|
|
|
{% if not saved_mappings %}
|
|
<div class="empty">
|
|
Nicio mapare salvata inca. Pe masura ce mapezi operatii, ele apar aici si le poti edita oricand.
|
|
</div>
|
|
{% else %}
|
|
{# US-005 (5.5): proza explicativa mutata in panoul Ajutor de la "De rezolvat" (o singura data). #}
|
|
|
|
<div data-dt="10">
|
|
<div class="dt-tools">
|
|
<input type="search" data-dt-search class="dt-search"
|
|
placeholder="Cauta operatie sau cod RAR..." aria-label="Cauta in maparile salvate">
|
|
</div>
|
|
<div class="tablewrap tabel-card">
|
|
<table>
|
|
<thead><tr>
|
|
<th>Operatie</th>
|
|
<th>Cod RAR</th>
|
|
<th>In coada</th>
|
|
<th>Actiuni</th>
|
|
</tr></thead>
|
|
<tbody>
|
|
{% for m in saved_mappings %}
|
|
{# data-dt-row = haystack de cautare (randul contine un <select> cu tot nomenclatorul). #}
|
|
<tr data-dt-row="{{ m.cod_op_service }} {{ m.cod_prestatie }} {{ m.nume_prestatie or '' }}">
|
|
<td data-eticheta="Operatie">
|
|
<form id="map-salv-{{ loop.index }}" hx-post="/mapari/salvate" hx-target="#mapari-section" hx-swap="outerHTML">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token or '' }}">
|
|
<input type="hidden" name="cod_op_service" value="{{ m.cod_op_service }}">
|
|
</form>
|
|
<form id="map-del-{{ loop.index }}" hx-post="/mapari/salvate/sterge" hx-target="#mapari-section" hx-swap="outerHTML"
|
|
hx-confirm="Stergi maparea pentru {{ m.cod_op_service }}?">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token or '' }}">
|
|
<input type="hidden" name="cod_op_service" value="{{ m.cod_op_service }}">
|
|
</form>
|
|
<div><strong>{{ m.cod_op_service }}</strong></div>
|
|
<div class="muted" style="font-size:12px;">
|
|
acum: {{ m.cod_prestatie }}{% if m.nume_prestatie %} — {{ m.nume_prestatie }}{% endif %}
|
|
</div>
|
|
</td>
|
|
<td data-eticheta="Cod RAR">
|
|
<select name="cod_prestatie" form="map-salv-{{ loop.index }}" required
|
|
aria-label="Cod RAR pentru {{ m.cod_op_service }}">
|
|
{% for n in nomenclator %}
|
|
<option value="{{ n.cod_prestatie }}" {% if n.cod_prestatie == m.cod_prestatie %}selected{% endif %}>
|
|
{{ n.cod_prestatie }} — {{ n.nume_prestatie }}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</td>
|
|
<td data-eticheta="In coada">
|
|
{{ ui.autosend_toggle(form_id="map-salv-" ~ loop.index, checked=m.auto_send) }}
|
|
</td>
|
|
<td style="text-align:right; white-space:nowrap;" data-eticheta="Actiuni">
|
|
{# Salveaza/Sterge in meniu contextual (kebab) — randul ramane ingust. Butoanele se
|
|
leaga prin form= de cele doua form-uri hx-post definite in prima celula a randului. #}
|
|
<details class="kebab">
|
|
<summary aria-label="Actiuni pentru {{ m.cod_op_service }}">⋯</summary>
|
|
<div class="kebab-menu">
|
|
<button type="submit" form="map-salv-{{ loop.index }}">Salveaza</button>
|
|
<button type="submit" form="map-del-{{ loop.index }}" class="danger">Sterge</button>
|
|
</div>
|
|
</details>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="dt-empty" data-dt-empty style="display:none;">Nicio mapare nu se potriveste cautarii.</div>
|
|
<div class="dt-pager" data-dt-pager></div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- ============================================================ -->
|
|
<!-- Sectiunea 3: Formate de coloane salvate (column_mappings) -->
|
|
<!-- ============================================================ -->
|
|
<div class="card">
|
|
<h2 style="font-size:15px; margin:0 0 12px;">Formate de coloane salvate</h2>
|
|
|
|
{% if not column_formats %}
|
|
<div class="empty">
|
|
Niciun format de coloane salvat inca. La primul import, maparea coloanelor fisierului
|
|
se retine aici si se reaplica automat la fisierele cu acelasi antet.
|
|
</div>
|
|
{% else %}
|
|
<p class="muted" style="margin:0 0 12px; font-size:13px;">
|
|
Antetele de fisier recunoscute. Un fisier cu alte coloane = format nou separat.
|
|
</p>
|
|
|
|
<div data-dt="10">
|
|
<div class="dt-tools">
|
|
<input type="search" data-dt-search class="dt-search"
|
|
placeholder="Cauta coloana sau camp..." aria-label="Cauta in formatele de coloane">
|
|
</div>
|
|
<div class="tablewrap tabel-card">
|
|
<table>
|
|
<thead><tr>
|
|
<th>Coloane</th>
|
|
<th>Mapari (coloana → camp)</th>
|
|
<th>Format data</th>
|
|
<th></th>
|
|
</tr></thead>
|
|
<tbody>
|
|
{% for f in column_formats %}
|
|
<tr>
|
|
<td style="white-space:nowrap;" data-eticheta="Coloane">
|
|
<strong>{{ f.columns | length }} coloane</strong>
|
|
</td>
|
|
<td class="muted" style="font-size:12px; white-space:normal; max-width:340px;" data-eticheta="Mapari (coloana → camp)">
|
|
{% for col, camp in f.mappings.items() %}
|
|
<span class="sugg">{{ col }}</span> → {{ camp }}{% if not loop.last %}; {% endif %}
|
|
{% endfor %}
|
|
</td>
|
|
<td data-eticheta="Format data">
|
|
<form id="fmt-edit-{{ loop.index }}" hx-post="/formate-coloane/editeaza"
|
|
hx-target="#mapari-section" hx-swap="outerHTML"
|
|
style="display:flex; gap:6px; align-items:center;">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token or '' }}">
|
|
<input type="hidden" name="format_id" value="{{ f.id }}">
|
|
<input type="text" name="format_data" value="{{ f.format_data or '' }}"
|
|
placeholder="ex. DD.MM.YYYY" aria-label="Format data" style="max-width:130px;">
|
|
<button type="submit">Salveaza data</button>
|
|
</form>
|
|
</td>
|
|
<td>
|
|
<form hx-post="/formate-coloane/sterge" hx-target="#mapari-section" hx-swap="outerHTML"
|
|
hx-confirm="Stergi acest format de coloane?">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token or '' }}">
|
|
<input type="hidden" name="format_id" value="{{ f.id }}">
|
|
<button type="submit" style="background:var(--card); color:var(--err); border-color:var(--err);">
|
|
Sterge
|
|
</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="dt-empty" data-dt-empty style="display:none;">Niciun format nu se potriveste cautarii.</div>
|
|
<div class="dt-pager" data-dt-pager></div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- ============================================================ -->
|
|
<!-- Sectiunea 4: Reguli automate pe text (operation_text_rules) -->
|
|
<!-- ============================================================ -->
|
|
<div class="card">
|
|
<h2 style="font-size:15px; margin:0 0 8px;">Reguli automate (text)</h2>
|
|
<p class="muted" style="margin:0 0 12px; font-size:13px; max-width:680px;">
|
|
O regula leaga orice operatie al carei text <strong>contine</strong> (nu egal, ci substring)
|
|
un cuvant de un cod RAR. Util pentru operatii fara cod intern: ex. orice operatie care
|
|
<em>contine</em> „verificare" primeste codul ales. Match insensibil la majuscule/diacritice.
|
|
<strong>In coada</strong>: implicit oprit — regula rezolva codul dar tine randul pentru
|
|
verificare umana pana activezi „In coada".
|
|
</p>
|
|
|
|
{% if not text_rules %}
|
|
<div class="empty" style="margin-bottom:12px;">
|
|
Inca nu ai reguli. Ex: operatia contine «verificare» → OE-2.
|
|
Mapeaza automat operatii similare fara cod intern. Adauga prima regula mai jos.
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="tablewrap tabel-card">
|
|
<table>
|
|
<thead><tr>
|
|
<th>Daca operatia contine</th>
|
|
<th>Cod RAR</th>
|
|
<th>In coada</th>
|
|
<th>Actiuni</th>
|
|
</tr></thead>
|
|
<tbody>
|
|
{% for r in text_rules %}
|
|
<tr>
|
|
<td data-eticheta="Daca operatia contine">
|
|
<form id="rt-del-{{ loop.index }}" hx-post="/mapari/reguli-text/sterge"
|
|
hx-target="#mapari-section" hx-swap="outerHTML"
|
|
hx-confirm="Stergi regula «{{ r.pattern }}»?">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token or '' }}">
|
|
<input type="hidden" name="pattern" value="{{ r.pattern }}">
|
|
</form>
|
|
<div>contine <strong>«{{ r.pattern }}»</strong></div>
|
|
</td>
|
|
<td class="muted" style="font-size:12px;" data-eticheta="Cod RAR">
|
|
{{ r.cod_prestatie }}
|
|
</td>
|
|
<td class="muted" style="font-size:12px;" data-eticheta="In coada">
|
|
{% if r.auto_send %}Auto (in coada){% else %}Manual (verificare){% endif %}
|
|
</td>
|
|
<td style="text-align:right; white-space:nowrap;">
|
|
<button type="submit" form="rt-del-{{ loop.index }}"
|
|
style="background:var(--card); color:var(--err); border-color:var(--err);">
|
|
Sterge
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
{# Rand de adaugare (mereu prezent ca placeholder, inclusiv in empty state). #}
|
|
<tr>
|
|
<td data-eticheta="Daca operatia contine">
|
|
<form id="rt-add" hx-post="/mapari/reguli-text" hx-target="#mapari-section" hx-swap="outerHTML">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token or '' }}">
|
|
<input type="text" name="pattern" required
|
|
placeholder="ex. verificare"
|
|
aria-label="Text continut in operatie"
|
|
style="width:100%; max-width:240px;"
|
|
hx-post="/mapari/reguli-text/preview"
|
|
hx-trigger="keyup delay:400ms"
|
|
hx-target="#rt-preview"
|
|
hx-swap="innerHTML"
|
|
hx-include="#rt-add">
|
|
</form>
|
|
</td>
|
|
<td data-eticheta="Cod RAR">
|
|
<select name="cod_prestatie" form="rt-add" required aria-label="Cod RAR pentru regula text">
|
|
<option value="">— alege cod RAR —</option>
|
|
{% for n in nomenclator %}
|
|
<option value="{{ n.cod_prestatie }}">{{ n.cod_prestatie }} — {{ n.nume_prestatie }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</td>
|
|
<td data-eticheta="In coada">
|
|
{{ ui.autosend_toggle(form_id="rt-add", checked=False) }}
|
|
</td>
|
|
<td style="text-align:right; white-space:nowrap;">
|
|
<button type="submit" form="rt-add">Adauga</button>
|
|
</td>
|
|
</tr>
|
|
{# Preview pre-salvare (US-009): cate operatii nemapate potriveste pattern-ul. #}
|
|
<tr>
|
|
<td colspan="4" style="padding-top:0;">
|
|
<div id="rt-preview" aria-live="polite"></div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|