Merge pull request #4310 from colemanw/CRM-14949
[civicrm-core.git] / templates / CRM / Contribute / Form / AdditionalInfo / Premium.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
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/editing Premium Information *}
27 <div id="id-premium" class="section-shown crm-contribution-additionalinfo-premium-form-block">
28 <table class="form-layout-compressed">
29 <tr class="crm-contribution-form-block-product_name">
30 <td class="label">{$form.product_name.label}</td>
31 <td class="html-adjust">{$form.product_name.html}</td>
32 </tr>
33 </table>
34
35 <div id="premium_contri">
36 <table class="form-layout-compressed">
37 <tr class="crm-contribution-form-block-min_amount">
38 <td class="label">{$form.min_amount.label}</td>
39 <td class="html-adjust">{$form.min_amount.html|crmAddClass:texttolabel|crmMoney:$currency}</td>
40 </tr>
41 </table>
42 <div class="spacer"></div>
43 </div>
44 <table class="form-layout-compressed">
45 <tr class="crm-contribution-form-block-fulfilled_date">
46 <td class="label">{$form.fulfilled_date.label}</td>
47 <td class="html-adjust">{include file="CRM/common/jcalendar.tpl" elementName=fulfilled_date}</td>
48 </tr>
49 </table>
50 </div>
51
52 {literal}
53 <script type="text/javascript">
54 var min_amount = document.getElementById("min_amount");
55 min_amount.readOnly = 1;
56 function showMinContrib( ) {
57 var product = document.getElementsByName("product_name[0]")[0];
58 var product_id = product.options[product.selectedIndex].value;
59 var min_amount = document.getElementById("min_amount");
60
61
62 var amount = [];
63 amount[0] = '';
64
65 if( product_id > 0 ) {
66 cj('#premium_contri').show();
67 } else {
68 cj('#premium_contri').hide();
69 }
70
71 {/literal}
72
73 var index = 1;
74 {foreach from= $mincontribution item=amt key=id}
75 {literal}amount[index]{/literal} = "{$amt}"
76 {literal}index = index + 1{/literal}
77 {/foreach}
78 {literal}
79 if(amount[product_id]) {
80 min_amount.value = amount[product_id];
81 } else {
82 min_amount.value = "";
83 }
84 }
85 </script>
86 {/literal}
87 {if $action eq 1 or $action eq 2 or $action eq null }
88 <script type="text/javascript">
89 showMinContrib( );
90 </script>
91 {/if}
92 {if $action ne 2 or $showOption eq true}
93 {$initHideBoxes}
94 {/if}