1/*** Asset: asset/ajax/giving.js ***/ 2 3var days=[{'id':0,'dayname':'Sunday'},{'id':1,'dayname':'Monday'},{'id':2,'dayname':'Tuesday'},{'id':3,'dayname':'Wednesday'},{'id':4,'dayname':'Thursday'},{'id':5,'dayname':'Friday'},{'id':6,'dayname':'Saturday'},] 4var _fundlist;var accToken;var platformID;var axiosGivingURLEndPoint;var axiosCmsURLEndPoint;var cmsToken;var activeSiteID;var givingProductID;var churchID;var accConID;var SpKzI;var stripe;var cardElement;var elements;var CardValidate=false;var SubStartDate='now';var OriSubStartDate='';var Fee=0;var TotalAmount=0;var OriginalAmount=0;var GiverAccID='';var GiverFirstName='';var GiverLastName='';var GiverEmail='';var GiverAccBaID='';var GiverAccBaStatus='';var GiverBankList='';var GiverPaymentMethod='card';var GiverBankPM='';var GiverCTok='';var GivingSetup=false;var ActiveACHsetup='givingmodal';const formatter=new Intl.NumberFormat('en-US',{minimumFractionDigits:2,maximumFractionDigits:2,});$(function(){if($('#GiveButton #GiveButtontxtShow').length>0&&$('#GiveButton #GiveButtontxtShow').attr('data-givetype')=='popup'){$('#GiveButton').css('opacity','0.2');} 5initApiConfiguration();});function validate_pre_achsetup(){pass=true;ActiveACHsetup='givingmodal';if($('#GivingModal #giveFirstName').val()==''){$('#GivingModal #grpgiveFirstName').addClass('has-error');pass=false;}else{$('#GivingModal #grpgiveFirstName').removeClass('has-error');} 6if($('#GivingModal #giveLastName').val()==''){$('#GivingModal #grpgiveLastName').addClass('has-error');pass=false;}else{$('#GivingModal #grpgiveLastName').removeClass('has-error');} 7if($('#GivingModal #giveEmail').val()==''){$('#GivingModal #grpgiveEmail').addClass('has-error');pass=false;}else{$('#GivingModal #grpgiveEmail').removeClass('has-error');} 8if(pass){$('#GivingAchSetup #acherror').hide();$('#GivingModal').modal('hide');$('#GivingAchSetup').modal('show');}} 9function enabled_disabled_account_field(){if(GiverAccID!=''){$('#GivingModal #giveFirstName').val(GiverFirstName);$('#GivingModal #giveLastName').val(GiverLastName);$('#GivingModal #giveEmail').val(GiverEmail);$('#GivingModal #giveFirstName').attr('disabled',true);$('#GivingModal #giveLastName').attr('disabled',true);$('#GivingModal #giveEmail').attr('disabled',true);$('#GivingModal #grpgiveFirstName').css('opacity','0.3');$('#GivingModal #grpgiveLastName').css('opacity','0.3');$('#GivingModal #grpgiveEmail').css('opacity','0.3');}else{$('#GivingModal #giveFirstName').attr('disabled',false);$('#GivingModal #giveLastName').attr('disabled',false);$('#GivingModal #giveEmail').attr('disabled',false);$('#GivingModal #grpgiveFirstName').css('opacity','');$('#GivingModal #grpgiveLastName').css('opacity','');$('#GivingModal #grpgiveEmail').css('opacity','');}} 10function disabled_ach_verified(disabled){if(disabled){$('#GivingModal #GiftAmount').attr("disabled",false);$('#GivingModal #giveFreq').removeClass('active').addClass('inactive');$('#GivingModal #giveFreqOne').removeClass('active').addClass('inactive');$('#GivingModal #giveFreqTwo').removeClass('active').addClass('inactive');$('#GivingModal #giveFundCat').removeClass('active').addClass('inactive');$('#GivingModal #FreqSelect').attr('disabled',true);$('#GivingModal #FreqWM').attr('disabled',true);$('#GivingModal #giveFreqWeekSelect').attr('disabled',true);$('#GivingModal #giveFreqMonthSelect').attr('disabled',true);enabled_disabled_account_field();$('#GivingModal #giveBtn').attr('disabled',true) 11$('#GivingModal #giveCoverFee').attr('disabled',true);}else{$('#GivingModal #GiftAmount').attr("disabled",false);$('#GivingModal #giveFreq').removeClass('inactive').addClass('active');$('#GivingModal #giveFundCat').removeClass('inactive').addClass('active');$('#GivingModal #FreqSelect').attr('disabled',false);if($('#GivingModal #FreqSelect').val()=="Recurring"){$('#GivingModal #giveFreqOne').removeClass('inactive').addClass('active');$('#GivingModal #giveFreqTwo').removeClass('inactive').addClass('active');$('#GivingModal #FreqWM').attr('disabled',false);$('#GivingModal #giveFreqWeekSelect').attr('disabled',false);$('#GivingModal #giveFreqMonthSelect').attr('disabled',false);}else{$('#GivingModal #giveFreqOne').removeClass('active').addClass('inactive');$('#GivingModal #giveFreqTwo').removeClass('active').addClass('inactive');$('#GivingModal #FreqWM').attr('disabled',true);$('#GivingModal #giveFreqWeekSelect').attr('disabled',true);$('#GivingModal #giveFreqMonthSelect').attr('disabled',true);} 12enabled_disabled_account_field();$('#GivingModal #giveBtn').attr('disabled',false) 13$('#GivingModal #giveCoverFee').attr('disabled',false);}} 14function clear_ach_bank(){$('#frmACHsetup #AccountHolderType').val('individual');$('#frmACHsetup #AccountHolderName').val('');$('#frmACHsetup #grpAccountHolderName').removeClass('has-error');$('#frmACHsetup #ACHRoutingNumber').val('');$('#frmACHsetup #grpACHRoutingNumber').removeClass('has-error');$('#frmACHsetup #ACHAccountNumber').val('');$('#frmACHsetup #grpACHAccountNumber').removeClass('has-error');$('#frmACHsetup #ACHAccountNumber2').val('');$('#frmACHsetup #grpACHAccountNumber2').removeClass('has-error');} 15function validate_ach_bank_form(){pass=true;if($('#frmACHsetup #AccountHolderName').val()==""){pass=false;$('#frmACHsetup #grpAccountHolderName').addClass('has-error');}else{$('#frmACHsetup #grpAccountHolderName').removeClass('has-error');} 16if($('#frmACHsetup #ACHRoutingNumber').val()==""){pass=false;$('#frmACHsetup #grpACHRoutingNumber').addClass('has-error');}else{$('#frmACHsetup #grpACHRoutingNumber').removeClass('has-error');} 17if($('#frmACHsetup #ACHAccountNumber').val()==""){pass=false;$('#frmACHsetup #grpACHAccountNumber').addClass('has-error');}else{$('#frmACHsetup #grpACHAccountNumber').removeClass('has-error');} 18if($('#frmACHsetup #ACHAccountNumber2').val()==""){pass=false;$('#frmACHsetup #grpACHAccountNumber2').addClass('has-error');}else{$('#frmACHsetup #grpACHAccountNumber2').removeClass('has-error');} 19if($('#frmACHsetup #ACHAccountNumber').val()!=$('#frmACHsetup #ACHAccountNumber2').val()){pass=false;$('#frmACHsetup #grpACHAccountNumber').addClass('has-error');$('#frmACHsetup #grpACHAccountNumber2').addClass('has-error');}else if($('#frmACHsetup #ACHAccountNumber').val()!=""&&$('#frmACHsetup #ACHAccountNumber2').val()!=""){$('#frmACHsetup #grpACHAccountNumber').removeClass('has-error');$('#frmACHsetup #grpACHAccountNumber2').removeClass('has-error');} 20return pass;} 21function cancel_ach_bank(achsetupsource){clear_ach_bank();$('#GivingAchSetup').modal('hide');if(achsetupsource=='givingmodal'&&ActiveACHsetup=='givingmodal'){$('#GivingModal').modal('show');}} 22function add_ach_bank(){if(validate_ach_bank_form()){$('#GivingAchSetup #btnACHSubmit').hide();$('#GivingAchSetup #btnACHProcess').show();var account_holder_name=$('#frmACHsetup #AccountHolderName').val();var account_holder_type=$('#frmACHsetup #AccountHolderType').val();var account_number=$('#frmACHsetup #ACHAccountNumber').val();var routing_number=$('#frmACHsetup #ACHRoutingNumber').val();attach_ach_to_customer(account_holder_name,account_holder_type,account_number,routing_number);}} 23function attach_ach_to_customer(account_holder_name,account_holder_type,account_number,routing_number){var _giveFirstName=$('#GivingModal #giveFirstName').val();var _giveLastName=$('#GivingModal #giveLastName').val();var _giveEmail=$('#GivingModal #giveEmail').val();$.post('/ajax/validate-giver-account/?pseudoParam='+new Date().getTime()+"",{giveFirstName:_giveFirstName,giveLastName:_giveLastName,giveEmail:_giveEmail,giveSiteID:activeSiteID},function(data){data=JSON.parse(data);if(data.result=='success'){_giveFirstName=data.params.fname;_giveLastName=data.params.lname;start_attach_ach_customer(data.params.accID,_giveFirstName,_giveLastName,_giveEmail,data.params.pwd,account_holder_name,account_holder_type,account_number,routing_number);}});} 24function verify_ach(){if(GiverAccBaID!=''&&GiverAccBaStatus=='requires_action'){$('#btnverifyach').attr('disabled',true);$('#GivingModal #ACHVerify').attr('readonly',true);$('#GivingModal #btnverifyach').html('Verifying...');stripe.verifyMicrodepositsForSetup(GiverAccBaID,{descriptor_code:$('#GivingModal #ACHVerify').val(),}).then(function(result){console.log(result);$('#btnverifyach').attr('disabled',false);
24if(result.error){$('#GivingModal #grpACHVerify').addClass('has-error');$('#btnverifyach').attr('disabled',false);$('#GivingModal #ACHVerify').attr('readonly',false);$('#GivingModal #btnverifyach').html('Verify');}else if(result.setupIntent.status=="succeeded"){axios.defaults.headers.common['Authorization']='Bearer '+accToken;axios.put(axiosGivingURLEndPoint+'/ach/'+platformID+'/verified',{usrID:platformID,siteID:activeSiteID,accid:GiverAccID,}).then(function(response){if(response.data.result=='success'){$('#GivingModal #grpACHVerify').removeClass('has-error');$('#btnverifyach').attr('disabled',false);$('#GivingModal #ACHVerify').attr('readonly',false);$('#GivingModal #btnverifyach').html('Verify');GiverAccBaID='';GiverAccBaStatus='';GiverBankList=response.data.blist;console.log(response.data);disabled_ach_verified(false);GiverBankPM=GiverBankList[0]['id'];$('#achlist').empty();$.each(GiverBankList,function(key,value){$('#achlist').append($("<option></option>").attr("value",value['id']).text(value['us_bank_account']['bank_name']+' â¢â¢â¢â¢'+value['us_bank_account']['last4']));});$('#achlist').unbind();$('#achlist').change(function(){GiverBankPM=this.value;});$('#ach-element').hide();$('#ach-verify').hide();$('#ach-verified').show();if($('#givePaymentMethodsTranslist').length>0&&$('#givingCard-tab').parent().hasClass('active')){load_giving_tab('paymentmethod');}}}).catch(function(error){}).then(function(){});}});} 25return false;} 26function check_giving_status(){var _loginid='';if(GiverAccID!=""){_loginid="/"+GiverAccID;} 27axios.defaults.headers.common['Authorization']='Bearer '+accToken;axios.get(axiosGivingURLEndPoint+'/church/'+platformID+'/status/'+activeSiteID+_loginid).then(function(response){if(response.data.result=='success'){GiverAccBaID=response.data.bacc;GiverAccBaStatus=response.data.bstatus;GiverBankList=response.data.blist;if(GiverBankList!=""){GiverBankPM=GiverBankList[0]['id'];} 28get_giving_setting();}else{GivingSetup=false;if($('#giving #prepareGivigData').length>0){$('#giving #prepareGivigData').html('<p id="activefundload" class="text-center">Giving is not setup for your church. Please contact a church administrator to have that setup.</p>');}}}).catch(function(error){console.log(error);}).then(function(){});} 29function createGivingModal(){var modal='<div class="modal fade" id="GivingModal" tabindex="-1" role="dialog" aria-labelledby="GivingModal">';modal+='<div class="modal-dialog" role="document">';modal+='<div class="modal-content giving-form">';modal+='<div class="modal-body">';modal+='<a href="javascript:void(0);" class="modal-close-icon" data-dismiss="modal"><span class="ion-close"></span></a>';modal+='<form id="frmGiving" name="frmGiving">';modal+='<div class="form-group give-amount" id="grpGiftAmount">';modal+='<label for="exampleInputEmail1">Gift Amount</label>';modal+='<div class="input-group">';modal+='<span class="input-group-addon">$</span>';modal+='<input type="text" class="form-control" id="GiftAmount" name="GiftAmount" placeholder="0.00" pattern="\d*" maxlength="7">';modal+='</div>';modal+='</div>';modal+='<div class="form-group give-category form-inline give-frequency" id="giveFundCat">';modal+='<label for="exampleInputEmail1">To:</label>';modal+='<select class="form-control custom-select" id="FundCat" name="FundCat">';modal+='</select>';modal+='</div>';modal+='<hr>';modal+='<div class="row">';modal+='<div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12 give-frequency" id="giveFreq">';modal+='<label for="">Frequency</label>';modal+='<select class="form-control custom-select" id="FreqSelect" name="FreqSelect">';modal+='<option value="OneTime">One-Time</option>';modal+='<option value="Recurring">Recurring</option>';modal+='</select>';modal+='</div>';modal+='<div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12 give-frequency inactive" id="giveFreqOne">';modal+='<label for=""> </label>';modal+='<select class="form-control custom-select" id="FreqWM" name="FreqWM" disabled>';modal+='<option value="week">Weekly</option>';modal+='<option value="month">Monthly</option>';modal+='</select>';modal+='<span>on</span>';modal+='</div>';modal+='<div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12 give-frequency inactive" id="giveFreqTwo">';modal+='<label for=""> </label>';modal+='<select class="form-control custom-select show" id="giveFreqWeekSelect" disabled>';for(i=0;i<days.length;i++){modal+='<option value="'+days[i].id+'">'+days[i].dayname+'</option>';} 30modal+='</select>';modal+='<select class="form-control custom-select hide" id="giveFreqMonthSelect">';
30for(i=1;i<=28;i++){var postfix='th';if(i==1||i==21){postfix='st'}else if(i==2||i==22){postfix='nd';}else if(i==3||i==23){postfix='rd';} 31modal+='<option value="'+i+'">'+i+postfix+'</option>';} 32modal+='</select>';modal+='</div>';modal+='</div>';modal+='<hr>';modal+='<div class="row">';modal+='<div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12" id="grpgiveFirstName">';modal+='<input type="text" class="form-control" id="giveFirstName" name="giveFirstName" placeholder="First Name" value="'+GiverFirstName+'">';modal+='</div>';modal+='<div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12" id="grpgiveLastName">';modal+='<input type="text" class="form-control" id="giveLastName" name="giveLastName" placeholder="Last Name" value="'+GiverLastName+'">';modal+='</div>';modal+='<div class="form-group col-lg-4 col-md-4 col-sm-4 col-xs-12" id="grpgiveEmail">';modal+='<input type="email" class="form-control" id="giveEmail" name="giveEmail" placeholder="Email" value="'+GiverEmail+'">';modal+='</div>';modal+='<div class="payment-options col-lg-12 col-md-12 col-sm-12 col-xs-12 "><a href="javascript:void(0);" class="toggle-button active" id="ccButton"><span class="glyphicon glyphicon-credit-card" aria-hidden="true"></span>Card</a><a href="javascript:void(0);" class="toggle-button" id="achButton"><ion-icon name="ios-business"></ion-icon>Bank</a>';modal+='</div>';modal+='<div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12 give-cc">';modal+='<div class="pt-2 pb-2 form-control" id="card-element" name="card-element" style="margin:0 0 0 0;">';modal+='</div>';if(GiverAccID!=""){modal+='<div class="" id="ach-element" name="ach-element" style="display:none;"><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 alert alert-info small ach-setup-box">You need to connect your bank for ACH payments.<a href="javascript:void(0);" onclick="return validate_pre_achsetup();" class="btn btn-sm btn-info">Connect your account</a></div>';modal+='</div>';modal+='<div class="" id="ach-verify" name="ach-verify" style="display:none;"><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 alert alert-info small ach-setup-box verify">ChurchSpring sent a small deposit to this bank account. To verify this account, please confirm the 6-digit code in the bank statement descriptor of this deposit.<div class="form-inline margin-top-2"><div class="form-group" id="grpACHVerify"><label>Descriptor Code</label><input type="text" class="form-control " id="ACHVerify" name="ACHVerify" placeholder="" value=""></div><button class="btn btn-sm btn-info verify" id="btnverifyach" onclick="return verify_ach();">Verify</button></div></div>';modal+='</div>';modal+='<div class="" id="ach-verified" name="ach-verified" style="display:none;"><select class="form-control custom-select" id="achlist" name="achlist"></select>';modal+='</div>';}else{modal+='<div class="" id="ach-element" name="ach-element" style="display:none;"><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 alert alert-info small ach-setup-box">You need to connect your bank for ACH payments.<a href="javascript:void(0);" onclick="return validate_pre_achsetup();" class="btn btn-sm btn-info">Connect your account</a></div>';modal+='</div>';modal+='<div class="" id="ach-element-login" name="ach-element-login" style="display:none;"><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 alert alert-info small ach-setup-box"><span id="achInformation">You need to login to use ACH payments.</span><a href="javascript:void(0);" onclick="return giving_login();" class="btn btn-sm btn-info">Login</a></div>';modal+='</div>';} 33modal+='<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 row">';modal+='<div class="checkbox give-cover-fee">';modal+='<label>';modal+='<input id="giveCoverFee" type="checkbox"> Add $<span id="ccFee">0.00</span> to cover the processing fees';modal+='</label>';modal+='</div>';modal+='</div>';modal+='<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 row">';modal+='<hr>';modal+='<label>Memo</label>';modal+='<textarea class="form-control" rows="3" name="GivingMemo" id="GivingMemo"></textarea>';modal+='</div>';modal+='</div>';modal+='</form>';modal+='</div>';modal+='<div class="modal-footer">';modal+='<div id="ccinfoerror" class="pull-left" style="display:none">';modal+='<small style="color:red">* Please check your credit card information</small>';modal+='</div>';modal+='<a href="javascript:void(0);" class="btn btn-primary" id="giveBtnProcess" style="display:none">Processing...</a>';modal+='<a href="javascript:void(0);" type="submit" class="btn btn-primary" id="giveBtn" name="giveBtn">Give $<span id="btnValue">0.00 </span> <span id="btnValueText"></span></a>';modal+='</div>';modal+='</div>';modal+='</div>';modal+='</div>';modal+='</div>';modal+='<div class="modal fade" id="GivingThanks" tabindex="-1" role="dialog" aria-labelledby="GivingThanks">';modal+='<div class="modal-dialog" role="document">';modal+='<div class="modal-content">';modal+='<div class="modal-body">';modal+='<a href="javascript:void(0);" class="modal-close-icon" data-dismiss="modal"><span class="ion-close"></span></a>';modal+='<h1 class="text-center text-green"><ion-icon name="checkmark-circle"></ion-icon></h1>';modal+='<h2 class="modal-titl text-center" id="givethankyouheader">Thank you!</h2>';modal+='<p class="text-center" id="givethankyoucontent">Your gift has been received. You will receive a confirmation email with the details of your gift shortly.</p>';modal+='</div>';modal+='<div class="modal-footer">';modal+='</div>';modal+='</div>';modal+='</div>';modal+='</div>';modal+='<div class="modal fade" id="GivingAchSetup" tabindex="-1" role="dialog" aria-labelledby="GivingAchSetup">';modal+='<div class="modal-dialog modal-width-60" role="document" style="top:50px">';modal+='<div class="modal-content">';modal+='<div class="modal-body">';modal+='<form action="" method="POST" id="frmACHsetup" name="frmACHsetup">';modal+='<a href="javascript:void(0);" class="modal-close-icon" data-dismiss="modal" data-toggle="modal"><span class="ion-close"></span></a>';modal+='<h2 class="modal-title">Setup Bank (ACH) Payments</h2>';modal+='<p class="small margin-bottom-3" style="line-height:2.2rem;">ChurchSpring and Stripe are required to verify the ownership of the bank account before collecting tithes and donations. Verification allows us to confirm account ownership and that we’ve connected to the correct account.</p>';modal+='<div class="row ach-setup-form" id="" name="">';modal+='<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">';modal+='<label for="AccountHolderType">Account type</label>';modal+='<select class="form-control custom-select show" id="AccountHolderType">';modal+='<option value="individual" selected>Individual</option>';modal+='<option value="company">Organization/Company</option>';modal+='</select>';modal+='</div>';modal+='<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="grpAccountHolderName">';modal+='<label for="AccountHolderName">Account name</label>';modal+='<input type="text" class="form-control" id="AccountHolderName" name="AccountHolderName" placeholder="" value="">';modal+='</div>';modal+='<div class="row">';modal+='<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">';modal+='<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="grpACHRoutingNumber">';modal+='<label for="ACHRoutingNumber">Routing number</label>';modal+='<input type="number" class="form-control" id="ACHRoutingNumber" name="ACHRoutingNumber" placeholder="" value="">';modal+='</div>';modal+='<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="grpACHAccountNumber">';modal+='<label for="ACHAccountNumber">Account number</label>';modal+='<input type="number" class="form-control" id="ACHAccountNumber" name="ACHAccountNumber" placeholder="" value="">';modal+='</div>';modal+='<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="grpACHAccountNumber2">';modal+='<label for="ACHAccountNumber2">Confirm account number</label>';modal+='<input type="number" onpaste="return false;" class="form-control" id="ACHAccountNumber2" name="ACHAccountNumber2" placeholder="" value="">';modal+='</div>';modal+='</div>';
33modal+='<div class="col-lg-7 col-md-7 col-sm-7 col-xs-12">';modal+='<img src="https://csstaticfile.s3.amazonaws.com/images/system/bank-account-routing.png" class="img-responsive">';modal+='</div>';modal+='</div>';modal+='<div class="row">';modal+='<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="acherror" style="display:none;">';modal+='<small style="color:red">* Invalid ACH Information</small>';modal+='</div>';modal+='</div>';modal+='</div>';modal+='</form>';modal+='</div>';modal+='<div class="modal-footer">';modal+='<button type="button" class="btn btn-secondary" id="btnACHCancel" onclick="return cancel_ach_bank(\''+ActiveACHsetup+'\');">Cancel</button>';modal+='<button type="button" class="btn btn-primary" id="btnACHSubmit" onclick="return add_ach_bank();">Add US Bank Account</button>';modal+='<button type="button" class="btn btn-primary" id="btnACHProcess" style="display: none;" disabled>Processing...</button>';modal+='</div>';modal+='</div>';modal+='</div>';modal+='</div>';$('body').append(modal);stripe=Stripe(SpKzI,{stripeAccount:accConID,});elements=stripe.elements();cardElement=elements.create('card',{hidePostalCode:true,style:{base:{colorBackground:'#ffffff',borderRadius:'10px',color:'#333',fontSize:'18px',fontFamily:'"Open Sans", sans-serif',fontSmoothing:'antialiased','::placeholder':{color:'#888',lineHeight:'80px',},},invalid:{color:'#e5424d',':focus':{color:'#303238',},},},});cardElement.mount('#card-element');cardElement.on('change',function(event){if(event.error){console.log('Card Error :'+event.error.message);$('#GivingModal #ccinfoerror').html('<small style="color:red"><sup>*</sup>'+event.error.message+'</small>');$('#GivingModal #ccinfoerror').show();CardValidate=false;}else{CardValidate=true;$('#GivingModal #ccinfoerror').hide();}});get_fundlist();$("#GivingModal #FreqSelect").change(function(){if($(this).val()=='OneTime'){$('#GivingModal #giveFreqOne').removeClass('active').addClass('inactive');$('#GivingModal #giveFreqTwo').removeClass('active').addClass('inactive');$('#GivingModal #FreqWM').attr('disabled',true);$('#GivingModal #giveFreqWeekSelect').attr('disabled',true);$('#GivingModal #giveFreqMonthSelect').attr('disabled',true);$('#GivingModal #btnValueText').html("");}else{$('#GivingModal #giveFreqOne').removeClass('inactive').addClass('active');$('#GivingModal #giveFreqTwo').removeClass('inactive').addClass('active');$('#GivingModal #FreqWM').attr('disabled',false);$('#GivingModal #giveFreqWeekSelect').attr('disabled',false);$('#GivingModal #giveFreqMonthSelect').attr('disabled',false);if($("#GivingModal #FreqWM").val()=='week'){$('#GivingModal #btnValueText').html('Weekly');get_startdate_weekly($("#GivingModal #giveFreqWeekSelect").val());}else{$('#GivingModal #btnValueText').html('Monthly');get_startdate_monthly($("#GivingModal #giveFreqMonthSelect").val());}}});$("#GivingModal #FreqWM").change(function(){if($(this).val()=='week'){$('#GivingModal #giveFreqWeekSelect').removeClass('hide').addClass('show');$('#GivingModal #giveFreqMonthSelect').removeClass('show').addClass('hide');$('#GivingModal #btnValueText').html('Weekly');get_startdate_weekly($("#GivingModal #giveFreqWeekSelect").val());}else if($(this).val()=='month'){$('#GivingModal #giveFreqWeekSelect').removeClass('show').addClass('hide');$('#GivingModal #giveFreqMonthSelect').removeClass('hide').addClass('show');$('#GivingModal #btnValueText').html('Monthly');get_startdate_monthly($("#GivingModal #giveFreqMonthSelect").val());}});$("#GivingModal #giveFreqMonthSelect").change(function(){get_startdate_monthly($(this).val());});$("#GivingModal #giveFreqWeekSelect").change(function(){get_startdate_weekly($(this).val());});$('#GivingModal #GiftAmount').keyup(function(){var giftAmount=$(this).val();formatCurrency($(this));giftAmount=giftAmount.replace(/\,/g,'');if(isNaN(giftAmount)||giftAmount==''||Math.ceil(giftAmount)=='0'){$('#GivingModal #ccFee').html('0.00');$('#GivingModal #btnValue').html('0.00');$('#GivingModal #GiftAmount').val('');}else{show_fee_amount(giftAmount);get_fee_amount(giftAmount);}});$('#ccButton').click(function(){disabled_ach_verified(false);$('#ccButton').addClass('active');$('#achButton').removeClass('active');$('#card-element').show();$('#ach-element').hide();$('#ach-element-login').hide();$('#ach-verify').hide();$('#ach-verified').hide();GiverPaymentMethod='card';var giftAmount=$('#GivingModal #GiftAmount').val();giftAmount=giftAmount.replace(/\,/g,'');show_fee_amount(giftAmount);get_fee_amount(giftAmount);});$('#achButton').click(function(){$('#achButton').addClass('active');$('#ccButton').removeClass('active');$('#card-element').hide();GiverPaymentMethod='ach';if(GiverAccBaID==""&&GiverAccBaStatus==""&&GiverBankList.length==0){disabled_ach_verified(true);$('#ach-element').show();$('#ach-verify').hide();$('#ach-verified').hide();}else if(GiverAccBaID!=""&&GiverAccBaStatus!=""&&GiverBankList.length==0){disabled_ach_verified(true);$('#ach-element').hide();$('#ach-verify').show();$('#ach-verified').hide();}else if(GiverBankList.length>0){disabled_ach_verified(false);$('#achlist').empty();$.each(GiverBankList,function(key,value){$('#achlist').append($("<option></option>").attr("value",value['id']).text(value['us_bank_account']['bank_name']+' â¢â¢â¢â¢'+value['us_bank_account']['last4']));});$('#achlist').unbind();$('#achlist').change(function(){GiverBankPM=this.value;});$('#ach-element').hide();$('#ach-verify').hide();$('#ach-verified').show();} 34var giftAmount=$('#GivingModal #GiftAmount').val();giftAmount=giftAmount.replace(/\,/g,'');show_fee_amount(giftAmount);get_fee_amount(giftAmount);});$('#GivingModal #giveCoverFee').click(function(){if($('#GivingModal #GiftAmount').val()==''){$('#GivingModal #ccFee').html('0.00');$('#GivingModal #btnValue').html('0.00');$('#GivingModal #GiftAmount').val('');}else{var giftAmount=$('#GivingModal #GiftAmount').val();giftAmount=giftAmount.replace(/\,/g,'');get_fee_amount(giftAmount);}});$('#GivingModal #giveBtn').click(function(){if(GiverBankList.length==0&&GiverPaymentMethod=="ach"){return false;}else{check_account_giver();}});$('#GivingModal #giveEmail').blur(function(){});} 35function set_thankyou_headercontent(header,content){$('#GivingThanks #givethankyouheader').html(header);$('#GivingThanks #givethankyoucontent').html(content);} 36function show_fee_amount(giftAmount){if(giftAmount!=''){if(GiverPaymentMethod=="card"){$('#GivingModal #ccFee').html(formatter.format(((parseFloat(giftAmount)+0.30)/0.971)-parseFloat(giftAmount)));}else if(GiverPaymentMethod=="ach"){if(parseFloat(giftAmount)>=625){$('#GivingModal #ccFee').html(formatter.format(5));}else{$('#GivingModal #ccFee').html(formatter.format(((parseFloat(giftAmount)/0.992))-parseFloat(giftAmount)));}}}else{$('#GivingModal #ccFee').html(formatter.format(0));}} 37function get_fee_amount(giftAmount){if(GiverPaymentMethod=="card"){Fee=formatter.format(((parseFloat(giftAmount)+0.30)/0.971)-parseFloat(giftAmount));}else if(GiverPaymentMethod=="ach"){if(parseFloat(giftAmount)>=625){Fee=formatter.format(5);}else{Fee=formatter.format((parseFloat(giftAmount)/0.992)-parseFloat(giftAmount));}} 38TotalAmount=giftAmount;OriginalAmount=giftAmount;if($('#GivingModal #giveCoverFee').prop('checked')==true){TotalAmount=parseFloat(giftAmount)+parseFloat(Fee);if(isNaN(TotalAmount)){TotalAmount=0;} 39showTotalAmount=formatter.format(TotalAmount);$('#GivingModal #btnValue').html(showTotalAmount);}else{showTotalAmount=formatter.format(TotalAmount);$('#GivingModal #btnValue').html(showTotalAmount);}} 40function get_startdate_monthly(date_in_month){date=new Date();var nowtime=date.getHours()+':'+date.getMinutes()+':'+date.getSeconds();var ret=new Date(date||new Date());var temp;if(date_in_month<ret.getDate()){day=date_in_month;if(date_in_month.length<2){day='0'+day;} 41month=String(ret.getMonth()+2);if(month.length<2){month='0'+month;} 42tmp=ret.getFullYear()+'-'+month+'-'+day+' '+nowtime;OriSubStartDate=ret.getFullYear()+'-'+month+'-'+day+' '+nowtime;tmp=toTimestamp(tmp);SubStartDate=tmp;}else{day=date_in_month;if(date_in_month.length<2){day='0'+day;} 43month=String(ret.getMonth()+1);if(month.length<2){month='0'+month;} 44tmp=ret.getFullYear()+'-'+month+'-'+day+' '+nowtime;OriSubStartDate=ret.getFullYear()+'-'+month+'-'+day+' '+nowtime;tmp=toTimestamp(tmp);SubStartDate=tmp;}} 45function get_startdate_weekly(day_in_week){date=new Date();var nowtime=date.getHours()+':'+date.getMinutes()+':'+date.getSeconds();var ret=new Date(date||new Date());var temp;if(ret.getDay()==day_in_week){temp=ret.toISOString().slice(0,10)+' '+nowtime;OriSubStartDate=ret.toISOString().slice(0,10)+' '+nowtime;temp=toTimestamp(temp);SubStartDate=temp;}else{ret.setDate(ret.getDate()+(day_in_week-1-ret.getDay()+7)%7+1);temp=ret.toISOString().slice(0,10)+' '+nowtime;OriSubStartDate=ret.toISOString().slice(0,10)+' '+nowtime;temp=toTimestamp(temp);SubStartDate=temp;}} 46function getDateTimeNow(){var today=new Date();var date=today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();var time=today.getHours()+":"+today.getMinutes()+":"+today.getSeconds();var dateTime=date+' '+time;return dateTime;} 47function start_attach_ach_customer(_accid,_firstname,_lastname,_email,_pwd,_account_holder_name,_account_holder_type,_account_number,_routing_number){axios.defaults.headers.common['Authorization']='Bearer '+accToken;axios.post(axiosGivingURLEndPoint+'/ach/'+platformID+'/attach',{usrID:platformID,siteID:activeSiteID,accid:_accid,firstname:_firstname,lastname:_lastname,email:_email,pwd:_pwd,account_holder_name:_account_holder_name,account_holder_type:_account_holder_type,account_number:_account_number,routing_number:_routing_number,}).then(function(response){console.log(response.data);if(response.data.result=='success'){$('#GivingAchSetup #acherror').hide();$('#GivingAchSetup #btnACHProcess').hide();$('#GivingAchSetup #btnACHSubmit').show();if($('#peopleprofilephoto').length>0&&GiverAccID!=""){GiverAccBaID=response.data.achid;GiverAccBaStatus=response.data.achstatus;if(GiverAccBaID!=''&&GiverAccBaStatus=='requires_action'){disabled_ach_verified(true);$('#ach-element').hide();$('#ach-verify').show();$('#ach-verified').hide();if($('#givePaymentMethodsTranslist').length>0&&$('#givingCard-tab').parent().hasClass('active')){$('#achButton').trigger('click');load_giving_tab('paymentmethod');}}}else{if(response.data.message=="ACH Already Attached"){$('#ach-element').hide();$('#ach-element-login #achInformation').html('ACH account already attached, please login to use it.') 48$('#ach-element-login').show();}else{$('#ach-element').hide();$('#ach-element-login #achInformation').html('Verification code will be sent to your bank account statement, it takes 1-2 working days to show up on. To verify, please login. For login details, please check your email.') 49$('#ach-element-login').show();}} 50cancel_ach_bank(ActiveACHsetup);}}).catch(function(error){console.log('ERROR : '+error.message);$('#GivingAchSetup #acherror').show();$('#GivingAchSetup #btnACHProcess').hide();$('#GivingAchSetup #btnACHSubmit').show();}).then(function(){});} 51function start_giving_process_ach(_accid,_firstname,_lastname,_email,_recurring,_interval,_frequency,_startdate,_oristartdate,_fee,_feecovered,_totalamount,_originalamount,_fund,_pwd,_comment){var _tokenid='';var _timezone=Intl.DateTimeFormat().resolvedOptions().timeZone;$('#GivingModal #ccinfoerror').hide();_tokenid=GiverBankPM;_transactiondate=getDateTimeNow();axios.defaults.headers.common['Authorization']='Bearer '+accToken;axios.post(axiosGivingURLEndPoint+'/ach/'+platformID+'/give',{usrID:platformID,siteID:activeSiteID,accid:_accid,firstname:_firstname,lastname:_lastname,email:_email,recurring:_recurring,interval:_interval,frequency:_frequency,startdate:_startdate,oristartdate:_oristartdate,gifttype:'Online',offlinetype:'',fee:_fee,feecovered:_feecovered,totalamount:_totalamount,originalamount:_originalamount,tokenid:_tokenid,fundid:_fund,transactiondate:_transactiondate,timezone:_timezone,pwd:_pwd,comment:_comment,}).then(function(response){if(response.data.result=='failed'){$('#GivingModal #ccinfoerror').html('<small style="color:red"><sup>*</sup>'+response.data.message+'</small>');$('#GivingModal #ccinfoerror').show();$('#GivingModal #giveBtn').show();$('#GivingModal #giveBtnProcess').hide();return false;} 52var clientSecret=response.data.params.client_secret;if(_recurring!='Recurring'){stripe.confirmUsBankAccountPayment(clientSecret,{}).then(function(result){if(result.error){console.log('Bank Account Payment intent confirmation failed');$('#GivingModal #ccinfoerror').html('<small style="color:red"><sup>*</sup>'+result.error.message+'</small>');$('#GivingModal #ccinfoerror').show();$('#GivingModal #giveBtn').show();$('#GivingModal #giveBtnProcess').hide();console.log(result.error.message)}else{console.log('Payment intent confirmed!');console.log(JSON.stringify(result,null,2));clear_gift_form();$('#GivingModal').modal('hide');$('#GivingThanks').modal('show');insert_give_activity_log(_accid,response.data.givetransID,_totalamount,_transactiondate);}})}else{clear_gift_form();$('#GivingModal').modal('hide');$('#GivingThanks').modal('show');insert_give_activity_log(_accid,response.data.givetransID,_totalamount,_transactiondate);}}).catch(function(error){$('#GivingModal #ccinfoerror').html('<small style="color:red"><sup>*</sup>'+error.response.data.message+'</small>');$('#GivingModal #ccinfoerror').show();$('#GivingModal #giveBtn').show();$('#GivingModal #giveBtnProcess').hide();console.log('STRIPE ERROR : '+error.response.data.message);}).then(function(){});} 53function start_giving_process(_accid,_firstname,_lastname,_email,_recurring,_interval,_frequency,_startdate,_oristartdate,_fee,_feecovered,_totalamount,_originalamount,_fund,_pwd,_GiverCTok,_comment){var _tokenid='';var _timezone=Intl.DateTimeFormat().resolvedOptions().timeZone;$('#GivingModal #ccinfoerror').hide();_tokenid=_GiverCTok;_transactiondate=getDateTimeNow();axios.defaults.headers.common['Authorization']='Bearer '+accToken;axios.post(axiosGivingURLEndPoint+'/give/'+platformID,{usrID:platformID,siteID:activeSiteID,accid:_accid,firstname:_firstname,lastname:_lastname,email:_email,recurring:_recurring,interval:_interval,frequency:_frequency,startdate:_startdate,oristartdate:_oristartdate,gifttype:'Online',offlinetype:'',fee:_fee,feecovered:_feecovered,totalamount:_totalamount,originalamount:_originalamount,tokenid:_tokenid,fundid:_fund,transactiondate:_transactiondate,timezone:_timezone,pwd:_pwd,comment:_comment,}).then(function(response){console.log(response.data);if(response.data.result=='failed'){$('#GivingModal #grpgiveFirstName').addClass('has-error');$('#GivingModal #grpgiveLastName').addClass('has-error');return false;} 54var clientSecret=response.data.params.client_secret;if(_recurring!='Recurring'){stripe.confirmCardPayment(clientSecret,{payment_method:{card:cardElement,}}).then(function(result){if(result.error){console.log('Payment intent confirmation failed');$('#GivingModal #ccinfoerror').html('<small style="color:red"><sup>*</sup>'+result.error.message+'</small>');$('#GivingModal #ccinfoerror').show();$('#GivingModal #giveBtn').show();$('#GivingModal #giveBtnProcess').hide();console.log(result.error.message)}else{console.log('Payment intent confirmed!');console.log(JSON.stringify(result,null,2));cardElement.clear();clear_gift_form();$('#GivingModal').modal('hide');$('#GivingThanks').modal('show');insert_give_activity_log(_accid,response.data.givetransID,_totalamount,_transactiondate);}})}else{clear_gift_form();$('#GivingModal').modal('hide');$('#GivingThanks').modal('show');insert_give_activity_log(_accid,response.data.givetransID,_totalamount,_transactiondate);}}).catch(function(error){$('#GivingModal #ccinfoerror').html('<small style="color:red"><sup>*</sup>'+error.response.data.message+'</small>');$('#GivingModal #ccinfoerror').show();$('#GivingModal #giveBtn').show();$('#GivingModal #giveBtnProcess').hide();console.log('STRIPE ERROR : '+error.response.data.message);}).then(function(){});} 55function insert_give_activity_log(_accid,_giverID,_totalAmount,_transactiondate){$.post('/ajax/insert-give-activity-log/?pseudoParam='+new Date().getTime()+"",{accid:_accid,module:'Giving',pk:_giverID,transactiondate:_transactiondate,title:'Online gift · $'+_totalAmount},function(data){});} 56function clear_gift_form(){$('#GivingModal #GiftAmount').val('');$('#GivingModal
56#FreqSelect').val('OneTime') 57$('#GivingModal #giveFreqOne').removeClass('active').addClass('inactive');$('#GivingModal #giveFreqTwo').removeClass('active').addClass('inactive');$('#GivingModal #FreqWM').attr('disabled',true);$('#GivingModal #giveFreqWeekSelect').attr('disabled',true);$('#GivingModal #giveFreqMonthSelect').attr('disabled',true);$('#GivingModal #btnValueText').html("");$('#GivingModal #giveCoverFee').prop('checked',false);$('#GivingModal #giveBtn').show();$('#GivingModal #giveBtnProcess').hide();} 58function validate_gift_form(){pass=true;if(!$('#GivingModal #FundCat').val()){$('#GivingModal #giveFundCat').addClass('has-error');pass=false;}else{$('#GivingModal #giveFundCat').removeClass('has-error');} 59if($('#GivingModal #GiftAmount').val()==''){$('#GivingModal #grpGiftAmount').addClass('has-error');pass=false;}else{$('#GivingModal #grpGiftAmount').removeClass('has-error');} 60if($('#GivingModal #giveFirstName').val()==''){$('#GivingModal #grpgiveFirstName').addClass('has-error');pass=false;}else{$('#GivingModal #grpgiveFirstName').removeClass('has-error');} 61if($('#GivingModal #giveLastName').val()==''){$('#GivingModal #grpgiveLastName').addClass('has-error');pass=false;}else{$('#GivingModal #grpgiveLastName').removeClass('has-error');} 62if($('#GivingModal #giveEmail').val()==''){$('#GivingModal #grpgiveEmail').addClass('has-error');pass=false;}else{$('#GivingModal #grpgiveEmail').removeClass('has-error');} 63return pass;} 64function check_account_giver(){if(validate_gift_form()){$('#GivingModal #giveBtn').hide();$('#GivingModal #giveBtnProcess').show();$('#GivingModal #ccinfoerror').hide();var _giveFirstName=$('#GivingModal #giveFirstName').val();var _giveLastName=$('#GivingModal #giveLastName').val();var _giveEmail=$('#GivingModal #giveEmail').val();var _recurring=$('#GivingModal #FreqSelect').val();var _interval=$('#GivingModal #FreqWM').val();var _frequency='';var _startdate=SubStartDate;var _oristartdate=OriSubStartDate;var _fee=Fee;var _totalamount=TotalAmount;var _fundid=$('#GivingModal #FundCat').val();var _originalAmount=OriginalAmount;var _feecovered='F';if($('#GivingModal #giveCoverFee').prop('checked')==true){_feecovered='T';} 65if(_recurring=='Recurring'){if(_interval=='week'){_frequency=$('#GivingModal #giveFreqWeekSelect').val();}else if(_interval=='month'){_frequency=$('#GivingModal #giveFreqMonthSelect').val();}} 66var _comment=$('#GivingModal #GivingMemo').val();if(GiverPaymentMethod=="card"){token=stripe.createToken(cardElement).then(function(result){if(result.error){$('#GivingModal #ccinfoerror').html('<small style="color:red"><sup>*</sup>'+result.error.message+'</small>');$('#GivingModal #ccinfoerror').show();$('#GivingModal #giveBtn').show();$('#GivingModal #giveBtnProcess').hide();console.log(result.error.message);}else{GiverCTok=result.token.id;$.post('/ajax/validate-giver-account/?pseudoParam='+new Date().getTime()+"",{giveFirstName:_giveFirstName,giveLastName:_giveLastName,giveEmail:_giveEmail,giveSiteID:activeSiteID},function(data){data=JSON.parse(data);if(data.result=='success'){_giveFirstName=data.params.fname;_giveLastName=data.params.lname;start_giving_process(data.params.accID,_giveFirstName,_giveLastName,_giveEmail,_recurring,_interval,_frequency,_startdate,_oristartdate,_fee,_feecovered,_totalamount,_originalAmount,_fundid,data.params.pwd,GiverCTok,_comment);}});}});}else if(GiverPaymentMethod=="ach"){$.post('/ajax/validate-giver-account/?pseudoParam='+new Date().getTime()+"",{giveFirstName:_giveFirstName,giveLastName:_giveLastName,giveEmail:_giveEmail,giveSiteID:activeSiteID},function(data){data=JSON.parse(data);if(data.result=='success'){_giveFirstName=data.params.fname;_giveLastName=data.params.lname;start_giving_process_ach(data.params.accID,_giveFirstName,_giveLastName,_giveEmail,_recurring,_interval,_frequency,_startdate,_oristartdate,_fee,_feecovered,_totalamount,_originalAmount,_fundid,data.params.pwd,_comment);}});}}else{$('#GivingModal #giveBtn').show();$('#GivingModal #giveBtnProcess').hide();}} 67function get_fundlist(){axios.defaults.headers.common['Authorization']='Bearer '+accToken;axios.get(axiosGivingURLEndPoint+'/fund/'+platformID+'/'+activeSiteID+'/active').then(function(response){_fundlist=response.data.params;$.each(response.data.params,function(key,value){$('#FundCat').append($("<option></option>").attr("value",value.id).text(value.fund_name));});}).catch(function(error){console.log(error);}).then(function(){});} 68function initApiConfiguration(){axios.get('/ajax/getApiConfig/').then(function(response){console.log('Init ApiConfig Success');if(response&&response.data&&response.data.params){platformID=response.data.params.platformid||'';accToken=response.data.params.token||'';axiosGivingURLEndPoint=response.data.params.givingurl||'';activeSiteID=response.data.params.siteid||'';GiverAccID=response.data.params.gaccid||'';GiverFirstName=response.data.params.gfname||'';GiverLastName=response.data.params.glname||'';GiverEmail=response.data.params.gemail||'';SpKzI=response.data.params.spkzi||'';axiosCmsURLEndPoint=response.data.params.cmsurl||'';cmsToken=response.data.params.cmstoken||'';check_giving_status();}else{console.error('Invalid API configuration response:',response);}}
68).catch(function(error){console.log(error);}).then(function(){});} 69function get_giving_setting(){axios.defaults.headers.common['Authorization']='Bearer '+accToken;axios.get(axiosGivingURLEndPoint+'/church/'+platformID+'/setting/'+activeSiteID).then(function(response){if(response.data.result=='success'){if(response.data.params.length!=0){console.log('Init Setting Success');churchID=response.data.params[0].id;accConID=response.data.params[0].conacid;givingProductID=response.data.params[0].givaccid;callStripeLib();GivingSetup=true;}}else{$('#GiveButtonTypeSetting').remove();}}).catch(function(error){console.log(error);}).then(function(){});} 70function callStripeLib(){$.getScript("https://js.stripe.com/v3/").done(function(script,textStatus){createGivingModal();if($('#GiveButton #GiveButtontxtShow').length>0&&$('#GiveButton #GiveButtontxtShow').attr('data-givetype')=='popup'){$('#GiveButton').css('opacity','');} 71console.log('Init Create Modal Success');if(window.location.hash=='#giving'){if($('#profileGivingTab').length>0){check_giving_setup();$('#profileGivingTab a[href="#giving"]').tab('show');}}}).fail(function(jqxhr,settings,exception){});} 72function giving_login(){$('#GivingModal').modal('hide');show_login_form();} 73function setCookie(cname,cvalue,exdays){const d=new Date();d.setTime(d.getTime()+(exdays*24*60*60*1000));let expires="expires="+d.toGMTString();document.cookie=cname+"="+cvalue+";"+expires+";path=/";} 74function getCookie(cname){let name=cname+"=";let decodedCookie=decodeURIComponent(document.cookie);let ca=decodedCookie.split(';');for(let i=0;i<ca.length;i++){let c=ca[i];while(c.charAt(0)==' '){c=c.substring(1);} 75if(c.indexOf(name)==0){return c.substring(name.length,c.length);}} 76return"";} 77function toTimestamp(strDate){var datum=Date.parse(strDate);return datum/1000;} 78function formatNumber(n){return n.replace(/\D/g,"").replace(/\B(?=(\d{3})+(?!\d))/g,",")} 79function formatCurrency(input,val,blur){var input_val='';if(typeof(val)!='undefined'&&val!=''){input_val=val;}else{input_val=input.val();} 80input_val=String(input_val);if(input_val===""){return;} 81var original_len=input_val.length;var caret_pos='';if(typeof(val)!='undefined'&&val!=''){caret_pos='';}else{caret_pos=input.prop("selectionStart");} 82if(input_val.indexOf(".")>=0){var decimal_pos=input_val.indexOf(".");var left_side=input_val.substring(0,decimal_pos);var right_side=input_val.substring(decimal_pos);left_side=formatNumber(left_side);right_side=formatNumber(right_side);if(blur==="blur"){right_side+="00";} 83right_side=right_side.substring(0,2);input_val=left_side+"."+right_side;}else{input_val=formatNumber(input_val);input_val=input_val;if(blur==="blur"){input_val+=".00";}} 84if(typeof(val)!='undefined'&&val!=''){return input_val;}else{input.val(input_val);var updated_len=input_val.length;caret_pos=updated_len-original_len+caret_pos;input[0].setSelectionRange(caret_pos,caret_pos);}}
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.