1ACC.silentorderpost = { 2 3 spinner: $("<img>").attr("src", ACC.config.commonResourcePath + "/images/spinner.gif"), 4 5 bindUseDeliveryAddress: function () 6 { 7 $("input[type='radio'][name='useDeliveryAddress']").on('change', function () 8 { 9 if ($(this).attr('data-value') == "useSame") 10 { 11 var country = $('#useDeliveryAddressData').data('countryisocode') ? $('#useDeliveryAddressData').data('countryisocode'): "US"; 12 var orderCode =''; 13 if($('#orderCode').val() != "" && $('#orderCode').val() != undefined){ 14 orderCode =$('#orderCode').val(); 15 } 16 var options = {'countryIsoCode': country, 'useDeliveryAddress': true , 'orderCode': orderCode}; 17 ACC.silentorderpost.enableAddressForm(); 18 ACC.silentorderpost.displayCreditCardAddressForm(options, ACC.silentorderpost.useDeliveryAddressSelected); 19 ACC.silentorderpost.disableAddressForm(); 20 $( "input[name='qasaddress']" ).val(""); 21 } 22 else 23 { 24 $( "input[name='qasaddress']" ).val("true"); 25 if($('#default_BillTo').val() =="false"){ 26 $('#billTo_street1').val(""); 27 $('#billTo_street2').val(""); 28 $('#billTo_city').val(""); 29 $('#billTo_state').val(""); 30 $('#billTo_postalCode').val(""); 31 } 32 $("#samebillingAddress").html(""); 33 $("#samebillingAddress").hide(); 34 $('#billingAddressForm').show(); 35 ACC.silentorderpost.enableAddressForm(); 36 } 37 }); 38 39 /*if ($('#useDeliveryAddress2').is(":checked")) 40 { 41 var country = $('#useDeliveryAddressData').data('countryisocode') ? $('#useDeliveryAddressData').data('countryisocode'): "US"; 42 var orderCode =''; 43 if($('#orderCode').val() != "" && $('#orderCode').val() != undefined){ 44 orderCode =$('#orderCode').val(); 45 } 46 var options = {'countryIsoCode': country, 'useDeliveryAddress': true , 'orderCode': orderCode}; 47 ACC.silentorderpost.enableAddressForm(); 48 $( "input[name='qasaddress']" ).val("false"); 49 ACC.silentorderpost.displayCreditCardAddressForm(options, ACC.silentorderpost.useDeliveryAddressSelected); 50 ACC.silentorderpost.disableAddressForm(); 51 }*/ 52 }, 53 54 bindSubmitSilentOrderPostForm: function () 55 { 56 $('.submit_silentOrderPostForm_mock').click(function () 57 { 58 ACC.common.blockFormAndShowProcessingMessage($(this)); 59 //$('.billingAddressForm').filter(":hidden").remove(); 60 ACC.silentorderpost.enableAddressForm(); 61 $('#silentOrderPostForm').submit(); 62 }); 63 }, 64 65 bindCycleFocusEvent: function () 66 { 67 $('#lastInTheForm').blur(function () 68 { 69 $('#silentOrderPostForm [tabindex$="10"]').focus(); 70 }) 71 }, 72 73 isEmpty: function (obj) 74 { 75 if (typeof obj == 'undefined' || obj === null || obj === '') return true; 76 return false; 77 }, 78 79 disableAddressForm: function () 80 { 81 $('input[id^="address\\."]').prop('disabled', true); 82 $('select[id^="address\\."]').prop('disabled', true); 83 }, 84 85 enableAddressForm: function () 86 { 87 $('input[id^="address\\."]').prop('disabled', false); 88 $('select[id^="address\\."]').prop('disabled', false); 89 }, 90 91 clearAddressForm: function () 92 { 93 $('input[id^="address\\."]').val(""); 94 $('select[id^="address\\."]').val(""); 95 }, 96 97 useDeliveryAddressSelected: function () 98 { 99 if ($('#useDeliveryAddress').is(":checked")) 100 { 101 $('#address\\.country').val($('#useDeliveryAddressData').data('countryisocode')); 102 ACC.silentorderpost.disableAddressForm(); 103 } 104 else 105 { 106 ACC.silentorderpost.clearAddressForm(); 107 ACC.silentorderpost.enableAddressForm(); 108 } 109 }, 110 111 112 113 bindCreditCardAddressForm: function () 114 { 115 $('#billingCountrySelector :input').on("change", function () 116 { 117 var countrySelection = $(this).val(); 118 var options = { 119 'countryIsoCode': countrySelection, 120 'useDeliveryAddress': false 121 }; 122 ACC.silentorderpost.displayCreditCardAddressForm(options); 123 }) 124 }, 125 126 displayCreditCardAddressForm: function (options, callback) 127 { 128 $.ajax({ 129 url: ACC.config.encodedContextPath + '/checkout/multi/sop/billingaddressform', 130 async: true, 131 data: options, 132 dataType: "json", 133 134 }).done(function (data) 135 { 136 137 var sameAddress = data.street+","+data.street2+"<br>"+data.city+","+data.state+" "+data.zipcode; 138 $("#samebillingAddress").html(sameAddress); 139 $("#samebillingAddress").show(); 140 $('#address.firstName').val(data.firstName); 141 $('#address.surname').val(data.lastName); 142 $('#billTo_street1').val(data.street); 143 $('#billTo_street2').val(data.street2); 144 $('#billTo_city').val(data.city); 145 $('#billTo_state').val(data.state); 146 $('#billTo_postalCode').val(data.zipcode); 147 if(ACC.isMockupPaymentProvider){ 148 $('input[name=billTo_firstName]').val(data.firstName); 149 $('input[name=billTo_lastName]').val(data.lastName); 150 $('input[name=billTo_street1]').val(data.street); 151 $('input[name=billTo_street2]').val(data.street2); 152 $('input[name=billTo_city]').val(data.city); 153 $('input[name=billTo_state]').val(data.state); 154 $('input[name=billTo_postalCode]').val(data.zipcode); 155 $('#billingAddressForm').show(); 156 } 157 $('#billingAddressForm').hide(); 158 if (typeof callback == 'function') 159 { 160 callback.call(); 161 } 162 }); 163 } 164} 165 166$(document).ready(function () 167{ 168ACC.silentorderpost.bindUseDeliveryAddress(); 169ACC.silentorderpost.bindSubmitSilentOrderPostForm(); 170ACC.silentorderpost.bindCreditCardAddressForm(); 171// check the checkbox 172/* 173if($('#default_BillTo').val() =="false" || $('#default_BillTo').val() == undefined){ 174 $("#useDeliveryAddress").click(); 175} 176*/ 177});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.