]> git.agnieray.net Git - galette.git/blob - galette/templates/default/pages/contributions_list.html.twig
d54d31cd783aee86b7b56d6f29882191195f5187
[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"></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"></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"></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 <a
100 href="{{ url_for("contributions", {"type": "contributions", "option": "member", "value": "all"}) }}"
101 >
102 <i class="icon times tooltip"></i>
103 <span class="ui special popup">{{ _T("Show all members contributions") }}</span>
104 </a>
105 {% endif %}
106 {{ member.sname }}{% if not member.isActive() %} ({{ _T("Inactive") }}){% endif %}
107 </span>
108 {% if login.isAdmin() or login.isStaff() %}
109 <div class="item">
110 <a href="{{ url_for("member", {"id": member.id}) }}" class="ui tiny labeled icon button">
111 <i class="ui user blue icon" aria-hidden="true"></i>
112 {{ _T("See member profile") }}
113 </a>
114 </div>
115 <div class="item">
116 <a href="{{ url_for("addContribution", {"type": constant('Galette\\Entity\\Contribution::TYPE_FEE')}) }}?id_adh={{ member.id }}" class="ui tiny labeled icon button">
117 <i class="ui receipt green icon" aria-hidden="true"></i>
118 {{ _T("Add a membership fee") }}
119 </a>
120 </div>
121 <div class="item">
122 <a href="{{ url_for("addContribution", {"type": constant('Galette\\Entity\\Contribution::TYPE_DONATION')}) }}?id_adh={{ member.id }}" class="ui tiny labeled icon button">
123 <i class="ui gift green icon" aria-hidden="true"></i>
124 {{ _T("Add a donation") }}
125 </a>
126 </div>
127 {% endif %}
128 </div>
129 </div>
130 {% endif %}
131 {% if member is defined %}
132 <div class="{{ member.getRowClass() }}{% if not member.isActive() %} inactive-account{% endif %} ui center aligned segment">
133 {{ member.getDues() }}
134 </div>
135 {% endif %}
136
137 {% if mode == 'ajax'%}
138 <input type="hidden" name="ajax" value="true"/>
139 <input type="hidden" name="max_amount" value="{{ filters.max_amount }}"/>
140 {% else %}
141 {% include "components/forms/csrf.html.twig" %}
142 {% endif %}
143 </form>
144 {% endblock %}
145
146 {% block infoline %}
147 {% set infoline = {
148 'label': _Tn("%count contribution", "%count contributions", nb)|replace({"%count": nb}),
149 'route': {
150 'name': 'payments_filter',
151 'args': {
152 'type': 'contributions'
153 }
154 }
155 } %}
156 {{ parent() }}
157 {% endblock %}
158
159 {% block infoline_actions %}
160 {% if login.isAdmin() or login.isStaff() %}
161 <a
162 class="ui tiny labeled icon button"
163 href="{{ url_for("addContribution", {type: constant('Galette\\Entity\\Contribution::TYPE_FEE')}) }}"
164 >
165 <i class="ui receipt green icon" aria-hidden="true"></i>
166 {{ _T("Add a membership fee") }}
167 </a>
168 <a
169 class="ui tiny labeled icon button"
170 href="{{ url_for("addContribution", {type: constant('Galette\\Entity\\Contribution::TYPE_DONATION')}) }}"
171 >
172 <i class="ui gift green icon" aria-hidden="true"></i>
173 {{ _T("Add a donation") }}
174 </a>
175
176 {% endif %}
177 {% endblock %}
178
179 {% block header %}
180 {% set columns = [
181 {'label': '#', 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_ID")},
182 {'label': _T("Date"), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_DATE")},
183 {'label': _T("Begin"), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_BEGIN_DATE")},
184 {'label': _T("End"), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_END_DATE")}
185 ] %}
186
187 {% if ((login.isAdmin() or login.isStaff()) and member is not defined) or pmember is defined %}
188 {% set columns = columns|merge([{'label': _T("Member"), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_MEMBER")}]) %}
189 {% endif %}
190
191 {% set columns = columns|merge([
192 {'label': _T('Type'), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_TYPE")},
193 {'label': _T('Amount'), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_AMOUNT")},
194 {'label': _T("Payment type"), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_PAYMENT_TYPE")},
195 {'label': _T("Duration")}
196 ]) %}
197
198 {{ parent() }}
199 {% endblock %}
200
201 {% block footer %}
202 {% if nb != 0 %}
203 <tr>
204 <th class="right" colspan="{% if (login.isAdmin() or login.isStaff()) and member is not defined %}10{% else %}9{% endif %}">
205 {{ _T("Found contributions total %f")|replace({"%f": contribs.getSum()}) }}
206 </th>
207 </tr>
208 {% endif %}
209 {% endblock %}
210
211 {% block body %}
212 {% for ordre, contribution in list %}
213 {% set mid = contribution.member %}
214 {% set cclass = contribution.getRowClass() %}
215 {% if contribution.isFee() %}
216 {% set ctype = constant('Galette\\Entity\\Contribution::TYPE_FEE') %}
217 {% else %}
218 {% set ctype = constant('Galette\\Entity\\Contribution::TYPE_DONATION') %}
219 {% endif %}
220
221 <tr{% if mode == 'ajax' %} class="contribution_row" id="row_{{ contribution.id }}"{% endif %}>
222 <td class="{{ cclass }}" data-scope="row">
223 {% if (login.isAdmin() or login.isStaff()) or mode == 'ajax' %}
224 <input type="checkbox" name="entries_sel[]" value="{{ contribution.id }}"/>
225 {% else %}
226 <input type="hidden" name="contrib_id" value="{{ contribution.id }}"/>
227 {% endif %}
228 {% if preferences.pref_show_id %}
229 {{ contribution.id }}
230 {% else %}
231 {{ ordre + 1 + (filters.current_page - 1) * numrows }}
232 {% endif %}
233 {% if (login.isAdmin() or login.isStaff()) or mode == 'ajax' %}
234 <span class="displaynone">
235 <a href="{{ url_for("editContribution", {"type": ctype, "id": contribution.id}) }}">
236 {{ _T("Contribution %id")|replace({"%id": contribution.id}) }}
237 </a>
238 </span>
239 {% if contribution.isTransactionPart() %}
240 <a
241 href="{{ url_for("editTransaction", {"id": contribution.transaction.id}) }}"
242 >
243 <i class="ui link icon tooltip"></i>
244 <span class="ui special popup">{{ _T("Transaction: %s")|replace({"%s": contribution.transaction.description}) }}</span>
245 </a>
246 {% endif %}
247 {% else %}
248 <span class="displaynone">
249 {{ _T("Contribution %id")|replace({"%id": contribution.id}) }}
250 </span>
251 {% if contribution.isTransactionPart() %}
252 <i class="ui link icon"></i>
253 <span class="displaynone">{{ _T("Transaction: %s")|replace({"%s": contribution.transaction.description}) }}</span>
254 {% endif %}
255 {% endif %}
256 {% if not contribution.isTransactionPart() %}
257 <i class="ui icon">&nbsp;</i>
258 {% endif %}
259 </td>
260 <td class="{{ cclass }}" data-title="{{ _T("Date") }}">{{ contribution.date }}</td>
261 <td class="{{ cclass }}" data-title="{{ _T("Begin") }}">{{ contribution.begin_date }}</td>
262 <td class="{{ cclass }}" data-title="{{ _T("End") }}">{{ contribution.end_date }}</td>
263 {% if ((login.isAdmin() or login.isStaff()) and member is not defined) or pmember is defined %}
264 <td class="{{ cclass }}" data-title="{{ _T("Member") }}">
265 {% if member is defined %}
266 {% set mname = member.sname %}
267 {% else %}
268 {# FIXME #}
269 {% set mname = memberName({'id': mid}) %}
270 {% endif %}
271 {% if filters.filtre_cotis_adh == "" %}
272 <a
273 href="{{ url_for("contributions", {"type": "contributions", "option": "member", "value": mid}) }}"
274 title="{{ _T("Show only '%name' contributions")|replace({"%name": mname}) }}"
275 >
276 <i class="ui filter grey small icon"></i>
277 </a>
278 {% endif %}
279 <a
280 href="{{ url_for("member", {"id": mid}) }}"
281 title="{{ _T("Show '%name' card")|replace({"%name": mname}) }}"
282 >
283 {{ mname }}
284 </a>
285 </td>
286 {% endif %}
287 <td class="{{ cclass }}" data-title="{{ _T("Type") }}">{{ contribution.type.libelle }}</td>
288 <td class="{{ cclass }}" data-title="{{ _T("Amount") }}">{{ contribution.amount }}</td>
289 <td class="{{ cclass }}" data-title="{{ _T("Payment type") }}">{{ contribution.spayment_type }}</td>
290 <td class="{{ cclass }}" data-title="{{ _T("Duration") }}">{{ contribution.duration }}</td>
291 {% if mode != 'ajax' %}
292 <td class="actions_row {{ cclass }} center">
293 <a
294 href="{{ url_for("printContribution", {"id": contribution.id}) }}"
295 >
296 <i class="ui file pdf green icon tooltip"></i>
297 <span class="ui special popup">{{ _T("Print an invoice or a receipt (depending on contribution type)") }}</span>
298 </a>
299 {% if (login.isAdmin() or login.isStaff()) %}
300 <a
301 href="{{ url_for("editContribution", {"type": ctype, "id": contribution.id}) }}"
302 class="action"
303 >
304 <i class="ui edit icon tooltip"></i>
305 <span class="ui special popup">{{ _T("Edit the contribution") }}</span>
306 </a>
307 <a
308 href="{{ url_for("removeContribution", {"type": "contributions", "id": contribution.id}) }}"
309 class="delete"
310 >
311 <i class="ui trash red icon tooltip"></i>
312 <span class="ui special popup">{{ _T("Delete the contribution") }}</span>
313 </a>
314 {% endif %}
315 </td>
316 {% endif %}
317 </tr>
318 {% else %}
319 <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>
320 {% endfor %}
321 {% endblock %}
322
323 {% block legend %}
324 <div id="legende" title="{{ _T("Legend") }}" class="ui modal">
325 <div class="header">{{ _T("Legend") }}</div>
326 <div class="content">
327 <table class="ui stripped table">
328 {% if (login.isAdmin() or login.isStaff()) and mode != 'ajax' %}
329 <tr>
330 <th class="action">
331 <i class="ui edit blue icon"></i>
332 </th>
333 <td class="back">{{ _T("Modification") }}</td>
334 </tr>
335 <tr>
336 <th class="delete">
337 <i class="ui trash red icon"></i>
338 </th>
339 <td class="back">{{ _T("Deletion") }}</td>
340 </tr>
341 {% endif %}
342 <tr>
343 <th class="cotis-normal color-sample">&nbsp;</th>
344 <td class="back">{{ _T("Contribution") }}</td>
345 </tr>
346 <tr>
347 <th class="cotis-give color-sample">&nbsp;</th>
348 <td class="back">{{ _T("Gift") }}</td>
349 </tr>
350 </table>
351 </div>
352 <div class="actions"><div class="ui labeled icon deny button"><i class="times icon"></i> {{ _T("Close") }}</div></div>
353 </div>
354 {% endblock %}