aboutsummaryrefslogtreecommitdiff
path: root/templates/balancing
diff options
context:
space:
mode:
Diffstat (limited to 'templates/balancing')
-rw-r--r--templates/balancing/create.html79
-rw-r--r--templates/balancing/table.html56
-rw-r--r--templates/balancing/update.html105
3 files changed, 240 insertions, 0 deletions
diff --git a/templates/balancing/create.html b/templates/balancing/create.html
new file mode 100644
index 0000000..c9bfdba
--- /dev/null
+++ b/templates/balancing/create.html
@@ -0,0 +1,79 @@
+{% extends "base.html" %}
+
+{% block title %}
+ Nouvel équilibrage
+{% endblock title %}
+
+{% block main %}
+
+ <section class="g-Section">
+ <p class="g-Paragraph">
+ <a
+ class="g-Link g-Media__Large"
+ href="/balancings?page={{ query.page or 1 }}"
+ >
+ Retour aux équilibrages
+ </a>
+ </p>
+
+ <form
+ class="g-Form"
+ action="/balancing/create?page={{ query.page or 1 }}"
+ method="POST"
+ >
+ <h1 class="g-H1">
+ Nouvel équilibrage
+ </h1>
+
+ {% if error %}
+ <div class="g-Form__Error">{{ error }}</div>
+ {% endif %}
+
+ <label class="g-Form__Label">
+ Montant
+ <input
+ name="amount"
+ type="number"
+ class="g-Form__Input"
+ value="{{ form.amount or "" }}"
+ min=1
+ required
+ {% if not form %} autofocus {% endif %}
+ />
+ </label>
+
+ {% set user_id = form.user_id or connected_user.id %}
+
+ <label class="g-Form__Label">
+ De
+ <select name="source" 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>
+ </label>
+
+ <label class="g-Form__Label">
+ Vers
+ <select name="destination" class="g-Form__Select" required>
+ <option value="" disabled selected></option>
+ {% for user in users %}
+ <option value="{{ user.id }}">
+ {{ user.name }}
+ </option>
+ {% endfor %}
+ </select>
+ </label>
+
+ <div>
+ <input class="g-Button__Validate" type="submit" value="Créer" />
+ </div>
+ </form>
+ </section>
+
+{% endblock main %}
diff --git a/templates/balancing/table.html b/templates/balancing/table.html
new file mode 100644
index 0000000..72f3b37
--- /dev/null
+++ b/templates/balancing/table.html
@@ -0,0 +1,56 @@
+{% import "macros/paging.html" as paging %}
+
+{% extends "base.html" %}
+
+{% block title %}
+ Équilibrages
+{% endblock title %}
+
+{% block main %}
+
+ <section class="g-Section">
+
+ {% if not balancings %}
+ <div class="g-Table__NoResults">
+ Il n’y a aucun équilibrage.
+ </div>
+ {% endif %}
+
+ <a
+ class="g-Paragraph g-Button__Validate"
+ href="/balancing?page={{ page or 1 }}"
+ >
+ Ajouter un équilibrage
+ </a>
+
+ {% if balancings %}
+ <div class="g-Table">
+ <div class="g-Table__Row g-Table__Row--Header">
+ <span class="g-Table__Cell">Montant</span>
+ <span class="g-Table__Cell">De</span>
+ <span class="g-Table__Cell">Vers</span>
+ </div>
+ {% for balancing in balancings %}
+ <a
+ class="g-Table__Row {% if highlight == balancing.id %} g-Table__Row--Highlight {% endif %}"
+ href="/balancing/{{ balancing.id }}?page={{ page or 1 }}"
+ >
+ <span class="g-Table__Cell g-Table__NumericCell">
+ {{ balancing.amount | euros() }}
+ </span>
+ <span class="g-Table__Cell">{{ balancing.source }}</span>
+ <span class="g-Table__Cell">{{ balancing.destination }}</span>
+ </a>
+ {% endfor %}
+ </div>
+
+ {{ paging.view(
+ url="/balancings",
+ page=page,
+ max_page=max_page
+ ) }}
+ {% endif %}
+
+ </section>
+
+{% endblock main %}
diff --git a/templates/balancing/update.html b/templates/balancing/update.html
new file mode 100644
index 0000000..9c98e93
--- /dev/null
+++ b/templates/balancing/update.html
@@ -0,0 +1,105 @@
+{% extends "base.html" %}
+
+{% block title %}
+ Équilibrage {{ id }}
+{% endblock title %}
+
+{% block main %}
+
+ <section class="g-Section">
+ <p class="g-Paragraph">
+ <a
+ class="g-Link g-Media__Large"
+ href="/balancings?page={{ query.page or 1 }}"
+ >
+ Retour aux équilibrages
+ </a>
+ </p>
+
+ {% if error %}
+ <div class="g-Form__Error">{{ error }}</div>
+ {% endif %}
+
+ {% if not balancing %}
+
+ L’équilibrage n’a pas été trouvé.
+
+ {% else %}
+
+ <form
+ class="g-Form"
+ action="/balancing/{{ balancing.id }}/update"
+ method="POST"
+ >
+ <h1 class="g-H1">Modification</h1>
+
+ <label class="g-Form__Label">
+ Montant
+ <input
+ name="amount"
+ type="number"
+ class="g-Form__Input"
+ value="{{ form.amount or balancing.amount }}"
+ min=1
+ required
+ />
+ </label>
+
+ {% set source = form.source or balancing.source %}
+
+ <label class="g-Form__Label">
+ De
+ <select name="source" class="g-Form__Select" required>
+ {% for user in users %}
+ <option
+ value="{{ user.id }}"
+ {% if "" ~ user.id == "" ~ source %} selected {% endif %}
+ >
+ {{ user.name }}
+ </option>
+ {% endfor %}
+ </select>
+ </label>
+
+ {% set destination = form.destination or balancing.destination %}
+
+ <label class="g-Form__Label">
+ Vers
+ <select name="destination" class="g-Form__Select" required>
+ {% for user in users %}
+ <option
+ value="{{ user.id }}"
+ {% if "" ~ user.id == "" ~ destination %} selected {% endif %}
+ >
+ {{ user.name }}
+ </option>
+ {% endfor %}
+ </select>
+ </label>
+
+ <div>
+ <input class="g-Button__Validate" type="submit" value="Modifier" />
+ </div>
+ </form>
+
+ <form
+ class="g-Form"
+ action="/balancing/{{ balancing.id }}/delete"
+ method="POST"
+ >
+ <h1 class="g-H1">Suppression</h1>
+
+ <label class="g-Form__Label">
+ Veuillez recopier le montant de l’équilibrage : « {{ balancing.amount }} ».
+ <input name="remove-input" class="g-Form__Input" data-name="{{ balancing.amount }}" />
+ </label>
+
+ <div>
+ <input id="remove-button" class="g-Button__Danger" type="submit" value="Supprimer" disabled />
+ </div>
+ </form>
+
+ {% endif %}
+ </section>
+
+{% endblock main %}