]> git.agnieray.net Git - galette.git/blob - galette/templates/default/pages/transactions_list.html.twig
Improve listings headers display on mobile
[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" aria-hidden="true"></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" aria-hidden="true"></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" aria-hidden="true"></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" aria-hidden="true"></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 {% if member is defined %}
143 {% set mname = member.sname %}
144 {% else %}
145 {% set mname = memberName({id: mid}) %}
146 {% endif %}
147
148 <tr class="{{ transaction.getRowClass() }}">
149 <td data-scope="row">
150 {% if preferences.pref_show_id %}
151 {{ transaction.id }}
152 {% else %}
153 {{ ordre + 1 + (filters.current_page - 1) * numrows }}
154 {% endif %}
155 <span class="displaynone">
156 <a href="{{ url_for("editTransaction", {"id": transaction.id}) }}">
157 {{ _T("Transaction %id")|replace({"%id": transaction.id}) }}
158 </a>
159 </span>
160 </td>
161 <td data-col-label="{{ _T("Date") }}">{{ transaction.date }}</td>
162 {% if ((login.isAdmin() or login.isStaff()) and member is not defined) or pmember is defined %}
163 <td data-col-label="{{ _T("Member") }}">
164 {% if filters.filtre_cotis_adh == "" or filters.filtre_cotis_adh == null %}
165 <a
166 href="{{ url_for("contributions", {"type": "transactions", "option": "member", "value": mid}) }}"
167 title="{{ _T("Show only '%name' transactions")|replace({"%name": mname}) }}"
168 >
169 <i class="filter grey small icon" aria-hidden="true"></i>
170 </a>
171 {% endif %}
172 <a
173 href="{{ url_for("member", {"id": mid}) }}"
174 title="{{ _T("Show '%name' card")|replace({"%name": mname}) }}"
175 >
176 {{ mname }}
177 </a>
178 </td>
179 {% endif %}
180 <td data-col-label="{{ _T("Description") }}">{{ transaction.description|escape }}</td>
181 <td data-col-label="{{ _T("Amount") }}">{{ transaction.amount }}</td>
182 {% if login.isAdmin() or login.isStaff() %}
183 <td class="center actions_row">
184 <a
185 href="{{ url_for("editTransaction", {"id": transaction.id}) }}"
186 class="action"
187 >
188 <i class="ui edit icon tooltip" aria-hidden="true"></i>
189 <span class="ui special popup">{{ _T("Edit transaction #%id")|replace({"%id": transaction.id}) }}</span>
190 </a>
191 <a
192 href="{{ url_for("removeContribution", {"type": "transactions", "id": transaction.id}) }}"
193 class="delete"
194 >
195 <i class="ui trash red icon tooltip" aria-hidden="true"></i>
196 <span class="ui special popup">{{ _T("Remove transaction #%id")|replace({"%id": transaction.id}) }}</span>
197 </a>
198 </td>
199 {% endif %}
200 </tr>
201 {% else %}
202 <tr><td colspan="{% if login.isAdmin() or login.isStaff() %}7{% else %}5{% endif %}" class="emptylist">{{ _T("no transaction") }}</td></tr>
203 {% endfor %}
204 {% endblock %}
205
206 {% block legend %}
207 <div id="legende" title="{{ _T("Legend") }}" class="ui modal">
208 <div class="header">{{ _T("Legend") }}</div>
209 <div class="content">
210 <table class="ui stripped table">
211 <tr>
212 <th class="transaction-normal color-sample"><i class="ui icon">&nbsp;</i></th>
213 <td class="back">{{ _T("Completely dispatched transaction") }}</td>
214 </tr>
215 <tr>
216 <th class="transaction-uncomplete color-sample"><i class="ui icon">&nbsp;</i></th>
217 <td class="back">{{ _T("Uncomplete dispatched transaction") }}</td>
218 </tr>
219 </table>
220 </div>
221 <div class="actions"><div class="ui labeled icon deny button"><i class="times icon" aria-hidden="true"></i> {{ _T("Close") }}</div></div>
222 </div>
223 {% endblock %}
224
225 {% block javascripts %}
226 <script type="text/javascript">
227 $(function(){
228 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>';
229 $('.listing').before(_checklinks);
230 $('.listing').after(_checklinks);
231
232 //$('#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>');
233
234 _bind_legend();
235
236 {% include "elements/js/removal.js.twig" with {
237 single_action: "true"
238 } %}
239 });
240 </script>
241 {% endblock %}