Pagina /integrare (tab autentificat, scoped pe cont): exemple cod multi-limbaj (curl/Python/PHP/C#/Node) + retetar Visual FoxPro (MSXML2 + WinHttp) pe ambele canale (prezentari JSON + import fisier), export Postman/OpenAPI/Swagger si buton "Testeaza conexiunea". - US-001: GET /v1/ping (readiness: account_id/mediu/autentificat_cu_cheie/ are_creds_rar/ts) + GET /v1/integrare/postman.json (v2.1.0, allowlist 3 rute) - US-002: app/web/integrare_examples.py pur (7 limbaje x 2 canale, drift-test is_required(), JSON compact pentru C#/VFP) - US-003: tab "Integrare" IA pe 2 niveluri (limbaj->canal, VFP cu dialecte), copy din <pre><code>, empty-state CTA, export .cardlink, script scoped - US-004: POST /integrare/test-cheie (account_for_key direct, scoped sesiune, no-echo cheie) Backend trimitere (worker/masina stari/idempotenta/mapping) si schema neatinse. 568 teste pass. VERIFY context curat + E2E browser (Playwright) + code-review high. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
100 lines
4.1 KiB
HTML
100 lines
4.1 KiB
HTML
{% extends "base.html" %}
|
|
{% block content %}
|
|
|
|
<!-- Nav cont: link admin (doar pentru admini) + logout -->
|
|
<div style="display:flex; gap:8px; justify-content:flex-end; margin-bottom:12px; flex-wrap:wrap;">
|
|
{% if is_admin %}<a class="cardlink" href="/admin">Panou admin</a>{% endif %}
|
|
<form method="post" action="/logout" style="display:inline; margin:0;">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
|
<button type="submit" style="background:var(--card); color:var(--muted); border-color:var(--line);">Iesi din cont</button>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Bara de status (US-002): mereu vizibila, deasupra tab-bar-ului -->
|
|
<div id="status-bar" class="status-bar card"
|
|
hx-get="/_fragments/status"
|
|
hx-trigger="load, every 15s"
|
|
hx-swap="outerHTML">
|
|
<div class="empty muted" style="padding:8px 0;">se incarca starea…</div>
|
|
</div>
|
|
|
|
<!-- Tab-bar: navigare intre sectiuni -->
|
|
<div role="tablist" class="tab-bar" aria-label="Sectiuni dashboard">
|
|
{# US-003 (3.6): tab-ul "Trimiteri" (coada) a fost eliminat — Trimiterile traiesc
|
|
ca sectiune permanenta pe Acasa. Raman: Acasa·Mapari·Cont·Nomenclator·Integrare. #}
|
|
{% set tabs = [
|
|
("acasa", "Acasa", "tab-acasa"),
|
|
("mapari", "Mapari", "tab-mapari"),
|
|
("cont", "Cont", "tab-cont"),
|
|
("nomenclator", "Nomenclator", "tab-nomenclator"),
|
|
("integrare", "Integrare", "tab-integrare")
|
|
] %}
|
|
{% for tab_id, tab_label, tab_elem_id in tabs %}
|
|
{% set badge = (badges.get(tab_id, 0) if badges else 0) %}
|
|
<a id="{{ tab_elem_id }}"
|
|
role="tab"
|
|
href="/?tab={{ tab_id }}"
|
|
aria-selected="{{ 'true' if active_tab == tab_id else 'false' }}"
|
|
aria-controls="tab-panel"
|
|
{% if badge %}aria-label="{{ tab_label }}, {{ badge }} necesita atentie"{% endif %}
|
|
class="tab-link{% if active_tab == tab_id %} tab-activ{% endif %}"
|
|
tabindex="{{ '0' if active_tab == tab_id else '-1' }}"
|
|
hx-get="/_fragments/{{ tab_id }}"
|
|
hx-target="#tab-panel"
|
|
hx-swap="innerHTML"
|
|
hx-push-url="/?tab={{ tab_id }}">{{ tab_label }}{% if badge %}<span class="tab-badge" aria-hidden="true" style="display:inline-flex; align-items:center; justify-content:center; min-width:18px; height:18px; margin-left:6px; padding:0 5px; border-radius:99px; background:var(--err); color:#fff; font-size:11px; font-weight:700;">{{ badge }}</span>{% endif %}</a>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<!-- Panou activ: randat server-side la full load; HTMX inlocuieste continutul la click pe tab -->
|
|
<div id="tab-panel" role="tabpanel" aria-labelledby="tab-{{ active_tab }}" class="tab-panel">
|
|
{{ panel_html | safe }}
|
|
</div>
|
|
|
|
<script>
|
|
(function() {
|
|
/* Navigare cu sageti intre tab-uri (ARIA pattern) — scoped pe fiecare tablist.
|
|
Folosim querySelectorAll pentru a suporta multiple tablist-uri pe pagina
|
|
(tab-bar principal + tab-urile interne din panoul Integrare). */
|
|
document.querySelectorAll('[role="tablist"]').forEach(function(tablist) {
|
|
var tabs = Array.from(tablist.querySelectorAll('[role="tab"]'));
|
|
if (!tabs.length) return;
|
|
|
|
tablist.addEventListener('keydown', function(e) {
|
|
var idx = tabs.indexOf(document.activeElement);
|
|
if (idx === -1) return;
|
|
var next = -1;
|
|
if (e.key === 'ArrowRight' || e.key === 'ArrowDown') {
|
|
next = (idx + 1) % tabs.length;
|
|
} else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {
|
|
next = (idx - 1 + tabs.length) % tabs.length;
|
|
} else if (e.key === 'Home') {
|
|
next = 0;
|
|
} else if (e.key === 'End') {
|
|
next = tabs.length - 1;
|
|
}
|
|
if (next !== -1) {
|
|
e.preventDefault();
|
|
tabs[next].focus();
|
|
}
|
|
});
|
|
|
|
/* La click pe tab: actualizeaza aria-selected + tabindex (scoped pe tablist-ul curent) */
|
|
tabs.forEach(function(tab) {
|
|
tab.addEventListener('click', function() {
|
|
tabs.forEach(function(t) {
|
|
t.setAttribute('aria-selected', 'false');
|
|
t.setAttribute('tabindex', '-1');
|
|
t.classList.remove('tab-activ');
|
|
});
|
|
tab.setAttribute('aria-selected', 'true');
|
|
tab.setAttribute('tabindex', '0');
|
|
tab.classList.add('tab-activ');
|
|
});
|
|
});
|
|
});
|
|
})();
|
|
</script>
|
|
|
|
{% endblock %}
|