Tema light ca bloc [data-theme="light"] peste variabilele :root (dark nemodificat la octet). Comutator soare/luna in header pe toate paginile, default OS-aware (prefers-color-scheme, fallback dark), persistenta in localStorage doar la comutare explicita, script anti-FOUC in <head> pre-paint. Suprafetele de stare hardcodate convertite la color-mix in base.html + 7 fragmente _*.html (light lizibil, contrast WCAG AA). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
142 lines
5.3 KiB
HTML
142 lines
5.3 KiB
HTML
<div id="import-section">
|
|
{% set pas = 1 %}{% include '_stepper.html' %}
|
|
{# US-004 (3.6): bara de upload accentuata (border de accent) ca sa ramana punctul
|
|
de intrare evident chiar cu tabelul Trimiteri lung dedesubt (D-1.1/D-5.2). #}
|
|
<div class="card" style="border-color:var(--accent);">
|
|
|
|
{% if message %}
|
|
<div class="flash" style="margin-bottom:12px;">{{ message }}</div>
|
|
{% endif %}
|
|
|
|
{% if error %}
|
|
<div class="flash" style="border-color:var(--err); background:color-mix(in srgb, var(--err) 12%, var(--card)); margin-bottom:12px;"
|
|
role="alert">{{ error }}</div>
|
|
{% endif %}
|
|
|
|
{% if sheets %}
|
|
<div class="flash" style="border-color:var(--warn); background:color-mix(in srgb, var(--warn) 12%, var(--card)); margin-bottom:12px;">
|
|
Fisierul are mai multe foi de lucru. Alege foaia de mai jos si incarca din nou.
|
|
</div>
|
|
{% endif %}
|
|
|
|
<form id="upload-form"
|
|
hx-post="/_import/upload"
|
|
hx-target="#import-section"
|
|
hx-swap="outerHTML"
|
|
hx-encoding="multipart/form-data"
|
|
hx-indicator="#upload-spinner">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token or '' }}">
|
|
|
|
{% if sheets %}
|
|
<div style="margin-bottom:12px;">
|
|
<label for="sheet-select"
|
|
style="display:block; margin-bottom:4px; font-size:13px; color:var(--muted);">
|
|
Foaie de lucru
|
|
</label>
|
|
<select id="sheet-select" name="sheet_name" style="min-width:200px;">
|
|
{% for s in sheets %}
|
|
<option value="{{ s }}">{{ s }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if are_trimiteri and not sheets %}
|
|
{# === Bara slim (returning user): eticheta + buton + zona de trage, pe un rand === #}
|
|
<div class="drop-zone" id="drop-zone"
|
|
role="region" aria-label="Zona de incarcare fisier"
|
|
style="display:flex; align-items:center; gap:14px; flex-wrap:wrap;
|
|
padding:12px 16px; text-align:left;">
|
|
<strong style="font-size:14px;">Importa:</strong>
|
|
<input id="file-input" type="file" name="file" accept=".xlsx,.xls,.csv"
|
|
style="display:none;" aria-label="Selecteaza fisier xlsx sau csv">
|
|
<button type="button" id="upload-btn"
|
|
style="min-height:44px; padding:10px 20px; font-size:14px;">
|
|
Alege fisier (xlsx/csv)
|
|
</button>
|
|
<span class="muted" style="font-size:13px;">sau trage aici</span>
|
|
<span class="muted" style="font-size:12px; margin-left:auto;">
|
|
NU se trimite nimic la RAR pana confirmi.
|
|
</span>
|
|
</div>
|
|
{% else %}
|
|
{# === Hero first-run (sau re-upload multi-foaie): pastreaza copy-ul de bun venit === #}
|
|
<div class="drop-zone" id="drop-zone"
|
|
role="region" aria-label="Zona de incarcare fisier">
|
|
{% if not sheets %}
|
|
<p style="font-size:17px; margin:0 0 4px; font-weight:600;">Primul fisier? Trage-l aici.</p>
|
|
<p class="muted" style="margin:0 0 16px; font-size:13px;">xlsx sau csv, max 5000 randuri</p>
|
|
{% else %}
|
|
<p class="muted" style="margin:0 0 16px; font-size:14px;">
|
|
Incarca fisierul din nou dupa ce ai ales foaia.
|
|
</p>
|
|
{% endif %}
|
|
|
|
<input id="file-input" type="file" name="file" accept=".xlsx,.xls,.csv"
|
|
style="display:none;" aria-label="Selecteaza fisier xlsx sau csv">
|
|
<button type="button" id="upload-btn"
|
|
style="min-height:44px; padding:10px 24px; font-size:14px;">
|
|
Alege fisier (xlsx/csv)
|
|
</button>
|
|
</div>
|
|
|
|
<p class="muted" style="margin:8px 0 0; font-size:12px;">
|
|
NU se trimite nimic la RAR pana confirmi explicit.
|
|
</p>
|
|
{% endif %}
|
|
|
|
<span id="upload-spinner" class="htmx-indicator muted"
|
|
style="font-size:13px; margin-top:6px; display:inline;">
|
|
se parseaza fisierul...
|
|
</span>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
(function() {
|
|
var btn = document.getElementById('upload-btn');
|
|
var fi = document.getElementById('file-input');
|
|
var dz = document.getElementById('drop-zone');
|
|
var frm = document.getElementById('upload-form');
|
|
|
|
/* US-003 (3.6): un singur sticky bar pe ecran — cand re-apare zona de upload
|
|
(reset sau dupa commit), sectiunea Trimiteri redevine vizibila. */
|
|
var trim = document.getElementById('trimiteri-section');
|
|
if (trim) trim.style.display = '';
|
|
|
|
/* Dupa un commit reusit (mesaj de succes), du utilizatorul la Trimiteri. */
|
|
{% if message and not error %}
|
|
if (trim) trim.scrollIntoView({behavior: 'smooth', block: 'start'});
|
|
{% endif %}
|
|
|
|
if (!btn || !fi || !frm) return;
|
|
|
|
btn.addEventListener('click', function() { fi.click(); });
|
|
|
|
fi.addEventListener('change', function() {
|
|
if (fi.files.length > 0) frm.requestSubmit();
|
|
});
|
|
|
|
dz.addEventListener('dragover', function(e) {
|
|
e.preventDefault();
|
|
dz.classList.add('drag-over');
|
|
});
|
|
dz.addEventListener('dragleave', function(e) {
|
|
if (!dz.contains(e.relatedTarget)) dz.classList.remove('drag-over');
|
|
});
|
|
dz.addEventListener('drop', function(e) {
|
|
e.preventDefault();
|
|
dz.classList.remove('drag-over');
|
|
var f = (e.dataTransfer.files || [])[0];
|
|
if (!f) return;
|
|
try {
|
|
var dt = new DataTransfer();
|
|
dt.items.add(f);
|
|
fi.files = dt.files;
|
|
} catch (_) {}
|
|
frm.requestSubmit();
|
|
});
|
|
})();
|
|
</script>
|