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 | <fieldset><legend>{if $useForMember}{ts}Membership Options{/ts}{else}{ts}Price Field Options{/ts}{/if}</legend> | |
27 | <div class="description"> | |
28 | {if $useForMember} | |
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"} | |
30 | {else} | |
0c165e1c | 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} |
6a488035 TO |
32 | {/if} |
33 | </div> | |
34 | {strip} | |
35 | <table id='optionField'> | |
36 | <tr> | |
37 | <th> </th> | |
38 | <th>{ts}Default{/ts}</th> | |
39 | {if $useForMember} | |
40 | <th>{ts}Membership Type{/ts} {help id="id-membership-type"}</th> | |
41 | <th>{ts}Number of Terms{/ts}</th> | |
42 | {/if} | |
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> | |
46 | {if $useForEvent} | |
47 | <th>{ts}Participant Count{/ts} {help id="id-participant-count"}</th> | |
48 | <th>{ts}Max Participant{/ts} {help id="id-participant-max"}</th> | |
49 | {/if} | |
7ecddde4 | 50 | <th>{ts}Order{/ts}</th> |
a13c171d | 51 | <th>{ts}Visibility{/ts} {help id="id-visibility-options"}</th> |
2db35bf6 | 52 | <th>{ts}Active?{/ts}</th> |
6a488035 TO |
53 | </tr> |
54 | ||
0c165e1c | 55 | {section name=rowLoop start=1 loop=16} |
6a488035 TO |
56 | {assign var=index value=$smarty.section.rowLoop.index} |
57 | <tr id="optionField_{$index}" class="form-item {cycle values="odd-row,even-row"}"> | |
58 | <td> | |
59 | {if $index GT 1} | |
35f81a32 | 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> |
6a488035 TO |
61 | {/if} |
62 | </td> | |
63 | <td> | |
64 | <div id="radio{$index}" style="display:none"> | |
65 | {$form.default_option[$index].html} | |
66 | </div> | |
67 | <div id="checkbox{$index}" style="display:none"> | |
68 | {$form.default_checkbox_option.$index.html} | |
69 | </div> | |
70 | </td> | |
71 | {if $useForMember} | |
72 | <td>{$form.membership_type_id.$index.html}</td> | |
73 | <td>{$form.membership_num_terms.$index.html}</td> | |
74 | {/if} | |
75 | <td> {$form.option_label.$index.html}</td> | |
76 | ||
77 | <td> {$form.option_amount.$index.html}</td> | |
78 | <td>{$form.option_financial_type_id.$index.html}</td> | |
79 | {if $useForEvent} | |
80 | <td>{$form.option_count.$index.html}</td> | |
81 | <td>{$form.option_max_value.$index.html}</td> | |
82 | {/if} | |
83 | <td> {$form.option_weight.$index.html}</td> | |
2db35bf6 AF |
84 | <td> {$form.option_visibility_id.$index.html}</td> |
85 | <td> {$form.option_status.$index.html}</td> | |
6a488035 TO |
86 | </tr> |
87 | {/section} | |
88 | </table> | |
89 | <div id="optionFieldLink" class="add-remove-link"> | |
35f81a32 | 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> |
6a488035 TO |
91 | </div> |
92 | <div id="additionalOption" class="description"> | |
93 | {ts}If you need additional options - you can add them after you Save your current entries.{/ts} | |
94 | </div> | |
95 | {/strip} | |
96 | ||
97 | </fieldset> | |
98 | <script type="text/javascript"> | |
99 | var showRows = new Array({$showBlocks}); | |
100 | var hideBlocks = new Array({$hideBlocks}); | |
101 | var rowcounter = 0; | |
102 | {literal} | |
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'; | |
107 | } | |
108 | } | |
152ff8b9 | 109 | |
6a488035 TO |
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) { | |
152ff8b9 | 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); | |
120 | } | |
121 | if (cj("#option_label_"+arrayID[2]).val().length == 0 && cj("#option_amount_"+arrayID[2]).val().length == 0) { | |
6a488035 | 122 | cj("#option_financial_type_id_"+arrayID[2]).val(''); |
152ff8b9 | 123 | } |
6a488035 | 124 | } |
152ff8b9 | 125 | |
6a488035 TO |
126 | }); |
127 | ||
128 | {/literal} | |
129 | {* hide and display the appropriate blocks as directed by the php code *} | |
130 | on_load_init_blocks( showRows, hideBlocks, '' ); | |
131 | </script> |