isbn-sort/templates/index.html

71 lines
2.7 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 %}
<dialog id="edit-book-dialog">
<form id="edit-book-form" action="/update-book" method="post">
<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-date">Date:</label><br>
<input type="text" id="edit-date" name="publish_date"><br>
<label for="edit-publisher">Éditeur:</label><br>
<input type="text" id="edit-publisher" name="publisher"><br>
<label for="edit-quantity">Quantité:</label><br>
<input type="number" id="edit-quantity" name="count"><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>
<form id="delete-book-form" action="/delete-book" method="post">
<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">
Ajouter manuellement
<form action="web-submit-isbn">
<input type="text" name="isbn" placeholder="ISBN">
<input type="submit" value="Ajouter">
</form>
</div>
2024-04-03 17:54:20 +02:00
<table id="books-table">
<tr>
<th>ISBN</th>
<th>Titre</th>
<th>Auteur</th>
<th>Date</th>
<th>Éditeur</th>
<th>Quantité</th>
<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.publish_date == None %}class="red"{% endif %}>{{ book.publish_date }}</p></td>
<td><p {% if book.publisher == None %}class="red"{% endif %}>{{ book.publisher }}</p></td>
2024-04-03 18:30:04 +02:00
<td><p {% if book.count != 1 %}class="red"{% endif %}>{{ book.count }}</p></td>
2024-04-03 17:54:20 +02:00
<td>
<button class="action" onclick="edit_book({{ book.isbn }})">✏️</button>
<button class="action" onclick="delete_book({{ book.isbn }})">🗑️</button>
</td>
</tr>
{% endfor %}
</table>
2024-04-03 18:30:04 +02:00
<br/>
<a href="/export-csv" download="books.csv">Exporter en CSV</a>
2024-04-03 17:54:20 +02:00
{% endblock %}