Merge pull request #15314 from jitendrapurohit/dev-1255
[civicrm-core.git] / templates / CRM / Event / Form / EventFees.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
4 | |
5 | This code 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 +--------------------------------------------------------------------+
9 *}
10 {assign var=isRecordPayment value=1 }
11 {capture assign="isShowBillingBlock"}{if $action neq 2}1{else}0{/if}{/capture}
12 {if $paid} {* We retrieve this tpl when event is selected - keep it empty if event is not paid *}
13 <table class="form-layout">
14 {if $priceSet}
15 {if $discount and $hasPayment}
16 <tr class="crm-event-eventfees-form-block-discount"><td class="label">&nbsp;&nbsp;{ts}Discount Set{/ts}</td><td class="view-value">{$discount}</td></tr>
17 {elseif $form.discount_id.label}
18 <tr class="crm-event-eventfees-form-block-discount_id"><td class="label">&nbsp;&nbsp;{$form.discount_id.label}</td><td>{$form.discount_id.html}</td></tr>
19 {/if}
20 {if $action eq 2 and $hasPayment} {* Updating *}
21 {if $lineItem}
22 <tr class="crm-event-eventfees-form-block-line_items">
23 <td class="label">{ts}Selections{/ts}</td>
24 <td>{include file="CRM/Price/Page/LineItem.tpl" context="Event"}</td>
25 </tr>
26 {else}
27 <tr class="crm-event-eventfees-form-block-event_level">
28 <td class="label">{ts}Event Level{/ts}</td>
29 <td>{$fee_level}&nbsp;{if $fee_amount}- {$fee_amount|crmMoney:$fee_currency}{/if}</td>
30 </tr>
31 {/if}
32 <tr>
33 <td></td>
34 <td>
35 <a class="action-item crm-hover-button" href='{crmURL p="civicrm/event/participant/feeselection" q="reset=1&id=`$participantId`&cid=`$contactId`&action=update"}'><i class="crm-i fa-pencil"></i> {ts}Change Selections{/ts}</a>
36 </td>
37 </tr>
38 {else} {* New participant *}
39 {if $priceSet.fields}
40 <fieldset id="priceset" class="crm-group priceset-group">
41 <tr class="crm-event-eventfees-form-block-price_set_amount">
42 <td class="label" style="padding-top: 10px;">{$form.amount.label}</td>
43 <td class="view-value"><table class="form-layout">{include file="CRM/Price/Form/PriceSet.tpl" extends="Event"}</td>
44 </fieldset>
45 {else}
46 {assign var=isRecordPayment value=0 }
47 <div class='messages status'>{ts}No active price fields found for this event!{/ts}</div>
48 {/if}
49 </table>
50 {/if}
51 </td>
52 </tr>
53 {/if}
54
55 {if $accessContribution and ! $participantMode and ($action neq 2 or !$rows.0.contribution_id or $onlinePendingContributionId) and $isRecordPayment and ! $registeredByParticipantId }
56 {assign var=isShowBillingBlock value=true}
57 <tr class="crm-event-eventfees-form-block-record_contribution">
58 <td class="label">{$form.record_contribution.label}</td>
59 <td>{$form.record_contribution.html}<br />
60 <span class="description">{ts}Check this box to enter payment information. You will also be able to generate a customized receipt.{/ts}</span>
61 </td>
62 </tr>
63 <tr id="payment_information" class="crm-event-eventfees-form-block-payment_information">
64 <td class ='html-adjust' colspan=2>
65 <fieldset><legend>{ts}Payment Information{/ts}</legend>
66 <table id="recordContribution" class="form-layout" style="width:auto;">
67 <tr class="crm-event-eventfees-form-block-financial_type_id">
68 <td class="label">{$form.financial_type_id.label}<span class="crm-marker"> *</span></td>
69 <td>{$form.financial_type_id.html}<br /><span class="description">{ts}Select the appropriate financial type for this payment.{/ts}</span></td>
70 </tr>
71 <tr class="crm-event-eventfees-form-block-total_amount"><td class="label">{$form.total_amount.label}</td><td>{$form.total_amount.html|crmMoney:$currency}</td></tr>
72 <tr>
73 <td class="label" >{$form.receive_date.label}</td>
74 <td>{$form.receive_date.html}</td>
75 </tr>
76 {if $showTransactionId }
77 <tr class="crm-event-eventfees-form-block-trxn_id"><td class="label">{$form.trxn_id.label}</td><td>{$form.trxn_id.html}</td></tr>
78 {/if}
79 <tr class="crm-event-eventfees-form-block-contribution_status_id"><td class="label">{$form.contribution_status_id.label}</td><td>{$form.contribution_status_id.html}</td></tr>
80 <tr class="crm-event-eventfees-form-block-payment_instrument_id"><td class="label">{$form.payment_instrument_id.label}<span class="crm-marker"> *</span></td><td>{$form.payment_instrument_id.html} {help id="payment_instrument_id" file="CRM/Contribute/Page/Tab.hlp"}</td></tr>
81 </table>
82 </fieldset>
83 </td>
84 </tr>
85 {/if}
86 </table>
87
88 {/if}
89
90 {if $isShowBillingBlock}
91 {include file='CRM/Core/BillingBlockWrapper.tpl'}
92 {/if}
93
94 {if ($email OR $batchEmail) and $outBound_option != 2}
95 <fieldset id="send_confirmation_receipt"><legend>{if $paid}{ts}Registration Confirmation and Receipt{/ts}{else}{ts}Registration Confirmation{/ts}{/if}</legend>
96 <table class="form-layout" style="width:auto;">
97 <tr class="crm-event-eventfees-form-block-send_receipt">
98 <td class="label">{if $paid}{ts}Send Confirmation and Receipt{/ts}{else}{ts}Send Confirmation{/ts}{/if}</td>
99 <td>{$form.send_receipt.html}<br>
100 {if $paid}
101 <span class="description">{ts 1=$email}Automatically email a confirmation and receipt to %1?{/ts}</span></td>
102 {else}
103 <span class="description">{ts 1=$email}Automatically email a confirmation to %1?{/ts}</span></td>
104 {/if}
105 </tr>
106 <tr id="from-email" class="crm-event-eventfees-form-block-from_email_address">
107 <td class="label">{$form.from_email_address.label}</td>
108 <td>{$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Email.hlp" isAdmin=$isAdmin}</td>
109 </tr>
110 <tr id='notice' class="crm-event-eventfees-form-block-receipt_text">
111 <td class="label">{$form.receipt_text.label}</td>
112 <td><span class="description">
113 {ts}Enter a message you want included at the beginning of the confirmation email. EXAMPLE: 'Thanks for registering for this event.'{/ts}
114 </span><br />
115 {$form.receipt_text.html|crmAddClass:huge}
116 </td>
117 </tr>
118 </table>
119 </fieldset>
120 {elseif $context eq 'standalone' and $outBound_option != 2 }
121 <fieldset id="email-receipt" style="display:none;"><legend>{if $paid}{ts}Registration Confirmation and Receipt{/ts}{else}{ts}Registration Confirmation{/ts}{/if}</legend>
122 <table class="form-layout" style="width:auto;">
123 <tr class="crm-event-eventfees-form-block-send_receipt">
124 <td class="label">{if $paid}{ts}Send Confirmation and Receipt{/ts}{else}{ts}Send Confirmation{/ts}{/if}</td>
125 <td>{$form.send_receipt.html}<br>
126 {if $paid}
127 <span class="description">{ts 1='<span id="email-address"></span>'}Automatically email a confirmation and receipt to %1?{/ts}</span>
128 {else}
129 <span class="description">{ts 1='<span id="email-address"></span>'}Automatically email a confirmation to %1?{/ts}</span>
130 {/if}
131 </td>
132 </tr>
133 <tr id="from-email" class="crm-event-eventfees-form-block-from_email_address">
134 <td class="label">{$form.from_email_address.label}</td>
135 <td>{$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Email.hlp" isAdmin=$isAdmin}</td>
136 </tr>
137 <tr id='notice' class="crm-event-eventfees-form-block-receipt_text">
138 <td class="label">{$form.receipt_text.label}</td>
139 <td><span class="description">
140 {ts}Enter a message you want included at the beginning of the confirmation email. EXAMPLE: 'Thanks for registering for this event.'{/ts}
141 </span><br />
142 {$form.receipt_text.html|crmAddClass:huge}</td>
143 </tr>
144 </table>
145 </fieldset>
146 {/if}
147
148 {if ($email and $outBound_option != 2) OR $context eq 'standalone' } {* Send receipt field only present if contact has a valid email address. *}
149 {include file="CRM/common/showHideByFieldValue.tpl"
150 trigger_field_id ="send_receipt"
151 trigger_value =""
152 target_element_id ="notice"
153 target_element_type ="table-row"
154 field_type ="radio"
155 invert = 0
156 }
157 {include file="CRM/common/showHideByFieldValue.tpl"
158 trigger_field_id ="send_receipt"
159 trigger_value =""
160 target_element_id ="from-email"
161 target_element_type ="table-row"
162 field_type ="radio"
163 invert = 0
164 }
165 {/if}
166
167 {if $context eq 'standalone' and $outBound_option != 2 }
168 <script type="text/javascript">
169 {literal}
170 CRM.$(function($) {
171 var $form = $("form.{/literal}{$form.formClass}{literal}");
172 $("#contact_id", $form).change(checkEmail);
173 checkEmail();
174
175 function checkEmail( ) {
176 var data = $("#contact_id", $form).select2('data');
177 if (data && data.extra && data.extra.email && data.extra.email.length) {
178 $("#email-receipt", $form).show();
179 if ($("#send_receipt", $form).is(':checked')) {
180 $("#notice", $form).show();
181 }
182 $("#email-address", $form).html(data.extra.email);
183 }
184 else {
185 $("#email-receipt, #notice", $form).hide();
186 }
187 }
188 });
189 {/literal}
190 </script>
191 {/if}
192
193 {if $onlinePendingContributionId}
194 <script type="text/javascript">
195 {literal}
196 function confirmStatus( pStatusId, cStatusId ) {
197 if ( (pStatusId == cj("#status_id").val() ) && (cStatusId == cj("#contribution_status_id").val()) ) {
198 var allow = confirm( '{/literal}{ts escape='js'}The Payment Status for this participant is Completed. The Participant Status is set to Pending (pay later). Click Cancel if you want to review or modify these values before saving this record{/ts}{literal}.' );
199 if ( !allow ) return false;
200 }
201 }
202
203 function checkCancelled( statusId, pStatusId, cStatusId ) {
204 //selected participant status is 'cancelled'
205 if ( statusId == pStatusId ) {
206 cj("#contribution_status_id").val( cStatusId );
207
208 //unset value for send receipt check box.
209 cj("#send_receipt").prop("checked", false );
210 cj("#send_confirmation_receipt").hide( );
211
212 // set receive data to null.
213 clearDateTime( 'receive_date' );
214 } else {
215 cj("#send_confirmation_receipt").show( );
216 }
217 sendNotification();
218 }
219
220 {/literal}
221 </script>
222 {/if}
223 {if $showFeeBlock && $feeBlockPaid && ! $priceSet && $action neq 2}
224 <script>
225 {literal}
226 fillTotalAmount( );
227
228 function fillTotalAmount( totalAmount ) {
229 if ( !totalAmount ) {
230 var amountVal = {/literal}{if $form.amount.value}{$form.amount.value}{else}0{/if}{literal};
231 if ( amountVal > 0 ) {
232 var eventFeeBlockValues = {/literal}{$eventFeeBlockValues}{literal};
233 totalAmount = eval('eventFeeBlockValues.amount_id_'+ amountVal);
234 } else {
235 totalAmount = '';
236 }
237 }
238 cj('#total_amount').val( totalAmount );
239 }
240 {/literal}
241 </script>
242 {/if}
243
244 {* ADD mode if *}