CRM-14383 - Update cj closures
[civicrm-core.git] / templates / CRM / Event / Form / ManageEvent / Fee.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
819d0d41 3 | CiviCRM version 4.5 |
6a488035 4 +--------------------------------------------------------------------+
819d0d41 5 | Copyright CiviCRM LLC (c) 2004-2014 |
6a488035
TO
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
8 | |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
12 | |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25*}
26{* this template is used for adding event *}
27{capture assign="adminPriceSets"}{crmURL p='civicrm/admin/price' q="reset=1"}{/capture}
28 {if !$paymentProcessor}
29 {capture assign=ppUrl}{crmURL p='civicrm/admin/paymentProcessor' q="reset=1"}{/capture}
30 <div class="status message">
31 {ts 1=$ppUrl}No Payment Processor has been configured / enabled for your site. If this is a <strong>paid event</strong> AND you want users to be able to <strong>register and pay online</strong>, you will need to <a href='%1'>configure a Payment Processor</a> first. Then return to this screen and assign the processor to this event.{/ts} {docURL page="user/contributions/payment-processors"}
32 <p>{ts}NOTE: Alternatively, you can enable the <strong>Pay Later</strong> option below without setting up a payment processor. All users will then be asked to submit payment offline (e.g. mail in a check, call in a credit card, etc.).{/ts}</p>
33 </div>
34 {/if}
35<div class="crm-block crm-form-block crm-event-manage-fee-form-block">
36{if $isQuick}
37 <div id="popupContainer">
38 {ts}Once you switch to using a Price Set, you won't be able to switch back to your existing settings below except by re-entering them. Are you sure you want to switch to a Price Set?{/ts}
39 </div>
40{/if}
41<div class="crm-submit-buttons">
42 {include file="CRM/common/formButtons.tpl" location="top"}
43</div>
44
45 <table class="form-layout">
46 <tr class="crm-event-manage-fee-form-block-title">
47 <td class="label">{$form.title.label}</td>
48 <td>{$form.title.html}</td>
49 </tr>
50 <tr class="crm-event-manage-fee-form-block-is_monetary">
51 <td class="label">{$form.is_monetary.label}</td>
52 <td>{$form.is_monetary.html}</td>
53 </tr>
54 </table>
55
56 <div id="event-fees">
57 <table id="currency" class="form-layout">
58 <tr class='crm-event-manage-fee-form-block-currency'>
59 <td class="label">{$form.currency.label}</td>
60 <td>{$form.currency.html}<br />
61 <span class="description">{ts}Select the currency to be used for event registration.{/ts}</span>
62 </td>
63 </tr>
64 </table>
65 {if $paymentProcessor}
66 <table id="paymentProcessor" class="form-layout">
67 <tr class="crm-event-manage-fee-form-block-payment_processor">
68 <td class="label">{$form.payment_processor.label}</td>
69 <td>{$form.payment_processor.html}</td>
70 </tr>
71 <tr>
72 <td class="">&nbsp;</td>
73 <td class="description">
74 {ts}If this is a paid event and you want users to be able to register and pay online, select a payment processor to use.{/ts}
75 {ts}NOTE: Alternatively, you can enable the <strong>Pay Later</strong> feature below without setting up a payment processor. All users will then be asked to submit payment offline (e.g. mail in a check, call in a credit card, etc.).{/ts} {docURL page="user/contributions/payment-processors"}<td>
76 </tr>
77 </table>
78 {/if}
79
80 <table id="payLater" class="form-layout">
81 <tr class="crm-event-manage-fee-form-block-is_pay_later">
82 <td class="extra-long-fourty label">{$form.is_pay_later.html}</td>
83 <td>{$form.is_pay_later.label}<br />
84 <span class="description">{ts}Check this box if you want to give users the option to submit payment offline (e.g. mail in a check, call in a credit card, etc.).{/ts}</span>
85 </td>
86 </tr>
87 </table>
88
89 <table id="payLaterOptions" class="form-layout">
90 <tr class="crm-event-manage-fee-form-block-pay_later_text">
91 <td class="label">{$form.pay_later_text.label}<span class="marker"> *</span> </td>
92 <td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='pay_later_text' id=$id}{/if}{$form.pay_later_text.html|crmAddClass:big}
93 </td>
94 </tr>
95 <tr>
96 <td>&nbsp;</td>
8a51f5e6 97 <td class="description">{ts}Text displayed next to the checkbox for the 'pay later' option on the contribution form. You may include HTML formatting tags.{/ts}</td>
6a488035
TO
98 </tr>
99 <tr class="crm-event-manage-fee-form-block-pay_later_receipt">
100 <td class="label">{$form.pay_later_receipt.label}<span class="marker"> *</span> </td>
101 <td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='pay_later_receipt' id=$id}{/if}{$form.pay_later_receipt.html|crmAddClass:big}
102 </td>
103 </tr>
9c52b6d0 104 <tr>
6a488035
TO
105 <td>&nbsp;</td>
106 <td class="description">{ts}Instructions added to Confirmation and Thank-you pages when the user selects the 'pay later' option (e.g. 'Mail your check to ... within 3 business days.').{/ts}
107 </td>
108 </tr>
9c52b6d0 109
110 </table>
6a488035
TO
111
112 <table id="contributionType" class="form-layout">
113 <tr class="crm-event-manage-fee-form-block-fee_label">
114 <td class="label">{$form.fee_label.label}<span class="marker"> *</span>
115 </td>
116 <td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='fee_label' id=$id}{/if}{$form.fee_label.html}
117 </td>
118 </tr>
119 <tr>
120 <td>&nbsp;</td>
121 <td class="description">{ts}This label is displayed with the list of event fees. When using a Price Set, this label is the title for the section containing the price fields.{/ts}
122 </td>
123 </tr>
124 <tr class="crm-event-manage-fee-form-block-financial_type_id">
125 <td class="label">{$form.financial_type_id.label}<span class="marker"> *</span></td>
126 <td>{$form.financial_type_id.html}</td>
127 </tr>
128 <tr>
129 <td>&nbsp;</td>
130 <td class="description">{ts}This financial type will be assigned to payments made by participants when they register online.{/ts}
131 </td>
132 </tr>
133 </table>
134
135 <table id="priceSet" class="form-layout">
136 <tr class="crm-event-manage-fee-form-block-price_set_id">
137 <td class="label">{$form.price_set_id.label}</td>
138 <td>{if $price eq false}
139 <div class="status message">{ts 1=$adminPriceSets}No Price Set has been configured / enabled for your site. Price sets allow you to meet the complex demands of your event registration structure.(e.g. "Pay $15 more for lunch."). Click <a href='%1'>here</a> if you want to configure price sets for your site.{/ts}</div>
140 {else}
141 {$form.price_set_id.html}
142 </td>
143 </tr>
144 <tr>
145 <td>&nbsp;</td>
146 <td class="description">{ts 1=$adminPriceSets}Select a pre-configured Price Set to offer multiple individually priced options for event registrants. Otherwise, select &quot;-none-&quot; and enter one or more fee levels in the table below. Create or edit Price Sets <a href='%1'>here</a>.{/ts}
147 {/if}
148 </td>
149 </tr>
150 </table>
151
152 <div id="map-field" >
153 <fieldset id="map-field"><legend>{ts}Regular Fees{/ts}</legend>
154 {ts}Use the table below to enter descriptive labels and amounts for up to ten event fee levels. These will be presented as a list of radio button options. Both the label and dollar amount will be displayed. You can also configure one or more sets of discounted fees by checking "Discounts by Signup Date" below.{/ts}<br />
247506c6 155 {if $isQuick}{ts}Click <a id='quickconfig' href='#'>here</a> if you want to configure the Regular Fees below as part of a Price Set, with the added flexibility and complexity that entails.{/ts}{/if}
6a488035 156 <table id="map-field-table">
8a4f27dc 157 <tr class="columnheader"><td scope="column">{ts}Fee Label{/ts}</td><td scope="column">{ts}Amount{/ts}</td><td scope="column">{ts}Default?{/ts}<br />{$form.default.0.html}</td></tr>
6a488035
TO
158 {section name=loop start=1 loop=11}
159 {assign var=idx value=$smarty.section.loop.index}
160 <tr><td class="even-row crm-event-manage-fee-form-block-label_{$idx}">{$form.label.$idx.html}</td><td class="crm-event-manage-fee-form-block-value_{$idx}">{$form.value.$idx.html|crmMoney}</td><td class="even-row crm-event-manage-fee-form-block-default_{$idx}">{$form.default.$idx.html}</td></tr>
161 {/section}
162 </table>
163 </fieldset>
164
165 <div id="isDiscount">
166 <table class="form-layout">
167 <tr class="crm-event-manage-fee-form-block-is_discount">
168 <td class="extra-long-fourty label">{$form.is_discount.html}</td>
169 <td>{$form.is_discount.label}<br /><span class="description">{ts}Check this box if you want to offer discounted fees based on registration date (e.g. 'early-registration discounts').{/ts}</span>
170 </td>
171 </tr>
172 </table>
173 </div>
174 <div class="spacer"></div>
175 <div>
176 <fieldset id="discount">
177 <table>
178 <tr class="columnheader">
179 <td>&nbsp;</th>
180 <td>{ts}Discount Set{/ts}</td>
181 <td>{ts}Start Date{/ts}</td>
182 <td>{ts}End Date{/ts}</td>
183 </tr>
184
185 {section name=rowLoop start=1 loop=6}
186 {assign var=index value=$smarty.section.rowLoop.index}
187 <tr id="discount_{$index}" class=" crm-event-manage-fee-form-block-discount_{$index} {if $index GT 1 AND empty( $form.discount_name[$index].value) } hiddenElement {/if} form-item {cycle values="odd-row,even-row"}">
b7054e52 188 <td>{if $index GT 1} <a onclick="showHideDiscountRow('discount_{$index}', false, {$index}); return false;" name="discount_{$index}" href="#" class="form-link"><img src="{$config->resourceBase}i/TreeMinus.gif" class="action-icon" alt="{ts}hide field or section{/ts}"/></a>{/if}
6a488035
TO
189 </td>
190 <td class="crm-event-manage-fee-form-block-discount_name"> {$form.discount_name.$index.html}</td>
191 <td class="crm-event-manage-fee-form-block-discount_start_date"> {include file="CRM/common/jcalendar.tpl" elementName='discount_start_date' elementIndex=$index} </td>
192 <td class="crm-event-manage-fee-form-block-discount_end_date"> {include file="CRM/common/jcalendar.tpl" elementName='discount_end_date' elementIndex=$index} </td>
193 </tr>
194 {/section}
195 </table>
196 <div id="discountLink" class="add-remove-link">
197 <a onclick="showHideDiscountRow( 'discount', true);return false;" id="discountLink" href="#" class="form-link"><img src="{$config->resourceBase}i/TreePlus.gif" class="action-icon" alt="{ts}show field or section{/ts}"/>{ts}another discount set{/ts}</a>
198 </div>
199 {$form._qf_Fee_submit.html}
200
201 {if $discountSection}
202 <fieldset id="map-field"><legend>{ts}Discounted Fees{/ts}</legend>
203 <p>{ts}Use the table below to enter descriptive labels and amounts for up to ten discounted event fees for each discount set. <strong>Don't forget to click 'Save' when you are finished.</strong>{/ts}</p>
204 <table id="map-field-table">
205 <tr class="columnheader">
206 <td scope="column">{ts}Fee Label{/ts}</td>
207 {section name=dloop start=1 loop=6}
208 {assign var=i value=$smarty.section.dloop.index}
209 {if $form.discount_name.$i.value}
210 <td scope="column">{$form.discount_name.$i.value}</td>
211 {/if}
212 {/section}
213 <td scope="column">{ts}Default?{/ts}</td>
214 </tr>
215
216 {section name=loop start=1 loop=11}
217 {assign var=idx value=$smarty.section.loop.index}
218 <tr><td class="even-row">{$form.discounted_label.$idx.html}</td>
219 {section name=loop1 start=1 loop=6}
220 {assign var=idy value=$smarty.section.loop1.index}
221 {if $form.discount_name.$idy.value}
222 <td>{$form.discounted_value.$idx.$idy.html|crmMoney}</td>
223 {/if}
224 {/section}
225 <td class="even-row">{$form.discounted_default.$idx.html}</td>
226 </tr>
227 {/section}
228 </table>
229 </fieldset>
230 {if $discountSection eq 2}
231 <script type="text/javascript">
232 {literal}
3cc60a06 233 CRM.$(function($) {
6a488035
TO
234 cj('#discounted_label_1').focus( );
235 });
236 {/literal}
237 </script>
238 {/if}
239 {/if}
240 </fieldset>
241 </div>
242 </div>
243 </div>
244<div class="crm-submit-buttons">
245 {include file="CRM/common/formButtons.tpl" location="bottom"}
246</div>
247</div>
248
249{include file="CRM/common/showHide.tpl"}
250<script type="text/javascript">
251 {if $price}
252 {literal}
253 // Re-show Fee Level grid if Price Set select has been set to none.
254 if (cj('#price_set_id').val() == '') {
255 cj('#map-field').show();
256 }
257 {/literal}
258 {/if}
259 {literal}
260
261 if ( document.getElementsByName('is_monetary')[0].checked ) {
262 cj('#event-fees').show();
263 }
264
265 function warnDiscountDel( ) {
266 if ( ! document.getElementsByName('is_discount')[0].checked ) {
267 CRM.alert('{/literal}{ts escape="js"}If you uncheck "Discounts by Signup Date" and Save this form, any existing discount sets will be deleted.{/ts} {ts escape="js"}This action cannot be undone.{/ts} {ts escape="js"}If this is NOT what you want to do, you can check "Discounts by Signup Date" again.{/ts}', '{ts escape="js}Warning{/ts}{literal}', 'alert', {expires: 0});
268 }
269 }
270
271 /**
272 * Function used to show /hide discount and set defaults
273 */
274 function showHideDiscountRow( rowName, show, index ) {
275 if ( show ) {
276 // show first hidden element and set date default
277 var counter = 0;
278 cj('tr[id^=' + rowName + ']').each( function( i ) {
279 counter++;
280 if ( cj(this).css('display') == 'none' ) {
281 cj(this).show( );
282
283 // set default
284 var currentRowId = cj(this).attr('id');
285 var temp = currentRowId.split('_');
286 var currentElementID = temp[1];
287 var lastElementID = currentElementID - 1 ;
288
289 var lastEndDate = cj( '#discount_end_date_' + lastElementID ).datepicker( 'getDate' );
290 if ( lastEndDate ) {
291 var discountDate = new Date( Date.parse( lastEndDate ) );
292 discountDate.setDate( discountDate.getDate() + 1 );
293 var newDate = discountDate.toDateString();
294 newDate = new Date( Date.parse( newDate ) );
295 cj( '#discount_start_date_' + currentElementID ).datepicker('setDate', newDate );
296 }
297
298 if ( counter == 5 ) {
299 cj('#discountLink').hide( );
300 }
301 return false;
302 }
303 });
304 } else {
305 // hide tr and clear dates
306 cj( '#discount_end_date_' + index ).val('');
307 cj( '#discount_name_' + index ).val('');
308 cj( '#discount_start_date_' + index ).val('');
309 cj( '#' + rowName ).hide( );
310 cj('#discountLink').show( );
311 }
312 }
313
314{/literal}
315</script>
316
317
318{include file="CRM/common/showHideByFieldValue.tpl"
319 trigger_field_id ="is_pay_later"
320 trigger_value =""
321 target_element_id ="payLaterOptions"
322 target_element_type ="block"
323 field_type ="radio"
324 invert = 0
325}
326{if $price }
327{include file="CRM/common/showHideByFieldValue.tpl"
328 trigger_field_id ="price_set_id"
329 trigger_value =""
330 target_element_id ="map-field"
331 target_element_type ="block"
332 field_type ="select"
333 invert = 0
334}
335{/if}
336{include file="CRM/common/showHideByFieldValue.tpl"
337 trigger_field_id ="is_discount"
338 trigger_value =""
339 target_element_id ="discount"
340 target_element_type ="block"
341 field_type ="radio"
342 invert = 0
343}
344
345{* include jscript to warn if unsaved form field changes *}
346{include file="CRM/common/formNavigate.tpl"}
347{if $isQuick}
348{literal}
349<script type="text/javascript">
350cj( document ).ready( function( ) {
351 cj("#popupContainer").hide();
352});
353cj("#quickconfig").click(function(){
354cj("#popupContainer").dialog({
355 title: "Selected Price Set",
356 width:400,
357 height:220,
358 modal: true,
359 overlay: {
360 opacity: 0.5,
361 background: "black"
362 },
363 buttons: {
364 "Ok": function() {
365 var dataUrl = {/literal}'{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Core_Page_AJAX&fnName=setIsQuickConfig&context=civicrm_event&id=$eventId" }';
366 var redirectUrl = '{crmURL p="civicrm/admin/price/field" h=0 q="reset=1&action=browse&sid=" }';
367 {literal}
368 cj.ajax({
369 url: dataUrl,
370 async: false,
371 global: false,
372 success: function ( result ) {
373 if (result) {
374 window.location= redirectUrl+eval(result);
375 }
376 }
377 });
378 },
379 "Close": function() {
380 cj(this).dialog("close");
381 }
382 }
383});
384return false;
385});
386</script>
387{/literal}
388{/if}