]> git.agnieray.net Git - galette.git/blob - galette/templates/default/pages/contributions_list.html.twig
Fix tables rows backgrounds colors on mobile
[galette.git] / galette / templates / default / pages / contributions_list.html.twig
1 {% extends 'elements/list.html.twig' %}
2
3 {% set basic_table = true %}
4
5 {% set form = {
6 'route': {
7 'name': "batch-contributionslist",
8 'args': {"type": "contributions"}
9 },
10 'order': {
11 'name': "contributions",
12 'args': {"type": "contributions"}
13 }
14 } %}
15
16 {% if nb != 0 and (login.isAdmin() or login.isStaff()) and mode != 'ajax' %}
17 {% set batch = {
18 'route': {
19 'name': 'batch-contributionslist',
20 'args': {"type": "contributions"}
21 },
22 'modal': {
23 'title': _T("No contribution selected"),
24 'content': _T("Please make sure to select at least one contribution from the list to perform this action.")
25 }
26 } %}
27 {% set batch_actions = [
28 {
29 'name': 'delete',
30 'label': _T("Delete"),
31 'icon': 'trash red'
32 },
33 {
34 'name': 'csv__directdownload',
35 'label': _T("Export as CSV"),
36 'icon': 'file csv'
37 }
38 ] %}
39 {% endif %}
40
41 {% block search %}
42 <form action="{{ url_for("payments_filter", {"type": "contributions"}) }}" method="post" class="ui form filters">
43 <div class="ui secondary yellow segment">
44 <div class="four fields">
45 <div class="field">
46 <label for="date_field">{{ _T("Show contributions by") }}</label>
47 <select name="date_field" id="date_field" class="ui search dropdown nochosen">
48 <option value="{{ constant("Galette\\Filters\\ContributionsList::DATE_BEGIN") }}"{% if filters.date_field == constant('Galette\\Filters\\ContributionsList::DATE_BEGIN') %} selected="selected"{% endif %}>{{ _T("Begin") }}</option>
49 <option value="{{ constant("Galette\\Filters\\ContributionsList::DATE_END") }}"{% if filters.date_field == constant('Galette\\Filters\\ContributionsList::DATE_END') %} selected="selected"{% endif %}>{{ _T("End") }}</option>
50 <option value="{{ constant("Galette\\Filters\\ContributionsList::DATE_RECORD") }}"{% if filters.date_field == constant('Galette\\Filters\\ContributionsList::DATE_RECORD') %} selected="selected"{% endif %}>{{ _T("Record") }}</option>
51 </select>
52 </div>
53 <div class="two fields">
54 <div class="field">
55 <label for="start_date_filter">{{ _T("since") }}</label>
56 <div class="ui calendar" id="contrib-rangestart">
57 <div class="ui input left icon">
58 <i class="calendar icon" aria-hidden="true"></i>
59 <input placeholder="{{ _T("(yyyy-mm-dd format)") }}" type="text" name="start_date_filter" id="start_date_filter" maxlength="10" size="10" value="{{ filters.start_date_filter }}"/>
60 </div>
61 </div>
62 </div>
63 <div class="field">
64 <label for="end_date_filter">{{ _T("until") }}</label>
65 <div class="ui calendar" id="contrib-rangeend">
66 <div class="ui input left icon">
67 <i class="calendar icon" aria-hidden="true"></i>
68 <input placeholder="{{ _T("(yyyy-mm-dd format)") }}" type="text" name="end_date_filter" id="end_date_filter" maxlength="10" size="10" value="{{ filters.end_date_filter }}"/>
69 </div>
70 </div>
71 </div>
72 </div>
73 <div class="field">
74 {% include "components/forms/payment_types.html.twig" with {
75 current: filters.payment_type_filter,
76 varname: "payment_type_filter",
77 show_inline: "",
78 classname: "",
79 empty: {'value': -1, 'label': _T("Select")}
80 } %}
81 </div>
82 <div class="ui right aligned basic fitted segment field flexend">
83 <button type="submit" class="tooltip ui labeled icon primary button" title="{{ _T("Apply filters") }}" name="filter">
84 <i class="search icon" aria-hidden="true"></i>
85 {{ _T("Filter") }}
86 </button>
87 <button type="submit" id="clear_filter" name="clear_filter" class="tooltip ui labeled icon button" title="{{ _T("Reset all filters to defaults") }}">
88 <i class="trash alt red icon" aria-hidden="true"></i>
89 {{ _T("Clear filter") }}
90 </button>
91 </div>
92 </div>
93 </div>
94 {% if member is defined and mode != 'ajax' %}
95 {% if login.isAdmin() or login.isStaff() or member.canShow(login) %}
96 <div class="ui compact vertically fitted segment">
97 <div class="ui horizontal list">
98 <span class="ui primary ribbon label">
99 {% set member_logged_in_as = member.name ~ " " ~ member.surname ~ " (" ~ member.login ~ ")" %}
100 {% if login.isAdmin() or login.isStaff() or member.hasChildren() or (member.hasParent() and (member_logged_in_as != login.loggedInAs(true))) %}
101 <a
102 href="{{ url_for("contributions", {"type": "contributions", "option": "member", "value": "all"}) }}"
103 >
104 <i class="icon times tooltip" aria-hidden="true"></i>
105 <span class="ui special popup">
106 {% if member.hasChildren() or (member.hasParent() and (member_logged_in_as != login.loggedInAs(true))) %}
107 {{ _T("Show all your contributions") }}
108 {% else %}
109 {{ _T("Show all members contributions") }}
110 {% endif %}
111 </span>
112 </a>
113 {% endif %}
114 {% endif %}
115 {{ member.sname }}{% if not member.isActive() %} ({{ _T("Inactive") }}){% endif %}
116 </span>
117 {% if login.isAdmin() or login.isStaff() %}
118 <div class="item">
119 <a href="{{ url_for("member", {"id": member.id}) }}" class="ui tiny labeled icon button">
120 <i class="ui user blue icon" aria-hidden="true"></i>
121 {{ _T("See member profile") }}
122 </a>
123 </div>
124 <div class="item">
125 <a href="{{ url_for("addContribution", {"type": constant('Galette\\Entity\\Contribution::TYPE_FEE')}) }}?id_adh={{ member.id }}" class="ui tiny labeled icon button">
126 <i class="ui user check green icon" aria-hidden="true"></i>
127 {{ _T("Add a membership fee") }}
128 </a>
129 </div>
130 <div class="item">
131 <a href="{{ url_for("addContribution", {"type": constant('Galette\\Entity\\Contribution::TYPE_DONATION')}) }}?id_adh={{ member.id }}" class="ui tiny labeled icon button">
132 <i class="ui gift green icon" aria-hidden="true"></i>
133 {{ _T("Add a donation") }}
134 </a>
135 </div>
136 {% endif %}
137 </div>
138 </div>
139 {% endif %}
140 {% if member is defined %}
141 <div class="{{ member.getRowClass() }}{% if not member.isActive() %} inactive-account{% endif %} ui center aligned segment">
142 {{ member.getDues() }}
143 </div>
144 {% endif %}
145
146 {% if mode == 'ajax'%}
147 <input type="hidden" name="ajax" value="true"/>
148 <input type="hidden" name="max_amount" value="{{ filters.max_amount }}"/>
149 <input type="hidden" name="filtre_transactions" value="{{ filters.filtre_transactions }}"/>
150 {% else %}
151 {% include "components/forms/csrf.html.twig" %}
152 {% endif %}
153 </form>
154 {% endblock %}
155
156 {% block infoline %}
157 {% set infoline = {
158 'label': _Tn("%count contribution", "%count contributions", nb)|replace({"%count": nb}),
159 'route': {
160 'name': 'payments_filter',
161 'args': {
162 'type': 'contributions'
163 }
164 }
165 } %}
166 {{ parent() }}
167 {% endblock %}
168
169 {% block infoline_actions %}
170 {% if (login.isAdmin() or login.isStaff()) and member is not defined %}
171 <a
172 class="ui tiny labeled icon button"
173 href="{{ url_for("addContribution", {type: constant('Galette\\Entity\\Contribution::TYPE_FEE')}) }}"
174 >
175 <i class="ui user check green icon" aria-hidden="true"></i>
176 {{ _T("Add a membership fee") }}
177 </a>
178 <a
179 class="ui tiny labeled icon button"
180 href="{{ url_for("addContribution", {type: constant('Galette\\Entity\\Contribution::TYPE_DONATION')}) }}"
181 >
182 <i class="ui gift green icon" aria-hidden="true"></i>
183 {{ _T("Add a donation") }}
184 </a>
185
186 {% endif %}
187 {% endblock %}
188
189 {% block header %}
190 {% set columns = [
191 {'label': '#', 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_ID")},
192 {'label': _T("Date"), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_DATE")},
193 {'label': _T("Begin"), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_BEGIN_DATE")},
194 {'label': _T("End"), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_END_DATE")}
195 ] %}
196
197 {% if ((login.isAdmin() or login.isStaff()) and member is not defined) or pmember is defined %}
198 {% set columns = columns|merge([{'label': _T("Member"), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_MEMBER")}]) %}
199 {% endif %}
200
201 {% set columns = columns|merge([
202 {'label': _T('Type'), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_TYPE")},
203 {'label': _T('Amount'), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_AMOUNT")},
204 {'label': _T("Payment type"), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_PAYMENT_TYPE")},
205 {'label': _T("Duration")}
206 ]) %}
207
208 {{ parent() }}
209 {% endblock %}
210
211 {% block footer %}
212 {% if nb != 0 %}
213 <tr>
214 <th class="right" colspan="{% if (login.isAdmin() or login.isStaff()) and member is not defined %}10{% else %}9{% endif %}">
215 {{ _T("Found contributions total %f")|replace({"%f": contribs.getSum()}) }}
216 </th>
217 </tr>
218 {% endif %}
219 {% endblock %}
220
221 {% block body %}
222 {% for ordre, contribution in list %}
223 {% set mid = contribution.member %}
224 {% if contribution.isFee() %}
225 {% set ctype = constant('Galette\\Entity\\Contribution::TYPE_FEE') %}
226 {% else %}
227 {% set ctype = constant('Galette\\Entity\\Contribution::TYPE_DONATION') %}
228 {% endif %}
229
230 <tr class="{% if mode == 'ajax' %}contribution_row {% endif %}{{ contribution.getRowClass() }}" id="row_{{ contribution.id }}">
231 <td data-scope="row">
232 {% if (login.isAdmin() or login.isStaff()) or mode == 'ajax' %}
233 <input type="checkbox" name="entries_sel[]" value="{{ contribution.id }}"/>
234 {% else %}
235 <input type="hidden" name="contrib_id" value="{{ contribution.id }}"/>
236 {% endif %}
237 {% if preferences.pref_show_id %}
238 {{ contribution.id }}
239 {% else %}
240 {{ ordre + 1 + (filters.current_page - 1) * numrows }}
241 {% endif %}
242 {% if (login.isAdmin() or login.isStaff()) or mode == 'ajax' %}
243 <span class="displaynone">
244 <a href="{{ url_for("editContribution", {"type": ctype, "id": contribution.id}) }}">
245 {{ _T("Contribution %id")|replace({"%id": contribution.id}) }}
246 </a>
247 </span>
248 {% if contribution.isTransactionPart() %}
249 <a
250 href="{{ url_for("editTransaction", {"id": contribution.transaction.id}) }}"
251 >
252 <i class="ui linkify icon tooltip" aria-hidden="true"></i>
253 <span class="ui special popup">{{ _T("Transaction: %s")|replace({"%s": contribution.transaction.description}) }}</span>
254 </a>
255 {% endif %}
256 {% else %}
257 <span class="displaynone">
258 {{ _T("Contribution %id")|replace({"%id": contribution.id}) }}
259 </span>
260 {% if contribution.isTransactionPart() %}
261 <i class="ui link icon" aria-hidden="true"></i>
262 <span class="displaynone">{{ _T("Transaction: %s")|replace({"%s": contribution.transaction.description}) }}</span>
263 {% endif %}
264 {% endif %}
265 {% if not contribution.isTransactionPart() %}
266 <i class="ui icon">&nbsp;</i>
267 {% endif %}
268 </td>
269 <td data-title="{{ _T("Date") }}">{{ contribution.date }}</td>
270 <td data-title="{{ _T("Begin") }}">{{ contribution.begin_date }}</td>
271 <td data-title="{{ _T("End") }}">{{ contribution.end_date }}</td>
272 {% if ((login.isAdmin() or login.isStaff()) and member is not defined) or pmember is defined %}
273 <td data-title="{{ _T("Member") }}">
274 {% if member is defined %}
275 {% set mname = member.sname %}
276 {% else %}
277 {# FIXME #}
278 {% set mname = memberName({'id': mid}) %}
279 {% endif %}
280 {% if filters.filtre_cotis_adh == "" %}
281 <a
282 href="{{ url_for("contributions", {"type": "contributions", "option": "member", "value": mid}) }}"
283 title="{{ _T("Show only '%name' contributions")|replace({"%name": mname}) }}"
284 >
285 <i class="ui filter grey small icon" aria-hidden="true"></i>
286 </a>
287 {% endif %}
288 <a
289 href="{{ url_for("member", {"id": mid}) }}"
290 title="{{ _T("Show '%name' card")|replace({"%name": mname}) }}"
291 >
292 {{ mname }}
293 </a>
294 </td>
295 {% endif %}
296 <td data-title="{{ _T("Type") }}">{{ contribution.type.libelle }}</td>
297 <td data-title="{{ _T("Amount") }}">{{ contribution.amount }}</td>
298 <td data-title="{{ _T("Payment type") }}">{{ contribution.spayment_type }}</td>
299 <td data-title="{{ _T("Duration") }}">{{ contribution.duration }}</td>
300 {% if mode != 'ajax' %}
301 <td class="actions_row center">
302 <a
303 href="{{ url_for("printContribution", {"id": contribution.id}) }}"
304 >
305 <i class="ui file pdf green icon tooltip" aria-hidden="true"></i>
306 <span class="ui special popup">{{ _T("Print an invoice or a receipt (depending on contribution type)") }}</span>
307 </a>
308 {% if (login.isAdmin() or login.isStaff()) %}
309 <a
310 href="{{ url_for("editContribution", {"type": ctype, "id": contribution.id}) }}"
311 class="action"
312 >
313 <i class="ui edit icon tooltip" aria-hidden="true"></i>
314 <span class="ui special popup">{{ _T("Edit the contribution") }}</span>
315 </a>
316 <a
317 href="{{ url_for("removeContribution", {"type": "contributions", "id": contribution.id}) }}"
318 class="delete"
319 >
320 <i class="ui trash red icon tooltip" aria-hidden="true"></i>
321 <span class="ui special popup">{{ _T("Delete the contribution") }}</span>
322 </a>
323 {% endif %}
324 </td>
325 {% endif %}
326 </tr>
327 {% else %}
328 <tr><td colspan="{% if (login.isAdmin() or login.isStaff()) and member is not defined %}10{% elseif login.isAdmin() or login.isStaff() %}11{% else %}10{% endif %}" class="emptylist">{{ _T("no contribution") }}</td></tr>
329 {% endfor %}
330 {% endblock %}
331
332 {% block legend %}
333 <div id="legende" title="{{ _T("Legend") }}" class="ui modal">
334 <div class="header">{{ _T("Legend") }}</div>
335 <div class="content">
336 <table class="ui stripped table">
337 {% if (login.isAdmin() or login.isStaff()) and mode != 'ajax' %}
338 <tr>
339 <th class="action">
340 <i class="ui edit blue icon" aria-hidden="true"></i>
341 </th>
342 <td class="back">{{ _T("Modification") }}</td>
343 </tr>
344 <tr>
345 <th class="delete">
346 <i class="ui trash red icon" aria-hidden="true"></i>
347 </th>
348 <td class="back">{{ _T("Deletion") }}</td>
349 </tr>
350 {% endif %}
351 <tr>
352 <th class="cotis-normal color-sample">&nbsp;</th>
353 <td class="back">{{ _T("Contribution") }}</td>
354 </tr>
355 <tr>
356 <th class="cotis-give color-sample">&nbsp;</th>
357 <td class="back">{{ _T("Gift") }}</td>
358 </tr>
359 </table>
360 </div>
361 <div class="actions"><div class="ui labeled icon deny button"><i class="times icon" aria-hidden="true"></i> {{ _T("Close") }}</div></div>
362 </div>
363 {% endblock %}