Files
gti d21a9d1140 Add 'fiscal/' from commit '102ba84500dbd9655a0471288c3e278652593ca9'
git-subtree-dir: fiscal
git-subtree-mainline: d95165fc8f
git-subtree-split: 102ba84500
2026-09-29 14:43:23 -03:00

72 lines
4.8 KiB
HTML

{% extends "base.html" %}
{% block title %}Tabelas oficiais | GTI Fiscal{% endblock %}
{% block content %}
<div class="page-heading">
<div><p class="eyebrow">CATÁLOGO DE REFERÊNCIA FISCAL</p><h1>Tabelas oficiais</h1><p class="muted">Nenhuma versão vira "vigente" sem aprovação de um administrador do diff.</p></div>
</div>
<section class="panel">
{% for r in rows %}
<article class="panel" style="margin-top:12px"><div class="panel-title"><h3>{{ r.kind }} · {{ r.version_label }}</h3><span class="badge {{ '' if r.status in ['VIGENTE','ACTIVE'] else ('critical' if r.status in ['REJECTED'] else '') }}">{{ r.status }}</span></div>
<dl class="facts">
<dt>Fonte</dt><dd>{{ r.provider }} — <a href="{{ r.source_url }}" target="_blank" rel="noopener">{{ r.source_url }}</a></dd>
<dt>Linhas</dt><dd>{{ r.record_count }}</dd>
<dt>Baixado em</dt><dd>{{ r.downloaded_at }}{% if r.submitted_by %} · por {{ r.submitted_by }}{% endif %}</dd>
{% if r.licence_terms %}<dt>Licença/termos</dt><dd>{{ r.licence_terms }}</dd>{% endif %}
{% if r.parse_errors %}<dt>Erros de parse</dt><dd class="coverage-status error">{{ r.parse_errors }}</dd>{% endif %}
{% if r.approved_by %}<dt>Decidido por</dt><dd>{{ r.approved_by }}</dd>{% endif %}
{% if r.diff %}
<dt>Diff vs. vigente atual</dt>
<dd>
{% if r.diff.is_first_version %}Primeira versão deste tipo de dataset — nada para comparar.
{% else %}Vigente atual: {{ r.diff.current_vigente.version_label }} ({{ r.diff.current_vigente.record_count }} linhas) →
proposto: {{ r.diff.draft.version_label }} ({{ r.diff.draft.record_count }} linhas, diferença de {{ r.diff.record_count_delta }})
{% if r.diff.sha256_unchanged %} · conteúdo idêntico (mesmo hash){% endif %}{% endif %}
</dd>
{% endif %}
</dl>
{% if r.checklist %}
<div class="technical-checklist" style="background:#f8f9fa; border:1px solid #e2e8f0; border-radius:6px; padding:12px; margin:12px 0;">
<h4 style="margin-top:0; margin-bottom:8px; font-size:14px; text-transform:uppercase; color:#475569;">Checklist Técnico de Aprovação (Sem Julgamento Fiscal Exigido)</h4>
<ul style="list-style:none; padding-left:0; margin-bottom:10px; font-size:13px; line-height:1.6;">
<li>
<span style="font-weight:bold; color:{{ 'green' if r.checklist.official_source.passed else 'red' }}">[{{ '✓' if r.checklist.official_source.passed else '✗' }}]</span>
<strong>1. Fonte Oficial:</strong> {{ r.checklist.official_source.provider }} · <a href="{{ r.checklist.official_source.url }}" target="_blank" rel="noopener">{{ r.checklist.official_source.url }}</a> · <em>{{ r.checklist.official_source.act }}</em>
</li>
<li>
<span style="font-weight:bold; color:{{ 'green' if r.checklist.integrity.passed else 'red' }}">[{{ '✓' if r.checklist.integrity.passed else '✗' }}]</span>
<strong>2. Hash SHA-256 e Tamanho:</strong> <code style="font-size:11px;">{{ r.checklist.integrity.sha256 }}</code> {% if r.checklist.integrity.file_size_bytes %}({{ r.checklist.integrity.file_size_bytes }} bytes){% endif %}
</li>
<li>
<span style="font-weight:bold; color:{{ 'green' if r.checklist.volume.passed else 'red' }}">[{{ '✓' if r.checklist.volume.passed else '✗' }}]</span>
<strong>3. Contagem de Linhas:</strong> {{ r.checklist.volume.record_count }} linhas registradas (esperado &ge; {{ r.checklist.volume.expected_minimum }})
</li>
<li>
<span style="font-weight:bold; color:{{ 'green' if r.checklist.no_parse_errors else 'red' }}">[{{ '✓' if r.checklist.no_parse_errors else '✗' }}]</span>
<strong>4. Erros de Parse:</strong> {{ 'Nenhum erro de parse (deterministico)' if r.checklist.no_parse_errors else 'Existem erros de parse no processamento!' }}
</li>
<li>
<span style="font-weight:bold; color:green">[✓]</span>
<strong>5. Amostra de 5 Consultas com Resultado Conhecido:</strong>
<ol style="margin-top:4px; margin-bottom:4px; padding-left:20px;">
{% for code, label in r.checklist.samples %}
<li><code>{{ code }}</code>: {{ label }}</li>
{% endfor %}
</ol>
</li>
</ul>
</div>
{% endif %}
{% if r.status == "DRAFT" and is_admin %}
<form method="post" action="/admin/reference-datasets/{{ r.id }}/decide" class="filters compact-filters">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="secondary" type="submit" name="action" value="approve" {% if not r.checklist.ready_to_approve %}disabled title="Checklist técnico não satisfeito ou erros presentes"{% endif %}>Aprovar (vira vigente)</button>
<button class="secondary" type="submit" name="action" value="reject" onclick="return confirm('Rejeitar esta versão?')">Rejeitar</button>
</form>
{% endif %}
</article>
{% else %}
<p class="muted">Nenhum dataset registrado no catálogo novo ainda.</p>
{% endfor %}
</section>
{% endblock %}