Acasa = ecran de import (tab Import scos, ?tab=import->Acasa). Bara status compacta pe 2 randuri cu bife accesibile (glife + text) + data formatata. 'Coada'->'Trimiteri': coloane RO, stare umana, detaliu la click in panou dedicat. Mapari pe 3 sectiuni (de rezolvat / op salvate / formate coloane), Cont doar cheie+creds. Filtrare Trimiteri, corectie inline needs_data cu re-enqueue + detectie coliziune idempotency, badge contoare pe tab-uri. Helper pur partajat payload_view.py (web + GET /v1/prezentari). Backend trimitere (worker/idempotenta/mapping/schema) neatins. 483 teste. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
183 lines
7.5 KiB
HTML
183 lines
7.5 KiB
HTML
<div id="mapari-section">
|
|
|
|
{% if message %}
|
|
<div class="flash" style="margin-bottom:12px;">{{ message }}</div>
|
|
{% endif %}
|
|
|
|
<!-- ============================================================ -->
|
|
<!-- Sectiunea 1: De rezolvat (operatii needs_mapping) -->
|
|
<!-- ============================================================ -->
|
|
<div class="card">
|
|
<h2 style="font-size:15px; margin:0 0 12px;">De rezolvat</h2>
|
|
|
|
{% 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 %}
|
|
<p class="muted" style="margin:0 0 12px; font-size:13px;">
|
|
Operatii ROAAUTO necunoscute, blocate in <span class="s-needs_mapping">needs_mapping</span>.
|
|
Alege codul RAR (sugestia fuzzy e preselectata) si salveaza — submission-urile se deblocheaza automat.
|
|
</p>
|
|
|
|
{% 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 '' %}
|
|
<form class="maprow" 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 }}">
|
|
|
|
<div class="mapcol grow">
|
|
<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>
|
|
{% if e.suggestions %}
|
|
<div class="muted" style="font-size:12px; margin-top:4px;">
|
|
sugestii:
|
|
{% for s in e.suggestions[:3] %}
|
|
<span class="sugg">{{ s.cod_prestatie }} ({{ s.score|round|int }}%)</span>{% if not loop.last %}, {% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="mapcol">
|
|
<select name="cod_prestatie" required>
|
|
<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>
|
|
</div>
|
|
|
|
<div class="mapcol">
|
|
<label class="chk"><input type="checkbox" name="auto_send" value="true" checked> auto-send</label>
|
|
</div>
|
|
|
|
<div class="mapcol">
|
|
<button type="submit">Salveaza</button>
|
|
</div>
|
|
</form>
|
|
{% endfor %}
|
|
{% 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 %}
|
|
<p class="muted" style="margin:0 0 12px; font-size:13px;">
|
|
Maparile operatie -> cod RAR retinute pentru contul tau. Schimba codul sau auto-send si salveaza;
|
|
la schimbarea unui cod, submission-urile blocate pe acea operatie se re-rezolva automat.
|
|
</p>
|
|
|
|
{% for m in saved_mappings %}
|
|
<form class="maprow" 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 }}">
|
|
|
|
<div class="mapcol grow">
|
|
<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>
|
|
</div>
|
|
|
|
<div class="mapcol">
|
|
<select name="cod_prestatie" 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>
|
|
</div>
|
|
|
|
<div class="mapcol">
|
|
<label class="chk"><input type="checkbox" name="auto_send" value="true"
|
|
{% if m.auto_send %}checked{% endif %}> auto-send</label>
|
|
</div>
|
|
|
|
<div class="mapcol" style="display:flex; gap:6px;">
|
|
<button type="submit">Salveaza</button>
|
|
</div>
|
|
<div class="mapcol">
|
|
<button type="submit"
|
|
hx-post="/mapari/salvate/sterge" hx-target="#mapari-section" hx-swap="outerHTML"
|
|
hx-confirm="Stergi maparea pentru {{ m.cod_op_service }}?"
|
|
style="background:var(--card); color:var(--err); border-color:var(--err);">
|
|
Sterge
|
|
</button>
|
|
</div>
|
|
</form>
|
|
{% endfor %}
|
|
{% 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 (nu suprascrie).
|
|
</p>
|
|
|
|
{% for f in column_formats %}
|
|
<div class="maprow" style="align-items:flex-start;">
|
|
<div class="mapcol grow">
|
|
<div style="font-size:13px; margin-bottom:4px;">
|
|
<strong>{{ f.columns | length }} coloane recunoscute</strong>
|
|
{% if f.format_data %}
|
|
<span class="pill" title="format data">data: {{ f.format_data }}</span>
|
|
{% endif %}
|
|
</div>
|
|
<div class="muted" style="font-size:12px;">
|
|
{% for col, camp in f.mappings.items() %}
|
|
<span class="sugg">{{ col }}</span> → {{ camp }}{% if not loop.last %}; {% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
|
|
<form class="mapcol" style="display:flex; gap:6px; align-items:center;"
|
|
hx-post="/formate-coloane/editeaza" hx-target="#mapari-section" hx-swap="outerHTML">
|
|
<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>
|
|
|
|
<form class="mapcol"
|
|
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>
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
</div>
|
|
|
|
</div>
|