diff options
author | Joris | 2021-01-03 13:40:40 +0100 |
---|---|---|
committer | Joris | 2021-01-03 13:54:20 +0100 |
commit | 11052951b74b9ad4b6a9412ae490086235f9154b (patch) | |
tree | 64526ac926c1bf470ea113f6cac8a33158684e8d /templates/payment/create.html | |
parent | 371449b0e312a03162b78797b83dee9d81706669 (diff) |
Rewrite in Rust
Diffstat (limited to 'templates/payment/create.html')
-rw-r--r-- | templates/payment/create.html | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/templates/payment/create.html b/templates/payment/create.html new file mode 100644 index 0000000..aea6fcd --- /dev/null +++ b/templates/payment/create.html @@ -0,0 +1,120 @@ +{% extends "base.html" %} + +{% block title %} + Nouveau paiement +{% endblock title %} + +{% block main %} + + <div> + <p class="g-Paragraph"> + <a + class="g-Link g-Media__Large" + href="/{{ payments_params( + page=query.page, + search=query.search, + frequency=query.frequency + ) }}" + > + Retour aux paiements + </a> + </p> + + <form class="g-Form" action="/payment/create" method="POST"> + <h1 class="g-H1"> + Nouveau paiement + {% if query.frequency != "Monthly" %} + ponctuel + {% else %} + mensuel + {% endif %} + </h1> + + {% if error %} + <div class="g-Form__Error">{{ error }}</div> + {% endif %} + + <label class="g-Form__Label" for="name">Nom</label> + <input + name="name" + class="g-Form__Input" + id="name" + value="{{ form.name | default(value="") }}" + required + {% if not form %} autofocus {% endif %} + /> + + <label class="g-Form__Label" for="cost">Coût</label> + <input + name="cost" + type="number" + class="g-Form__Input" + id="cost" + value="{{ form.cost | default(value="") }}" + required + /> + + {% set user_id = form.user_id | default(value="" ~ connected_user.id) %} + + <label class="g-Form__Label" for="user_id">Personne</label> + <select name="user_id" id="user_id" class="g-Form__Select" required> + {% for user in users %} + <option + value="{{ user.id }}" + {% if "" ~ user.id == user_id %} + selected + {% endif %} + > + {{ user.name }} + </option> + {% endfor %} + </select> + + {% set category_id = form.category_id | default(value="") %} + + <label class="g-Form__Label" for="category_id">Catégorie</label> + <select name="category_id" id="category_id" class="g-Form__Select" required> + {% for category in categories %} + <option + value="{{ category.id }}" + style="color: {{ category.color }}" + {% if "" ~ category.id == category_id %} selected {% endif %} + > + {{ category.name }} + </option> + {% endfor %} + </select> + + {% set date = form.date | default(value=now() | date(format="%Y-%m-%d")) %} + + {% if query.frequency != "Monthly" %} + <label class="g-Form__Label" for="date">Date</label> + <input + name="date" + type="date" + class="g-Form__Input" + id="date" + value="{{ date }}" + required + /> + {% else %} + <input + name="date" + type="hidden" + value="{{ date }}" + /> + {% endif %} + + <input + type="hidden" + name="frequency" + value="{{ query.frequency | default(value="Punctual") }}" + /> + + <div> + <input class="g-Button__Validate" type="submit" value="Créer" /> + </div> + </form> + </div> + +{% endblock main %} |