gmao/app_new/ent/templates/ent/interpretations.html
2026-08-14 16:02:25 +00:00

120 lines
No EOL
6.4 KiB
HTML

{% extends "base.html" %}
{% block title %}Interprétations ENT - GMAO Collège{% endblock %}
{% block content %}
<div class="container-fluid mt-4">
<div class="row">
<div class="col-12">
<h2><i class="bi bi-robot"></i> Interprétations ENT</h2>
<p class="text-muted">Messages ENT analysés automatiquement par Hermes</p>
</div>
</div>
<!-- Filtres -->
<div class="row mb-3">
<div class="col-md-6">
<form method="GET" class="row g-2">
<div class="col-auto">
<select name="status" class="form-select">
<option value="pending" {% if status == 'pending' %}selected{% endif %}>En attente</option>
<option value="approved" {% if status == 'approved' %}selected{% endif %}>Approuvées</option>
<option value="rejected" {% if status == 'rejected' %}selected{% endif %}>Rejetées</option>
<option value="all" {% if status == 'all' %}selected{% endif %}>Toutes</option>
</select>
</div>
<div class="col-auto">
<select name="type" class="form-select">
<option value="">Tous types</option>
<option value="curative" {% if interpretation_type == 'curative' %}selected{% endif %}>Curative</option>
<option value="preventive" {% if interpretation_type == 'preventive' %}selected{% endif %}>Préventive</option>
<option value="administrative" {% if interpretation_type == 'administrative' %}selected{% endif %}>Administrative</option>
<option value="formation" {% if interpretation_type == 'formation' %}selected{% endif %}>Formation</option>
<option value="information" {% if interpretation_type == 'information' %}selected{% endif %}>Information</option>
</select>
</div>
<div class="col-auto">
<button type="submit" class="btn btn-primary">
<i class="bi bi-funnel"></i> Filtrer
</button>
</div>
</form>
</div>
</div>
<!-- Liste des interprétations -->
<div class="row">
<div class="col-12">
{% if interpretations %}
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Date</th>
<th>Expéditeur</th>
<th>Sujet</th>
<th>Type</th>
<th>Action</th>
<th>Description</th>
<th>Confiance</th>
<th>Statut</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for interp in interpretations %}
<tr>
<td>{{ interp.message.date.strftime('%d/%m/%Y %H:%M') if interp.message.date else '-' }}</td>
<td>{{ interp.message.sender_name or 'Inconnu' }}</td>
<td>
<a href="{{ url_for('ent.message_detail', msg_id=interp.message.id) }}">
{{ interp.message.subject[:50] }}{% if interp.message.subject|length > 50 %}...{% endif %}
</a>
</td>
<td>
<span class="badge bg-{% if interp.analysis_type == 'curative' %}danger{% elif interp.analysis_type == 'preventive' %}primary{% elif interp.analysis_type == 'administrative' %}secondary{% elif interp.analysis_type == 'formation' %}info{% else %}light text-dark{% endif %}">
{{ interp.analysis_type }}
</span>
</td>
<td>{{ interp.analysis_action }}</td>
<td>{{ interp.suggested_description[:100] if interp.suggested_description else '-' }}{% if interp.suggested_description and interp.suggested_description|length > 100 %}...{% endif %}</td>
<td>
<div class="progress" style="width: 60px; height: 8px;">
<div class="progress-bar" role="progressbar" style="width: {{ (interp.analysis_confidence * 100)|int }}%;"
aria-valuenow="{{ (interp.analysis_confidence * 100)|int }}" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
</td>
<td>
<span class="badge bg-{% if interp.status == 'pending' %}warning{% elif interp.status == 'approved' %}success{% else %}secondary{% endif %}">
{{ interp.status }}
</span>
</td>
<td>
{% if interp.status == 'pending' %}
<div class="btn-group btn-group-sm">
<button type="button" class="btn btn-outline-success" title="Approuver">
<i class="bi bi-check-lg"></i>
</button>
<button type="button" class="btn btn-outline-danger" title="Rejeter">
<i class="bi bi-x-lg"></i>
</button>
</div>
{% else %}
<span class="text-muted">-</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info">
<i class="bi bi-info-circle"></i> Aucune interprétation trouvée.
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}