1 {extends file="page.tpl"}
4 {if isset($members.list)}
5 <form action="{if $transaction->id}{path_for name="editTransaction" data=["id" => $transaction->id]}{else}{path_for name="addTransaction"}{/if}" enctype="multipart/form-data" method="post">
7 <fieldset class="cssform">
8 <legend class="ui-state-active ui-corner-top">{_T string="Transaction details"}</legend>
10 <label for="trans_desc" class="bline">{_T string="Description:"}</label>
11 <input type="text" name="trans_desc" id="trans_desc" value="{$transaction->description}" maxlength="150" size="30"{if $required.trans_desc eq 1} required="required"{/if}/>
14 <label for="id_adh" class="bline" >{_T string="Originator:"}</label>
15 <select name="id_adh" id="id_adh" class="nochosen"{if $required.id_adh eq 1} required="required"{/if}>
16 {if !$transaction->member}
17 <option value="">{_T string="-- select a name --"}</option>
19 {foreach $members.list as $k=>$v}
20 <option value="{$k}"{if $transaction->member == $k} selected="selected"{/if}>{$v}</option>
25 <label for="trans_date" class="bline">{_T string="Date:"}</label>
26 <input type="text" class="date-pick" name="trans_date" id="trans_date" value="{$transaction->date}" maxlength="10"{if $required.trans_date eq 1} required="required"{/if}/> <span class="exemple">{_T string="(yyyy-mm-dd format)"}</span>
29 <label for="trans_amount" class="bline">{_T string="Amount:"}</label>
30 <input type="text" name="trans_amount" id="trans_amount" value="{$transaction->amount}" maxlength="10"{if $required.trans_amount eq 1} required="required"{/if}/>
32 {if $transaction->id eq null or $transaction->getMissingAmount() > 0}
34 <span class="bline tooltip" title="{_T string="Select a contribution type to create for dispatch transaction"}">{_T string="Dispatch type:"}</span>
35 <span class="tip">{_T string="Select a contribution type to create for dispatch transaction"}</span>
36 <input type="radio" name="contrib_type" id="contrib_type_fee" value="{constant('Galette\Entity\Contribution::TYPE_FEE')}" checked="checked"/> <label for="contrib_type_fee">{_T string="Membership fee"}</label>
37 <input type="radio" name="contrib_type" id="contrib_type_donation" value="{constant('Galette\Entity\Contribution::TYPE_DONATION')}"/> <label for="contrib_type_donation">{_T string="Donation"}</label>
42 {include file="edit_dynamic_fields.tpl" object=$transaction}
43 <div class="button-container">
44 <button type="submit" name="valid" class="action">
45 <i class="fas fa-save fa-fw"></i> {_T string="Save"}
47 <input type="hidden" name="trans_id" value="{$transaction->id}"/>
48 <input type="hidden" name="valid" value="1"/>
50 <p>{_T string="NB : The mandatory fields are in"} <span class="required">{_T string="red"}</span></p>
54 <table class="listing">
56 {_T string="Attached contributions"}
57 {if $transaction->getMissingAmount() > 0}
59 href="{path_for name="addContribution" data=["type" => constant('Galette\Entity\Contribution::TYPE_FEE')]}?trans_id={$transaction->id}"
60 class="button fright tooltip"
62 <i class="fas fa-user-check"></i>
63 <span class="sr-only">{_T string="Create a new fee that will be attached to the current transaction"}</span>
66 href="{path_for name="addContribution" data=["type" => constant('Galette\Entity\Contribution::TYPE_DONATION')]}?trans_id={$transaction->id}"
67 class="button fright tooltip"
69 <i class="fas fa-gift"></i>
70 <span class="sr-only">{_T string="Create a new donation that will be attached to the current transaction"}</span>
74 class="button fright tooltip"
77 <i class="fas fa-cookie"></i>
78 <span class="sr-only">{_T string="Select an existing contribution in the database, and attach it to the current transaction"}</span>
84 <th class="id_row">#</th>
85 <th class="left date_row">{_T string="Date"}</th>
86 <th class="left date_row">{_T string="Begin"}</th>
87 <th class="left date_row">{_T string="End"}</th>
88 <th class="left">{_T string="Duration"}</th>
89 {if $login->isAdmin() or $login->isStaff()}
90 <th class="left">{_T string="Member"}</th>
92 <th class="left">{_T string="Type"}</th>
93 <th class="left">{_T string="Amount"}</th>
94 {if $login->isAdmin() or $login->isStaff()}
95 <th class="actions_row"></th>
101 <th class="right bgfree" colspan="{if $login->isAdmin() or $login->isStaff()}7{else}5{/if}">{_T string="Dispatched amount:"}</th>
102 <th class="right bgfree">{$transaction->getDispatchedAmount()}</th>
106 <th class="right bgfree" colspan="{if $login->isAdmin() or $login->isStaff()}7{else}5{/if}">{_T string="Not dispatched amount:"}</th>
107 <th class="right bgfree">{$transaction->getMissingAmount()}</th>
112 {foreach from=$contribs item=contrib key=ordre}
113 {assign var="mid" value=$contrib->member}
114 {assign var="cclass" value=$contrib->getRowClass()}
116 <td class="{$cclass} center nowrap">
119 <td class="{$cclass} center nowrap">{$contrib->date}</td>
120 <td class="{$cclass} center nowrap">{$contrib->begin_date}</td>
121 <td class="{$cclass} center nowrap">{$contrib->end_date}</td>
122 <td class="{$cclass} nowrap">{$contrib->duration}</td>
123 {if $login->isAdmin() or $login->isStaff()}
124 <td class="{$cclass}">{memberName id="$mid"}</td>
126 <td class="{$cclass}">{$contrib->type->libelle}</td>
127 <td class="{$cclass} nowrap right">{$contrib->amount}</td>
128 {if $login->isAdmin() or $login->isStaff()}
129 <td class="{$cclass} actions_row">
131 href="{path_for name="detach_contribution" data=["id" => $transaction->id, "cid" => $contrib->id]}"
132 class="delete tooltip"
134 <i class="fas fa-trash"></i>
135 <span class="sr-only">{_T string="Detach contribution from this transaction"}</span>
141 <tr><td colspan="{if $login->isAdmin() or $login->isStaff()}9{else}7{/if}" class="emptylist">{_T string="no contribution"}</td></tr>
146 {else} {* No members *}
147 <div class="center" id="warningbox">
148 <h3>{_T string="No member registered!"}</h3>
150 {_T string="Unfortunately, there is no member in your database yet,"}
152 <a href="{path_for name="addMember"}">{_T string="please create a member"}</a>
158 {block name="javascripts"}
159 <script type="text/javascript">
160 {include file="js_chosen_adh.tpl"}
162 {if $transaction->id}
163 $('#contribslist').click(function(){
165 url: '{path_for name="contributions" data=["type" => "contributions"]}',
169 max_amount: '{$transaction->getMissingAmount()}'
171 {include file="js_loader.tpl"},
172 success: function(res){
173 _contribs_dialog(res);
176 alert("{_T string="An error occurred displaying members interface :("}");
182 var _contribs_dialog = function(res){
183 var _el = $('<div id="contributions_list" title="{_T string="Contributions selection"}"> </div>');
184 _el.appendTo('body').dialog({
189 close: function(event, ui){
191 $("#legende").remove();
194 _contribs_ajax_mapper(res);
197 var _contribs_ajax_mapper = function(res){
198 $('#contributions_list').append( res );
199 $("#contributions_list #legende").remove();
200 $("#contributions_list i.fa-filter").remove();
202 //Deactivate contributions list links
203 $('#contributions_list tbody a').click(function(){
204 //for links in body (members links), we de nothing
207 _bindNbshow('#contributions_list #filtre');
208 //Use JS to send form
209 $('#contributions_list #filtre').submit(function(){
213 data: $("#filtre").serialize(),
214 {include file="js_loader.tpl"},
215 success: function(res){
216 $('#contributions_list').empty();
217 _contribs_ajax_mapper(res);
220 alert("{_T string="An error occurred displaying contributions :("}");
225 //Bind pagination and ordering links
226 $('#contributions_list .pages a, #contributions_list thead a').bind({
229 url: this.href.substring(this.href.indexOf('?')) + (this.href.indexOf('?') > -1 ? "&" : "?") + "ajax=true",
231 {include file="js_loader.tpl"},
232 success: function(res){
233 $('#contributions_list').empty();
234 _contribs_ajax_mapper(res);
237 alert("{_T string="An error occurred displaying contributions :("}");
244 $('#contributions_list .contribution_row').click(function(){
245 $('#contributions_list').dialog("close");
246 var _cid = $(this).find('input[name="contrib_sel[]"]').val();
247 window.location.href = '{path_for name="attach_contribution" data=["id" => $transaction->id, "cid" => "%cid"]}'.replace(/%cid/, _cid);
248 }).css('cursor', 'pointer').attr('title', '{_T string="Click on a contribution row to attach it to the current transaction" escape="js"}');
251 $('#trans_date').datepicker({
255 buttonText: '<i class="far fa-calendar-alt"></i> <span class="sr-only">{_T string="Select a date" escape="js"}</span>'