isbn-sort/isbn_sort/templates/index.html

89 lines
3.5 KiB
HTML
Raw Normal View History

2024-04-03 17:54:20 +02:00
{% extends 'base.html' %}
2024-04-03 18:30:04 +02:00
{% block title %}Liste des livres{% endblock %}
2024-04-03 17:54:20 +02:00
{% block header %}
<h1>Table des livres</h1>
{% endblock %}
{% block content %}
2024-04-05 17:47:15 +02:00
<script src="{{ url_for('static', filename='main.js') }}" defer></script>
<script src="{{ url_for('static', filename='dynamicUpdate.js') }}" defer></script>
2024-04-03 17:54:20 +02:00
<dialog id="edit-book-dialog">
2024-04-05 17:24:02 +02:00
<form id="edit-book-form" action="/app/update-book" method="post">
2024-04-03 17:54:20 +02:00
<input type="hidden" id="edit-isbn" value="" name="isbn">
<label for="edit-title">Titre:</label><br>
<input type="text" id="edit-title" name="title"><br>
<label for="edit-author">Auteur:</label><br>
<input type="text" id="edit-author" name="author"><br>
<label for="edit-owner">Propriétaire:</label><br>
<input type="text" id="edit-owner" name="owner"><br>
<label for="edit-status">État:</label><br>
<select id="edit-status" name="status">
<option value="0">À lire</option>
<option value="1">En cours</option>
<option value="2">Lu</option>
</select>
2024-05-01 19:57:01 +02:00
<label for="edit-category">Catégorie:</label><br>
<select id="edit-category" name="category" onchange="categoryChange()">
2024-05-01 19:57:01 +02:00
<option value="">- Pas de catégorie -</option>
<option value="">- Nouvelle catégorie -</option>
2024-05-01 19:57:01 +02:00
{% for category in categories %}
{% if category != "" %}
<option value="{{ category }}">{{ category }}</option>
{% endif %}
{% endfor %}
</select><br>
2024-04-03 18:30:04 +02:00
<input type="submit" value="Mettre à jour">
2024-04-03 17:54:20 +02:00
</form>
<button onclick="hideEditBookDialog()">Annuler</button>
</dialog>
<dialog id="delete-book-dialog">
<p>Êtes-vous sûr de supprimer ce livre ?</p>
<b id="delete-book-name">Nom du livre...</b>
2024-04-05 17:24:02 +02:00
<form id="delete-book-form" action="/app/delete-book" method="post">
2024-04-03 17:54:20 +02:00
<input type="hidden" id="delete-isbn" value="" name="isbn">
2024-04-03 18:30:04 +02:00
<input type="submit" value="Oui">
2024-04-03 17:54:20 +02:00
</form>
<button id="cancel-delete">Annuler</button>
</dialog>
2024-04-03 18:30:04 +02:00
<div id="add-book">
<details>
<summary>Ajouter manuellement</summary>
<form action="/app/web-submit-isbn">
<input type="text" name="isbn" placeholder="ISBN">
<input type="submit" value="Ajouter">
</form>
</details>
2024-04-03 18:30:04 +02:00
</div>
2024-04-04 12:48:41 +02:00
<div id="table-container">
<table id="books-table">
<tr>
<th>ISBN</th>
<th>Titre</th>
<th>Auteur</th>
<th>État</th>
<th>Propriétaire</th>
2024-05-01 19:57:01 +02:00
<th>Catégorie</th>
2024-04-04 12:48:41 +02:00
<th>Actions</th>
</tr>
{% for book in books %}
<tr>
<td>{{ book.isbn }}</td>
<td><p {% if book.title == None %}class="red"{% endif %}>{{ book.title }}</p></td>
<td><p {% if book.author == None %}class="red"{% endif %}>{{ book.author }}</p></td>
<td><p {% if book.status == 0 %}class="red"{% elif book.status==2 %}class="green"{% endif %}>{{ book.status_text }}</p></td>
<td><p {% if book.owner == None %}class="red"{% endif %}>{{ book.owner }}</p></td>
2024-05-01 19:57:01 +02:00
<td><p {% if book.category == None %}class="red"{% endif %}>{{ book.category }}</p></td>
2024-04-04 12:48:41 +02:00
<td>
2024-04-19 11:30:55 +02:00
<button class="action" onclick='openEditBookDialog("{{ book.isbn }}")'>✏️</button>
<button class="action" onclick='openDeleteBookDialog("{{ book.isbn }}")'>🗑️</button>
2024-04-04 12:48:41 +02:00
</td>
</tr>
{% endfor %}
</table>
</div>
2024-04-03 18:30:04 +02:00
<br/>
2024-04-05 17:24:02 +02:00
<a href="/app/export-csv" download="books.csv">Exporter en CSV</a>
2024-04-03 17:54:20 +02:00
{% endblock %}