Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-07-14-13-42-39
[civicrm-core.git] / templates / CRM / Contribute / Form / ContributionPage / AddProduct.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
819d0d41 3 | CiviCRM version 4.5 |
6a488035 4 +--------------------------------------------------------------------+
819d0d41 5 | Copyright CiviCRM LLC (c) 2004-2014 |
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{capture assign=managePremiumsURL}{crmURL p='civicrm/admin/contribute/managePremiums' q="reset=1"}{/capture}
27<h3>{if $action eq 2 }{ts}Add Products to This Page{/ts} {elseif $action eq 1024}{ts}Preview{/ts}{else} {ts}Remove Products from this Page{/ts}{/if}</h3>
28<div class="crm-block crm-form-block crm-contribution-add_product-form-block">
29 <div id="help">
30 {if $action eq 1024}
31 {ts}This is a preview of this product as it will appear on your Contributions page(s).{/ts}
32 {else}
33 {ts}Use this form to select a premium to be offered on this Online Contribution Page.{/ts}
34 {/if}
35 </div>
36
37 {if $action eq 8}
38 <div class="messages status no-popup">
39 <div class="icon inform-icon"></div>
40 {ts}Are you sure you want to remove this premium product from this Contribution page?{/ts}
41 </div>
42 {elseif $action eq 1024}
43 {include file="CRM/Contribute/Form/Contribution/PremiumBlock.tpl"}
44 {else}
45 <table class="form-layout-compressed">
46 <tr class="crm-contribution-form-block-product_id"><td class="label">{$form.product_id.label}</td><td class="html-adjust">{$form.product_id.html}<br />
47 <span class="description">{ts 1=$managePremiumsURL}Pick a premium to include on this Contribution Page. Use <a href='%1'>Manage Premiums</a> to create or enable additional premium choices for your site.{/ts}</span></td></tr>
48 <tr class="crm-contribution-form-block-financial_type">
49 <td class="label">{$form.financial_type_id.label}</td>
50 <td>
51 {if !$financialType }
b2603e29 52 {capture assign=ftUrl}{crmURL p='civicrm/admin/financial/financialType' q="reset=1"}{/capture}
6a488035 53 {ts 1=$ftUrl}There are no financial types configured with linked 'Cost of Sales Premiums' and 'Premiums Inventory Account' accounts. If you want to generate accounting transactions which track the cost of premiums used <a href='%1'>click here</a> to configure financial types and accounts.{/ts}
b2603e29 54 {else}
6a488035 55 {$form.financial_type_id.html}{help id="id-financial_type-product"}
b2603e29 56 {/if}
6a488035
TO
57 </td>
58 </tr>
59 <tr class="crm-contribution-form-block-weight"><td class="label">{$form.weight.label}</td><td class="html-adjust">{$form.weight.html}<br />
60 <span class="description">{ts}Weight controls the order that premiums are displayed on the Contribution Page.{/ts}</span></td></tr>
61 </table>
62 {/if}
63
64{if $action ne 4}
65 <div class="crm-submit-buttons">
66 {include file="CRM/common/formButtons.tpl" location="bottom"}
67 </div>
68{else}
69 <div class="crm-done-button">
70 {include file="CRM/common/formButtons.tpl"}
71 </div>
72{/if} {* $action ne view *}
73</div>
74
6a488035
TO
75<script language="JavaScript" type="text/javascript">
76{literal}
77function getFinancialType()
78{
79{/literal}
b2603e29 80 productID = "#product_id";
81 financialTypeID = "#financial_type_id"
82 callbackURL = "{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=jqFinancialType'}"
6a488035 83{literal}
b2603e29 84
85 var check = cj(productID).val();
86 callbackURL = callbackURL+"&_value="+check;
6a488035
TO
87 cj.ajax({
88 url: callbackURL,
89 context: document.body,
90 success: function( data, textStatus ){
b2603e29 91 data = eval(data);//get json array
6a488035 92 if ( data != null ) {
b2603e29 93 cj(financialTypeID).val(data);
94
95 }
96
97 }
98 });
99
100 }
6a488035 101
b2603e29 102cj(document).ready(function(){
103 getFinancialType();
6a488035 104
b2603e29 105 cj("#product_id").change( function(){
106 getFinancialType();
107 });
108});
6a488035 109{/literal}
232624b1 110</script>