Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
fee14197 | 3 | | CiviCRM version 5 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
8c9251b3 | 5 | | Copyright CiviCRM LLC (c) 2004-2018 | |
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"> | |
847f8123 | 36 | <div class="crm-submit-buttons"> |
6a488035 | 37 | {include file="CRM/common/formButtons.tpl" location="top"} |
847f8123 | 38 | </div> |
6a488035 TO |
39 | |
40 | <table class="form-layout"> | |
41 | <tr class="crm-event-manage-fee-form-block-title"> | |
42 | <td class="label">{$form.title.label}</td> | |
43 | <td>{$form.title.html}</td> | |
44 | </tr> | |
45 | <tr class="crm-event-manage-fee-form-block-is_monetary"> | |
46 | <td class="label">{$form.is_monetary.label}</td> | |
47 | <td>{$form.is_monetary.html}</td> | |
48 | </tr> | |
49 | </table> | |
50 | ||
51 | <div id="event-fees"> | |
52 | <table id="currency" class="form-layout"> | |
53 | <tr class='crm-event-manage-fee-form-block-currency'> | |
54 | <td class="label">{$form.currency.label}</td> | |
55 | <td>{$form.currency.html}<br /> | |
56 | <span class="description">{ts}Select the currency to be used for event registration.{/ts}</span> | |
57 | </td> | |
58 | </tr> | |
59 | </table> | |
60 | {if $paymentProcessor} | |
61 | <table id="paymentProcessor" class="form-layout"> | |
62 | <tr class="crm-event-manage-fee-form-block-payment_processor"> | |
63 | <td class="label">{$form.payment_processor.label}</td> | |
64 | <td>{$form.payment_processor.html}</td> | |
65 | </tr> | |
66 | <tr> | |
67 | <td class=""> </td> | |
68 | <td class="description"> | |
69 | {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} | |
70 | {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> | |
71 | </tr> | |
72 | </table> | |
73 | {/if} | |
74 | ||
75 | <table id="payLater" class="form-layout"> | |
76 | <tr class="crm-event-manage-fee-form-block-is_pay_later"> | |
77 | <td class="extra-long-fourty label">{$form.is_pay_later.html}</td> | |
78 | <td>{$form.is_pay_later.label}<br /> | |
79 | <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> | |
80 | </td> | |
81 | </tr> | |
82 | </table> | |
83 | ||
84 | <table id="payLaterOptions" class="form-layout"> | |
85 | <tr class="crm-event-manage-fee-form-block-pay_later_text"> | |
836cf509 | 86 | <td class="label">{$form.pay_later_text.label}<span class="crm-marker"> *</span> </td> |
6a488035 TO |
87 | <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} |
88 | </td> | |
89 | </tr> | |
90 | <tr> | |
91 | <td> </td> | |
8a51f5e6 | 92 | <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 |
93 | </tr> |
94 | <tr class="crm-event-manage-fee-form-block-pay_later_receipt"> | |
836cf509 | 95 | <td class="label">{$form.pay_later_receipt.label}<span class="crm-marker"> *</span> </td> |
6a488035 TO |
96 | <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} |
97 | </td> | |
98 | </tr> | |
2b3fa30d | 99 | <tr> |
6a488035 TO |
100 | <td> </td> |
101 | <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} | |
102 | </td> | |
103 | </tr> | |
e45f6ab0 PB |
104 | <tr> |
105 | <td class="extra-long-fourty label">{$form.is_billing_required.html}</td> | |
2b3fa30d DG |
106 | <td> |
107 | {$form.is_billing_required.label}<br /> | |
108 | <span class="description">{ts}Check this box to require users who select the pay later option to provide billing name and address.{/ts}</span> | |
109 | </td> | |
e45f6ab0 | 110 | </tr> |
9c52b6d0 | 111 | </table> |
6a488035 TO |
112 | |
113 | <table id="contributionType" class="form-layout"> | |
114 | <tr class="crm-event-manage-fee-form-block-fee_label"> | |
836cf509 | 115 | <td class="label">{$form.fee_label.label}<span class="crm-marker"> *</span> |
6a488035 TO |
116 | </td> |
117 | <td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='fee_label' id=$id}{/if}{$form.fee_label.html} | |
118 | </td> | |
119 | </tr> | |
120 | <tr> | |
121 | <td> </td> | |
122 | <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} | |
123 | </td> | |
124 | </tr> | |
125 | <tr class="crm-event-manage-fee-form-block-financial_type_id"> | |
836cf509 | 126 | <td class="label">{$form.financial_type_id.label}<span class="crm-marker"> *</span></td> |
6a488035 TO |
127 | <td>{$form.financial_type_id.html}</td> |
128 | </tr> | |
129 | <tr> | |
130 | <td> </td> | |
5ebee375 | 131 | <td class="description">{ts}This financial type will be assigned to payments made by participants when they register online. If using a price set below note that the contribution record will have this financial type, however line items will be processed using the actual financial type selected for the price set item.{/ts} |
6a488035 TO |
132 | </td> |
133 | </tr> | |
134 | </table> | |
135 | ||
136 | <table id="priceSet" class="form-layout"> | |
137 | <tr class="crm-event-manage-fee-form-block-price_set_id"> | |
138 | <td class="label">{$form.price_set_id.label}</td> | |
139 | <td>{if $price eq false} | |
140 | <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> | |
141 | {else} | |
142 | {$form.price_set_id.html} | |
143 | </td> | |
144 | </tr> | |
145 | <tr> | |
146 | <td> </td> | |
147 | <td class="description">{ts 1=$adminPriceSets}Select a pre-configured Price Set to offer multiple individually priced options for event registrants. Otherwise, select "-none-" and enter one or more fee levels in the table below. Create or edit Price Sets <a href='%1'>here</a>.{/ts} | |
148 | {/if} | |
149 | </td> | |
150 | </tr> | |
151 | </table> | |
152 | ||
153 | <div id="map-field" > | |
154 | <fieldset id="map-field"><legend>{ts}Regular Fees{/ts}</legend> | |
92e15dd5 MR |
155 | <span class="description">{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} |
156 | <br /> | |
157 | {if $isQuick} | |
158 | {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} | |
159 | {/if} | |
160 | </span> | |
6a488035 | 161 | <table id="map-field-table"> |
8a4f27dc | 162 | <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 |
163 | {section name=loop start=1 loop=11} |
164 | {assign var=idx value=$smarty.section.loop.index} | |
165 | <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> | |
166 | {/section} | |
167 | </table> | |
168 | </fieldset> | |
169 | ||
170 | <div id="isDiscount"> | |
171 | <table class="form-layout"> | |
172 | <tr class="crm-event-manage-fee-form-block-is_discount"> | |
173 | <td class="extra-long-fourty label">{$form.is_discount.html}</td> | |
174 | <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> | |
175 | </td> | |
176 | </tr> | |
177 | </table> | |
178 | </div> | |
179 | <div class="spacer"></div> | |
180 | <div> | |
181 | <fieldset id="discount"> | |
182 | <table> | |
183 | <tr class="columnheader"> | |
184 | <td> </th> | |
185 | <td>{ts}Discount Set{/ts}</td> | |
186 | <td>{ts}Start Date{/ts}</td> | |
187 | <td>{ts}End Date{/ts}</td> | |
188 | </tr> | |
189 | ||
190 | {section name=rowLoop start=1 loop=6} | |
191 | {assign var=index value=$smarty.section.rowLoop.index} | |
192 | <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 | 193 | <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 |
194 | </td> |
195 | <td class="crm-event-manage-fee-form-block-discount_name"> {$form.discount_name.$index.html}</td> | |
196 | <td class="crm-event-manage-fee-form-block-discount_start_date"> {include file="CRM/common/jcalendar.tpl" elementName='discount_start_date' elementIndex=$index} </td> | |
197 | <td class="crm-event-manage-fee-form-block-discount_end_date"> {include file="CRM/common/jcalendar.tpl" elementName='discount_end_date' elementIndex=$index} </td> | |
198 | </tr> | |
199 | {/section} | |
200 | </table> | |
201 | <div id="discountLink" class="add-remove-link"> | |
202 | <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> | |
203 | </div> | |
204 | {$form._qf_Fee_submit.html} | |
205 | ||
206 | {if $discountSection} | |
207 | <fieldset id="map-field"><legend>{ts}Discounted Fees{/ts}</legend> | |
92e15dd5 | 208 | <span class="description">{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}</span> |
6a488035 TO |
209 | <table id="map-field-table"> |
210 | <tr class="columnheader"> | |
211 | <td scope="column">{ts}Fee Label{/ts}</td> | |
212 | {section name=dloop start=1 loop=6} | |
213 | {assign var=i value=$smarty.section.dloop.index} | |
214 | {if $form.discount_name.$i.value} | |
215 | <td scope="column">{$form.discount_name.$i.value}</td> | |
216 | {/if} | |
217 | {/section} | |
218 | <td scope="column">{ts}Default?{/ts}</td> | |
219 | </tr> | |
220 | ||
221 | {section name=loop start=1 loop=11} | |
222 | {assign var=idx value=$smarty.section.loop.index} | |
223 | <tr><td class="even-row">{$form.discounted_label.$idx.html}</td> | |
224 | {section name=loop1 start=1 loop=6} | |
225 | {assign var=idy value=$smarty.section.loop1.index} | |
226 | {if $form.discount_name.$idy.value} | |
227 | <td>{$form.discounted_value.$idx.$idy.html|crmMoney}</td> | |
228 | {/if} | |
229 | {/section} | |
230 | <td class="even-row">{$form.discounted_default.$idx.html}</td> | |
231 | </tr> | |
232 | {/section} | |
233 | </table> | |
234 | </fieldset> | |
235 | {if $discountSection eq 2} | |
236 | <script type="text/javascript"> | |
237 | {literal} | |
3cc60a06 | 238 | CRM.$(function($) { |
ae8f569f | 239 | $('#discounted_label_1').focus( ); |
6a488035 TO |
240 | }); |
241 | {/literal} | |
242 | </script> | |
243 | {/if} | |
244 | {/if} | |
245 | </fieldset> | |
246 | </div> | |
247 | </div> | |
248 | </div> | |
249 | <div class="crm-submit-buttons"> | |
250 | {include file="CRM/common/formButtons.tpl" location="bottom"} | |
251 | </div> | |
252 | </div> | |
253 | ||
cebff547 | 254 | {include file="CRM/common/deferredFinancialType.tpl" context='Event'} |
6a488035 TO |
255 | {include file="CRM/common/showHide.tpl"} |
256 | <script type="text/javascript"> | |
257 | {if $price} | |
258 | {literal} | |
259 | // Re-show Fee Level grid if Price Set select has been set to none. | |
260 | if (cj('#price_set_id').val() == '') { | |
261 | cj('#map-field').show(); | |
262 | } | |
263 | {/literal} | |
264 | {/if} | |
265 | {literal} | |
266 | ||
267 | if ( document.getElementsByName('is_monetary')[0].checked ) { | |
268 | cj('#event-fees').show(); | |
269 | } | |
270 | ||
271 | function warnDiscountDel( ) { | |
272 | if ( ! document.getElementsByName('is_discount')[0].checked ) { | |
273 | 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}); | |
274 | } | |
275 | } | |
276 | ||
277 | /** | |
278 | * Function used to show /hide discount and set defaults | |
279 | */ | |
280 | function showHideDiscountRow( rowName, show, index ) { | |
281 | if ( show ) { | |
282 | // show first hidden element and set date default | |
283 | var counter = 0; | |
284 | cj('tr[id^=' + rowName + ']').each( function( i ) { | |
285 | counter++; | |
286 | if ( cj(this).css('display') == 'none' ) { | |
287 | cj(this).show( ); | |
288 | ||
289 | // set default | |
290 | var currentRowId = cj(this).attr('id'); | |
291 | var temp = currentRowId.split('_'); | |
292 | var currentElementID = temp[1]; | |
293 | var lastElementID = currentElementID - 1 ; | |
294 | ||
295 | var lastEndDate = cj( '#discount_end_date_' + lastElementID ).datepicker( 'getDate' ); | |
296 | if ( lastEndDate ) { | |
297 | var discountDate = new Date( Date.parse( lastEndDate ) ); | |
298 | discountDate.setDate( discountDate.getDate() + 1 ); | |
299 | var newDate = discountDate.toDateString(); | |
300 | newDate = new Date( Date.parse( newDate ) ); | |
301 | cj( '#discount_start_date_' + currentElementID ).datepicker('setDate', newDate ); | |
302 | } | |
303 | ||
304 | if ( counter == 5 ) { | |
305 | cj('#discountLink').hide( ); | |
306 | } | |
307 | return false; | |
308 | } | |
309 | }); | |
310 | } else { | |
311 | // hide tr and clear dates | |
312 | cj( '#discount_end_date_' + index ).val(''); | |
313 | cj( '#discount_name_' + index ).val(''); | |
314 | cj( '#discount_start_date_' + index ).val(''); | |
315 | cj( '#' + rowName ).hide( ); | |
316 | cj('#discountLink').show( ); | |
317 | } | |
318 | } | |
319 | ||
320 | {/literal} | |
321 | </script> | |
322 | ||
323 | ||
324 | {include file="CRM/common/showHideByFieldValue.tpl" | |
325 | trigger_field_id ="is_pay_later" | |
326 | trigger_value ="" | |
327 | target_element_id ="payLaterOptions" | |
328 | target_element_type ="block" | |
329 | field_type ="radio" | |
330 | invert = 0 | |
331 | } | |
332 | {if $price } | |
333 | {include file="CRM/common/showHideByFieldValue.tpl" | |
334 | trigger_field_id ="price_set_id" | |
335 | trigger_value ="" | |
336 | target_element_id ="map-field" | |
337 | target_element_type ="block" | |
338 | field_type ="select" | |
339 | invert = 0 | |
340 | } | |
341 | {/if} | |
342 | {include file="CRM/common/showHideByFieldValue.tpl" | |
343 | trigger_field_id ="is_discount" | |
344 | trigger_value ="" | |
345 | target_element_id ="discount" | |
346 | target_element_type ="block" | |
347 | field_type ="radio" | |
348 | invert = 0 | |
349 | } | |
350 | ||
6a488035 TO |
351 | {if $isQuick} |
352 | {literal} | |
353 | <script type="text/javascript"> | |
847f8123 CW |
354 | CRM.$(function($) { |
355 | $("#quickconfig").click(function(e) { | |
356 | e.preventDefault(); | |
357 | CRM.confirm({ | |
51d1ef0f | 358 | width: 400, |
847f8123 CW |
359 | message: {/literal}"{ts escape='js'}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}"{literal} |
360 | }).on('crmConfirm:yes', function() { | |
361 | {/literal} | |
362 | var dataUrl = '{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Core_Page_AJAX&fnName=setIsQuickConfig&context=civicrm_event&id=$eventId" }'; | |
363 | {literal} | |
364 | $.getJSON(dataUrl).done(function(result) {window.location = CRM.url("civicrm/admin/price/field", {reset: 1, action: 'browse', sid: result});}); | |
365 | }); | |
366 | }); | |
367 | }); | |
6a488035 TO |
368 | </script> |
369 | {/literal} | |
92e15dd5 | 370 | {/if} |