Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 28 additions & 20 deletions app/web/templates/region_card.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
<div class="container row row-cols-1 row-cols-md-3 g-4">
{% set categories = component_attributes.get_unique_values("category") %}
{% for cat in categories|sort %}
<div class="col">
<div class="card">
<h5 class="card-header">
{{ cat }}
</h2>
{# Filtering components for category #}
{% set filtered_components = [] %}
{% for component in all_components_with_incidents %}
{% with attrs = component.get_attributes_as_dict() %}
{% if 'region' in attrs and attrs['region'] == region and 'category' in attrs and attrs['category'] == cat %}
{% set _ = filtered_components.append(component) %}
{% endif %}
{% endwith %}
{% endfor %}

<ul class="list-group list-group-flush">
{% for component in all_components_with_incidents %}
{% with attrs = component.get_attributes_as_dict() %}
{% if 'region' in attrs and attrs['region'] == region and 'category' in attrs and attrs['category'] == cat %}
<li class="list-group-item d-flex justify-content-between
align-items-center">
{{ component.name }}
{{ component_status_widget(component) }}
</li>
{% endif %}
{% endwith %}
{% endfor %}
</ul>
{# Display card only if there are components for the current category and region #}
{% if filtered_components %}
<div class="col">
<div class="card">
<h5 class="card-header">
{{ cat }}
</h5>

<ul class="list-group list-group-flush">
{% for component in filtered_components %}
<li class="list-group-item d-flex justify-content-between align-items-center">
{{ component.name }}
{{ component_status_widget(component) }}
</li>
{% endfor %}
</ul>

</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>