2023-11-01 18:46:27 +00:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
|
|
{% block title %}
|
|
|
|
SAR Records
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
<div class="container mt-5">
|
|
|
|
<h2>SAR Records</h2>
|
2023-11-24 19:50:56 +00:00
|
|
|
|
|
|
|
<form method="get" action="{{ url_for('list_sar') }}" id="filter-form">
|
|
|
|
<!-- Filter by Status -->
|
|
|
|
<select id="status-select" name="status" onchange="submitForm()">
|
|
|
|
<option value="">All Statuses</option>
|
|
|
|
<!-- Populate options with statuses -->
|
|
|
|
{% for status in statuses %}
|
|
|
|
<option value="{{ status.id }}">{{ status.name }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- Filter by Category -->
|
|
|
|
<select id="category-select" name="category" onchange="submitForm()">
|
|
|
|
<option value="">All Categories</option>
|
|
|
|
<!-- Populate options with categories -->
|
|
|
|
{% for category in categories %}
|
|
|
|
<option value="{{ category.id }}">{{ category.name }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- Sorting Options -->
|
|
|
|
<select id="sort-select" name="sort" onchange="submitForm()">
|
|
|
|
<option value="date_asc">Date (Oldest First)</option>
|
|
|
|
<option value="date_desc">Date (Newest First)</option>
|
|
|
|
<!-- other sorting options -->
|
|
|
|
</select>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
2023-11-01 18:46:27 +00:00
|
|
|
<table class="table table-bordered table-hover">
|
|
|
|
<thead>
|
2023-10-30 14:48:00 +00:00
|
|
|
<tr>
|
2023-11-01 18:46:27 +00:00
|
|
|
<th>Id</th>
|
2023-11-12 20:06:15 +00:00
|
|
|
<th>Title</th>
|
2023-11-18 19:34:23 +00:00
|
|
|
<th>Status</th>
|
2023-10-30 14:48:00 +00:00
|
|
|
<th>Start Date</th>
|
|
|
|
<th>Finish Date</th>
|
|
|
|
<th>Category</th>
|
2023-11-12 20:06:15 +00:00
|
|
|
<th>Created by</th>
|
2023-11-18 19:34:23 +00:00
|
|
|
<th>Manager</th>
|
2023-11-19 21:08:19 +00:00
|
|
|
|
2023-11-24 19:50:56 +00:00
|
|
|
{% if is_logged_in %}
|
|
|
|
<th>Actions</th>
|
2023-11-19 21:08:19 +00:00
|
|
|
{% endif %}
|
2023-10-30 14:48:00 +00:00
|
|
|
</tr>
|
2023-11-01 18:46:27 +00:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
2023-10-30 14:48:00 +00:00
|
|
|
{% for sar in sar_calls %}
|
2023-11-14 10:07:43 +00:00
|
|
|
<tr class="clickable-row" data-href="{{ url_for('sar_details', id=sar.SARCall.id) }}">
|
2023-11-12 20:06:15 +00:00
|
|
|
<td>{{ sar.SARCall.id }}</td>
|
|
|
|
<td>{{ sar.SARCall.title }}</td>
|
2023-11-19 21:08:19 +00:00
|
|
|
<td>{{ sar.SARStatus.name }}</td>
|
2023-11-12 20:06:15 +00:00
|
|
|
<td>{{ sar.SARCall.start_date }}</td>
|
|
|
|
<td>{{ sar.SARCall.finish_date }}</td>
|
|
|
|
<td>{{ sar.SARCategory.name }}</td>
|
2023-11-19 21:08:19 +00:00
|
|
|
<td>{{ sar.SARCall.coordination_officer.full_name }}</td>
|
|
|
|
<td>{{ sar.SARCall.search_officer.full_name }}</td>
|
|
|
|
{% if is_logged_in %}
|
2023-11-24 19:50:56 +00:00
|
|
|
<td>
|
|
|
|
<a href="{{ url_for('edit_sar', id=sar.SARCall.id) }}">
|
|
|
|
<button type="button" class="btn btn-info">Edit</button>
|
|
|
|
</a>
|
|
|
|
{# <a href="{{ url_for('delete_sar', id=sar.SARCall.id) }}">#}
|
|
|
|
{# <button type="button" class="btn btn-danger">Delete</button>#}
|
|
|
|
{# </a>#}
|
|
|
|
</td>
|
2023-11-19 21:08:19 +00:00
|
|
|
{% endif %}
|
2023-11-01 18:46:27 +00:00
|
|
|
</tr>
|
2023-10-30 14:48:00 +00:00
|
|
|
{% endfor %}
|
2023-11-01 18:46:27 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
2023-11-24 19:50:56 +00:00
|
|
|
{# <a href="/dashboard">Back to Dashboard</a>#}
|
2023-11-01 18:46:27 +00:00
|
|
|
</div>
|
2023-11-12 20:06:15 +00:00
|
|
|
|
|
|
|
<script>
|
2023-11-14 10:07:43 +00:00
|
|
|
document.querySelectorAll('.clickable-row').forEach(row => {
|
|
|
|
row.addEventListener('click', () => {
|
|
|
|
window.location.href = row.dataset.href;
|
|
|
|
});
|
2023-11-12 20:06:15 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2023-11-24 19:50:56 +00:00
|
|
|
<script>
|
|
|
|
function submitForm() {
|
|
|
|
document.getElementById("filter-form").submit();
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-12 20:06:15 +00:00
|
|
|
|
|
|
|
|
2023-11-01 18:46:27 +00:00
|
|
|
{% endblock %}
|