ISO-27001-Risk-Management/templates/risks/item_incident.html
Kevin Heyer f7ead4e5c3 Refactor risk management templates for improved usability and localization
- Updated `item_incident.html` to implement ERP-style tabs for better navigation and added action icons for editing and deleting incidents.
- Enhanced the overview tab with translated labels and improved layout for incident details.
- Introduced linked risks and history tabs with appropriate translations and table structures.
- Modified `item_risk.html` to include action icons for editing and deleting risks.
- Refined `list_controls.html` to improve filter section layout and added translations for filter labels.
- Updated `list_incidents.html` to enhance filter functionality and table layout, including translations for headers and buttons.
- Improved `list_risks.html` by adding an action icon for adding new risks.
- Adjusted `notifications.html` to enhance the display of new notifications with improved formatting and links.
2025-09-12 13:04:04 +02:00

126 lines
5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends "base.html" %}
{% load i18n risk_extras %}
{% block crumbs %}
<li><a href="{% url 'risks:list_incidents' %}">{% trans "Incidents" %}</a></li>
<li><a href="{% url 'risks:show_incident' incident.id %}">{{ incident.title }}</a></li>
{% endblock %}
{% block content %}
<!-- ERP-style tabs -->
<div class="erp-tabs">
<a class="is-active" data-tab="overview">{% trans "Overview" %}</a>
<a data-tab="risks">{% trans "Linked Risks" %}</a>
<a data-tab="history">{% trans "History" %}</a>
<!-- Action Icons -->
<div class="buttons">
<a href="{% url 'admin:risks_incident_change' incident.pk %}" class="button is-small is-warning" title="{% trans 'Edit Incident' %}">
<span class="icon"><i class="fas fa-edit"></i></span>
</a>
<a href="{% url 'admin:risks_incident_delete' incident.pk %}" class="button is-small is-danger" title="{% trans 'Delete Incident' %}">
<span class="icon"><i class="fas fa-trash"></i></span>
</a>
</div>
</div>
<!-- Tab: Overview -->
<div class="tab-panel" data-tab="overview">
<div class="card">
<div class="card-content">
<div class="columns is-multiline">
<div class="column is-half">
<p><strong>{% trans "Incident" %}:</strong> {{ incident.title }}</p>
<p><strong>{% trans "Reported by" %}:</strong> {{ incident.reported_by|default:"" }}</p>
<p><strong>{% trans "Reported on" %}:</strong> {{ incident.date_reported|date:"d.m.Y" }}</p>
<p><strong>{% trans "Status" %}:</strong> {{ incident.get_status_display }}</p>
</div>
<div class="column is-half">
<p><strong>{% trans "Created at" %}:</strong> {{ incident.created_at|date:"d.m.Y H:i" }}</p>
<p><strong>{% trans "Updated at" %}:</strong> {{ incident.updated_at|date:"d.m.Y H:i" }}</p>
</div>
</div>
<section>
<h3 class="title is-6">{% trans "Description" %}</h3>
<p>{{ incident.description|default:"" }}</p>
</section>
</div>
</div>
</div><!-- Overview Tab End -->
<!-- Tab: Linked Risks -->
<div class="tab-panel is-hidden" data-tab="risks">
<div class="table-container">
<table class="table is-bordered is-striped is-narrow is-hoverable is-fullwidth">
<thead>
<tr class="has-background-prosoft">
<th class="has-text-centered">{% trans "Risk" %}</th>
<th class="has-text-centered">{% trans "Owner" %}</th>
<th class="has-text-centered">{% trans "Category" %}</th>
<th class="has-text-centered">{% trans "Asset" %}</th>
<th class="has-text-centered">{% trans "Process" %}</th>
</tr>
</thead>
<tbody>
{% for risk in incident.related_risks.all %}
<tr onclick="window.location.href='{% url 'risks:show_risk' risk.id %}'" style="cursor:pointer;">
<td>{{ risk.title }}</td>
<td class="has-text-centered">{{ risk.owner|user_display|default:"" }}</td>
<td class="has-text-centered">{{ risk.category|default:"" }}</td>
<td class="has-text-centered">{{ risk.asset|default:"" }}</td>
<td class="has-text-centered">{{ risk.process|default:"" }}</td>
</tr>
{% empty %}
<tr><td colspan="5" class="has-text-grey has-text-centered">{% trans "No linked risks." %}</td></tr>
{% endfor %}
</tbody>
</table>
</div>
</div><!-- Linked Risks Tab End -->
<!-- Tab: History -->
<div class="tab-panel is-hidden" data-tab="history">
<div class="table-container">
<table class="table is-bordered is-striped is-narrow is-hoverable is-fullwidth">
<thead>
<tr class="has-background-prosoft">
<th class="has-text-centered">{% trans "Time" %}</th>
<th class="has-text-centered">{% trans "User" %}</th>
<th class="has-text-centered">{% trans "Action" %}</th>
</tr>
</thead>
<tbody>
{% for log in logs %}
<tr>
<td class="has-text-centered">{{ log.action_time|date:"d.m.Y H:i" }}</td>
<td class="has-text-centered">{{ log.user.get_full_name|default:log.user.username }}</td>
<td>{{ log.get_change_message }}</td>
</tr>
{% empty %}
<tr><td colspan="3" class="has-text-grey has-text-centered">{% trans "No history found." %}</td></tr>
{% endfor %}
</tbody>
</table>
</div>
</div><!-- History Tab End -->
<!-- Tab switching script -->
<script>
document.addEventListener('DOMContentLoaded', () => {
const tabs = document.querySelectorAll('.erp-tabs a[data-tab]');
const panels = document.querySelectorAll('.tab-panel');
tabs.forEach(tab => {
tab.addEventListener('click', e => {
e.preventDefault();
tabs.forEach(x => x.classList.remove('is-active'));
panels.forEach(p => p.classList.add('is-hidden'));
tab.classList.add('is-active');
const target = tab.getAttribute('data-tab');
const activePanel = document.querySelector(`.tab-panel[data-tab="${target}"]`);
if (activePanel) activePanel.classList.remove('is-hidden');
});
});
});
</script>
{% endblock %}