]> git.agnieray.net Git - galette.git/blob - galette/templates/default/gestion_contributions.tpl
e9aca8968ead430c473f207948792ce5e2048438
[galette.git] / galette / templates / default / gestion_contributions.tpl
1 {if $mode eq 'ajax'}
2 {assign var="extend" value='ajax.tpl'}
3 {else}
4 {assign var="extend" value='page.tpl'}
5 {/if}
6 {extends file=$extend}
7 {block name="content"}
8 <form action="{path_for name="payments_filter" data=["type" => "contributions"]}" method="post" id="filtre">
9 <div id="listfilter">
10 <label for="date_field_filter">{_T string="Show contributions by"}</label>&nbsp;
11 <select name="date_field_filter" id="date_field_filter">
12 <option value="{Galette\Filters\ContributionsList::DATE_BEGIN}"{if $filters->date_field eq constant('Galette\Filters\ContributionsList::DATE_BEGIN')} selected="selected"{/if}>{_T string="Begin"}</option>
13 <option value="{Galette\Filters\ContributionsList::DATE_END}"{if $filters->date_field eq constant('Galette\Filters\ContributionsList::DATE_END')} selected="selected"{/if}>{_T string="End"}</option>
14 <option value="{Galette\Filters\ContributionsList::DATE_RECORD}"{if $filters->date_field eq constant('Galette\Filters\ContributionsList::DATE_RECORD')} selected="selected"{/if}>{_T string="Record"}</option>
15 </select>
16 <label for="start_date_filter">{_T string="since"}</label>&nbsp;
17 <input type="text" name="start_date_filter" id="start_date_filter" maxlength="10" size="10" value="{$filters->start_date_filter}"/>
18 <label for="end_date_filter">{_T string="until"}</label>&nbsp;
19 <input type="text" name="end_date_filter" id="end_date_filter" maxlength="10" size="10" value="{$filters->end_date_filter}"/>
20 {include file="forms_types/payment_types.tpl"
21 current=$filters->payment_type_filter varname="payment_type_filter"
22 show_inline=""
23 classname=""
24 empty=['value' => -1, 'label' => {_T string="Select"}]
25 }
26 <input type="submit" class="inline" value="{_T string="Filter"}"/>
27 <input type="submit" name="clear_filter" class="inline" value="{_T string="Clear filter"}"/>
28 </div>
29 {if isset($member)}
30 <div id="member_stateofdue" class="{$member->getRowClass()}{if not $member->isActive()} inactive{/if}">{$member->getDues()}</div>
31 {/if}
32 <div class="infoline">
33 {if isset($member) && $mode neq 'ajax'}
34 {if $login->isAdmin() or $login->isStaff()}
35 <a
36 href="{path_for name="contributions" data=["type" => "contributions", "option" => "member", "value" => "all"]}"
37 class="tooltip"
38 >
39 <i class="fas fa-eraser"></i>
40 <span class="sr-only">{_T string="Show all members contributions"}</span>
41 </a>
42 {/if}
43 <strong>{$member->sname}</strong>
44 {if not $member->isActive() } ({_T string="Inactive"}){/if}
45 {if $login->isAdmin() or $login->isStaff()}
46 (<a href="{path_for name="member" data=["id" => $member->id]}">{_T string="See member profile"}</a> -
47 <a href="{path_for name="addContribution" data=["type" => "fee"]}?id_adh={$member->id}">{_T string="Add a membership fee"}</a> -
48 <a href="{path_for name="addContribution" data=["type" => "donation"]}?id_adh={$member->id}">{_T string="Add a donation"}</a>)
49 {/if}
50 -
51 {/if}
52 {_T string="%count contribution" plural="%count contributions" count=$nb pattern="/%count/" replace=$nb}
53 <div class="fright">
54 {if $mode eq 'ajax'}
55 <input type="hidden" name="ajax" value="true"/>
56 <input type="hidden" name="max_amount" value="{$filters->max_amount}"/>
57 {/if}
58 <label for="nbshow">{_T string="Records per page:"}</label>
59 <select name="nbshow" id="nbshow">
60 {html_options options=$nbshow_options selected=$numrows}
61 </select>
62 <noscript> <span><input type="submit" value="{_T string="Change"}" /></span></noscript>
63 </div>
64 </div>
65 </form>
66 <form action="" method="post" id="listform">
67 <table class="listing">
68 <thead>
69 <tr>
70 <th class="id_row">#</th>
71 <th class="left date_row">
72 <a href="{path_for name="contributions" data=["type" => "contributions", "option" => "order", "value" => "Galette\Filters\ContributionsList::ORDERBY_DATE"|constant]}">{_T string="Date"}
73 {if $filters->orderby eq constant('Galette\Filters\ContributionsList::ORDERBY_DATE')}
74 {if $filters->ordered eq constant('Galette\Filters\ContributionsList::ORDER_ASC')}
75 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt=""/>
76 {else}
77 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt=""/>
78 {/if}
79 {/if}
80 </a>
81 </th>
82 <th class="left date_row">
83 <a href="{path_for name="contributions" data=["type" => "contributions", "option" => "order", "value" => "Galette\Filters\ContributionsList::ORDERBY_BEGIN_DATE"|constant]}">{_T string="Begin"}
84 {if $filters->orderby eq constant('Galette\Filters\ContributionsList::ORDERBY_BEGIN_DATE')}
85 {if $filters->ordered eq constant('Galette\Filters\ContributionsList::ORDER_ASC')}
86 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt=""/>
87 {else}
88 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt=""/>
89 {/if}
90 {/if}
91 </a>
92 </th>
93 <th class="left date_row">
94 <a href="{path_for name="contributions" data=["type" => "contributions", "option" => "order", "value" => "Galette\Filters\ContributionsList::ORDERBY_END_DATE"|constant]}">{_T string="End"}
95 {if $filters->orderby eq constant('Galette\Filters\ContributionsList::ORDERBY_END_DATE')}
96 {if $filters->ordered eq constant('Galette\Filters\ContributionsList::ORDER_ASC')}
97 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt=""/>
98 {else}
99 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt=""/>
100 {/if}
101 {/if}
102 </a>
103 </th>
104 {if ($login->isAdmin() or $login->isStaff()) and !isset($member)}
105 <th class="left">
106 <a href="{path_for name="contributions" data=["type" => "contributions", "option" => "order", "value" => "Galette\Filters\ContributionsList::ORDERBY_MEMBER"|constant]}">{_T string="Member"}
107 {if $filters->orderby eq constant('Galette\Filters\ContributionsList::ORDERBY_MEMBER')}
108 {if $filters->ordered eq constant('Galette\Filters\ContributionsList::ORDER_ASC')}
109 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt=""/>
110 {else}
111 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt=""/>
112 {/if}
113 {/if}
114 </a>
115 </th>
116 {/if}
117 <th class="left">
118 <a href="{path_for name="contributions" data=["type" => "contributions", "option" => "order", "value" => "Galette\Filters\ContributionsList::ORDERBY_TYPE"|constant]}">{_T string="Type"}
119 {if $filters->orderby eq constant('Galette\Filters\ContributionsList::ORDERBY_TYPE')}
120 {if $filters->ordered eq constant('Galette\Filters\ContributionsList::ORDER_ASC')}
121 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt=""/>
122 {else}
123 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt=""/>
124 {/if}
125 {/if}
126 </a>
127 </th>
128 <th class="left">
129 <a href="{path_for name="contributions" data=["type" => "contributions", "option" => "order", "value" => "Galette\Filters\ContributionsList::ORDERBY_AMOUNT"|constant]}">{_T string="Amount"}
130 {if $filters->orderby eq constant('Galette\Filters\ContributionsList::ORDERBY_AMOUNT')}
131 {if $filters->ordered eq constant('Galette\Filters\ContributionsList::ORDER_ASC')}
132 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt=""/>
133 {else}
134 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt=""/>
135 {/if}
136 {/if}
137 </a>
138 </th>
139 <th class="left">
140 <a href="{path_for name="contributions" data=["type" => "contributions", "option" => "order", "value" => "Galette\Filters\ContributionsList::ORDERBY_PAYMENT_TYPE"|constant]}">{_T string="Payment type"}
141 {if $filters->orderby eq constant('Galette\Filters\ContributionsList::ORDERBY_PAYMENT_TYPE')}
142 {if $filters->ordered eq constant('Galette\Filters\ContributionsList::ORDER_ASC')}
143 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt=""/>
144 {else}
145 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt=""/>
146 {/if}
147 {/if}
148 </a>
149 </th>
150 <th class="left">
151 {_T string="Duration"}
152 </th>
153 {if $mode neq 'ajax'}
154 <th class="nowrap actions_row">{_T string="Actions"}</th>
155 {/if}
156 </tr>
157 </thead>
158 {if $nb != 0}
159 <tfoot>
160 <tr>
161 <th class="right" colspan="{if ($login->isAdmin() or $login->isStaff()) && !isset($member)}10{else}9{/if}">
162 {_T string="Found contributions total %f" pattern="/%f/" replace=$contribs->getSum()}
163 </th>
164 </tr>
165 </tfoot>
166 {/if}
167 <tbody>
168 {foreach from=$list item=contribution key=ordre}
169 {assign var="mid" value=$contribution->member}
170 {assign var="cclass" value=$contribution->getRowClass()}
171 {if $contribution->isCotis()}
172 {assign var="ctype" value="fee"}
173 {else}
174 {assign var="ctype" value="donation"}
175 {/if}
176
177 <tr{if $mode eq 'ajax'} class="contribution_row" id="row_{$contribution->id}"{/if}>
178 <td class="{$cclass} nowrap" data-scope="row">
179 {if ($login->isAdmin() or $login->isStaff()) or $mode eq 'ajax'}
180 <input type="checkbox" name="contrib_sel[]" value="{$contribution->id}"/>
181 {else}
182 <input type="hidden" name="contrib_id" value="{$contribution->id}"/>
183 {/if}
184 {if $preferences->pref_show_id}
185 {$contribution->id}
186 {else}
187 {$ordre+1+($filters->current_page - 1)*$numrows}
188 {/if}
189 {if ($login->isAdmin() or $login->isStaff()) or $mode eq 'ajax'}
190 <span class="row-title">
191 <a href="{path_for name="editContribution" data=["type" => $ctype, "id" => $contribution->id]}">
192 {_T string="Contribution %id" pattern="/%id/" replace=$contribution->id}
193 </a>
194 </span>
195 {if $contribution->isTransactionPart() }
196 <a
197 href="{path_for name="editTransaction" data=["id" => $contribution->transaction->id]}"
198 class="tooltip"
199 >
200 <i class="fas fa-link"></i>
201 <span class="sr-only">{_T string="Transaction: %s" pattern="/%s/" replace=$contribution->transaction->description}</span>
202 </a>
203 {/if}
204 {else}
205 <span class="row-title">
206 {_T string="Contribution %id" pattern="/%id/" replace=$contribution->id}
207 </span>
208 {if $contribution->isTransactionPart() }
209 <i class="fas fa-link"></i>
210 <span class="sr-only">{_T string="Transaction: %s" pattern="/%s/" replace=$contribution->transaction->description}</span>
211 {/if}
212 {/if}
213 {if !$contribution->isTransactionPart() }
214 <img src="{base_url}/{$template_subdir}images/icon-empty.png"
215 alt=""
216 width="16"
217 height="16"/>
218 {/if}
219 </td>
220 <td class="{$cclass} nowrap" data-title="{_T string="Date"}">{$contribution->date}</td>
221 <td class="{$cclass} nowrap" data-title="{_T string="Begin"}">{$contribution->begin_date}</td>
222 <td class="{$cclass} nowrap" data-title="{_T string="End"}">{$contribution->end_date}</td>
223 {if ($login->isAdmin() or $login->isStaff()) && !isset($member)}
224 <td class="{$cclass}" data-title="{_T string="Member"}">
225 {if $filters->filtre_cotis_adh eq ""}
226 <a href="{path_for name="contributions" data=["type" => "contributions", "option" => "member", "value" => $mid]}">{if isset($member)}{$member->sname}{else}{memberName id="$mid"}{/if}</a>
227 {else}
228 <a href="{path_for name="member" data=["id" => $mid]}">{if isset($member)}{$member->sname}{else}{memberName id="$mid"}{/if}</a>
229 {/if}
230 </td>
231 {/if}
232 <td class="{$cclass}" data-title="{_T string="Type"}">{$contribution->type->libelle}</td>
233 <td class="{$cclass} nowrap" data-title="{_T string="Amount"}">{$contribution->amount}</td>
234 <td class="{$cclass} nowrap" data-title="{_T string="Payment type"}">{$contribution->spayment_type}</td>
235 <td class="{$cclass} nowrap" data-title="{_T string="Duration"}">{$contribution->duration}</td>
236 {if $mode neq 'ajax'}
237 <td class="{$cclass} center nowrap">
238 <a
239 href="{path_for name="printContribution" data=["id" => $contribution->id]}"
240 class="tooltip"
241 >
242 <i class="fas fa-file-pdf"></i>
243 <span class="sr-only">{_T string="Print an invoice or a receipt (depending on contribution type)"}</span>
244 </a>
245 {if ($login->isAdmin() or $login->isStaff()) and $mode neq 'ajax'}
246 <a
247 href="{path_for name="editContribution" data=["type" => $ctype, "id" => $contribution->id]}"
248 class="tooltip action"
249 >
250 <i class="fas fa-edit"></i>
251 <span class="sr-only">{_T string="Edit the contribution"}</span>
252 </a>
253 <a
254 href="{path_for name="removeContribution" data=["type" => "contributions", "id" => $contribution->id]}"
255 class="tooltip delete"
256 >
257 <i class="fas fa-trash"></i>
258 <span class="sr-only">{_T string="Delete the contribution"}</span>
259 </a>
260 {/if}
261 </td>
262 {/if}
263 </tr>
264 {foreachelse}
265 <tr><td colspan="{if ($login->isAdmin() or $login->isStaff()) && !isset($member)}10{elseif $login->isAdmin() or $login->isStaff()}9{else}8{/if}" class="emptylist">{_T string="no contribution"}</td></tr>
266 {/foreach}
267 </tbody>
268 </table>
269 {if $nb != 0}
270 <div class="center cright">
271 {_T string="Pages:"}<br/>
272 <ul class="pages">{$pagination}</ul>
273 </div>
274 {if ($login->isAdmin() or $login->isStaff()) && $mode neq 'ajax'}
275 <ul class="selection_menu">
276 <li>{_T string="For the selection:"}</li>
277 <li>
278 <button type="submit" id="delete" name="delete">
279 <i class="fas fa-trash fa-fw"></i> {_T string="Delete"}
280 </button>
281 </li>
282 </ul>
283 {/if}
284 {/if}
285 </form>
286 <div id="legende" title="{_T string="Legend"}">
287 <h1>{_T string="Legend"}</h1>
288 <table>
289 {if ($login->isAdmin() or $login->isStaff()) and $mode neq 'ajax'}
290 <tr>
291 <th class="action">
292 <i class="fas fa-edit fa-fw"></i>
293 </th>
294 <td class="back">{_T string="Modification"}</td>
295 </tr>
296 <tr>
297 <th class="delete">
298 <i class="fas fa-trash fa-fw"></i>
299 </th>
300 <td class="back">{_T string="Deletion"}</td>
301 </tr>
302 {/if}
303 <tr>
304 <th class="cotis-normal color-sample">&nbsp;</th>
305 <td class="back">{_T string="Contribution"}</td>
306 </tr>
307 <tr>
308 <th class="cotis-give color-sample">&nbsp;</th>
309 <td class="back">{_T string="Gift"}</td>
310 </tr>
311 </table>
312 </div>
313 {/block}
314
315 {block name="javascripts"}
316 <script type="text/javascript">
317 var _checkselection = function() {
318 var _checkeds = $('table.listing').find('input[type=checkbox]:checked').length;
319 if ( _checkeds == 0 ) {
320 var _el = $('<div id="pleaseselect" title="{_T string="No contribution selected" escape="js"}">{_T string="Please make sure to select at least one contribution from the list to perform this action." escape="js"}</div>');
321 _el.appendTo('body').dialog({
322 modal: true,
323 buttons: {
324 Ok: function() {
325 $(this).dialog( "close" );
326 }
327 },
328 close: function(event, ui){
329 _el.remove();
330 }
331 });
332 return false;
333 }
334 return true;
335 }
336 $(function(){
337 var _init_contribs_page = function(res){
338 {if ($login->isAdmin() or $login->isStaff())}
339 var _checklinks = '<div class="checkboxes"><span class="fleft"><a href="#" class="checkall tooltip"><i class="fas fa-check-square"></i> {_T string="(Un)Check all" escape="js"}</a> | <a href="#" class="checkinvert tooltip"><i class="fas fa-exchange-alt"></i> {_T string="Invert selection" escape="js"}</a></span><a href="#" class="show_legend fright">{_T string="Show legend" escape="js"}</a></div>';
340
341 $('.listing').before(_checklinks);
342 $('.listing').after(_checklinks);
343 _bind_check('contrib_sel');
344 {/if}
345 _bind_legend();
346
347 $('#start_date_filter, #end_date_filter').datepicker({
348 changeMonth: true,
349 changeYear: true,
350 showOn: 'button',
351 buttonText: '<i class="far fa-calendar-alt"></i> <span class="sr-only">{_T string="Select a date" escape="js"}</span>'
352 });
353 }
354 _init_contribs_page();
355
356 {include file="js_removal.tpl"}
357 {include file="js_removal.tpl" selector="#delete" deleteurl="'{path_for name="removeContributions" data=["type" => "contributions"]}'" extra_check="if (!_checkselection()) {ldelim}return false;{rdelim}" extra_data="delete: true, contrib_sel: $('#listform input[type=\"checkbox\"]:checked').map(function(){ return $(this).val(); }).get()" method="POST"}
358 });
359 </script>
360 {/block}