Lists: list & add

This commit is contained in:
William Bouzourène 2024-12-30 16:18:40 +01:00
parent 0159e8d528
commit 6acd737b99
6 changed files with 173 additions and 3 deletions

56
views/list_form.html Normal file
View file

@ -0,0 +1,56 @@
{% extends "layouts/main.html" %}
{% block main %}
<div class="container mt-4">
<h1>Ajouter un liste</h1>
<hr>
{% if Errors %}
<div class="alert alert-danger">
<ul class="m-0">
{% for Error in Errors %}
<li>{{ Error }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
<form id="list" method="post">
<div class="mb-3">
<label for="name" class="form-label">
Nom
</label>
<input
id="name"
class="form-control"
type="text"
name="name"
required
value="{{ List.Name }}"
>
</div>
<div class="mb-3">
<input
type="checkbox"
class="form-check-input me-2"
id="multi"
name="multi"
{% if List.Multi %}checked{% endif %}
>
<label for="multi" class="form-label">
Liste à choix multiples
</label>
</div>
<div class="mt-3">
<button class="btn btn-primary" type="submit">
<i class="me-1" data-feather="save"></i>
Enregistrer
</button>
</div>
</form>
</div>
{% endblock %}

41
views/lists.html Normal file
View file

@ -0,0 +1,41 @@
{% extends "layouts/main.html" %}
{% block main %}
<div class="container mt-4">
<h1>Listes</h1>
<hr>
{% if Lists %}
<div class="table-responsive">
<table class="table table-borderless table-hover">
<tbody>
{% for List in Lists %}
<tr>
<td
class="item-click"
onclick="window.location.href='/admin/lists/{{ List.ID }}'"
>
<a href="/admin/lists/{{ List.ID }}">
{{ List.Name }}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="my-4">
Pas de liste pour le moment
</div>
{% endif %}
<div class="mt-3">
<a class="btn btn-md btn-primary" href="/admin/lists/add">
<i class="feather" data-feather="plus"></i>
Ajouter
</a>
</div>
</div>
{% endblock %}