2 +--------------------------------------------------------------------+
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2018 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
26 <fieldset><legend>{if $useForMember}{ts}Membership Options{/ts}{else}{ts}Price Field Options{/ts}{/if}</legend>
27 <div class="description">
29 {ts}Fill in a row for each membership type you want to offer as an option (click 'another choice' for each additional choice). Click the help icon for more info on membership price sets.{/ts} {help id="id-member-price-options"}
31 {ts}Enter up to fifteen (15) multiple choice options in this table (click 'another choice' for each additional choice). If you need more than ten options, you can create an unlimited number of additional choices using the Edit Price Options link after saving this new field. Enter a description of the option in the 'Label' column, and the associated price in the 'Amount' column. Click the 'Default' radio button to the left of an option if you want that to be selected by default.{/ts}
35 <table id='optionField'>
38 <th>{ts}Default{/ts}</th>
40 <th>{ts}Membership Type{/ts} {help id="id-membership-type"}</th>
41 <th>{ts}Number of Terms{/ts}</th>
43 <th>{ts}Label{/ts}</th>
44 <th>{ts}Amount{/ts} {if $useForEvent}{help id="id-negative-options"}{/if}</th>
45 <th>{ts}Financial Type{/ts}</th>
47 <th>{ts}Participant Count{/ts} {help id="id-participant-count"}</th>
48 <th>{ts}Max Participant{/ts} {help id="id-participant-max"}</th>
50 <th>{ts}Order{/ts}</th>
51 <th>{ts}Visibility{/ts} {help id="id-visibility-options"}</th>
52 <th>{ts}Active?{/ts}</th>
55 {section name=rowLoop start=1 loop=16}
56 {assign var=index value=$smarty.section.rowLoop.index}
57 <tr id="optionField_{$index}" class="form-item {cycle values="odd-row,even-row"}">
60 <a onclick="showHideRow({$index}); return false;" name="optionField_{$index}" href="#" class="form-link"><i class="crm-i fa-trash" title="{ts}hide field or section{/ts}"></i></a>
64 <div id="radio{$index}" style="display:none">
65 {$form.default_option[$index].html}
67 <div id="checkbox{$index}" style="display:none">
68 {$form.default_checkbox_option.$index.html}
72 <td>{$form.membership_type_id.$index.html}</td>
73 <td>{$form.membership_num_terms.$index.html}</td>
75 <td> {$form.option_label.$index.html}</td>
77 <td> {$form.option_amount.$index.html}</td>
78 <td>{$form.option_financial_type_id.$index.html}</td>
80 <td>{$form.option_count.$index.html}</td>
81 <td>{$form.option_max_value.$index.html}</td>
83 <td> {$form.option_weight.$index.html}</td>
84 <td> {$form.option_visibility_id.$index.html}</td>
85 <td> {$form.option_status.$index.html}</td>
89 <div id="optionFieldLink" class="add-remove-link">
90 <a onclick="showHideRow(); return false;" name="optionFieldLink" href="#" class="form-link"><i class="crm-i fa-plus-circle"></i> {ts}add another choice{/ts}</a>
92 <div id="additionalOption" class="description">
93 {ts}If you need additional options - you can add them after you Save your current entries.{/ts}
98 <script type="text/javascript">
99 var showRows = new Array({$showBlocks});
100 var hideBlocks = new Array({$hideBlocks});
103 if (navigator.appName == "Microsoft Internet Explorer") {
104 for ( var count = 0; count < hideBlocks.length; count++ ) {
105 var r = document.getElementById(hideBlocks[count]);
106 r.style.display = 'none';
110 cj('#optionField input').blur( function(){
111 var currentId = cj(this).attr('id');
112 var arrayID = currentId.split('_');
113 if ((arrayID[1] == 'label' || arrayID[1] == 'amount') && arrayID[2] > 1) {
114 var value = cj("#"+currentId).val();
115 if (value.length != 0 && cj("#option_financial_type_id_"+arrayID[2]).val() =='') {
116 var currentFtid = "#option_financial_type_id_"+arrayID[2];
117 var previousFtid = "#option_financial_type_id_"+ (arrayID[2]-1);
118 var financial_type = cj(previousFtid).val();
119 cj(currentFtid).val(financial_type);
121 if (cj("#option_label_"+arrayID[2]).val().length == 0 && cj("#option_amount_"+arrayID[2]).val().length == 0) {
122 cj("#option_financial_type_id_"+arrayID[2]).val('');
129 {* hide and display the appropriate blocks as directed by the php code *}
130 on_load_init_blocks( showRows, hideBlocks, '' );