Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
1188c7a8 | 3 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 4 | | | |
1188c7a8 TO |
5 | | This work 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 | | |
6a488035 TO |
8 | +--------------------------------------------------------------------+ |
9 | *} | |
10 | <fieldset><legend>{if $useForMember}{ts}Membership Options{/ts}{else}{ts}Price Field Options{/ts}{/if}</legend> | |
11 | <div class="description"> | |
12 | {if $useForMember} | |
13 | {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"} | |
14 | {else} | |
0c165e1c | 15 | {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 |
16 | {/if} |
17 | </div> | |
18 | {strip} | |
19 | <table id='optionField'> | |
20 | <tr> | |
21 | <th> </th> | |
22 | <th>{ts}Default{/ts}</th> | |
23 | {if $useForMember} | |
24 | <th>{ts}Membership Type{/ts} {help id="id-membership-type"}</th> | |
25 | <th>{ts}Number of Terms{/ts}</th> | |
26 | {/if} | |
27 | <th>{ts}Label{/ts}</th> | |
28 | <th>{ts}Amount{/ts} {if $useForEvent}{help id="id-negative-options"}{/if}</th> | |
29 | <th>{ts}Financial Type{/ts}</th> | |
30 | {if $useForEvent} | |
31 | <th>{ts}Participant Count{/ts} {help id="id-participant-count"}</th> | |
32 | <th>{ts}Max Participant{/ts} {help id="id-participant-max"}</th> | |
33 | {/if} | |
7ecddde4 | 34 | <th>{ts}Order{/ts}</th> |
a13c171d | 35 | <th>{ts}Visibility{/ts} {help id="id-visibility-options"}</th> |
2db35bf6 | 36 | <th>{ts}Active?{/ts}</th> |
6a488035 TO |
37 | </tr> |
38 | ||
0c165e1c | 39 | {section name=rowLoop start=1 loop=16} |
6a488035 TO |
40 | {assign var=index value=$smarty.section.rowLoop.index} |
41 | <tr id="optionField_{$index}" class="form-item {cycle values="odd-row,even-row"}"> | |
42 | <td> | |
43 | {if $index GT 1} | |
13a3d214 | 44 | <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}" aria-hidden="true"></i></a> |
6a488035 TO |
45 | {/if} |
46 | </td> | |
47 | <td> | |
48 | <div id="radio{$index}" style="display:none"> | |
49 | {$form.default_option[$index].html} | |
50 | </div> | |
51 | <div id="checkbox{$index}" style="display:none"> | |
52 | {$form.default_checkbox_option.$index.html} | |
53 | </div> | |
54 | </td> | |
55 | {if $useForMember} | |
56 | <td>{$form.membership_type_id.$index.html}</td> | |
57 | <td>{$form.membership_num_terms.$index.html}</td> | |
58 | {/if} | |
59 | <td> {$form.option_label.$index.html}</td> | |
60 | ||
61 | <td> {$form.option_amount.$index.html}</td> | |
62 | <td>{$form.option_financial_type_id.$index.html}</td> | |
63 | {if $useForEvent} | |
64 | <td>{$form.option_count.$index.html}</td> | |
65 | <td>{$form.option_max_value.$index.html}</td> | |
66 | {/if} | |
67 | <td> {$form.option_weight.$index.html}</td> | |
2db35bf6 AF |
68 | <td> {$form.option_visibility_id.$index.html}</td> |
69 | <td> {$form.option_status.$index.html}</td> | |
6a488035 TO |
70 | </tr> |
71 | {/section} | |
72 | </table> | |
73 | <div id="optionFieldLink" class="add-remove-link"> | |
13a3d214 | 74 | <a onclick="showHideRow(); return false;" name="optionFieldLink" href="#" class="form-link"><i class="crm-i fa-plus-circle" aria-hidden="true"></i> {ts}add another choice{/ts}</a> |
6a488035 TO |
75 | </div> |
76 | <div id="additionalOption" class="description"> | |
77 | {ts}If you need additional options - you can add them after you Save your current entries.{/ts} | |
78 | </div> | |
79 | {/strip} | |
80 | ||
81 | </fieldset> | |
82 | <script type="text/javascript"> | |
83 | var showRows = new Array({$showBlocks}); | |
84 | var hideBlocks = new Array({$hideBlocks}); | |
85 | var rowcounter = 0; | |
86 | {literal} | |
87 | if (navigator.appName == "Microsoft Internet Explorer") { | |
88 | for ( var count = 0; count < hideBlocks.length; count++ ) { | |
89 | var r = document.getElementById(hideBlocks[count]); | |
90 | r.style.display = 'none'; | |
91 | } | |
92 | } | |
152ff8b9 | 93 | |
6a488035 TO |
94 | cj('#optionField input').blur( function(){ |
95 | var currentId = cj(this).attr('id'); | |
96 | var arrayID = currentId.split('_'); | |
97 | if ((arrayID[1] == 'label' || arrayID[1] == 'amount') && arrayID[2] > 1) { | |
152ff8b9 | 98 | var value = cj("#"+currentId).val(); |
99 | if (value.length != 0 && cj("#option_financial_type_id_"+arrayID[2]).val() =='') { | |
100 | var currentFtid = "#option_financial_type_id_"+arrayID[2]; | |
101 | var previousFtid = "#option_financial_type_id_"+ (arrayID[2]-1); | |
102 | var financial_type = cj(previousFtid).val(); | |
103 | cj(currentFtid).val(financial_type); | |
104 | } | |
105 | if (cj("#option_label_"+arrayID[2]).val().length == 0 && cj("#option_amount_"+arrayID[2]).val().length == 0) { | |
6a488035 | 106 | cj("#option_financial_type_id_"+arrayID[2]).val(''); |
152ff8b9 | 107 | } |
6a488035 | 108 | } |
152ff8b9 | 109 | |
6a488035 TO |
110 | }); |
111 | ||
112 | {/literal} | |
113 | {* hide and display the appropriate blocks as directed by the php code *} | |
114 | on_load_init_blocks( showRows, hideBlocks, '' ); | |
115 | </script> |