FHIRFLARE-IG-Toolkit/templates/cp_downloaded_igs.html
Sudo-JHare 9fba23c83b v.0.02
update to fix  caused 500 internal error
2025-04-10 17:06:02 +10:00

143 lines
9.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Manage FHIR Packages</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
</head>
<body>
<div class="container mt-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2><i class="bi bi-journal-arrow-down me-2"></i>Manage FHIR Packages</h2>
<div>
<a href="{{ url_for('import_ig') }}" class="btn btn-success"><i class="bi bi-download me-1"></i> Import More IGs</a>
<a href="{{ url_for('index') }}" class="btn btn-secondary"><i class="bi bi-arrow-left"></i> Back to Home</a>
</div>
</div>
{% with messages = get_flashed_messages(with_categories=True) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ 'success' if category == 'success' else 'danger' }} 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 %}
<div class="row g-4">
<div class="col-md-6">
<div class="card h-100">
<div class="card-header"><i class="bi bi-folder-symlink me-1"></i> Downloaded Packages ({{ packages|length }})</div>
<div class="card-body">
{% if packages %}
<div class="table-responsive">
<table class="table table-sm table-hover">
<thead>
<tr><th>Package Name</th><th>Version</th><th>Actions</th></tr>
</thead>
<tbody>
{% for pkg in packages %}
{% set is_processed = (pkg.name, pkg.version) in processed_ids %}
{% set is_duplicate = pkg.name in duplicate_names and duplicate_names[pkg.name]|length > 1 %}
{% set group_color = group_colors[pkg.name] if is_duplicate else 'bg-warning' %}
<tr {% if is_duplicate %}class="{{ group_color }} text-dark"{% endif %}>
<td>
<code>{{ pkg.name }}</code>
{% if is_duplicate %}
<span class="badge {{ group_color }} text-dark ms-1">Duplicate</span>
{% endif %}
</td>
<td>{{ pkg.version }}</td>
<td>
<div class="btn-group btn-group-sm">
{% if is_processed %}
<span class="btn btn-success disabled"><i class="bi bi-check-lg"></i> Processed</span>
{% else %}
<form method="POST" action="{{ url_for('process_ig') }}" style="display:inline;">
<input type="hidden" name="filename" value="{{ pkg.filename }}">
<button type="submit" class="btn btn-primary"><i class="bi bi-gear"></i> Process</button>
</form>
{% endif %}
<form method="POST" action="{{ url_for('delete_ig') }}" style="display:inline;">
<input type="hidden" name="filename" value="{{ pkg.filename }}">
<button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete {{ pkg.name }}#{{ pkg.version }}?');"><i class="bi bi-trash"></i> Delete</button>
</form>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if duplicate_groups %}
<p class="mt-2 small text-muted">Duplicates detected:
{% for name, versions in duplicate_groups.items() %}
{% if versions|length > 1 %}
<span class="badge {{ group_colors[name] }} text-dark">{{ name }} ({{ versions|join(', ') }})</span>
{% endif %}
{% endfor %}
</p>
{% endif %}
{% else %}
<p class="text-muted">No downloaded FHIR packages found.</p>
{% endif %}
</div>
</div>
</div>
<div class="col-md-6">
<div class="card h-100">
<div class="card-header"><i class="bi bi-check-circle me-1"></i> Processed Packages ({{ processed_list|length }})</div>
<div class="card-body">
{% if processed_list %}
<p class="mb-2"><small><span class="badge bg-warning text-dark border me-1">MS</span> = Contains Must Support Elements</small></p>
<div class="table-responsive">
<table class="table table-sm table-hover">
<thead>
<tr><th>Package Name</th><th>Version</th><th>Resource Types</th><th>Actions</th></tr>
</thead>
<tbody>
{% for processed_ig in processed_list %}
<tr>
<td><code>{{ processed_ig.package_name }}</code></td>
<td>{{ processed_ig.version }}</td>
<td>
{% set types_info = processed_ig.resource_types_info %}
{% if types_info %}<div class="d-flex flex-wrap gap-1">
{% for type_info in types_info %}
{% if type_info.must_support %}
<span class="badge bg-warning text-dark border" title="Has Must Support">{{ type_info.name }}</span>
{% else %}
<span class="badge bg-light text-dark border">{{ type_info.name }}</span>
{% endif %}
{% endfor %}
</div>{% else %}<small class="text-muted">N/A</small>{% endif %}
</td>
<td>
<div class="btn-group-vertical btn-group-sm w-100">
<a href="{{ url_for('view_ig', processed_ig_id=processed_ig.id) }}" class="btn btn-outline-info w-100" title="View Details"><i class="bi bi-search"></i> View</a>
<form method="POST" action="{{ url_for('unload_ig') }}" style="display:inline;">
<input type="hidden" name="ig_id" value="{{ processed_ig.id }}">
<button type="submit" class="btn btn-outline-warning w-100 mt-1" onclick="return confirm('Are you sure you want to unload {{ processed_ig.package_name }}#{{ processed_ig.version }}?');"><i class="bi bi-arrow-down-circle"></i> Unload</button>
</form>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="text-muted">No packages recorded as processed yet.</p>
{% endif %}
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>