Edit en Delete functie toegevoegd

This commit is contained in:
gavinvanderbij
2025-06-04 15:13:53 +02:00
parent 75b19f2e1b
commit 0c096891ea
4 changed files with 206 additions and 55 deletions

View File

@@ -10,64 +10,69 @@
</div>
</div>
<div class="col-md-12">
<div class="card mb-4">
<div class="card-body">
<h5 class="card-title fs-4">Logs</h5>
<div class="log-container" style="max-height: 250px; overflow-y: auto;">
<table class="table table-sm table-hover">
<thead>
<tr>
<th scope="col" class="fs-5">Time</th>
<th scope="col" class="fs-5">Numberplate</th>
<th scope="col" class="fs-5">Gate Status</th>
</tr>
</thead>
<tbody>
{% for log in logs %}
<tr>
<td><small class="fs-6">{{ log.dateLogged.strftime('%H:%M:%S') }}</small></td>
<td><small class="fs-6">{{ log.plate }}</small></td>
<td>
<span
class="badge {% if log.status == 'success' %}bg-success{% elif log.status == 'warning' %}bg-warning{% elif log.status == 'error' %}bg-danger{% else %}bg-secondary{% endif %} fs-6">
{{ log.allowed }}
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="col-md-12">
<div class="card mb-4">
<div class="card-body">
<h5 class="card-title fs-4">Logs</h5>
<div class="log-container" style="max-height: 250px; overflow-y: auto;">
<table class="table table-sm table-hover">
<thead>
<tr>
<th scope="col" class="fs-5">Time</th>
<th scope="col" class="fs-5">Numberplate</th>
<th scope="col" class="fs-5">Gate Status</th>
</tr>
</thead>
<tbody>
{% for log in logs %}
<tr>
<td><small class="fs-6">{{ log.dateLogged.strftime('%H:%M:%S') }}</small></td>
<td><small class="fs-6">{{ log.plate }}</small></td>
<td>
<span class="badge {% if log.status == 'success' %}bg-success{% elif log.status == 'warning' %}bg-warning{% elif log.status == 'error' %}bg-danger{% else %}bg-secondary{% endif %} fs-6">
{{ log.allowed }}
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="card mb-4">
<div class="card-body">
<h5 class="card-title fs-4">Numberplates</h5>
<div class="log-container" style="max-height: 250px; overflow-y: auto;">
<table class="table table-sm table-hover">
<thead>
<tr>
<th scope="col" class="fs-5">ID</th>
<th scope="col" class="fs-5">Numberplate</th>
</tr>
</thead>
<tbody>
{% for plate in plates %}
<tr>
<td><small class="fs-6">{{ plate.id }}</small></td>
<td><small class="fs-6">{{ plate.plate }}</small></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="col-md-12">
<div class="card mb-4">
<div class="card-body">
<h5 class="card-title fs-4">Numberplates</h5>
<div class="log-container" style="max-height: 250px; overflow-y: auto;">
<table class="table table-sm table-hover">
<thead>
<tr>
<th scope="col" class="fs-5">ID</th>
<th scope="col" class="fs-5">Numberplate</th>
</tr>
</thead>
<tbody>
{% for plate in plates %}
<tr>
<td><small class="fs-6">{{ plate.id }}</small></td>
<td><small class="fs-6">{{ plate.plate }}</small></td>
<td>
<a href="{{ url_for('dash.edit', plate=plate.plate) }}" class="btn btn-sm btn-primary">Edit</a>
<form method="POST" action="{{ url_for('dash.delete_plate', plate=plate.plate) }}" style="display:inline;" onsubmit="return confirm('Are you sure you want to delete this numberplate?');">
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>