aboutsummaryrefslogtreecommitdiff
path: root/templates/payment
diff options
context:
space:
mode:
authorJoris2021-10-10 19:27:22 +0200
committerJoris2021-10-10 21:21:34 +0200
commit6e695bf7a0253b4f6d1db78fa4310616d8a1357f (patch)
treea5b9f30b74a6914336993f93504df3b42fccb933 /templates/payment
parent8ccd762bfc3d7da2716749d709cf5cc216882a23 (diff)
Search by name, cost and user
Diffstat (limited to 'templates/payment')
-rw-r--r--templates/payment/create.html3
-rw-r--r--templates/payment/table.html91
-rw-r--r--templates/payment/table/search.html68
-rw-r--r--templates/payment/update.html9
4 files changed, 97 insertions, 74 deletions
diff --git a/templates/payment/create.html b/templates/payment/create.html
index 8defad3..4fc3245 100644
--- a/templates/payment/create.html
+++ b/templates/payment/create.html
@@ -12,7 +12,8 @@
class="g-Link g-Media__Large"
href="/{{ payments_params(
page=query.page,
- search=query.search,
+ name=query.name,
+ cost=query.cost,
frequency=query.frequency
) }}"
>
diff --git a/templates/payment/table.html b/templates/payment/table.html
index da15b22..c187f17 100644
--- a/templates/payment/table.html
+++ b/templates/payment/table.html
@@ -9,84 +9,34 @@
{% block main %}
<aside class="g-Aside">
- <form action="/" method="GET" class="g-Payments__Filters">
- <label class="g-Form__Label">
- Fréquence
- <select name="frequency" class="g-Form__Select">
- <option value="Punctual" {% if query.frequency == "Punctual" %} selected {% endif %}>
- Ponctuelle
- </option>
- <option value="Monthly" {% if query.frequency == "Monthly" %} selected {% endif %}>
- Mensuelle
- </option>
- </select>
- </label>
-
- <label class="g-Form__Label">
- Recherche
- <input
- type="search"
- name="search"
- class="g-Form__Input"
- value="{{ query.search }}"
- />
- </label>
-
- <label class="g-Form__Label">
- Catégorie
- <select name="category" class="g-Form__Select">
- <option selected disabled hidden></option>
- {% for category in categories %}
- <option
- value="{{ category.id }}"
- style="color: {{ category.color }}"
- {% if category.id == query.category %} selected {% endif %}
- >
- {{ category.name }}
- </option>
- {% endfor %}
- </select>
- </label>
-
- <input type="submit" class="g-Button__Validate" value="Rechercher">
- </form>
+ {% include "payment/table/search.html" %}
</aside>
<section class="g-Section">
- {% if not payments %}
- <div class="g-Payments__NoResults">
+ {% if not payments %}
+ <div class="g-Table__NoResults">
Aucun paiement ne correspond à votre recherche.
</div>
-
- <a
- class="g-Button__Validate g-Payments__New"
- href="/payment{{ payments_params(
- page=query.page,
- search=query.search,
- frequency=query.frequency
- ) }}"
- >
- Nouveau
- </a>
-
{% else %}
-
<div class="g-Paragraph">
{{ count | numeric }} paiement{{ count | pluralize }} comptabilisant {{ total_cost | euros() }}.
</div>
+ {% endif %}
- <a
- class="g-Paragraph g-Button__Validate g-Payments__New"
- href="/payment{{ payments_params(
- page=query.page,
- search=query.search,
- frequency=query.frequency
- ) }}"
- >
- Ajouter un paiement
- </a>
-
+ <a
+ class="g-Paragraph g-Button__Validate"
+ href="/payment{{ payments_params(
+ page=query.page,
+ name=query.name,
+ cost=query.cost,
+ frequency=query.frequency
+ ) }}"
+ >
+ Ajouter un paiement
+ </a>
+
+ {% if payments %}
<div class="g-Table">
<div class="g-Table__Row g-Table__Row--Header">
<span class="g-Table__Cell">Nom</span>
@@ -102,7 +52,8 @@
class="g-Table__Row {% if query.highlight == payment.id %} g-Table__Row--Highlight {% endif %}"
href="/payment/{{ payment.id }}{{ payments_params(
page=query.page,
- search=query.search,
+ name=query.name,
+ cost=query.cost,
frequency=query.frequency
) }}"
>
@@ -131,14 +82,14 @@
{{ paging::paging(
url="/" ~ payments_params(
- search=query.search,
+ name=query.name,
+ cost=query.cost,
frequency=query.frequency,
category=query.category
),
page=page,
max_page=max_page
) }}
-
{% endif %}
</section>
diff --git a/templates/payment/table/search.html b/templates/payment/table/search.html
new file mode 100644
index 0000000..8805cbb
--- /dev/null
+++ b/templates/payment/table/search.html
@@ -0,0 +1,68 @@
+<form action="/" method="GET" class="g-Payments__Filters">
+
+ <label class="g-Form__Label">
+ Fréquence
+ <select name="frequency" class="g-Form__Select">
+ <option value="Punctual" {% if query.frequency == "Punctual" %} selected {% endif %}>
+ Ponctuelle
+ </option>
+ <option value="Monthly" {% if query.frequency == "Monthly" %} selected {% endif %}>
+ Mensuelle
+ </option>
+ </select>
+ </label>
+
+ <label class="g-Form__Label">
+ Nom
+ <input
+ type="search"
+ name="name"
+ class="g-Form__Input"
+ value="{{ query.name }}"
+ />
+ </label>
+
+ <label class="g-Form__Label">
+ Coût
+ <input
+ type="number"
+ name="cost"
+ class="g-Form__Input"
+ value="{{ query.cost }}"
+ />
+ </label>
+
+ <label class="g-Form__Label">
+ Personne
+ <select name="user" class="g-Form__Select">
+ <option selected disabled hidden></option>
+ {% for user in users %}
+ <option
+ value="{{ user.id }}"
+ {% if user.id == query.user %} selected {% endif %}
+ >
+ {{ user.name }}
+ </option>
+ {% endfor %}
+ </select>
+ </label>
+
+ <label class="g-Form__Label">
+ Catégorie
+ <select name="category" class="g-Form__Select">
+ <option selected disabled hidden></option>
+ {% for category in categories %}
+ <option
+ value="{{ category.id }}"
+ style="color: {{ category.color }}"
+ {% if category.id == query.category %} selected {% endif %}
+ >
+ {{ category.name }}
+ </option>
+ {% endfor %}
+ </select>
+ </label>
+
+ <input type="submit" class="g-Button__Validate" value="Rechercher">
+
+</form>
diff --git a/templates/payment/update.html b/templates/payment/update.html
index 4e244f4..002117e 100644
--- a/templates/payment/update.html
+++ b/templates/payment/update.html
@@ -12,7 +12,8 @@
class="g-Link g-Media__Large"
href="/{{ payments_params(
page=query.page,
- search=query.search,
+ name=query.name,
+ cost=query.cost,
frequency=query.frequency
) }}"
>
@@ -34,7 +35,8 @@
class="g-Form"
action="/payment/{{ payment.id }}/update{{ payments_params(
page=query.page,
- search=query.search,
+ name=query.name,
+ cost=query.cost,
frequency=query.frequency,
highlight=query.highlight
) }}"
@@ -126,7 +128,8 @@
class="g-Form"
action="/payment/{{ payment.id }}/delete{{ payments_params(
page=query.page,
- search=query.search,
+ name=query.name,
+ cost=query.cost,
frequency=query.frequency,
highlight=query.highlight
) }}"