1 {extends file="page.tpl"}
4 {if isset($members.list)}
5 <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">
7 {if $contribution->isTransactionPart()}
8 {assign var="mid" value=$contribution->transaction->member}
9 <table id="transaction_detail">
10 <caption>{_T string="Related transaction information"}</caption>
14 {$contribution->transaction->description}
15 <a href="{path_for name="editTransaction" data=["id" => $contribution->transaction->id]}" title="{_T string="View transaction"}">
16 <img src="{base_url}/{$template_subdir}images/icon-money.png"
17 alt="{_T string="[view]"}"
26 <th class="listing">#</th>
27 <th class="listing">{_T string="Date"}</th>
28 <th class="listing">{_T string="Member"}</th>
29 <th class="listing">{_T string="Amount"}</th>
30 <th class="listing">{_T string="Not dispatched amount"}</th>
33 <td>{$contribution->transaction->id}</td>
34 <td>{$contribution->transaction->date}</td>
35 <td>{memberName id="$mid"}</td>
36 <td class="right">{$contribution->transaction->amount}</td>
37 <td class="right">{$contribution->transaction->getMissingAmount()}</td>
42 <p>{_T string="NB : The mandatory fields are in"} <span class="required">{_T string="red"}</span></p>
43 <fieldset class="cssform">
44 <legend class="ui-state-active ui-corner-top">
46 {_T string="Select contributor and membership fee type"}
48 {_T string="Select contributor and donation type"}
50 {if $contribution->isTransactionPart() && $contribution->transaction->getMissingAmount() > 0}
52 href="{path_for name="addContribution" data=["type" => "fee"]}?trans_id={$contribution->transaction->id}"
53 class="button fright tooltip"
54 title="{_T string="Create a new fee that will be attached to the current transaction"}">
55 <i class="fas fa-user-check"></i>
56 <span class="sr-only">{_T string="New attached fee"}</span>
59 href="{path_for name="addContribution" data=["type" => "donation"]}?trans_id={$contribution->transaction->id}"
60 class="button fright tooltip"
61 title="{_T string="Create a new donation that will be attached to the current transaction"}">
62 <i class="fas fa-gift"></i>
63 <span class="sr-only">{_T string="New attached donation"}</span>
68 <label for="id_adh" class="bline">{_T string="Contributor:"}</label>
69 <select name="id_adh" id="id_adh" class="nochosen"{if isset($disabled.id_adh)} {$disabled.id_adh}{/if}>
70 {if $adh_selected eq 0}
71 <option value="">{_T string="Search for name or ID and pick member"}</option>
73 {foreach $members.list as $k=>$v}
74 <option value="{$k}"{if $contribution->member == $k} selected="selected"{/if}>{$v}</option>
79 <label for="id_type_cotis" class="bline">{_T string="Contribution type:"}</label>
80 <select name="id_type_cotis" id="id_type_cotis"{if $required.id_type_cotis eq 1} required="required"{/if}>
81 {if $contribution->type}
82 {assign var="selectedid" value=$contribution->type->id}
84 {assign var="selectedid" value=null}
86 {html_options options=$type_cotis_options selected=$selectedid}
91 <div class="button-container" id="reloadcont">
92 <input type="submit" id="btnreload" name="btnreload" value="{_T string="Reload"}" title="{_T string="Reload date information according to selected member and contribution type"}"/>
98 <fieldset class="cssform">
99 <legend class="ui-state-active ui-corner-top">{if $type eq "fee"}{_T string="Details of membership fee"}{else}{_T string="Details of donation"}{/if}</legend>
101 <label class="bline" for="montant_cotis">{_T string="Amount:"}</label>
102 <input type="text" name="montant_cotis" id="montant_cotis" value="{$contribution->amount}" maxlength="10"{if $required.montant_cotis eq 1} required="required"{/if}/>
105 {assign var="ptype" value=$contribution->payment_type}
107 {assign var="ptype" value=constant('Galette\Entity\PaymentType::CHECK')}
109 {include file="forms_types/payment_types.tpl" current=$ptype varname="type_paiement_cotis"}
111 <label class="bline" for="date_enreg">
112 {_T string="Record date:"}
114 <input class="past-date-pick" type="text" name="date_enreg" id="date_enreg" value="{$contribution->date}" maxlength="10"{if $required.date_enreg eq 1} required="required"{/if}/>
115 <span class="exemple">{_T string="(yyyy-mm-dd format)"}</span>
119 <label class="bline" for="date_debut_cotis">
121 {_T string="Start date of membership:"}
123 {_T string="Date of contribution:"}
126 <input class="past-date-pick" type="text" name="date_debut_cotis" id="date_debut_cotis" value="{$contribution->begin_date}" maxlength="10"{if $required.date_debut_cotis eq 1} required="required"{/if}/>
127 <span class="exemple">{_T string="(yyyy-mm-dd format)"}</span>
131 {if $pref_membership_ext != ""}
132 <label class="bline" for="duree_mois_cotis">{_T string="Membership extension:"}</label>
133 <input type="text" name="duree_mois_cotis" id="duree_mois_cotis" value="{$contribution->duration}" maxlength="3"{if $required.date_fin_cotis eq 1} required="required"{/if}/>
134 <span class="exemple">{_T string="months"}</span>
136 <label class="bline" for="date_fin_cotis">{_T string="End date of membership:"}</label>
137 <input type="text" name="date_fin_cotis" id="date_fin_cotis" value="{$contribution->end_date}" maxlength="10"{if $required.date_fin_cotis eq 1} required="required"{/if}/>
138 <span class="exemple">{_T string="(yyyy-mm-dd format)"}</span>
143 <label class="bline" for="info_cotis">{_T string="Comments:"}</label>
144 <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>
148 {if $contribution->isTransactionPart() && $contribution->transaction->getMissingAmount()}
149 <fieldset class="cssform" id="transaction_related">
150 <legend class="ui-state-active ui-corner-top">{_T string="Transaction related"}</legend>
152 <span class="bline tooltip" title="{_T string="Select a contribution type to create for dispatch transaction"}">{_T string="Dispatch type:"}</span>
153 <span class="tip">{_T string="Select a contribution type to create for dispatch transaction"}</span>
154 <input type="radio" name="contrib_type" id="contrib_type_fee" value="fee" checked="checked"/> <label for="contrib_type_fee">{_T string="Membership fee"}</label>
155 <input type="radio" name="contrib_type" id="contrib_type_donation" value="donation"/> <label for="contrib_type_donation">{_T string="Donation"}</label>
159 {include file="edit_dynamic_fields.tpl" object=$contribution}
160 {if not $contribution->id and $pref_mail_method neq constant('Galette\Core\GaletteMail::METHOD_DISABLED')}
162 <label for="mail_confirm">{_T string="Notify member"}</label>
163 <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}/>
164 <br/><span class="exemple">{_T string="Member will receive a notification by email, if he has an address."}</span>
168 <div class="button-container">
169 <button type="submit" name="valid" class="action">
170 <i class="fas fa-save fa-fw"></i> {_T string="Save"}
172 <input type="hidden" name="id_cotis" value="{$contribution->id}"/>
173 <input type="hidden" name="valid" value="1"/>
174 <input type="hidden" name="trans_id" value="{if $contribution->transaction neq NULL}{$contribution->transaction->id}{/if}"/>
177 {else} {* No members *}
178 <div class="center" id="warningbox">
179 <h3>{_T string="No member registered!"}</h3>
181 {_T string="Unfortunately, there is no member in your database yet,"}
183 <a href="{path_for name="addMember"}">{_T string="please create a member"}</a>
189 {block name="javascripts"}
190 <script type="text/javascript">
191 {include file="js_chosen_adh.tpl"}
194 $('#date_debut_cotis, #date_fin_cotis, #date_enreg').datepicker({
198 buttonText: '<i class="far fa-calendar-alt"></i> <span class="sr-only">{_T string="Select a date" escape="js"}</span>'
201 {if $type eq "fee" and !$contribution->id}
202 $('#id_adh, #id_type_cotis').on('change', function() {
204 var _member = $('#id_adh').val();
205 var _fee = $('#id_type_cotis').val();
210 url : '{path_for name="contributionDates"}',
215 {include file="js_loader.tpl"},
216 success: function(res){
217 $('#date_debut_cotis').val(res.date_debut_cotis);
218 $('#date_fin_cotis').val(res.date_fin_cotis);
221 alert("{_T string="An error occurred retrieving dates :(" escape="js"}");
228 {if $contribution->isTransactionPart() && $contribution->transaction->getMissingAmount()}
229 $('#transaction_related').hide();
230 $('#montant_cotis').on('keyup', function() {
231 var _amount = {$contribution->transaction->getMissingAmount()};
232 var _current = $(this).val();
233 if (_current < _amount) {
234 $('#transaction_related').show();
235 } else if (_current > _amount) {
236 alert('{_T string="Contribution amount should be greater than %max" pattern="/%max/" replace=$contribution->transaction->getMissingAmount() escape="js"}');
238 $('#transaction_related').hide();