Files
t2a_v2/src/viewer/templates/base.html
dom 5b58886ebf feat: versioning sémantique (single source of truth)
- Crée src/__version__.py comme source unique de version (2.1.0)
- pyproject.toml utilise dynamic version via setuptools attr
- Affiche la version dans le footer de la sidebar (base.html)
- Ajoute endpoint /health avec version et status

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 11:47:44 +01:00

488 lines
14 KiB
HTML

<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}Viewer CIM-10{% endblock %} — T2A</title>
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
background: #f1f5f9;
color: #1e293b;
display: flex;
min-height: 100vh;
}
/* Sidebar */
.sidebar {
width: 280px;
min-width: 280px;
background: #1e293b;
color: #e2e8f0;
display: flex;
flex-direction: column;
position: fixed;
top: 0;
left: 0;
bottom: 0;
overflow-y: auto;
}
.sidebar-header {
padding: 1.25rem 1rem;
border-bottom: 1px solid #334155;
}
.sidebar-header h1 {
font-size: 1.1rem;
color: #f1f5f9;
font-weight: 700;
}
.sidebar-header p {
font-size: 0.75rem;
color: #94a3b8;
margin-top: 0.25rem;
}
.sidebar-nav {
flex: 1;
padding: 0.75rem 0;
overflow-y: auto;
}
.sidebar-nav .group-title {
padding: 0.5rem 1rem 0.25rem;
font-size: 0.65rem;
text-transform: uppercase;
letter-spacing: 0.08em;
color: #94a3b8;
font-weight: 700;
}
.sidebar-nav a {
display: block;
padding: 0.4rem 1rem;
color: #cbd5e1;
text-decoration: none;
font-size: 0.8rem;
font-weight: 600;
border-left: 3px solid transparent;
transition: all 0.15s;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.sidebar-nav a:hover {
color: #f8fafc;
background: #334155;
border-left-color: #3b82f6;
}
.sidebar-nav a.sidebar-fusionne {
color: #60a5fa;
font-weight: 700;
}
/* Main nav links */
.sidebar-link {
display: block;
padding: 0.4rem 1rem;
color: #cbd5e1;
text-decoration: none;
font-size: 0.8rem;
font-weight: 600;
border-left: 3px solid transparent;
transition: all 0.15s;
}
.sidebar-link:hover {
color: #f8fafc;
background: #334155;
border-left-color: #3b82f6;
}
/* Search */
.sidebar-search {
position: relative;
padding: 0.75rem 1rem 0.5rem;
border-bottom: 1px solid #334155;
}
.sidebar-search input {
width: 100%;
padding: 0.45rem 0.6rem;
border-radius: 6px;
border: 1px solid #475569;
background: #0f172a;
color: #e2e8f0;
font-size: 0.8rem;
outline: none;
transition: border-color 0.15s;
}
.sidebar-search input::placeholder { color: #64748b; }
.sidebar-search input:focus { border-color: #3b82f6; }
/* Admin section */
.sidebar-admin {
padding: 1rem;
border-top: 1px solid #334155;
font-size: 0.8rem;
}
.sidebar-admin label {
display: block;
margin-bottom: 0.35rem;
font-weight: 600;
color: #cbd5e1;
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.sidebar-admin select {
width: 100%;
padding: 0.4rem;
border-radius: 6px;
border: 1px solid #475569;
background: #0f172a;
color: #e2e8f0;
font-size: 0.8rem;
margin-bottom: 0.5rem;
}
.sidebar-admin button {
width: 100%;
padding: 0.45rem;
border-radius: 6px;
border: none;
background: #3b82f6;
color: #fff;
font-size: 0.8rem;
font-weight: 600;
cursor: pointer;
transition: background 0.15s;
}
.sidebar-admin button:hover { background: #2563eb; }
.sidebar-admin .status-msg {
margin-top: 0.35rem;
font-size: 0.7rem;
min-height: 1rem;
}
/* Main content */
.main {
margin-left: 280px;
flex: 1;
padding: 2rem;
}
/* Utilities */
.card {
background: #fff;
border-radius: 10px;
box-shadow: 0 1px 3px rgba(0,0,0,0.08);
padding: 1.25rem;
margin-bottom: 1rem;
}
.badge {
display: inline-block;
padding: 2px 8px;
border-radius: 9999px;
font-size: 0.7rem;
font-weight: 600;
transition: all 0.15s;
}
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid #e2e8f0; }
th { font-weight: 600; color: #475569; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr.anomalie { background: #fef2f2; }
details { margin-top: 0.35rem; }
details summary {
cursor: pointer;
font-size: 0.75rem;
color: #3b82f6;
}
details pre {
font-size: 0.75rem;
background: #f8fafc;
padding: 0.5rem;
border-radius: 6px;
margin-top: 0.25rem;
white-space: pre-wrap;
word-break: break-word;
}
h2 { font-size: 1.1rem; margin-bottom: 0.75rem; color: #0f172a; }
h3 { font-size: 0.95rem; margin-bottom: 0.5rem; color: #334155; }
.info-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 0.75rem;
}
.info-item label { display: block; font-size: 0.7rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.info-item span { font-size: 0.9rem; }
.section { margin-bottom: 1.5rem; }
ul.bullet { list-style: disc; padding-left: 1.5rem; font-size: 0.85rem; }
ul.bullet li { margin-bottom: 0.25rem; }
a.back { font-size: 0.85rem; color: #3b82f6; text-decoration: none; }
a.back:hover { text-decoration: underline; }
/* Badges compteurs */
.badge-count {
display: inline-flex;
align-items: center;
gap: 0.2rem;
padding: 2px 8px;
border-radius: 9999px;
font-size: 0.7rem;
font-weight: 600;
transition: all 0.15s;
}
.badge-das { background: #dbeafe; color: #1d4ed8; }
.badge-actes { background: #e0e7ff; color: #3730a3; }
.badge-alertes { background: #ffedd5; color: #c2410c; }
.badge-cma { background: #fee2e2; color: #dc2626; }
.badge-regroup { background: #f0fdf4; color: #166534; font-size: 0.65rem; }
.badge-fusion { background: #ede9fe; color: #5b21b6; }
/* Alertes non-cumul (rouge) vs standard (orange) */
.alerte-noncumul { color: #dc2626; font-weight: 600; }
.alerte-standard { color: #9a3412; }
/* Source files */
.source-files { font-size: 0.8rem; color: #64748b; margin-top: 0.5rem; }
.source-files code { background: #f1f5f9; padding: 1px 4px; border-radius: 3px; }
/* Spinner animation */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
display: inline-block;
width: 14px;
height: 14px;
border: 2px solid rgba(255,255,255,0.3);
border-top-color: #fff;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
/* Source tracking badges */
.src-btn {
display: inline-block;
padding: 1px 6px;
border-radius: 9999px;
font-size: 0.65rem;
font-weight: 600;
background: #e0f2fe;
color: #0369a1;
border: 1px solid #bae6fd;
cursor: pointer;
margin-left: 0.3rem;
vertical-align: middle;
transition: background 0.15s;
}
.src-btn:hover { background: #bae6fd; }
/* Source modal */
#source-modal {
display: none;
position: fixed;
inset: 0;
z-index: 9999;
background: rgba(0,0,0,0.5);
padding: 2rem;
}
#source-modal-inner {
background: #fff;
border-radius: 12px;
max-width: 95vw;
width: 95vw;
margin: 0 auto;
max-height: 95vh;
height: 95vh;
display: flex;
flex-direction: column;
box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
#source-modal-inner.source-modal-text {
max-width: 900px;
width: auto;
max-height: 90vh;
height: auto;
}
#source-header {
padding: 1rem 1.25rem;
border-bottom: 1px solid #e2e8f0;
font-weight: 700;
font-size: 0.9rem;
color: #0f172a;
display: flex;
justify-content: space-between;
align-items: center;
}
#source-content {
flex: 1;
overflow-y: auto;
padding: 1.25rem;
font-size: 0.85rem;
line-height: 1.6;
white-space: pre-wrap;
word-break: break-word;
color: #334155;
}
#source-content.source-content-pdf {
padding: 0;
white-space: normal;
overflow: hidden;
}
#source-content mark {
background: #fef08a;
padding: 2px 0;
border-radius: 2px;
}
#source-close-btn {
padding: 0.4rem 1rem;
background: #64748b;
color: #fff;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 0.8rem;
font-weight: 600;
}
#source-close-btn:hover { background: #475569; }
/* PDF file picker buttons */
.src-file-btn {
display: inline-block;
padding: 0.35rem 0.75rem;
border-radius: 6px;
border: 1px solid #cbd5e1;
background: #f8fafc;
color: #1e293b;
font-size: 0.8rem;
font-weight: 600;
cursor: pointer;
transition: all 0.15s;
}
.src-file-btn:hover { background: #e2e8f0; border-color: #3b82f6; }
.src-file-btn.active { background: #3b82f6; color: #fff; border-color: #3b82f6; }
/* Tableau dossiers (index) */
.table-dossiers { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table-dossiers th {
text-align: left; padding: 0.6rem 0.75rem; border-bottom: 2px solid #e2e8f0;
font-weight: 600; color: #475569; font-size: 0.75rem; text-transform: uppercase;
letter-spacing: 0.05em; background: #f8fafc;
}
.table-dossiers td { padding: 0.6rem 0.75rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.row-clickable { cursor: pointer; transition: background 0.15s; }
.row-clickable:hover { background: #f0f9ff; }
/* Hamburger toggle (mobile) */
.sidebar-toggle {
display: none;
position: fixed;
top: 0.75rem;
left: 0.75rem;
z-index: 10001;
background: #1e293b;
color: #e2e8f0;
border: none;
border-radius: 6px;
padding: 0.5rem 0.65rem;
font-size: 1.2rem;
cursor: pointer;
line-height: 1;
}
/* Responsive */
@media (max-width: 768px) {
.sidebar-toggle { display: block; }
.sidebar {
transform: translateX(-100%);
transition: transform 0.25s ease;
z-index: 10000;
}
.sidebar.open { transform: translateX(0); }
.main { margin-left: 0; padding: 1rem; padding-top: 3.5rem; }
}
</style>
</head>
<body>
<!-- Hamburger (mobile) -->
<button class="sidebar-toggle" id="sidebar-toggle" aria-label="Menu">&#9776;</button>
<!-- Sidebar -->
<aside class="sidebar" id="sidebar">
<div class="sidebar-header">
<img src="{{ url_for('static', filename='logo_aivanov.png') }}" alt="Aivanov" style="height:32px;margin-bottom:0.5rem;background:#fff;border-radius:6px;padding:2px 8px;">
<h1>T2A Viewer <span style="font-size:0.65rem;font-weight:400;color:#94a3b8;">v1.0</span></h1>
<p>Visualisation CIM-10</p>
</div>
<nav class="sidebar-main-nav" style="padding:0.5rem 0;border-bottom:1px solid #334155;">
<a href="/" class="sidebar-link">&#128193; Dossiers</a>
<a href="/dashboard" class="sidebar-link">&#128202; Dashboard</a>
<a href="/dim" class="sidebar-link">&#127973; Synth&egrave;se DIM</a>
<a href="/cpam" class="sidebar-link">&#9888; Contr&ocirc;les UCR</a>
<a href="/admin/referentiels" class="sidebar-link">&#128218; R&eacute;f&eacute;rentiels</a>
<a href="/admin/rules" class="sidebar-link">&#9881; R&egrave;gles m&eacute;tier</a>
</nav>
<div class="sidebar-search">
<input type="text" id="sidebar-search" placeholder="Rechercher un dossier…" autocomplete="off">
<div id="sidebar-autocomplete" style="display:none;position:absolute;left:0;right:0;background:#0f172a;border:1px solid #475569;border-radius:0 0 6px 6px;max-height:250px;overflow-y:auto;z-index:100;"></div>
</div>
<div style="padding:0.5rem 1rem;border-top:1px solid #334155;font-size:0.6rem;color:#475569;text-align:center;">
v{{ app_version }}
</div>
</aside>
<!-- Main -->
<div class="main">
{% block content %}{% endblock %}
</div>
<script>
// Sidebar toggle (mobile)
(function() {
var btn = document.getElementById('sidebar-toggle');
var sb = document.getElementById('sidebar');
if (btn && sb) {
btn.addEventListener('click', function() { sb.classList.toggle('open'); });
sb.addEventListener('click', function(e) {
if (e.target.tagName === 'A') sb.classList.remove('open');
});
}
})();
// Sidebar autocomplete search
(function() {
var input = document.getElementById('sidebar-search');
var dropdown = document.getElementById('sidebar-autocomplete');
if (!input || !dropdown) return;
var dossiers = {{ dossier_list | tojson }};
input.addEventListener('input', function() {
var q = this.value.toLowerCase().trim();
dropdown.innerHTML = '';
if (!q) { dropdown.style.display = 'none'; return; }
var matches = dossiers.filter(function(d) { return d.name.toLowerCase().includes(q); }).slice(0, 15);
if (!matches.length) { dropdown.style.display = 'none'; return; }
matches.forEach(function(d) {
var a = document.createElement('a');
a.href = '/dossier/' + d.path;
a.textContent = d.name;
a.style.cssText = 'display:block;padding:0.35rem 0.6rem;color:#e2e8f0;text-decoration:none;font-size:0.8rem;border-bottom:1px solid #1e293b;';
a.addEventListener('mouseenter', function() { this.style.background = '#334155'; });
a.addEventListener('mouseleave', function() { this.style.background = ''; });
dropdown.appendChild(a);
});
dropdown.style.display = 'block';
});
input.addEventListener('keydown', function(e) {
if (e.key === 'Enter') {
var first = dropdown.querySelector('a');
if (first) { window.location = first.href; e.preventDefault(); }
}
});
document.addEventListener('click', function(e) {
if (!e.target.closest('.sidebar-search')) dropdown.style.display = 'none';
});
})();
</script>
{% block scripts %}{% endblock %}
</body>
</html>