2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.6 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
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 {crmRegion name="billing-block"}
27 <div id="payment_information">
28 {if $paymentFields|@count}
29 <fieldset class="billing_mode-group {$paymentTypeName}_info-group">
33 {if $form.$expressButtonName}
34 {include file= "CRM/Core/paypalexpress.tpl"}
36 <div class="crm-section billing_mode-section {$paymentTypeName}_info-section">
37 {foreach from=$paymentFields item=paymentField}
38 <div class="crm-section {$form.$paymentField.name}-section">
39 <div class="label">{$form.$paymentField.label}</div>
40 <div class="content">{$form.$paymentField.html}
41 {if $paymentField == 'cvv2'}{* @todo move to form assignment*}
42 <span class="cvv2-icon" title="{ts}Usually the last 3-4 digits in the signature area on the back of the card.{/ts}"> </span>
44 {if $paymentField == 'credit_card_type'}
45 <div class="crm-credit_card_type-icons"></div>
48 <div class="clear"></div>
54 {if $billingDetailsFields|@count}
55 {if $profileAddressFields}
56 <input type="checkbox" id="billingcheckbox" value="0">
57 <label for="billingcheckbox">{ts}My billing address is the same as above{/ts}</label>
59 <fieldset class="billing_name_address-group">
60 <legend>{ts}Billing Name and Address{/ts}</legend>
61 <div class="crm-section billing_name_address-section">
62 {foreach from=$billingDetailsFields item=billingField}
63 <div class="crm-section {$form.$billingField.name}-section">
64 <div class="label">{$form.$billingField.label}</div>
65 {if $form.$billingField.type == 'text'}
66 <div class="content">{$form.$billingField.html}</div>
68 <div class="content">{$form.$billingField.html|crmAddClass:big}</div>
70 <div class="clear"></div>
77 {if $profileAddressFields}
78 <script type="text/javascript">
82 // build list of ids to track changes on
83 var address_fields = {/literal}{$profileAddressFields|@json_encode}{literal};
86 var orig_id, field, field_name;
89 $('.billing_name_address-section input').each(function (i) {
90 orig_id = $(this).attr('id');
91 field = orig_id.split('-');
92 field_name = field[0].replace('billing_', '');
94 if (address_fields[field_name]) {
95 input_ids['#' + field_name + '-' + address_fields[field_name]] = '#' + orig_id;
99 if ($('#first_name').length)
100 input_ids['#first_name'] = '#billing_first_name';
101 if ($('#middle_name').length)
102 input_ids['#middle_name'] = '#billing_middle_name';
103 if ($('#last_name').length)
104 input_ids['#last_name'] = '#billing_last_name';
107 $('.billing_name_address-section select').each(function (i) {
108 orig_id = $(this).attr('id');
109 field = orig_id.split('-');
110 field_name = field[0].replace('billing_', '').replace('_id', '');
112 if (address_fields[field_name]) {
113 select_ids['#' + field_name + '-' + address_fields[field_name]] = '#' + orig_id;
118 // detect if billing checkbox should default to checked
120 for (var id in input_ids) {
121 orig_id = input_ids[id];
122 if ($(id).val() != $(orig_id).val()) {
127 for (var id in select_ids) {
128 orig_id = select_ids[id];
129 if ($(id).val() != $(orig_id).val()) {
135 $('#billingcheckbox').prop('checked', true);
136 if (!CRM.billing || CRM.billing.billingProfileIsHideable) {
137 $('.billing_name_address-group').hide();
141 // onchange handlers for non-billing fields
142 for (var id in input_ids) {
143 orig_id = input_ids[id];
144 $(id).change(function () {
145 var id = '#' + $(this).attr('id');
146 var orig_id = input_ids[id];
148 // if billing checkbox is active, copy other field into billing field
149 if ($('#billingcheckbox').prop('checked')) {
150 $(orig_id).val($(id).val());
154 for (var id in select_ids) {
155 orig_id = select_ids[id];
156 $(id).change(function () {
157 var id = '#' + $(this).attr('id');
158 var orig_id = select_ids[id];
160 // if billing checkbox is active, copy other field into billing field
161 if ($('#billingcheckbox').prop('checked')) {
162 $(orig_id + ' option').prop('selected', false);
163 $(orig_id + ' option[value="' + $(id).val() + '"]').prop('selected', true);
166 if (orig_id == '#billing_country_id-5') {
174 $('#billingcheckbox').click(function () {
176 if (!CRM.billing || CRM.billing.billingProfileIsHideable) {
177 $('.billing_name_address-group').hide(200);
181 for (var id in input_ids) {
182 orig_id = input_ids[id];
183 $(orig_id).val($(id).val());
185 for (var id in select_ids) {
186 orig_id = select_ids[id];
187 $(orig_id + ' option').prop('selected', false);
188 $(orig_id + ' option[value="' + $(id).val() + '"]').prop('selected', true);
191 $('.billing_name_address-group').show(200);
195 // remove spaces, dashes from credit card number
196 $('#credit_card_number').change(function () {
197 var cc = $('#credit_card_number').val()
200 $('#credit_card_number').val(cc);