diff options
Diffstat (limited to 'templates/income')
-rw-r--r-- | templates/income/create.html | 89 | ||||
-rw-r--r-- | templates/income/table.html | 55 | ||||
-rw-r--r-- | templates/income/update.html | 117 |
3 files changed, 261 insertions, 0 deletions
diff --git a/templates/income/create.html b/templates/income/create.html new file mode 100644 index 0000000..b74dddd --- /dev/null +++ b/templates/income/create.html @@ -0,0 +1,89 @@ +{% extends "base.html" %} + +{% block title %} + Nouveau revenu +{% endblock title %} + +{% block main %} + + <div> + <p class="g-Paragraph"> + <a + class="g-Link g-Media__Large" + href="/incomes?page={{ query.page | default(value=1) }}" + > + Retour aux revenus + </a> + </p> + + <form + class="g-Form" + action="/income/create?page={{ query.page | default(value=1) }}" + method="POST" + > + <h1 class="g-H1"> + Nouveau revenu + </h1> + + {% if error %} + <div class="g-Form__Error">{{ error }}</div> + {% endif %} + + <label class="g-Form__Label" for="amount">Montant</label> + <input + name="amount" + type="number" + class="g-Form__Input" + id="amount" + value="{{ form.amount | default(value="") }}" + required + {% if not form %} autofocus {% endif %} + /> + + {% 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 month_index = form.month | default(value="" ~ current_month) %} + + <label class="g-Form__Label" for="month">Mois</label> + <select name="month" id="month" class="g-Form__Select" required> + {% for month in months %} + <option + value="{{ loop.index }}" + {% if "" ~ loop.index == month_index %} + selected + {% endif %} + > + {{ month }} + </option> + {% endfor %} + </select> + + <label class="g-Form__Label" for="year">Année</label> + <input + name="year" + type="number" + class="g-Form__Input" + id="year" + value="{{ form.year | default(value=now() | date(format="%Y")) }}" + required + /> + + <div> + <input class="g-Button__Validate" type="submit" value="Créer" /> + </div> + </form> + </div> + +{% endblock main %} diff --git a/templates/income/table.html b/templates/income/table.html new file mode 100644 index 0000000..efd82a7 --- /dev/null +++ b/templates/income/table.html @@ -0,0 +1,55 @@ +{% import "macros/paging.html" as paging %} + +{% extends "base.html" %} + +{% block title %} + Revenus +{% endblock title %} + +{% block main %} + + <div class="g-Paragraph g-Payments__Header"> + <a + class="g-Button__Validate" + href="/income?page={{ page | default(value=1) }}" + > + Nouveau + </a> + </div> + + {% if not incomes %} + + <div class="g-Payments__NoResults"> + Il n’y a aucun revenu. + </div> + + {% else %} + + <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">Personne</span> + <span class="g-Table__Cell">Mois</span> + </div> + {% for income in incomes %} + <a + class="g-Table__Row {% if highlight == income.id %} g-Table__Row--Highlight {% endif %}" + href="/income/{{ income.id }}?page={{ page | default(value=1) }}" + > + <span class="g-Table__Cell g-Table__NumericCell"> + {{ income.amount | euros() }} + </span> + <span class="g-Table__Cell">{{ income.user }}</span> + <span class="g-Table__Cell">{{ income.date }}</span> + </a> + {% endfor %} + </div> + + {{ paging::paging( + url="/incomes", + page=page, + max_page=max_page + ) }} + + {% endif %} +{% endblock main %} diff --git a/templates/income/update.html b/templates/income/update.html new file mode 100644 index 0000000..6dd649a --- /dev/null +++ b/templates/income/update.html @@ -0,0 +1,117 @@ +{% extends "base.html" %} + +{% block title %} + Revenu {{ id }} +{% endblock title %} + +{% block main %} + + <div> + <p class="g-Paragraph"> + <a + class="g-Link g-Media__Large" + href="/incomes?page={{ query.page | default(value=1) }}" + > + Retour aux revenus + </a> + </p> + + {% if error %} + <div class="g-Form__Error">{{ error }}</div> + {% endif %} + + {% if not income %} + + Le revenu n’a pas été trouvé. + + {% else %} + + <form + class="g-Form" + action="/income/{{ income.id }}/update" + method="POST" + > + <h1 class="g-H1">Modification</h1> + + <label class="g-Form__Label" for="amount">Montant</label> + <input + name="amount" + type="number" + class="g-Form__Input" + id="amount" + value="{{ form.amount | default(value=income.amount) }}" + required + /> + + {% set user_id = form.user_id | default(value="" ~ income.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 month_index = form.month | default(value="" ~ income.month) %} + + <label class="g-Form__Label" for="month">Mois</label> + <select name="month" id="month" class="g-Form__Select" required> + {% for month in months %} + <option + value="{{ loop.index }}" + {% if "" ~ loop.index == month_index %} selected {% endif %} + > + {{ month }} + </option> + {% endfor %} + </select> + + <label class="g-Form__Label" for="year">Année</label> + <input + name="year" + type="number" + class="g-Form__Input" + id="year" + value="{{ form.year | default(value=income.year) }}" + required + /> + + <div> + <input class="g-Button__Validate" type="submit" value="Modifier" /> + </div> + </form> + + <form + class="g-Form" + action="/income/{{ income.id }}/delete" + method="POST" + > + <h1 class="g-H1">Suppression</h1> + + {% if is_category_used %} + <p> + La catégorie ne peut pas être supprimée car elle est actuellement + utilisée. + </p> + {% else %} + <label class="g-Form__Label" for="remove-input"> + Veuillez recopier le montant du revenu : « {{ income.amount }} ». + </label> + + <input name="remove-input" class="g-Form__Input" id="remove-input" data-name="{{ income.amount }}" /> + + <div> + <input class="g-Button__Danger" type="submit" value="Supprimer" id="remove-button" disabled /> + </div> + {% endif %} + </form> + + {% endif %} + </div> + +{% endblock main %} |