2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
8 +--------------------------------------------------------------------+
10 {* This template is used to change selections of fees for a participant *}
12 <script type='text/javascript'>
13 function display(totalfee) {
14 {/literal}{if $optionFullTotalAmount}
15 totalfee += {$optionFullTotalAmount};{/if}
17 // totalfee is monetary, round it to 2 decimal points so it can
18 // go as a float - CRM-13491
19 totalfee = Math.round(totalfee*100)/100;
20 // note : some variables used used here are global variables defined inside Calculate.tpl
21 var totalEventFee = formatMoney( totalfee, 2, seperator, thousandMarker);
22 cj('#pricevalue').html("<b>"+symbol+"</b> "+totalEventFee);
25 cj('#total_amount').val(totalfee);
26 ( totalfee < 0 ) ? cj('table#pricelabel').addClass('disabled') : cj('table#pricelabel').removeClass('disabled');
28 // populate the balance amount div
29 // change the status selections according to updated selections
30 populatebalanceFee(totalfee, false);
33 function populatebalanceFee(updatedAmt, onlyStatusUpdate) {
34 // updatedAmt is: selected line total
37 var partiallyPaid = {/literal}{$partiallyPaid}{literal};
38 var pendingRefund = {/literal}{$pendingRefund}{literal};
39 var participantStatus = {/literal}{$participantStatus}{literal};
42 var feePaid = {/literal}{$feePaid}{literal};
44 var updatedTotalLineTotal = updatedAmt;
46 {/literal}{if $totalLineTotal}{literal}
47 // line total of current participant stored in DB
48 var linetotal = {/literal}{$lineItemTotal}{literal};
50 // line total of all the participants
51 var totalLineTotal = {/literal}{$totalLineTotal}{literal};
52 updatedTotalLineTotal = totalLineTotal + (updatedAmt - linetotal);
53 {/literal}{/if}{literal}
55 // calculate the balance amount using total paid and updated amount
56 var balanceAmt = updatedTotalLineTotal - feePaid;
58 // change the status selections according to updated selections
59 if (balanceAmt > 0 && feePaid != 0) {
60 cj('#status_id').val(partiallyPaid);
62 else if(balanceAmt < 0) {
63 cj('#status_id').val(pendingRefund);
66 cj('#status_id').val(participantStatus);
69 if (!onlyStatusUpdate) {
70 balanceAmt = formatMoney(balanceAmt, 2, seperator, thousandMarker);
71 cj('#balance-fee').text(symbol+" "+balanceAmt);
76 var updatedFeeUnFormatted = $('#pricevalue').text();
77 var updatedAmt = parseFloat(updatedFeeUnFormatted.replace(/[^0-9-.]/g, ''));
79 populatebalanceFee(updatedAmt, true);
84 <h3>Change Registration Selections</h3>
86 <div class="crm-block crm-form-block crm-payment-form-block">
87 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
89 <div class="messages status no-popup">
90 <i class="crm-i fa-info-circle" aria-hidden="true"></i> {ts}You will not be able to send an automatic email receipt for this payment because there is no email address recorded for this contact. If you want a receipt to be sent when this payment is recorded, click Cancel and then click Edit from the Summary tab to add an email address before recording the payment.{/ts}
93 <table class="form-layout">
95 <td class="font-size12pt label"><strong>{ts}Participant{/ts}</strong></td><td class="font-size12pt"><strong>{$displayName}</strong></td>
98 <td class='label'>{ts}Event{/ts}</td><td>{$eventName}</td>
100 <tr class="crm-participant-form-block-status_id">
101 <td class="label">{$form.status_id.label}</td>
102 <td>{$form.status_id.html}</td>
105 <tr class="crm-event-eventfees-form-block-line_items">
106 <td class="label">{ts}Current Selections{/ts}</td>
107 <td>{include file="CRM/Price/Page/LineItem.tpl" context="Event"}</td>
112 {if $priceSet.fields}
113 <fieldset id="priceset" class="crm-group priceset-group">
114 <table class='form-layout'>
115 <tr class="crm-event-eventfees-form-block-price_set_amount">
116 <td class="label" style="padding-top: 10px;">{$form.amount.label}</td>
117 <td class="view-value"><table class="form-layout">{include file="CRM/Price/Form/PriceSet.tpl" extends="Event" noCalcValueDisplay=0 context="participant"}</table></td>
121 <div class='crm-section'>
122 <div class='label'>{ts}Updated Fee(s){/ts}</div><div id="pricevalue" class='content updated-fee'></div>
123 <div class='label'>{ts}Total Paid{/ts}</div>
124 <div class='content'>
125 {$paymentInfo.paid|crmMoney}<br/>
126 <a class="crm-hover-button action-item crm-popup medium-popup" href='{crmURL p="civicrm/payment" q="view=transaction&action=browse&cid=`$contactId`&id=`$paymentInfo.id`&component=`$paymentInfo.component`&context=transaction"}'><i class="crm-i fa-list-alt" aria-hidden="true"></i> {ts}view payments{/ts}</a>
128 <div class='label'><strong>{ts}Balance Owed{/ts}</strong></div><div class='content'><strong id='balance-fee'></strong></div>
130 {include file='CRM/Price/Form/Calculate.tpl' currencySymbol=$currencySymbol noCalcValueDisplay=1 displayOveride='true'}
136 <fieldset id="email-receipt"><legend>{ts}Participant Confirmation{/ts}</legend>
137 <table class="form-layout" style="width:auto;">
138 <tr class="crm-event-eventfees-form-block-send_receipt">
139 <td class="label">{ts}Send Confirmation{/ts}</td>
140 <td>{$form.send_receipt.html}<br>
141 <span class="description">{ts 1=$email}Automatically email a confirmation to %1?{/ts}</span>
144 <tr id="from-email" class="crm-event-eventfees-form-block-from_email_address">
145 <td class="label">{$form.from_email_address.label}</td>
146 <td>{$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Email.hlp" isAdmin=$isAdmin}</td>
148 <tr id='notice' class="crm-event-eventfees-form-block-receipt_text">
149 <td class="label">{$form.receipt_text.label}</td>
150 <td><span class="description">
151 {ts}Enter a message you want included at the beginning of the confirmation email. EXAMPLE: 'We have made the changes you requested to your registration.'{/ts}
153 {$form.receipt_text.html|crmAddClass:huge}
160 <table class="form-layout">
161 <tr class="crm-participant-form-block-note">
162 <td class="label">{$form.note.label}</td><td>{$form.note.html}</td>
166 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
169 {include file="CRM/common/showHideByFieldValue.tpl"
170 trigger_field_id ="send_receipt"
172 target_element_id ="notice"
173 target_element_type ="table-row"
177 {include file="CRM/common/showHideByFieldValue.tpl"
178 trigger_field_id ="send_receipt"
180 target_element_id ="from-email"
181 target_element_type ="table-row"
187 <script type='text/javascript'>
189 var $form = $('form.{/literal}{$form.formClass}{literal}');
190 cj('.total_amount-section').remove();
192 cj($form).submit(function(e) {
193 var partiallyPaid = {/literal}{$partiallyPaid}{literal};
194 var pendingRefund = {/literal}{$pendingRefund}{literal};
195 var statusId = cj('#status_id').val();
196 var statusLabel = cj('#status_id option:selected').text();
197 var balanceFee = cj('#balance-fee').text();
200 var feePaid = {/literal}{$feePaid}{literal};
202 balanceFee = parseFloat(balanceFee.replace(/[^0-9-.]/g, ''));
204 if ((balanceFee > 0 && feePaid != 0) && statusId != partiallyPaid) {
205 var result = confirm('Balance is owing for the updated selections. Expected participant status is \'Partially paid\'. Are you sure you want to set the participant status to ' + statusLabel + ' ? Click OK to continue, Cancel to change your entries.');
206 if (result == false) {
210 else if ((balanceFee < 0 && feePaid != 0) && statusId != pendingRefund) {
211 var result = confirm('Balance is overpaid for the updated selections. Expected participant status is \'Pending refund\'. Are you sure you want to set the participant status to ' + statusLabel + ' ? Click OK to continue, Cancel to change your entries');
212 if (result == false) {