]> git.agnieray.net Git - galette.git/blob - galette/templates/default/pages/transactions_list.html.twig
3e9b3b1a948d2e956979c019353191c7fa59e5ec
[galette.git] / galette / templates / default / pages / transactions_list.html.twig
1 {% extends 'elements/list.html.twig' %}
2
3 {% set basic_table = true %}
4
5 {% set form = {
6 'route': {
7 'name': 'payments_filter',
8 'args': {
9 'type': 'transactions'
10 }
11 },
12 'order': {
13 'name': "contributions",
14 'args': {"type": "transactions"}
15 }
16 } %}
17
18 {% block search %}
19 <form action="{{ url_for("payments_filter", {"type": "transactions"}) }}" method="post" class="ui form filters">
20 <div class="ui secondary yellow segment">
21 <div class="two fields">
22 <div class="two fields">
23 <div class="field">
24 <label for="start_date_filter">{{ _T("Show transactions since") }}</label>
25 <div class="ui calendar" id="contrib-rangestart">
26 <div class="ui input left icon">
27 <i class="calendar icon"></i>
28 <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 }}"/>
29 </div>
30 </div>
31 </div>
32 <div class="field">
33 <label for="end_date_filter">{{ _T("until") }}</label>
34 <div class="ui calendar" id="contrib-rangeend">
35 <div class="ui input left icon">
36 <i class="calendar icon"></i>
37 <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 }}"/>
38
39 </div>
40 </div>
41 </div>
42 </div>
43 <div class="ui right aligned basic fitted segment field flexend">
44 <button type="submit" class="tooltip action ui labeled icon primary button" title="{{ _T("Apply filters") }}" name="filter">
45 <i class="search icon"></i>
46 {{ _T("Filter") }}
47 </button>
48 <button type="submit" name="clear_filter" class="tooltip ui labeled icon button" title="{{ _T("Reset all filters to defaults") }}">
49 <i class="trash alt red icon" aria-hidden="true"></i>
50 {{ _T("Clear filter") }}
51 </button>
52 </div>
53 </div>
54 </div>
55 {% if member is defined %}
56 {% if login.isAdmin() or login.isStaff() or member.canShow(login) %}
57 <div class="ui compact vertically fitted segment">
58 <div class="ui horizontal list">
59 <span class="ui primary ribbon label">
60 {% set member_logged_in_as = member.name ~ " " ~ member.surname ~ " (" ~ member.login ~ ")" %}
61 {% if login.isAdmin() or login.isStaff() or member.hasChildren() or (member.hasParent() and (member_logged_in_as != login.loggedInAs(true))) %}
62 <a
63 href="{{ url_for("contributions", {"type": "transactions", "option": "member", "value": "all"}) }}"
64 >
65 <i class="icon times tooltip"></i>
66 <span class="ui special popup">
67 {% if member.hasChildren() or (member.hasParent() and (member_logged_in_as != login.logged_in_as(true))) %}
68 {{ _T("Show all your transactions") }}
69 {% else %}
70 {{ _T("Show all members transactions") }}
71 {% endif %}
72 </span>
73 </a>
74 {% endif %}
75 {% endif %}
76 {{ member.sname }}{% if not member.isActive() %} ({{ _T("Inactive") }}){% endif %}
77 </span>
78 {% if login.isAdmin() or login.isStaff() %}
79 <div class="item">
80 <a href="{{ url_for("member", {"id": member.id}) }}" class="ui tiny button">{{ _T("See member profile") }}</a>
81 </div>
82 <div class="item">
83 <a href="{{ url_for("addTransaction") }}?id_adh={{ member.id }}" class="ui tiny button">{{ _T("Add a transaction") }}</a>
84 </div>
85 {% endif %}
86 </div>
87 </div>
88 {% endif %}
89 {% include "components/forms/csrf.html.twig" %}
90 </form>
91 {% endblock %}
92
93 {% block infoline %}
94 {% set infoline = {
95 'label': _Tn("%count transaction", "%count transactions", nb)|replace({"%count": nb}),
96 'route': {
97 'name': 'payments_filter',
98 'args': {
99 'type': 'transactions'
100 }
101 }
102 } %}
103 {{ parent() }}
104 {% endblock %}
105
106 {% block infoline_actions %}
107 {% if login.isAdmin() or login.isStaff() %}
108 <a
109 class="ui tiny labeled icon button"
110 href="{{ url_for("addTransaction") }}"
111 >
112 <i class="ui plus circle green icon" aria-hidden="true"></i>
113 {{ _T("Add a transaction") }}
114 </a>
115 {% endif %}
116 {% endblock %}
117
118 {% block header %}
119 {% set columns = [
120 {'label': '#', 'order': constant("Galette\\Filters\\TransactionsList::ORDERBY_ID")},
121 {'label': _T("Date"), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_DATE")}
122 ] %}
123
124 {% if ((login.isAdmin() or login.isStaff()) and member is not defined) or pmember is defined %}
125 {% set columns = columns|merge([{'label': _T("Originator"), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_MEMBER")}]) %}
126 {% endif %}
127
128 {% set columns = columns|merge([
129 {'label': _T("Description")}
130 ]) %}
131
132 {% set columns = columns|merge([
133 {'label': _T('Amount'), 'order': constant("Galette\\Filters\\ContributionsList::ORDERBY_AMOUNT")}
134 ]) %}
135
136 {{ parent() }}
137 {% endblock %}
138
139 {% block body %}
140 {% for ordre, transaction in list %}
141 {% set mid = transaction.member %}
142 {% set cclass = transaction.getRowClass() %}
143 {% if member is defined %}
144 {% set mname = member.sname %}
145 {% else %}
146 {% set mname = memberName({id: mid}) %}
147 {% endif %}
148
149 <tr>
150 <td class="{{ cclass }}" data-scope="row">
151 {% if preferences.pref_show_id %}
152 {{ transaction.id }}
153 {% else %}
154 {{ ordre + 1 + (filters.current_page - 1) * numrows }}
155 {% endif %}
156 <span class="displaynone">
157 <a href="{{ url_for("editTransaction", {"id": transaction.id}) }}">
158 {{ _T("Transaction %id")|replace({"%id": transaction.id}) }}
159 </a>
160 </span>
161 </td>
162 <td class="{{ cclass }}" data-title="{{ _T("Date") }}">{{ transaction.date }}</td>
163 {% if ((login.isAdmin() or login.isStaff()) and member is not defined) or pmember is defined %}
164 <td class="{{ cclass }}" data-title="{{ _T("Member") }}">
165 {% if filters.filtre_cotis_adh == "" or filters.filtre_cotis_adh == null %}
166 <a
167 href="{{ url_for("contributions", {"type": "transactions", "option": "member", "value": mid}) }}"
168 title="{{ _T("Show only '%name' transactions")|replace({"%name": mname}) }}"
169 >
170 <i class="filter grey small icon"></i>
171 </a>
172 {% endif %}
173 <a
174 href="{{ url_for("member", {"id": mid}) }}"
175 title="{{ _T("Show '%name' card")|replace({"%name": mname}) }}"
176 >
177 {{ mname }}
178 </a>
179 </td>
180 {% endif %}
181 <td class="{{ cclass }}" data-title="{{ _T("Description") }}">{{ transaction.description|escape }}</td>
182 <td class="actions_row {{ cclass }}" data-title="{{ _T("Amount") }}">{{ transaction.amount }}</td>
183 {% if login.isAdmin() or login.isStaff() %}
184 <td class="{{ cclass }} center">
185 <a
186 href="{{ url_for("editTransaction", {"id": transaction.id}) }}"
187 class="action"
188 >
189 <i class="ui edit icon tooltip"></i>
190 <span class="ui special popup">{{ _T("Edit transaction #%id")|replace({"%id": transaction.id}) }}</span>
191 </a>
192 <a
193 href="{{ url_for("removeContribution", {"type": "transactions", "id": transaction.id}) }}"
194 class="delete"
195 >
196 <i class="ui trash red icon tooltip"></i>
197 <span class="ui special popup">{{ _T("Remove transaction #%id")|replace({"%id": transaction.id}) }}</span>
198 </a>
199 </td>
200 {% endif %}
201 </tr>
202 {% else %}
203 <tr><td colspan="{% if login.isAdmin() or login.isStaff() %}7{% else %}5{% endif %}" class="emptylist">{{ _T("no transaction") }}</td></tr>
204 {% endfor %}
205 {% endblock %}
206
207 {% block legend %}
208 <div id="legende" title="{{ _T("Legend") }}" class="ui modal">
209 <div class="header">{{ _T("Legend") }}</div>
210 <div class="content">
211 <table class="ui stripped table">
212 <tr>
213 <th class="transaction-normal color-sample"><i class="ui icon">&nbsp;</i></th>
214 <td class="back">{{ _T("Completely dispatched transaction") }}</td>
215 </tr>
216 <tr>
217 <th class="transaction-uncomplete color-sample"><i class="ui icon">&nbsp;</i></th>
218 <td class="back">{{ _T("Uncomplete dispatched transaction") }}</td>
219 </tr>
220 </table>
221 </div>
222 <div class="actions"><div class="ui labeled icon deny button"><i class="times icon"></i> {{ _T("Close") }}</div></div>
223 </div>
224 {% endblock %}
225
226 {% block javascripts %}
227 <script type="text/javascript">
228 $(function(){
229 var _checklinks = '<div class="checkboxes ui basic horizontal segments"><div class="ui basic right aligned fitted segment"><a href="#" class="show_legend ui blue tertiary button">{{ _T("Show legend")|e('js') }}</a></div></div>';
230 $('.listing').before(_checklinks);
231 $('.listing').after(_checklinks);
232
233 //$('#table_footer').parent().before('<td class="right" colspan="{% if (login.isAdmin() or login.isStaff()) and member is not defined %}9{% elseif login.isAdmin() or login.isStaff() %}8{% else %}7{% endif %}"><a href="#" class="show_legend">{{ _T("Show legend") }}</a></td>');
234
235 _bind_legend();
236
237 {% include "elements/js/removal.js.twig" with {
238 single_action: "true"
239 } %}
240 });
241 </script>
242 {% endblock %}