| {% extends "base.html" %} |
|
|
| {% block title %}Impact Analyses - PoliSage{% endblock %} |
|
|
| {% block content %} |
| <div class="container mt-4"> |
| <div class="d-flex justify-content-between align-items-center mb-3"> |
| <h2>Impact Analyses</h2> |
| <a href="{{ url_for("analysis.run_analysis") }}" class="btn btn-primary"> |
| <i class="bi bi-play-circle me-1"></i> Run New Analysis |
| </a> |
| </div> |
|
|
| {% with messages = get_flashed_messages(with_categories=true) %} |
| {% if messages %} |
| {% for category, message in messages %} |
| <div class="alert alert-{{ category }} alert-dismissible fade show" role="alert"> |
| {{ message }} |
| <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> |
| </div> |
| {% endfor %} |
| {% endif %} |
| {% endwith %} |
|
|
| {% if analyses %} |
| <div class="list-group"> |
| {% for analysis in analyses %} |
| {% set doc_title = "Unknown Document" %} |
| {% if analysis.document_type == "Legislation" and analysis.legislation %} |
| {% set doc_title = analysis.legislation.title %} |
| {% elif analysis.document_type == "Draft" and analysis.draft %} |
| {% set doc_title = analysis.draft.title %} |
| {% elif analysis.document_type == "Amendment" and analysis.amendment %} |
| {% set doc_title = "Amendment #" ~ analysis.amendment.id ~ (" for " ~ analysis.amendment.legislation.title if analysis.amendment.legislation else "") %} |
| {% endif %} |
| <a href="{{ url_for("analysis.view_analysis", analysis_id=analysis.id) }}" class="list-group-item list-group-item-action flex-column align-items-start"> |
| <div class="d-flex w-100 justify-content-between"> |
| <h5 class="mb-1">{{ analysis.analysis_type }} Analysis for: {{ doc_title | truncate(80) }}</h5> |
| <small>{{ analysis.generated_at.strftime("%Y-%m-%d %H:%M") }}</small> |
| </div> |
| <p class="mb-1">Document: {{ analysis.document_type }} ID {{ analysis.document_id }} | Confidence: {{ "%.1f"|format(analysis.confidence_score * 100) ~ "%" if analysis.confidence_score is not none else "N/A" }}</p> |
| <small>Generated by: {{ analysis.generator.username if analysis.generator else "System" }}</small> |
| </a> |
| {% endfor %} |
| </div> |
| |
| {% else %} |
| <div class="alert alert-info" role="alert"> |
| No impact analyses found. <a href="{{ url_for("analysis.run_analysis") }}">Run a new one?</a> |
| </div> |
| {% endif %} |
| </div> |
| {% endblock %} |
|
|
|
|