PURSUIT BOATS – Build a boat

PURSUIT BOATS – Build a boat maxTextAreaLength) rfq.whereDoYouBoat = rfq.whereDoYouBoat.substr(0,maxTextAreaLength); if (rfq.howHearAbout.length > maxTextAreaLength) rfq.howHearAbout = rfq.howHearAbout.substr(0,maxTextAreaLength); if (rfq.additionalComments.length > maxTextAreaLength) rfq.additionalComments = rfq.additionalComments.substr(0,maxTextAreaLength); $(‘#requestQuoteButton’).text(‘Please wait…’); $(‘#requestQuoteButton’).get(0).disabled = true; $(‘#cancelButton’).get(0).disabled = true; /* if (rfq.countrySelect != ‘US’) rfq.stateSelect = ”; if (rfq.countrySelect != ‘CA’ && rfq.countrySelect != ‘US’) rfq.zip = ”; */ /* lead = { “Leadmanagementinstanceid” : “16”, “productlineid” : “1”, “reasonforcontactid” : “9”, // Price Quote “leadsourceid” : “6”, // Pursuit Boats website (www.pursuitboats.com) “productid” : rfq.boatid, // Specific boat ID (S280, C280, etc) “leadfirstname” : rfq.lastName, “leadlastname” : rfq.firstName, “leadzip” : rfq.zip, “leadhomephone” : rfq.homePhone, “leadcellphone” : rfq.mobilePhone, “leadalternatephone” : “”, “leademailaddress” : rfq.emailAddress, “leadaddress1” : rfq.streetAddress, “leadaddress2” : “”, “leadcity” : rfq.city, “leadstate” : rfq.stateSelect, “leadcomments” : rfq.additionalComments, “leadcountry” : rfq.countrySelect, // Use ISO 3166 Standard for country names “emailoptin” : “1”, // User will receive Pursuit emails and promotions “_buildaboat” : “1”, // To make searching Build-a-boat entries easier “_boat_url” : “http://pursuitboats.com/buildaboat/?xd=1&r=” + rfq.FUID // URL }; */ lead = { boatid : rfq.boatid, firstname : rfq.firstName, lastname : rfq.lastName, zip : rfq.zip, homephone : rfq.homePhone, mobilephone : rfq.mobilePhone, email : rfq.emailAddress, address1 : rfq.streetAddress, address2 : “”, city : rfq.city, state : rfq.stateSelect, comment : rfq.additionalComments, // + “n” + “http://pursuitboats.com/buildaboat/?xd=1&r=” + rfq.FUID, URL country : rfq.countrySelect, whereBoat : rfq.whereDoYouBoat, HowHear : rfq.howHearAbout, boaturl : “http://www.pursuitboats.com/buildaboat/?xd=1&r=” + rfq.FUID }; pursuitLeadURL = “/Inquiries/aimbase-sendBAB.php”; //pursuitLeadURL = “http://viewyourleads.net/pursuit/remoteinfo.php?l=1”; //pursuitLeadURL = “remoteinfo.php?l=1”; //pursuitLeadURL = “http://projects.imavit.com/remoteinfo.php?l=1”; $.ajaxSetup ({ async: false }); try { $.post(pursuitLeadURL,lead); } catch(e) { console.log(e); } // Send object to SS; on success, return URL and close dialog $.post(“buildaboatrfq.php”, {“requestType”:”rfq”,”rfq”:rfq} ) .success(function(d) { if (d.responseType == ‘Error’) { alert(‘There was an error processing your request: ‘ + d.errorMessage); closeRfqDialog(); return; } alert(‘Your boat has been saved to your browser’s address bar. You may bookmark this page or send the link via email. ‘+ ‘Your message has been sent to the Pursuit Boats dealer you selected; They will contact you shortly. Thanks!’); location = d.linkToRFQ; } ) .error(function() { alert(‘There was an error processing your request.’); closeRfqDialog(); }) } function validateZip() { z = $(‘#zip’).val(); switch($(‘#countrySelect’).val()) { case ‘US’: if (z.length != 5) return; if (z.match(/d{5}/) == null) return; // Must be a five-digit zip code for US dealerLocator.getByZipCode(z); break; case ‘CA’: z = z.toUpperCase().replace(/s/g,”); if (z.match(/([ABCEGHJKLMNPRSTVXY]d[ABCEGHJKLMNPRSTVWXYZ])(d[ABCEGHJKLMNPRSTVWXYZ]d)/) == null) return; // Must be a valid CA postal code dealerLocator.getByPostalCode(z); break; } } function selectDealer(idx) { dealerLocator.selectedDealerEmail = dealerLocator.returnedDealers[idx].email; $(‘.dealerEntry’).removeClass(‘selectedDealer’); $(‘#dealerDiv’+idx).addClass(‘selectedDealer’); } // Populate dealers function displayDealers() { if (currentStep > steps.Model) { if (rfqDialogObject.css(‘display’) == ‘none’) footerFloatObject.show(); footerFloatObject.css(‘top’,(windowObject.height() + documentObject.scrollTop() – 94) + ‘px’); if (!footerFloatObject.hasClass(‘noPrint’)) footerFloatObject.addClass(‘noPrint’); } else { footerFloatObject.hide(); } if (!dealerLocator.waitingOnReturnedDealers) return; dealerLocator.waitingOnReturnedDealers = false; if (dealerLocator.returnedDealers.length == 0) { $(‘#listOfDealersPrompt’).html(‘Please enter your country or zip code to display a list of authorized Pursuit dealers.’); return; } bob = ”; br = ‘
‘; for (i=0; i360º Tour’; boat = boatThumb.replace(/%designator%/g,boats[b][model].designator) .replace(/%boatUID%/g,boatUIDs.length-1) .replace(/%boattitle%/g,boats[b][model].title) //6-17-20 Alt text for boat thumbs and heading .replace(/%thumbAlt%/g,boats[b][model].thumbAlt) .replace(/%headingAlt%/g,boats[b][model].headingAlt) .replace(/%Preliminary%/g,boats[b][model].Preliminary) .replace(/%has360Tour%/g,has360Tour); row += boat; } properClassName = b.replace(/s/,”); hiddenClass = (properClassName == ‘InshoreSeries’) ? ‘ style=”display:none”‘ : ”; boatClassHTML += boatClassDiv .replace(/%class%/g,properClassName) .replace(/%rows%/,row) .replace(/%classDisplay%/,b) .replace(/%classHidden%/g,hiddenClass); //boatClassHTML += boatClassDiv } $(‘#boatSelectionDiv’).html(boatClassHTML); //showStep(steps.Model); } function dealerPromotionEnable(uid) { ck = $(‘#dealerPromotionalCheckbox’+uid); thisDesc = $(‘#dealerPromotionDescription’+uid); thisDiscount = $(‘#dealerPromotionDiscount’+uid); if (ck.hasClass(‘checkboxChecked’)) { // Uncheck the box ck.removeClass(‘checkboxChecked’); thisDesc.addClass(‘isHidden’); thisDiscount.addClass(‘isHidden’); delete dealerPromotions[uid]; } else { // Check the box ck.addClass(‘checkboxChecked’); thisDesc.val(”); thisDesc.removeClass(‘isHidden’); thisDiscount.val(”); thisDiscount.removeClass(‘isHidden’); dealerPromotions[uid] = {description:”,discount:”}; } } function updateDealerPromotions() { $(‘.dealerPromotionDescription’).each(function(a,b) { idx = b.id.match(/^.+?(d+)$/)[1]; thisDesc = $(b); thisDiscount = $(‘#dealerPromotionDiscount’+idx); thisCk = $(‘#dealerPromotionalCheckbox’+idx); if (thisCk.hasClass(‘checkboxChecked’)) { desc = thisDesc.val(); disc = thisDiscount.val(); dealerPromotions[idx] = {description:desc,discount:disc}; } }); calculateOptionsCost(); } function dealerPromotionColumn(o) { col=”; if (isDealer) { // Display checkbox, description and discount isChecked = (typeof(dealerPromotions[o]) != ‘undefined’) ? ‘ checkboxChecked’ : ”; col+=”+ ”; isHidden = (typeof(dealerPromotions[o]) == ‘undefined’) ? ‘ isHidden’ : ”; desc = ”; disc = ”; if (typeof(dealerPromotions[o]) != ‘undefined’) { desc = dealerPromotions[o].description; disc = dealerPromotions[o].discount; } col+=”; col+=”; } else { // Display only text and discount – no checkbox or text fields if (typeof(dealerPromotions[o]) != ‘undefined’) { col += dealerPromotions[o].description;// + ‘: ‘ + dealerPromotions[o].discount; } } return col; } function bkgdDim(f) { $(‘.bkgdDim’).hide(); if (f) $(‘.bkgdDim’).show(); } function displayCost(c,uid) { if (typeof(c) == ‘undefined’) return(‘N/C’); if (c == 0) return(‘N/C’); discountedCost = getDiscountedCost(c,uid); if (discountedCost != c) { // Discounted cost return(”+formatCost(c)+’  ‘ + formatCost(discountedCost)); } else { // Not discounted return(formatCost(c)); } } function getDiscountedCost(cost,idx) { realCost = cost; if (typeof(dealerPromotions[idx]) != ‘undefined’) { disc = dealerPromotions[idx].discount; if (disc != ”) { // Percentage or number? if (disc.indexOf(‘%’) != -1) { disc = parseInt(disc.substr(0,disc.length-1)); if (!isNaN(disc)) realCost *= ((100-disc) / 100); } else { // Number? disc = parseInt(disc); if (!isNaN(disc)) realCost -= disc; } } } if (realCost < 0) realCost = 0; return(realCost); } // Updates summary cost table function calculateOptionsCost() { // Calculate cost of boat cost = 0; nondiscountcost = 0; for (var s in selectedUIDs) { idx = selectedUIDs[s]; // Apply promotional discounts nondiscountcost += UIDs[idx].cost; realCost = getDiscountedCost(UIDs[idx].cost,idx); cost += realCost; } // If dealer/taxes don't exist, add them if (isDealer && typeof(dealerPromotions[1000]) == 'undefined') { dealerPromotions[1000] = {description:"Freight / Delivery",discount:0 }; dealerPromotions[1001] = {description:"Tax",discount:0 }; } // Factor in additional (non-attached to options) dealer promotional items startIdx = 1000; while (typeof(dealerPromotions[startIdx]) != 'undefined') { cost -= dealerPromotions[startIdx].discount; ++startIdx; } $('.finalPriceTable').remove(); sendDealerButton = ' ‘; priceDisclaimer = ‘
Total MSRP with selected options; does not include tax, dealer prep or freight.’; if (nondiscountcost == cost) { $(‘#finalprice’).html(‘

Price:’+priceDisclaimer+’

‘+formatCost(cost)+”+sendDealerButton+”); } else { $(‘#finalprice’).html(‘

Price:’+priceDisclaimer+’

‘+formatCost(nondiscountcost)+”+ ‘  ‘+formatCost(cost)+”+sendDealerButton+”); } costTable = ‘

‘; costTable += ‘

Color Options:

Dealer Promotions

 ‘; for (var s in selectedUIDs) { opt = UIDs[selectedUIDs[s]]; if (opt.type == ‘colorSelection’) { if (typeof(opt.color) != ‘undefined’) { costTable += ‘

‘+ ‘   

‘ + opt.colorSelectionType + ‘:
‘ + opt.color.title + ‘  

‘+ ”; if (typeof opt.color.RGB2 != ‘undefined’) costTable += ”; costTable += ”+ ‘

‘ + dealerPromotionColumn(selectedUIDs[s]) + ”+ ‘ ‘ + displayCost(opt.cost,selectedUIDs[s]) + ”; } else if (typeof(opt.fabric) != ‘undefined’) { costTable += ‘

   ‘ + opt.colorSelectionType + ‘:
‘ + opt.fabric.title + ‘  ‘+ ‘
‘ + dealerPromotionColumn(selectedUIDs[s]) + ”+ ‘ ‘ + displayCost(opt.cost,selectedUIDs[s]) + ”; } } } costTable += ‘

EDIT OPTIONS’; costTable += ‘

Optional Equipment:

   ‘; // List optional equipment (and prices) for (var s in selectedUIDs) { opt = UIDs[selectedUIDs[s]]; if (opt.type == ‘optionalEquipment’) costTable += ‘

   ‘ + opt.name + ‘    ‘+ ‘ ‘+ dealerPromotionColumn(selectedUIDs[s]) +”+ ‘ ‘ + displayCost(opt.cost,selectedUIDs[s]) +”; } // Additional dealer promotions – descriptions only startIdx = 1000; while (typeof(dealerPromotions[startIdx]) != ‘undefined’) { if (startIdx == 1000) { // Header: First item only costTable += ‘

  ‘; costTable += ‘

Dealer Promotions:

   ‘; } costTable += ‘

   ‘; if (isDealer) { costTable += ‘Edit ‘; costTable += ‘Delete ‘; } costTable += dealerPromotions[startIdx].description +”+ ‘

‘+ formatCost(dealerPromotions[startIdx].discount)+”; ++startIdx; } costTable += ‘

EDIT OPTIONS’; costTable += ‘

 ‘; if (isDealer) { costTable += ‘



Source

Leave a Reply