parcel_box_key_management/templates/index.html

102 lines
5.0 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Gestion codes déverouillage "Boite aux colis"</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h1 class="text-center">Gestion codes déverouillage "Boite aux colis"</h1>
<form method="POST" action="/generate_code">
<div class="mb-3">
<label for="comment" class="form-label">Commentaire:</label>
<input type="text" id="comment" name="comment" class="form-control">
</div>
<div class="mb-3 form-check">
<input type="checkbox" id="eternal" name="eternal" class="form-check-input">
<label for="eternal" class="form-check-label">Eternel</label>
</div>
<button type="submit" class="btn btn-primary">Générer un code</button>
</form>
<h2>Codes actifs</h2>
<form method="POST" action="/process_action">
<table class="table">
<thead>
<tr>
<th>Code</th>
<th>Commentaire</th>
<th>Date d'expiration</th>
<th>Actions</th>
<th>Sélectionner</th> <!-- Nouvelle colonne pour les cases à cocher -->
</tr>
</thead>
<tbody>
{% for code in codes %}
{% if code['active'] %}
<tr>
<td>{{ code['code'] }}</td>
<td>{{ code['comment'] }}</td>
<td>{{ code['expiration'] }}</td>
<td>
<form method="POST" action="/update_code" class="d-inline">
<input type="hidden" name="code_id" value="{{ code['id'] }}">
<button type="submit" name="action" value="disable" class="btn btn-warning">Désactiver</button>
<button type="submit" name="action" value="delete" class="btn btn-danger">Supprimer</button>
</form>
</td>
<td>
<input type="checkbox" name="selected_codes" value="{{ code['id'] }}">
</td> <!-- Nouvelle colonne avec la case à cocher -->
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
<button type="submit" name="group_action" value="disable_selected" class="btn btn-warning">Désactiver sélectionnés</button>
<button type="submit" name="group_action" value="delete_selected" class="btn btn-danger">Supprimer sélectionnés</button>
</form>
<h2>Codes inactifs</h2>
<form method="POST" action="/process_action">
<table class="table">
<thead>
<tr>
<th>Code</th>
<th>Commentaire</th>
<th>Date d'expiration</th>
<th>Actions</th>
<th>Sélectionner</th> <!-- Nouvelle colonne pour les cases à cocher -->
</tr>
</thead>
<tbody>
{% for code in codes %}
{% if not code['active'] %}
<tr>
<td>{{ code['code'] }}</td>
<td>{{ code['comment'] }}</td>
<td>{{ code['expiration'] }}</td>
<td>
<form method="POST" action="/update_code" class="d-inline">
<input type="hidden" name="code_id" value="{{ code['id'] }}">
<button type="submit" name="action" value="disable" class="btn btn-warning">Désactiver</button>
<button type="submit" name="action" value="delete" class="btn btn-danger">Supprimer</button>
</form>
</td>
<td>
<input type="checkbox" name="selected_codes" value="{{ code['id'] }}">
</td> <!-- Nouvelle colonne avec la case à cocher -->
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
<button type="submit" name="group_action" value="disable_selected" class="btn btn-warning">Désactiver sélectionnés</button>
<button type="submit" name="group_action" value="delete_selected" class="btn btn-danger">Supprimer sélectionnés</button>
</form>
</div>
</body>
</html>