1 {if isset($mode) && $mode eq 'ajax'}
2 {assign var="extend" value='ajax.tpl'}
4 {assign var="extend" value='page.tpl'}
9 {if isset($members.list) || $require_mass}
10 <form action="{if $contribution->id}{path_for name="doEditContribution" data=["type" => $type, "id" => $contribution->id]}{else}{path_for name="doAddContribution" data=["type" => $type]}{/if}" enctype="multipart/form-data" method="post">
11 <div class="bigtable">
12 {if $contribution->isTransactionPart()}
13 {assign var="mid" value=$contribution->transaction->member}
14 <table id="transaction_detail">
15 <caption>{_T string="Related transaction information"}</caption>
19 {$contribution->transaction->description}
20 <a href="{path_for name="editTransaction" data=["id" => $contribution->transaction->id]}" title="{_T string="View transaction"}">
21 <img src="{base_url}/{$template_subdir}images/icon-money.png"
22 alt="{_T string="[view]"}"
31 <th class="listing">#</th>
32 <th class="listing">{_T string="Date"}</th>
33 <th class="listing">{_T string="Member"}</th>
34 <th class="listing">{_T string="Amount"}</th>
35 <th class="listing">{_T string="Not dispatched amount"}</th>
38 <td>{$contribution->transaction->id}</td>
39 <td>{$contribution->transaction->date}</td>
40 <td>{memberName id="$mid"}</td>
41 <td class="right">{$contribution->transaction->amount}</td>
42 <td class="right">{$contribution->transaction->getMissingAmount()}</td>
47 <p>{_T string="NB : The mandatory fields are in"} <span class="required">{_T string="red"}</span></p>
48 <fieldset class="cssform">
49 <legend class="ui-state-active ui-corner-top">
50 {if $type eq constant('Galette\Entity\Contribution::TYPE_FEE')}
51 {_T string="Select contributor and membership fee type"}
53 {_T string="Select contributor and donation type"}
55 {if $contribution->isTransactionPart() && $contribution->transaction->getMissingAmount() > 0}
57 href="{path_for name="addContribution" data=["type" => constant('Galette\Entity\Contribution::TYPE_FEE')]}?trans_id={$contribution->transaction->id}"
58 class="button fright tooltip"
59 title="{_T string="Create a new fee that will be attached to the current transaction"}">
60 <i class="fas fa-user-check"></i>
61 <span class="sr-only">{_T string="New attached fee"}</span>
64 href="{path_for name="addContribution" data=["type" => "donation"]}?trans_id={$contribution->transaction->id}"
65 class="button fright tooltip"
66 title="{_T string="Create a new donation that will be attached to the current transaction"}">
67 <i class="fas fa-gift"></i>
68 <span class="sr-only">{_T string="New attached donation"}</span>
74 <label for="id_adh" class="bline">{_T string="Contributor:"}</label>
75 <select name="id_adh" id="id_adh" class="nochosen">
76 {if $adh_selected eq 0}
77 <option value="">{_T string="Search for name or ID and pick member"}</option>
79 {foreach $members.list as $k=>$v}
80 <option value="{$k}"{if $contribution->member == $k} selected="selected"{/if}>{$v}</option>
86 <label for="id_type_cotis" class="bline">{_T string="Contribution type:"}</label>
87 <select name="id_type_cotis" id="id_type_cotis"{if isset($required.id_type_cotis) && ($required.id_type_cotis eq 1)} required="required"{/if}>
88 {if $contribution->type}
89 {assign var="selectedid" value=$contribution->type->id}
91 {assign var="selectedid" value=null}
93 {html_options options=$type_cotis_options selected=$selectedid}
96 {if $type eq constant('Galette\Entity\Contribution::TYPE_FEE')}
98 <div class="button-container" id="reloadcont">
99 <input type="submit" id="btnreload" name="btnreload" value="{_T string="Reload"}" title="{_T string="Reload date information according to selected member and contribution type"}"/>
105 <fieldset class="cssform">
106 <legend class="ui-state-active ui-corner-top">{if $type eq constant('Galette\Entity\Contribution::TYPE_FEE')}{_T string="Details of membership fee"}{else}{_T string="Details of donation"}{/if}</legend>
108 <label class="bline" for="montant_cotis">{_T string="Amount:"}</label>
109 <input type="text" name="montant_cotis" id="montant_cotis" value="{$contribution->amount}" maxlength="10"{if isset($required.montant_cotis) && ($required.montant_cotis eq 1)} required="required"{/if}/>
112 {assign var="ptype" value=$contribution->payment_type}
114 {assign var="ptype" value=constant('Galette\Entity\PaymentType::CHECK')}
116 {include file="forms_types/payment_types.tpl" current=$ptype varname="type_paiement_cotis"}
118 <label class="bline" for="date_enreg">
119 {_T string="Record date:"}
121 <input class="past-date-pick" type="text" name="date_enreg" id="date_enreg" value="{$contribution->date}" maxlength="10"{if isset($required.date_enreg) && ($required.date_enreg eq 1)} required="required"{/if}/>
122 <span class="exemple">{_T string="(yyyy-mm-dd format)"}</span>
126 <label class="bline" for="date_debut_cotis">
127 {if $type eq constant('Galette\Entity\Contribution::TYPE_FEE')}
128 {_T string="Start date of membership:"}
130 {_T string="Date of contribution:"}
133 <input class="past-date-pick" type="text" name="date_debut_cotis" id="date_debut_cotis" value="{$contribution->begin_date}" maxlength="10"{if isset($required.date_debut_cotis) && ($required.date_debut_cotis eq 1)} required="required"{/if}/>
134 <span class="exemple">{_T string="(yyyy-mm-dd format)"}</span>
136 {if $type eq constant('Galette\Entity\Contribution::TYPE_FEE')}
138 {if $preferences->pref_membership_ext != ""}
139 <label class="bline" for="duree_mois_cotis">{_T string="Membership extension:"}</label>
140 <input type="text" name="duree_mois_cotis" id="duree_mois_cotis" value="{$contribution->duration}" maxlength="3"{if isset($required.date_fin_cotis) && ($required.date_fin_cotis eq 1)} required="required"{/if}/>
141 <span class="exemple">{_T string="months"}</span>
143 <label class="bline" for="date_fin_cotis">{_T string="End date of membership:"}</label>
144 <input type="text" name="date_fin_cotis" id="date_fin_cotis" value="{$contribution->end_date}" maxlength="10"{if isset($required.date_fin_cotis) && ($required.date_fin_cotis eq 1)} required="required"{/if}/>
145 <span class="exemple">{_T string="(yyyy-mm-dd format)"}</span>
150 <label class="bline" for="info_cotis">{_T string="Comments:"}</label>
151 <textarea name="info_cotis" id="info_cotis" cols="61" rows="6"{if isset($required.info_cotis) and $required.info_cotis eq 1} required="required"{/if}>{$contribution->info}</textarea>
155 {if $contribution->isTransactionPart() && $contribution->transaction->getMissingAmount()}
156 <fieldset class="cssform" id="transaction_related">
157 <legend class="ui-state-active ui-corner-top">{_T string="Transaction related"}</legend>
159 <span class="bline tooltip" title="{_T string="Select a contribution type to create for dispatch transaction"}">{_T string="Dispatch type:"}</span>
160 <span class="tip">{_T string="Select a contribution type to create for dispatch transaction"}</span>
161 <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>
162 <input type="radio" name="contrib_type" id="contrib_type_donation" value="donation"/> <label for="contrib_type_donation">{_T string="Donation"}</label>
166 {include file="edit_dynamic_fields.tpl" object=$contribution}
167 {if not $contribution->id and $pref_mail_method neq constant('Galette\Core\GaletteMail::METHOD_DISABLED')}
170 <label for="mail_confirm">{_T string="Notify member"}</label>
171 <input type="checkbox" name="mail_confirm" id="mail_confirm" value="1" {if $preferences->pref_bool_mailowner || isset($smarty.post.mail_confirm) and $smarty.post.mail_confirm != ""}checked="checked"{/if}/>
172 <br/><span class="exemple">{_T string="Member will receive a notification by email, if he has an address."}</span>
178 <div class="button-container">
179 <button type="submit" name="valid" class="action">
180 <i class="fas fa-save fa-fw"></i> {_T string="Save"}
182 <input type="hidden" name="id_cotis" value="{$contribution->id}"/>
183 <input type="hidden" name="valid" value="1"/>
184 <input type="hidden" name="trans_id" value="{if $contribution->transaction neq NULL}{$contribution->transaction->id}{/if}"/>
187 {include file="forms_types/csrf.tpl"}
189 {else} {* No members *}
190 <div class="center" id="warningbox">
191 <h3>{_T string="No member registered!"}</h3>
193 {_T string="Unfortunately, there is no member in your database yet,"}
195 <a href="{path_for name="addMember"}">{_T string="please create a member"}</a>
201 {block name="javascripts"}
202 <script type="text/javascript">
203 {include file="js_chosen_adh.tpl"}
206 $('#date_debut_cotis, #date_fin_cotis, #date_enreg').datepicker({
210 buttonText: '<i class="far fa-calendar-alt"></i> <span class="sr-only">{_T string="Select a date" escape="js"}</span>'
213 {if $type eq constant('Galette\Entity\Contribution::TYPE_FEE') and !$contribution->id}
214 $('#id_adh, #id_type_cotis').on('change', function() {
216 var _member = $('#id_adh').val();
217 var _fee = $('#id_type_cotis').val();
222 url : '{path_for name="contributionDates"}',
227 {include file="js_loader.tpl"},
228 success: function(res){
229 $('#date_debut_cotis').val(res.date_debut_cotis);
230 $('#date_fin_cotis').val(res.date_fin_cotis);
233 alert("{_T string="An error occurred retrieving dates :(" escape="js"}");
240 {if $contribution->isTransactionPart() && $contribution->transaction->getMissingAmount()}
241 $('#transaction_related').hide();
242 $('#montant_cotis').on('keyup', function() {
243 var _amount = {$contribution->transaction->getMissingAmount()};
244 var _current = $(this).val();
245 if (_current < _amount) {
246 $('#transaction_related').show();
247 } else if (_current > _amount) {
248 alert('{_T string="Contribution amount should be greater than %max" pattern="/%max/" replace=$contribution->transaction->getMissingAmount() escape="js"}');
250 $('#transaction_related').hide();