2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.6 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2015 |
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 && (!$form.$expressButtonName || $paymentProcessor.payment_processor_type EQ 'PayPal')}
29 <fieldset class="billing_mode-group {$paymentTypeName}_info-group">
33 {crmRegion name="billing-block-pre"}
35 <div class="crm-section billing_mode-section {$paymentTypeName}_info-section">
36 {foreach from=$paymentFields item=paymentField}
37 <div class="crm-section {$form.$paymentField.name}-section">
38 <div class="label">{$form.$paymentField.label}</div>
39 <div class="content">{$form.$paymentField.html}
40 {if $paymentField == 'cvv2'}{* @todo move to form assignment*}
41 <span class="cvv2-icon" title="{ts}Usually the last 3-4 digits in the signature area on the back of the card.{/ts}"> </span>
43 {if $paymentField == 'credit_card_type'}
44 <div class="crm-credit_card_type-icons"></div>
47 <div class="clear"></div>
52 {if $billingDetailsFields|@count}
53 {if $profileAddressFields}
54 <input type="checkbox" id="billingcheckbox" value="0">
55 <label for="billingcheckbox">{ts}My billing address is the same as above{/ts}</label>
57 <fieldset class="billing_name_address-group">
58 <legend>{ts}Billing Name and Address{/ts}</legend>
59 <div class="crm-section billing_name_address-section">
60 {foreach from=$billingDetailsFields item=billingField}
61 <div class="crm-section {$form.$billingField.name}-section">
62 <div class="label">{$form.$billingField.label}</div>
63 {if $form.$billingField.type == 'text'}
64 <div class="content">{$form.$billingField.html}</div>
66 <div class="content">{$form.$billingField.html|crmAddClass:big}</div>
68 <div class="clear"></div>
76 {if $profileAddressFields}
77 <script type="text/javascript">
81 // build list of ids to track changes on
82 var address_fields = {/literal}{$profileAddressFields|@json_encode}{literal};
85 var orig_id, field, field_name;
88 $('.billing_name_address-section input').each(function (i) {
89 orig_id = $(this).attr('id');
90 field = orig_id.split('-');
91 field_name = field[0].replace('billing_', '');
93 if (address_fields[field_name]) {
94 input_ids['#' + field_name + '-' + address_fields[field_name]] = '#' + orig_id;
98 if ($('#first_name').length)
99 input_ids['#first_name'] = '#billing_first_name';
100 if ($('#middle_name').length)
101 input_ids['#middle_name'] = '#billing_middle_name';
102 if ($('#last_name').length)
103 input_ids['#last_name'] = '#billing_last_name';
106 $('.billing_name_address-section select').each(function (i) {
107 orig_id = $(this).attr('id');
108 field = orig_id.split('-');
109 field_name = field[0].replace('billing_', '').replace('_id', '');
111 if (address_fields[field_name]) {
112 select_ids['#' + field_name + '-' + address_fields[field_name]] = '#' + orig_id;
117 // detect if billing checkbox should default to checked
119 for (var id in input_ids) {
120 orig_id = input_ids[id];
121 if ($(id).val() != $(orig_id).val()) {
126 for (var id in select_ids) {
127 orig_id = select_ids[id];
128 if ($(id).val() != $(orig_id).val()) {
134 $('#billingcheckbox').prop('checked', true);
135 if (!CRM.billing || CRM.billing.billingProfileIsHideable) {
136 $('.billing_name_address-group').hide();
140 // onchange handlers for non-billing fields
141 for (var id in input_ids) {
142 orig_id = input_ids[id];
143 $(id).change(function () {
144 var id = '#' + $(this).attr('id');
145 var orig_id = input_ids[id];
147 // if billing checkbox is active, copy other field into billing field
148 if ($('#billingcheckbox').prop('checked')) {
149 $(orig_id).val($(id).val());
153 for (var id in select_ids) {
154 orig_id = select_ids[id];
155 $(id).change(function () {
156 var id = '#' + $(this).attr('id');
157 var orig_id = select_ids[id];
159 // if billing checkbox is active, copy other field into billing field
160 if ($('#billingcheckbox').prop('checked')) {
161 $(orig_id + ' option').prop('selected', false);
162 $(orig_id + ' option[value="' + $(id).val() + '"]').prop('selected', true);
170 $('#billingcheckbox').click(function () {
172 if (!CRM.billing || CRM.billing.billingProfileIsHideable) {
173 $('.billing_name_address-group').hide(200);
177 for (var id in input_ids) {
178 orig_id = input_ids[id];
179 $(orig_id).val($(id).val());
181 for (var id in select_ids) {
182 orig_id = select_ids[id];
183 $(orig_id + ' option').prop('selected', false);
184 $(orig_id + ' option[value="' + $(id).val() + '"]').prop('selected', true);
188 $('.billing_name_address-group').show(200);
192 // remove spaces, dashes from credit card number
193 $('#credit_card_number').change(function () {
194 var cc = $('#credit_card_number').val()
197 $('#credit_card_number').val(cc);
201 $('input[name="payment_processor_id"]').change( function() {
202 function toggleConfirmButton() {
203 var suppressSubmitButton = {/literal}"{$suppressSubmitButton}"{literal};
204 var elementObj = $('input[name="payment_processor"]');
205 if ( elementObj.attr('type') == 'hidden' ) {
206 var processorTypeId = elementObj.val( );
209 var processorTypeId = elementObj.filter(':checked').val();
212 if (suppressSubmitButton) {
213 $("#crm-submit-buttons").hide();
216 $("#crm-submit-buttons").show();
219 toggleConfirmButton();
226 {crmRegion name="billing-block-post"}
227 {* Payment processors sometimes need to append something to the end of the billing block. We create a region for
228 clarity - the plan is to move to assigning this through the payment processor to this region *}