Tom Ford Glasses FT-5665-B 001 (2025)

270,83$US

Tom Ford Glasses FT-5665-B 001 (1) Article In stock
1 remaining in stock

Size: L

`;}}$("#lensesTypeSecondOffer").html(lensesTypeSecondOffer);}};function onlyloupes() {$.ajax({type: "POST",url: '/check-lense-price',data: {is_pricee: '0'},cache: false,success: function (response) {eyeGlassLensesJsonData = JSON.parse(response);/********//Form 5 - step 1 Data********///$('#app_lense_form_step_5_1 #app_lenses_step1_products_options_values').val(eyeGlassLensesJsonData.step1b_name.name_en);$('#app_lense_form_step_5_1 #app_lenses_step1_products_options_values').val( 'Readers glasses' );$('#app_lense_form_step_5_1 #app_lenses_step1_nameId').val(eyeGlassLensesJsonData.group_id_4.nameId);$('#app_lense_form_step_5_1 #app_lenses_step1_products_options').val(eyeGlassLensesJsonData.step1b_name.name_en);$('#app_lense_form_step_5_1 #app_lenses_step3_products_options_values').val(eyeGlassLensesJsonData.lens_step_3.name_en);$('#app_lense_form_step_5_1 #app_lenses_step3_nameId').val(eyeGlassLensesJsonData.lens_step_3.nameId);$('#app_lense_form_step_5_1 #app_lenses_step3_products_options').val(eyeGlassLensesJsonData.lens_step_3.name_en);price_step_3 = `%${eyeGlassLensesJsonData.lens_step_3.name_en}%0`;$('#app_lense_form_step_5_1 #app_lenses_step3_lenses').val(price_step_3);// form 5 option 2nd$('#app_lense_form_step_5_2 #app_lenses_step1_products_options_values').val(eyeGlassLensesJsonData.lens_option_id_20.name_en);$('#app_lense_form_step_5_2 #app_lenses_step1_nameId').val(eyeGlassLensesJsonData.lens_option_id_20.nameId);$('#app_lense_form_step_5_2 #app_lenses_step1_products_options').val(eyeGlassLensesJsonData.step1b_name.name_en);$('#app_lense_form_step_5_2 #app_lenses_step3_products_options_values').val(eyeGlassLensesJsonData.lens_step_3.name_en);$('#app_lense_form_step_5_2 #app_lenses_step3_nameId').val(eyeGlassLensesJsonData.lens_step_3.nameId);$('#app_lense_form_step_5_2 #app_lenses_step3_products_options').val(eyeGlassLensesJsonData.lens_step_3.name_en);price_step_3 = `%${eyeGlassLensesJsonData.lens_step_3.name_en}%0`;$('#app_lense_form_step_5_2 #app_lenses_step3_lenses').val(price_step_3);}});}/* Popup hide Show Functionality */$('.js-toggle-first').click(function() {$(this).toggleClass("is-active");$('html').toggleClass("select-options-show");$('#popup_2').hide();$('.main-popup').show();});/* on close popup button click event */$('.js-close').click(function() {$('.js-toggle-first').removeClass("is-active");$('html').removeClass("select-options-show"); $('.sg_popup').hide();resetSelectedPDData();resetSelectedPrescriptionsData();resetSelectedMutData();});/* popup options click Event */$(document).on('click', '.action-list', function(){$('.action-list__item').removeClass('active');$(this).children('.action-list__item').addClass('active');let url = $(this).attr('data-link');formId = $(this).attr('data-form-id');// Updating the popup button Labelsif(formId == 'app_lense_form_step_3' || 'app_lense_form_step_6' == formId){$('.confirm__btn_js').text('Add to Cart');}else{$('.confirm__btn_js').text('Continue');} // Updating the popup button events$('.confirm__btn_js').removeClass('tool-tips').attr('title', '');if('' != url ){$('.confirm__btn_js').removeClass('btn--disabled unclick').attr('href', 'javascript:void(0);').attr('href', url);}});/***First Popup Confirm button click functinality**/$('.confirm__btn_js').click(function(){let currentForm = $('#' + formId);switch(formId) {case 'app_lense_form_step_3':{$(this).html(``);let ia = 1;let actionUrl = currentForm.attr('action');actionUrl.replace('---variantCode---',variantCode);if(ia == 1){$.ajax({type: "POST",url: actionUrl,data: currentForm.serialize(),cache: false,success: function (response) {if(response ){addToCart();}}});ia = 2;}}break;case 'app_lense_form_step_4':{$(this).html(``);let actionUrl = currentForm.attr('action');let optionPrice = $('input[name=action_option]:checked').val();let step1Val = $('#app_lense_form_step_4 #app_lenses_step1_products_options_values').val();$('#app_lense_form_step_4 #app_lenses_step1_lenses').val(`%${step1Val}%${optionPrice}`);actionUrl.replace('---variantCode---',variantCode);let ia = 1;if(ia == 1) {$.ajax({type: "POST",url: actionUrl,data: currentForm.serialize(),cache: false,success: function (response) {if(response ){location.href = actionUrl;}}});ia = 2;}}break;case 'app_lense_form_step_5':{let iaop = 1;// It Will open the 2nd popup screen to choose optionsif(iaop == 1){$('.main-popup').hide(); $('#popup_2').show(); iaop = 2;}}break;case 'app_lense_form_step_6':$(this).html(``);// calling Direct Add to cart function with base pricelet ia = 1;if(ia == 1){addToCart();ia = 2;}break;default:// Need to choose at least 1 option for proceedbreak;}});$(document).on('click', '.confirm__btn_js_2', function() {let currentHtml = $(this).html();if('app_lense_form_step_5_1' == formId || 'app_lense_form_step_5_2' == formId){let lensePower = $('input[name=glass_power]:checked').val();let step5_Lense_Price = $('input[name=action_option_2]:checked').val();if('app_lense_form_step_5_2' == formId){let step52Val = $('#app_lense_form_step_5_2 #app_lenses_step1_products_options_values').val();$('#app_lense_form_step_5_2 #app_lenses_step1_lenses').val(`%${step52Val}%${step5_Lense_Price}`);}else{let step5Val = $('#app_lense_form_step_5_1 #app_lenses_step1_products_options_values').val();$('#app_lense_form_step_5_1 #app_lenses_step1_lenses').val(`%${step5Val}%${step5_Lense_Price}`);}if(undefined == lensePower || '' == lensePower){$('#sg-popup-step-initial').hide(); $('#popup_2').show(); }else{$(this).html(``);let curretForm = $('#' + formId);let ajxtime = 1;$('#' + formId + ' #app_lenses_prescription_order_comment').val(lensePower); let myURL = curretForm.attr('action');myURL.replace('---variantCode---',variantCode);if(1 == ajxtime){$.ajax({type: "POST",url: myURL,data: curretForm.serialize(),cache: false,success: function (response) {if(response ){addToCart();}}});ajxtime = 2;}}}else{$(this).attr('title','Choose the treatment Choose the power of the glasses').addClass('tool-tip');}});// Tootl tip and title messages for step 5-1,2$(document).on('mouseover', '.confirm__btn_js_2', function(){let lensePower = $('input[name=glass_power]:checked').val();let OtionVal = $('input[name=action_option_2]:checked').val();let lblTitle = 'Choose the treatment \n Choose the power of the glasses ';if(undefined == lensePower && undefined == OtionVal){$(this).attr('title', lblTitle).addClass('tool-tips');}else if(undefined == lensePower || '' == lensePower){$(this).attr('title', 'Choose the power of the glasses').addClass('tool-tips');}else if(undefined == OtionVal) {$(this).attr('title', 'Choose the treatment').addClass('tool-tips');}else{$(this).attr('title', '');$(this).removeClass('tool-tips btn--disabled');}});/*$('html').addClass('select-options-show');*//* commented this code, becuase it was causing to scroll product detail page content, i.e down area not visible */$('#popup_2').hide(); $('.main-popup').show(); $('.confirm__btn_js').text('Continue');$(document).on("my-event-afterLastDocumentReady", function () {/*$('html').addClass('select-options-show');*/$('#popup_2').hide(); $('.main-popup').show(); $('#thesquiggle').css('display','none');});let variantCode = $('input[name="sylius_add_to_cart[cartItem][variant]"]:checked').val();$(document).ready(function() {// Fires FOURTH// This event will fire after all the other $(document).ready() functions have completed.// Usefull when your script is at the top of the page, but you need it run last$(document).trigger("my-event-afterLastDocumentReady");handleRunTimeVariantCode();});let handleRunTimeVariantCode = function(){// http://dev.visio-net.fr/23523/23527/lenses/step/1// http://dev.visio-net.fr/23523/---variantCode---/lenses/step/1let vCode = $('input[name="sylius_add_to_cart[cartItem][variant]"]:checked').val();$('form[name="app_lenses"]').each(function(){let sampleActionUrl = $(this).find("input[name='temp_frm_action']").val();sampleActionUrl = sampleActionUrl.replace('---variantCode---',vCode);$(this).attr('action', sampleActionUrl);$(this).find("input[id='product_code']").val(vCode);});$('form[name="sunglass_app_lenses"]').each(function(){let sampleActionUrl = $(this).find("input[name='temp_frm_action']").val();sampleActionUrl = sampleActionUrl.replace('---variantCode---',vCode);$(this).attr('action', sampleActionUrl);$(this).find("input[id='product_code']").val(vCode);});$('label[name="change_url"]').each(function(){let sampleActionUrl = $(this).attr("data-link-sample");sampleActionUrl = sampleActionUrl.replace('---variantCode---',vCode);$(this).attr('data-link', sampleActionUrl);});/* detect, if size has been selected or not or exists more than one size, then lenses popup will be show/hide accordingly[ */let selectedVariantCode = 0;$(".link--variant").each((index, obj)=>{if( $(obj).hasClass("active")){selectedVariantCode = $(obj).attr("data-value");}});let isSelectSizeExists = $(".link--variant").length;if( parseInt(isSelectSizeExists) == 0 ){if( variantCode != "" ){$(".variantWiseShowHide").each((index,obj)=>{let onc = $(obj).attr("data-onc");$(obj).attr("onclick", onc);$(obj).removeClass('btn--disabled');$(obj).removeClass('tool-tips');$(obj).removeClass('lock__block');$(obj).removeClass('unclick'); });}} else {if( selectedVariantCode != "" ){$(".variantWiseShowHide").each((index,obj)=>{let onc = $(obj).attr("data-onc");$(obj).attr("onclick", onc);$(obj).removeClass('btn--disabled');$(obj).removeClass('tool-tips');$(obj).removeClass('lock__block');$(obj).removeClass('unclick');});} else {$(".variantWiseShowHide").each((index,obj)=>{$(obj).attr("onclick", "");$(obj).addClass('btn--disabled');$(obj).addClass('tool-tips');});}}/* ] */}/***Sunglasses Section Start Here**************************************************************************************************/var sunGlassLensesJsonData;var chosenSGLensesArrForAddToCart = [];let alreadyLoadedLensesData = [];var rootSGLenseKeyName;var loadedSGLenseTypeName;var loadedSGLenseTypeExtraDiscounts = [];//var isProductOnSales = ;var isProductOnSales = false;var showLblFrameDiscountSecondPairNotEligible = false;function at(n) {// ToInteger() abstract opn = Math.trunc(n) || 0;// Allow negative indexing from the endif (n < 0) n += this.length;// OOB access is guaranteed to return undefinedif (n < 0 || n >= this.length) return undefined;// Otherwise, this is just normal property accessreturn this[n];}const TypedArray = Reflect.getPrototypeOf(Int8Array);for (const C of [Array, String, TypedArray]) {Object.defineProperty(C.prototype, "at", { value: at,writable: true,enumerable: false,configurable: true });}loadSGLensesData = (lenseTypeName, categoryId)=>{loadedSGLenseTypeName = lenseTypeName;$('#sg-popup-step-multi-level #sg-popup-step-multi-level-inner').html('');$('#sg-popup-step-multi-level').show();/* to check, if data of requested lense Type is already loaded in earlier ajax call, then same is returned again, no need to request Ajax call again[ */const isLenseDataAlreadyLoaded = alreadyLoadedLensesData.some(el => el.key === lenseTypeName);if( isLenseDataAlreadyLoaded ){sunGlassLensesJsonData = '';let re = alreadyLoadedLensesData.find(obj => {return obj.key === lenseTypeName});sunGlassLensesJsonData = re.data;if( sunGlassLensesJsonData.extra_discounts.length > 0 && isProductOnSales ){showLblFrameDiscountSecondPairNotEligible = true;}if( !isProductOnSales ){loadedSGLenseTypeExtraDiscounts = sunGlassLensesJsonData.extra_discounts;}rootSGLenseKeyName = lenseTypeName; /* Object.keys(sunGlassLensesJsonData.sunglass_lenses)[0]; */loadSGPopupNextStep(rootSGLenseKeyName);return;}/* ] */$.ajax({type: "POST",url: '/get-sunglass-lenses',data: {'is_percee': '0', 'lense_type_name': lenseTypeName, 'categoryId': categoryId,'product_code': `54573`,'productPrescriptionRequirement': productPrescriptionRequirement},cache: false,success: function (response) {lensesTaxRate = JSON.parse(response).tax_rate;prescriptionId = JSON.parse(response).prescription_id;sunGlassLensesJsonData = JSON.parse(response);let tempObj = {key:lenseTypeName,data:sunGlassLensesJsonData,}alreadyLoadedLensesData.push(tempObj);rootSGLenseKeyName = lenseTypeName; /* Object.keys(sunGlassLensesJsonData.sunglass_lenses)[0]; */loadSGPopupNextStep(rootSGLenseKeyName);if( sunGlassLensesJsonData.extra_discounts.length > 0 && isProductOnSales ){showLblFrameDiscountSecondPairNotEligible = true;}if( !isProductOnSales ){loadedSGLenseTypeExtraDiscounts = sunGlassLensesJsonData.extra_discounts;}}});};var selectedSecondOfferId = 0;$('#sunglass_confirm__btn_js').click(()=>{let lenseTypeName = '';$(".lenseTypeOption-js").each(function(){let el = $(this).find(".action-list__item");if( $(el).hasClass("active")){lenseTypeName = $(el).attr("data-lense-type-name");selectedSecondOfferId = $(el).attr("data-second-offer-id");if (typeof selectedSecondOfferId == 'undefined' || selectedSecondOfferId == false) {selectedSecondOfferId = 0;}selectedSecondOfferId = parseInt(selectedSecondOfferId);}if( lenseTypeName != "" ){return false; /* to break the loop, if selected value found*/}});if( lenseTypeName == "" || typeof(lenseTypeName) == "undefined" ){return;}let categoryId = '51';if( lenseTypeName != "loupes-lecture" ) {loadSGLensesData(lenseTypeName, parseInt(categoryId));} else {// TODO: add here the loupes lecture callonlyloupes();let iaop = 1;// It Will open the 2nd popup screen to choose optionsif(iaop == 1){$('#sg-popup-step-initial').hide(); $('#popup_2').show(); iaop = 2;}}});let getTotalExtraDiscountAmt = ()=>{let theExchangeRate = 130 / 100;/* extra discounts(if any) handling[ */let extraDiscountAmtWithTax = 0;let extraDiscountTotalAmtWithTax = 0;for( let i = 0; i< loadedSGLenseTypeExtraDiscounts.length; i++ ){extraDiscountAmtWithTax = getTaxableAmount(parseFloat(loadedSGLenseTypeExtraDiscounts[i].price));extraDiscountAmtWithTax = (extraDiscountAmtWithTax * theExchangeRate).toFixed(2);extraDiscountTotalAmtWithTax = parseFloat(extraDiscountTotalAmtWithTax) + parseFloat(extraDiscountAmtWithTax);}/* ] */return extraDiscountTotalAmtWithTax;};function getSGPopUpBreadCrumb(sepator, showPrice = true, showProduct = true){if( typeof sepator == "undefined" || sepator==`` ){sepator = `
`;}let theExchangeRate = 130 / 100;let breadCrumbString = ``;if( showProduct == true ){breadCrumbString = `${ 'Tom Ford FT-5665-B 001' }
`;}if( showPrice == true ){let productPriceRaw = parseInt($('#sg-popup-step-last').attr('data-product-price'));let productPriceWithTax = parseFloat(getTaxableAmount(productPriceRaw));productPriceWithTax = (productPriceWithTax * theExchangeRate).toFixed(2);breadCrumbString += `: ${displayMoneyFormat(parseFloat(productPriceWithTax) + parseFloat(getTotalExtraDiscountAmt()))}
`;}chosenSGLensesArrForAddToCart.forEach(function (item, index) {breadCrumbString += item.title;if( item.price > 0 && showPrice == true){breadCrumbString += ` (` + displayMoneyFormat(getTaxableAmount(item.price * theExchangeRate)) + `)`;}if( index != (chosenSGLensesArrForAddToCart.length - 1) ){breadCrumbString += sepator;}});breadCrumbString = breadCrumbString.replace(rootSGLenseKeyName, '');breadCrumbString = breadCrumbString.replace('
', '');breadCrumbString = breadCrumbString.replace(', ', '');return breadCrumbString;}function getSGPopUpSelectedLensesPrice() {let lensesPriceWithTax = 0;chosenSGLensesArrForAddToCart.forEach( (item, index) => { if (item.price == null) {item.price=0;}lensesPriceWithTax += parseFloat(getTaxableAmount(item.price));});return lensesPriceWithTax;}function getSGPopUpSelectedLensesCrossedPrice(){let priceWithTax = 0;chosenSGLensesArrForAddToCart.forEach( (item, index) => {let tempItemPrice = 0;let itemCrossedPrice = parseFloat(item.crossed_price);let itemPrice = item.price;if( itemCrossedPrice === null || itemCrossedPrice == 0 ){tempItemPrice = itemPrice} else {tempItemPrice = itemCrossedPrice;}priceWithTax += parseFloat(getTaxableAmount(tempItemPrice));});return priceWithTax;}function loadSGPopupPreviousStep(){let previousStep = chosenSGLensesArrForAddToCart.at(-2);chosenSGLensesArrForAddToCart.pop();loadSGPopupNextStep(previousStep.key);}function loadSGPopupNextStep(lenseUniqueName){$('.sg_popup').hide();if( lenseUniqueName === rootSGLenseKeyName ){chosenSGLensesArrForAddToCart = [];} const isLenseKeyAlreadyExists = chosenSGLensesArrForAddToCart.some(el => el.key === lenseUniqueName);if( !isLenseKeyAlreadyExists){let title = '';let price = 0;let crossed_price = 0;let second_offer = 0;if( lenseUniqueName != rootSGLenseKeyName ){if( typeof sunGlassLensesJsonData.sunglass_lenses[lenseUniqueName] == "undefined" ){let lastElement = chosenSGLensesArrForAddToCart.at(-1);sunGlassLensesJsonData.sunglass_lenses[lastElement.key].map( (ele, Index) => {if(ele.val == lenseUniqueName){title = ele.title;price = ele.price;crossed_price = ele.crossed_price;second_offer = ele.second_offer;}});} else {let lastElement = chosenSGLensesArrForAddToCart.at(-1);sunGlassLensesJsonData.sunglass_lenses[lastElement.key].map( (ele, Index) => {if(ele.val == lenseUniqueName){title = ele.title;price = ele.price;crossed_price = ele.crossed_price;second_offer = ele.second_offer;}});}} else {title = rootSGLenseKeyName;}let tempObj = {key:lenseUniqueName,title: title,price: price,crossed_price: crossed_price,second_offer: second_offer}chosenSGLensesArrForAddToCart.push(tempObj);}if( typeof sunGlassLensesJsonData.sunglass_lenses[lenseUniqueName] == "undefined" || sunGlassLensesJsonData.sunglass_lenses[lenseUniqueName].length == 0 ){loadSGPopupLastStep(lenseUniqueName);return;}let mediaImages = '';let html = `

`;if( lenseUniqueName != rootSGLenseKeyName ){html += `Back`;}html +=`

`;/* get frame price[ */let topSummaryPrice = getSGPopUpSelectedLensesPrice();let theExchangeRate = 130 / 100;let productPriceRaw = parseInt($('#sg-popup-step-last').attr('data-product-price'));let productPriceWithTax = parseFloat(getTaxableAmount(productPriceRaw));productPriceWithTax = (productPriceWithTax * theExchangeRate).toFixed(2);/* ] */let thebread=``;if (productPriceRaw < 4168 && rootSGLenseKeyName=="prescription_tp") {thebread=getSGPopUpBreadCrumb(``, false);} else {thebread=getSGPopUpBreadCrumb();}$("#sg-popup-step-multi-level .breadcrumb").html(thebread);if( topSummaryPrice > 0 || productPriceWithTax > 0 ){let topSummaryPriceWithTax = (topSummaryPrice * theExchangeRate).toFixed(2);topSummaryPriceWithTax = parseFloat(topSummaryPriceWithTax) + parseFloat(productPriceWithTax);let lensesCrossedPriceWithTax = getSGPopUpSelectedLensesCrossedPrice();topSummaryPriceWithTax = (parseFloat(topSummaryPriceWithTax) + parseFloat(getTotalExtraDiscountAmt())).toFixed(2);topSummaryPriceWithTax = displayMoneyFormat(topSummaryPriceWithTax);let priceHtml = ``;if (productPriceRaw < 4168 && rootSGLenseKeyName=="prescription_tp") {} else {priceHtml += `Total: `;if( lensesCrossedPriceWithTax > 0 && lensesCrossedPriceWithTax != topSummaryPrice ){lensesCrossedPriceWithTax = (lensesCrossedPriceWithTax * theExchangeRate).toFixed(2);lensesCrossedPriceWithTax = (parseFloat(lensesCrossedPriceWithTax) + parseFloat(productPriceWithTax)).toFixed(2);/* priceHtml += `

${displayMoneyFormat(lensesCrossedPriceWithTax)}

`; */}priceHtml += topSummaryPriceWithTax;}$("#sg-popup-step-multi-level .top-summary-price-js").html(priceHtml);} else {$("#sg-popup-step-multi-level .top-summary-price-js").html('');}// let isProductPercee = `0`;let isProductPercee = `0`;let widthProductLens = `0`;if( typeof sunGlassLensesJsonData.sunglass_lenses[lenseUniqueName] === 'object' ){sunGlassLensesJsonData.sunglass_lenses[lenseUniqueName] = Object.values(sunGlassLensesJsonData.sunglass_lenses[lenseUniqueName]);}sunGlassLensesJsonData.sunglass_lenses[lenseUniqueName].filter( (ele) => {let isThisNodePercee = ele.is_percee;/* if entry is 2 in the array column "percee". then do not show if is_percee = 1/2/3/4 andif ispercee=0 and lens width >56 */if( ( (isProductPercee == '1' || isProductPercee == '3') && isThisNodePercee == '0') || (isThisNodePercee == '2' && (isProductPercee == '1' || isProductPercee == '2' || isProductPercee == '3' || isProductPercee == '4') ) || (isThisNodePercee == '2' && widthProductLens !='0' && isProductPercee == '0' ) ) {return false; /* skip this element */}return true;}).map((ele,Index)=>{let eleCrossedPrice = parseFloat(ele.crossed_price);let elePrice = parseFloat(ele.price);let lenseFormattedPrice = getTaxableAmount(Math.round(elePrice));let lenseCrossedPriceFormatted = getTaxableAmount(Math.round(eleCrossedPrice));let theExchangeRate= '130' / 100;lenseFormattedPrice = (lenseFormattedPrice * theExchangeRate).toFixed(2);lenseCrossedPriceFormatted = (lenseCrossedPriceFormatted * theExchangeRate).toFixed(2);html += `

Tom Ford Glasses FT-5665-B 001 (2)${ele.image_title}

${ele.title}${ele.description}`;if( elePrice > 0 ){html += ``;if( eleCrossedPrice > elePrice){html += ``;if(lenseUniqueName != rootSGLenseKeyName){ html += `+ `;}html += `${displayMoneyFormat(lenseCrossedPriceFormatted)}`;html += ` `;}if(lenseUniqueName != rootSGLenseKeyName){ html += `+ `;}html += `${displayMoneyFormat(lenseFormattedPrice)}`;if( eleCrossedPrice > elePrice){let discountPercentage = ((eleCrossedPrice - elePrice) * 100/eleCrossedPrice);discountPercentage = parseInt(Math.round(discountPercentage));html += ` (save ${discountPercentage} %)`;}html += ``;} else if( elePrice == 0 && lenseUniqueName != rootSGLenseKeyName ){html += `(included)`;}html += `

`;if(ele.images.length > 0) {let loopIteratorStartWith = generateRandom(1000 + Index, 2000 + Index);mediaImages += `

`;}});html += `

`;/* lenses help text[ */let lensesHelpText = ``;let previousStep = chosenSGLensesArrForAddToCart.at(-1).key;if( sunGlassLensesJsonData.lens_help_text_arr.hasOwnProperty(previousStep) ){sunGlassLensesJsonData.lens_help_text_arr[previousStep].map( (ele, Index) => {if( ele.entry_type == "1" ){lensesHelpText += `${ele.label_key_caption}`;} else if( ele.entry_type == "2" ){if (channelCode == 'DE_WEB' && ele.entry_value=='array_help_prog_warning_de_popup') {lensesHelpText += `${ele.label_key_caption}`;lensesHelpText += `

`;} else {lensesHelpText += `${ele.label_key_caption}`;}}});}html += lensesHelpText;/* ] *//* additional text[ */let additionalText = ``;let productPrescriptionRequirementArr = productPrescriptionRequirement.split(",");productPrescriptionRequirementArr = productPrescriptionRequirementArr.map( (item)=>{ return parseInt(item,10); } );if( (rootSGLenseKeyName == "prescription_tp" || rootSGLenseKeyName == "prescription_all" ) && productPrescriptionRequirementArr.includes(4)){additionalText = `

Varifocals are not available for this model.

`;}html += additionalText;/* ] */html += mediaImages;$('#sg-popup-step-multi-level #sg-popup-step-multi-level-inner').html(html);$('#sg-popup-step-multi-level').show();}let enablePopLastConfirmBtn = ()=>{$("#sg-popup-last-confirm-btn").show();$("#sg-popup-last-confirm-btn").removeClass("tool-tips btn--disabled unclick");$("#sg-popup-last-confirm-btn").removeAttr("title");$("#sg-popup-last-confirm-btn").attr("onclick", "sunglass_addtoCart(this);");};let disablePopLastConfirmBtn = (showPrescTitle, showPDTitle, showMutTitle = false)=>{$("#sg-popup-last-confirm-btn").show();let title = "";let counter = 0;if( true == showPrescTitle ){title += "Add my prescription ";counter++;}if( true == showPrescTitle && true == showPDTitle ){title += " & ";}if( true == showPDTitle ){title += "Add my Pupillary Distance ";counter++;}if( true == showMutTitle ){if( counter > 0 ){title += " & ";}title += "Add my health insurance card ";}$("#sg-popup-last-confirm-btn").addClass("tool-tips btn--disabled unclick");$("#sg-popup-last-confirm-btn").attr("title", title);$("#sg-popup-last-confirm-btn").removeAttr("onclick");};function loadSGPopupLastStep(lenseUniqueName){$("#sg-popup-last-confirm-btn").html(`Tom Ford Glasses FT-5665-B 001 (3) ADD TO BAG`);$("#selected-presc-wrapper").hide();$("#selected-pd-wrapper").hide();$("#selected-mut-wrapper").hide();let lensesPriceWithTax = getSGPopUpSelectedLensesPrice();lensesPriceWithTax = parseFloat(lensesPriceWithTax);let lensesPriceWithoutTax = 100 * getTaxlessAmount(lensesPriceWithTax * 100);let theExchangeRate = 130 / 100;let lensesCrossedPriceWithTax = getSGPopUpSelectedLensesCrossedPrice();lensesCrossedPriceWithTax = parseFloat(lensesCrossedPriceWithTax);let productPriceRaw = parseInt($('#sg-popup-step-last').attr('data-product-price'));let productPriceWithTax = parseFloat(getTaxableAmount(productPriceRaw));let totalAmountWithTax = lensesPriceWithTax + 0 + productPriceWithTax;let chosenLenses = getSGPopUpBreadCrumb(`, `,false, false);/* last step conformation buttons show/hide as per current selection[ */$("#sg-popup-last-input-prescription-btn").hide();$("#sg-popup-last-input-pupillary-distance-btn").hide();$("#sg-popup-last-input-mut-btn").hide();let isShowPrescriptionsInput = false;let isShowPDsInput = false;let isShowMutInput = false;if( rootSGLenseKeyName == "prescription_all_sun" || rootSGLenseKeyName == "prescription_all" || rootSGLenseKeyName == "prescription_tp"){isShowPrescriptionsInput = true;isShowPDsInput = true;if(rootSGLenseKeyName == "prescription_tp"){isShowPrescriptionsInput = true;isShowPDsInput = true;isShowMutInput = true;}/* mark confirm btn disabled[ */disablePopLastConfirmBtn(isShowPrescriptionsInput, isShowPDsInput, isShowMutInput);/* ] */if(true == isShowPrescriptionsInput){$("#sg-popup-last-input-prescription-btn").show();}if(true == isShowPDsInput){$("#sg-popup-last-input-pupillary-distance-btn").show();}if( true == isShowMutInput ){let lastSelectedLens = chosenSGLensesArrForAddToCart.at(-1).key;if(lastSelectedLens.toLowerCase().includes("css") == true){$("#sg-popup-last-input-mut-btn").text(`Add my health insurance card`);} else {$("#sg-popup-last-input-mut-btn").text(`Add my health insurance card`);}$("#sg-popup-last-input-mut-btn").show();}let isSelectedChoicePrescTypeEnter = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeEnter);let isSelectedChoicePrescTypeExists = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeExists);let isSelectedChoicePrescTypeSendEmail = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeSendEmail);let isSelectedChoicePrescTypeNewFileUpload = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeNewFilesUpload);let isSelectedChoicePDTypeEnter = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeEnter);let isSelectedChoicePDTypeExists = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeExists);let isSelectedChoicePDTypeUpload = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeUpload);let isSelectedChoicePDTypeSendGlasses = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeSendGlasses);let isSelectedChoicePDTypeNewFileUpload = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeNewFilesUpload);let isSelectedChoiceMutTypeUpload = selectedPrescAndPDData.mutData.selectedChoice.includes(prescAndPDChoiceTypes.mut.typeUpload);let isSelectedChoiceMutTypeNewFileUpload = selectedPrescAndPDData.mutData.selectedChoice.includes(prescAndPDChoiceTypes.mut.typeNewFilesUpload);if( selectedPrescAndPDData.prescData.selectedChoice.length != 0 && true == isShowPrescriptionsInput ){$("#sg-popup-last-input-prescription-btn").hide();let ifCond1 = (isSelectedChoicePrescTypeEnter && selectedPrescAndPDData.prescData.enterData.firstName != "" && selectedPrescAndPDData.prescData.enterData.lastName != "");let ifCond2 = (isSelectedChoicePrescTypeExists && selectedPrescAndPDData.prescData.existsData.firstName != "" && selectedPrescAndPDData.prescData.existsData.lastName != "");if( (ifCond1) || (ifCond2) || (!isSelectedChoicePrescTypeEnter && !isSelectedChoicePrescTypeExists) ){let selectedPrescDetail = ``;if( isSelectedChoicePrescTypeEnter ){selectedPrescDetail = `
First Name: ${selectedPrescAndPDData.prescData.enterData.firstName}Last Name: ${selectedPrescAndPDData.prescData.enterData.lastName}

Right eye:Left eye:
Sphere:${selectedPrescAndPDData.prescData.enterData.sphericalRightEye}${selectedPrescAndPDData.prescData.enterData.sphericalLeftEye}
Cylinder:${selectedPrescAndPDData.prescData.enterData.cylinderRightEye}${selectedPrescAndPDData.prescData.enterData.cylinderLeftEye}
Axis:${selectedPrescAndPDData.prescData.enterData.axisRightEye}${selectedPrescAndPDData.prescData.enterData.axisLeftEye}
Addition:${selectedPrescAndPDData.prescData.enterData.additionRightEye}${selectedPrescAndPDData.prescData.enterData.additionLeftEye}

`;}if( isSelectedChoicePrescTypeExists ){selectedPrescDetail += `
First Name: ${selectedPrescAndPDData.prescData.existsData.firstName}Last Name: ${selectedPrescAndPDData.prescData.existsData.lastName}
Visionet already has my prescription : ${selectedPrescAndPDData.prescData.existsData.previousOrderHint}`;}if( isSelectedChoicePrescTypeSendEmail ){selectedPrescDetail += `
First Name: ${selectedPrescAndPDData.prescData.sendEmailData.firstName}Last Name: ${selectedPrescAndPDData.prescData.sendEmailData.lastName}
Send my prescription later`;}if( isSelectedChoicePrescTypeNewFileUpload && prescUploadedFilesExists ){selectedPrescDetail += `
First Name: ${selectedPrescAndPDData.prescData.newFilesUploadData.firstName}Last Name: ${selectedPrescAndPDData.prescData.newFilesUploadData.lastName}
Upload my prescription now`;if(prescUploadedFilesExists){selectedPrescDetail += `${prescUploadedFilesHtml}`;}}if( selectedPrescDetail != '' ){let selectedPrescWrapperHtml = `

Prescription${selectedPrescDetail}

modify

`;$("#selected-presc-wrapper").show();$("#selected-presc-wrapper").html(selectedPrescWrapperHtml);if( prescUploadedFilesExists ){$("#selected-presc-wrapper").find(".btnDeletePrescPdFile").remove();}} else {$("#sg-popup-last-input-prescription-btn").show();}}ifCond1 = (isSelectedChoicePrescTypeEnter && (selectedPrescAndPDData.prescData.enterData.firstName == "" || selectedPrescAndPDData.prescData.enterData.lastName == ""));ifCond2 = ( isSelectedChoicePrescTypeExists && ( selectedPrescAndPDData.prescData.existsData.firstName == "" || selectedPrescAndPDData.prescData.existsData.lastName == "" ) );if( (ifCond1) || (ifCond2) ){$("#sg-popup-last-input-prescription-btn").show();}}if( selectedPrescAndPDData.pdData.selectedChoice.length != 0 && isShowPDsInput == true ) {$("#sg-popup-last-input-pupillary-distance-btn").hide();let ifCond1 = (isSelectedChoicePDTypeEnter && selectedPrescAndPDData.pdData.enterData.halfDistanceRightEye != "" && selectedPrescAndPDData.pdData.enterData.halfDistanceLeftEye != "");let ifCond2 = (isSelectedChoicePDTypeExists && selectedPrescAndPDData.pdData.existsData.firstName != "" && selectedPrescAndPDData.pdData.existsData.lastName != "");if( (ifCond1) || (ifCond2) || ( !isSelectedChoicePDTypeEnter && !isSelectedChoicePDTypeExists) ) {let selectedPDDetail = ``;if(isSelectedChoicePDTypeEnter){selectedPDDetail = `

Right eye:${selectedPrescAndPDData.pdData.enterData.halfDistanceRightEye}
Left eye:${selectedPrescAndPDData.pdData.enterData.halfDistanceLeftEye}

`;}if(isSelectedChoicePDTypeExists){selectedPDDetail = `
First Name: ${selectedPrescAndPDData.pdData.existsData.firstName}Last Name: ${selectedPrescAndPDData.pdData.existsData.lastName}

Previous Order details: ${selectedPrescAndPDData.pdData.existsData.previousOrderHint}`;}if(isSelectedChoicePDTypeUpload){selectedPDDetail = `
Measure with a photo`;}if(isSelectedChoicePDTypeSendGlasses){selectedPDDetail = `
Send us an old pair of your glasses`;}if( isSelectedChoicePDTypeNewFileUpload && pdUploadedFilesExists ){selectedPDDetail += `
Upload a photo or document now`;if(pdUploadedFilesExists){selectedPDDetail += `${pdUploadedFilesHtml}`;}}if( selectedPDDetail != '' ){let selectedPDWrapperHtml = `

Pupillary Distance${selectedPDDetail}

Change Pupillary Distance

`;$("#selected-pd-wrapper").show();$("#selected-pd-wrapper").html(selectedPDWrapperHtml);if( pdUploadedFilesExists ){$("#selected-pd-wrapper").find(".btnDeletePrescPdFile").remove();}} else {$("#sg-popup-last-input-pupillary-distance-btn").show();}}if((isSelectedChoicePDTypeEnter && (selectedPrescAndPDData.pdData.enterData.halfDistanceRightEye == "" || selectedPrescAndPDData.pdData.enterData.halfDistanceLeftEye == "")) || (isSelectedChoicePDTypeExists && ( selectedPrescAndPDData.pdData.existsData.firstName == "" || selectedPrescAndPDData.pdData.existsData.lastName == "" )) ){$("#sg-popup-last-input-pupillary-distance-btn").show();}}if( selectedPrescAndPDData.mutData.selectedChoice.length != 0 && isShowMutInput == true ) {$("#sg-popup-last-input-mut-btn").hide();let selectedMutDetail = ``;if(isSelectedChoiceMutTypeUpload){selectedMutDetail = `
Send my document later`;}if( isSelectedChoiceMutTypeNewFileUpload && mutUploadedFilesExists ){selectedMutDetail += `
Upload my document now`;if(mutUploadedFilesExists){selectedMutDetail += `${mutUploadedFilesHtml}`;}}if( selectedMutDetail != '' ){let selectedMutWrapperHtml = `

Documents mutuelle / CSS${selectedMutDetail}

Edit my document

`;$("#selected-mut-wrapper").show();$("#selected-mut-wrapper").html(selectedMutWrapperHtml);if( mutUploadedFilesExists ){$("#selected-mut-wrapper").find(".btnDeletePrescPdFile").remove();}} else {let lastSelectedLens = chosenSGLensesArrForAddToCart.at(-1).key;if(lastSelectedLens.toLowerCase().includes("css") == true){$("#sg-popup-last-input-mut-btn").text(`Add my health insurance card`);} else {$("#sg-popup-last-input-mut-btn").text(`Add my health insurance card`);}$("#sg-popup-last-input-mut-btn").show();}}let isPrescriptionsInputValidated = false;let isPDsInputValidated = false;let isMutInputValidated = false;if( true == isShowPrescriptionsInput ){if((isSelectedChoicePrescTypeEnter && selectedPrescAndPDData.prescData.enterData.firstName != "" && selectedPrescAndPDData.prescData.enterData.lastName != "" ) || (isSelectedChoicePrescTypeExists && selectedPrescAndPDData.prescData.existsData.firstName != "" && selectedPrescAndPDData.prescData.existsData.lastName != "" ) || (!isSelectedChoicePrescTypeEnter && !isSelectedChoicePrescTypeExists && selectedPrescAndPDData.prescData.selectedChoice.length != 0 ) ){isPrescriptionsInputValidated = true;}} else {isPrescriptionsInputValidated = true;}if( true == isShowPDsInput ){if( (isSelectedChoicePDTypeEnter && selectedPrescAndPDData.pdData.enterData.halfDistanceRightEye != "" && selectedPrescAndPDData.pdData.enterData.halfDistanceLeftEye != "") || (isSelectedChoicePDTypeExists && ( selectedPrescAndPDData.pdData.existsData.firstName != "" || selectedPrescAndPDData.pdData.existsData.lastName != "" ) ) ||(!isSelectedChoicePDTypeEnter && !isSelectedChoicePDTypeExists && selectedPrescAndPDData.pdData.selectedChoice.length != 0) ){isPDsInputValidated = true;}} else {isPDsInputValidated = true;}if( true == isShowMutInput ){if( isSelectedChoiceMutTypeUpload || isSelectedChoiceMutTypeNewFileUpload ){isMutInputValidated = true;}} else {isMutInputValidated = true;} if( true == isPrescriptionsInputValidated && true == isPDsInputValidated && true == isMutInputValidated ) {enablePopLastConfirmBtn();} else {if( false === isPrescriptionsInputValidated || false === isPDsInputValidated || false === isMutInputValidated ){disablePopLastConfirmBtn(!isPrescriptionsInputValidated, !isPDsInputValidated, !isMutInputValidated);}}} else {enablePopLastConfirmBtn();}/* ] */let crossedPriceHtml = ``;let lensDiscountHtml = ``;let lensesPrice = lensesPriceWithTax;lensesPrice = (lensesPrice * theExchangeRate).toFixed(2);let lensesDiscountedAmtWithTax = 0;if( lensesCrossedPriceWithTax > 0 && lensesCrossedPriceWithTax != parseFloat(lensesPriceWithTax) ){lensesDiscountedAmtWithTax = (lensesCrossedPriceWithTax - lensesPriceWithTax);lensesDiscountedAmtWithTax = (lensesDiscountedAmtWithTax * theExchangeRate).toFixed(2);let lensesWithoutDiscountedAmtWithTax = (lensesCrossedPriceWithTax * theExchangeRate).toFixed(2);crossedPriceHtml += `${displayMoneyFormat(lensesDiscountedAmtWithTax)}`;lensDiscountHtml = `

Lens discount-${crossedPriceHtml}

`;lensesPrice = lensesWithoutDiscountedAmtWithTax;}productPriceWithTax = (productPriceWithTax * theExchangeRate).toFixed(2);lensesPriceWithTax = (lensesPriceWithTax * theExchangeRate).toFixed(2);totalAmountWithTax = (totalAmountWithTax * theExchangeRate).toFixed(2);/* apply extra discunts(if any) starts[ */let extraDiscountsHtml = '';let extraDiscountAmtWithTax = 0;let extraDiscountTotalAmtWithoutTax = 0;for( let i = 0; i< loadedSGLenseTypeExtraDiscounts.length; i++ ){extraDiscountTotalAmtWithoutTax += parseFloat(loadedSGLenseTypeExtraDiscounts[i].price);extraDiscountAmtWithTax = getTaxableAmount(parseFloat(loadedSGLenseTypeExtraDiscounts[i].price));extraDiscountAmtWithTax = (extraDiscountAmtWithTax * theExchangeRate).toFixed(2);if (parseFloat(productPriceWithTax) + 0 + parseFloat(extraDiscountAmtWithTax) < 0) {extraDiscountAmtWithTax = -1 * parseFloat(productPriceWithTax);extraDiscountTotalAmtWithoutTax = -1 * parseInt(productPriceRaw);}totalAmountWithTax = parseFloat(totalAmountWithTax) + parseFloat(extraDiscountAmtWithTax);totalAmountWithTax = totalAmountWithTax.toFixed(2);extraDiscountsHtml += `

${loadedSGLenseTypeExtraDiscounts[i].text_define_lbl}${displayMoneyFormat(extraDiscountAmtWithTax)}

`;}lensesPriceWithoutTax = lensesPriceWithoutTax + extraDiscountTotalAmtWithoutTax;/* ] */let lastSelectedLens = chosenSGLensesArrForAddToCart.at(-1).key;let html = `

`;if(lastSelectedLens.startsWith("tp_") == true ) {html += `Votre demande de devis 100% santé, sans engagement et avec un reste à charge de 0 € garanti`;} else {html += `Order Summary`;}html += `

${ 'Tom Ford FT-5665-B 001' }`;if (lastSelectedLens.startsWith("tp_") == true && productPriceRaw < 4168) {} else {html += `${displayMoneyFormat(productPriceWithTax)}`;}html += `

`;if (lastSelectedLens.startsWith("tp_") == true && productPriceRaw < 4168) {html += `

`;}let isShowLensesCartInfoAndTotal = true;if((lastSelectedLens.startsWith("tp_mut_A") == true) || (lastSelectedLens.startsWith("tp_css") == true) || (lastSelectedLens.startsWith("tp_mut_sv_distance_A") == true) || (lastSelectedLens.startsWith("tp_mut_sv_reading_A") == true) || (lastSelectedLens.startsWith("tp_mut_prog_A") == true) || (lastSelectedLens.startsWith("tp_mut_mi_distance_A") == true) ){isShowLensesCartInfoAndTotal = false;}html += `

${chosenLenses}`;if(true == isShowLensesCartInfoAndTotal){html += `${displayMoneyFormat(lensesPrice)}`;}html += `

${lensDiscountHtml}${extraDiscountsHtml}`;if(true == isShowLensesCartInfoAndTotal){html +=`

Total frame and lenses${displayMoneyFormat(totalAmountWithTax) + ''}

`;}html += `

`;if (typeof(lensTypeWarningLbls[loadedSGLenseTypeName]) != "undefined" ) {if (lensTypeWarningLbls[loadedSGLenseTypeName].length >1) {html +=`

${lensTypeWarningLbls[loadedSGLenseTypeName]}

`;}}if(false == isShowLensesCartInfoAndTotal && lastSelectedLens.startsWith("tp_") == false ){html += `

lens_panierA_warning_summary_popup

`;}/* second offer display area[ */let lastSelectedLensSecondOfferVal = chosenSGLensesArrForAddToCart.at(-1).second_offer;/* this variable lastSelectedLensSecondOfferVal is used to display the 2nd offer in final summary popup, even the user has not added the relevant item in the cart */let lastSelectedLensSecondOfferValToCart = 0;if(lastSelectedLensSecondOfferVal > 0 && secondOfferLensesArray != null ){let second_offer_array_name = '';for( i = 0; i < secondOfferLensesArray.length; i++ ){if( secondOfferLensesArray[i].second_offer_id == lastSelectedLensSecondOfferVal ){lastSelectedLensSecondOfferValToCart = lastSelectedLensSecondOfferVal;second_offer_array_name = secondOfferLensesArray[i].array_name;html += `

${secondOfferLensesLbls[second_offer_array_name]}

`;break;}}}/* ] */if( showLblFrameDiscountSecondPairNotEligible ){html += `

This frame is not eligible for the second pair discount

`;}$('#sg-popup-step-last #sg-popup-step-last-inner').html(html);/* $('#sg-popup-step-last .breadcrumb').html('').html(getSGPopUpBreadCrumb()); */if( lensesPriceWithTax > 0 || productPriceWithTax > 0 ){let breadcrumbSummaryTotalHtml = `Total: `;/* extra discounts(if any) handling[ */let extraDiscountAmtWithTax = 0;let extraDiscountTotalAmtWithTax = 0;let extraDiscountTotalAmtWithoutTax = 0;for( let i = 0; i< loadedSGLenseTypeExtraDiscounts.length; i++ ){extraDiscountAmtWithTax = getTaxableAmount(parseFloat(loadedSGLenseTypeExtraDiscounts[i].price));extraDiscountAmtWithTax = (extraDiscountAmtWithTax * theExchangeRate).toFixed(2);extraDiscountTotalAmtWithTax = parseFloat(extraDiscountTotalAmtWithTax) + parseFloat(extraDiscountAmtWithTax);}extraDiscountTotalAmtWithTax = extraDiscountTotalAmtWithTax.toFixed(2);/* ] */if( lensesCrossedPriceWithTax > 0 && parseInt(lensesCrossedPriceWithTax) != parseInt(lensesPriceWithTax) ){let lensesCrossedPriceWithTaxToDisplay = (lensesCrossedPriceWithTax * theExchangeRate).toFixed(2);lensesCrossedPriceWithTaxToDisplay = (parseFloat(lensesCrossedPriceWithTaxToDisplay) + parseFloat(productPriceWithTax)).toFixed(2);breadcrumbSummaryTotalHtml += `

${displayMoneyFormat(lensesCrossedPriceWithTaxToDisplay)}

`;}//lensesPriceWithTax = (parseFloat(lensesPriceWithTax) + parseFloat(productPriceWithTax) + parseFloat(extraDiscountTotalAmtWithTax)).toFixed(2);let $summaryTotal = (parseFloat(lensesPriceWithTax) + parseFloat(productPriceWithTax) + parseFloat(extraDiscountTotalAmtWithTax)).toFixed(2);breadcrumbSummaryTotalHtml += displayMoneyFormat($summaryTotal);//$('#sg-popup-step-last .top-summary-price-js').html(breadcrumbSummaryTotalHtml);$('#sg-popup-step-last .top-summary-price-js').html('');} else {$('#sg-popup-step-last .top-summary-price-js').html('');}$('#sg-popup-step-last a.step-back-link').attr("onclick",'loadSGPopupPreviousStep();');$(".sg_popup").hide();$("#sg-popup-step-last").show();/** Adding content in add to cart Button */if((currentCartLensSecondOfferId > 0 || Object.keys(earlierPlacedOrderSecondOfferIds).length > 0 ) && secondOfferLensesArray != null && (rootSGLenseKeyName == "prescription_2nd_free" || rootSGLenseKeyName == "prescription_all_2nd_50" || rootSGLenseKeyName == "prescription_all_sun_2nd_50" || rootSGLenseKeyName == "prescription_all_2nd_50_css")){let secondOfferId = 0;if( currentCartLensSecondOfferId > 0 ){secondOfferId = currentCartLensSecondOfferId;} else if( Object.keys(earlierPlacedOrderSecondOfferIds).length > 0 ){secondOfferId = selectedSecondOfferId;}var lenseUniqueNameWithSecondOfferId = `${lenseUniqueName}|is_second_${secondOfferId}`;} else {var lenseUniqueNameWithSecondOfferId = `${lenseUniqueName}|second_offer_id_${lastSelectedLensSecondOfferValToCart}`;}$('#sunglass_addToCart_form #app_lenses_step1_nameId').val(lenseUniqueName);$('#sunglass_addToCart_form #app_lenses_step1_lenses').val(`%${chosenLenses}%${lensesPriceWithoutTax}`);$('#sunglass_addToCart_form #app_lenses_step1_products_options').val(`${lenseUniqueNameWithSecondOfferId}`);$('#sunglass_addToCart_form #app_lenses_step1_products_options_values').val(chosenLenses);$('#sunglass_addToCart_form #app_lenses_step1_options_values_price').val(lensesPriceWithoutTax);$('#sunglass_addToCart_form #app_lenses_frame_before_discount').val(productPriceWithTax);/* $('#sunglass_addToCart_form #app_lenses_lens_before_discount').val(lensesPriceWithTax); */$('#sunglass_addToCart_form #app_lenses_lens_before_discount').val(lensesPrice);$('#sunglass_addToCart_form #app_lenses_frame_discount').val(extraDiscountAmtWithTax);$('#sunglass_addToCart_form #app_lenses_lens_discount').val('-' + lensesDiscountedAmtWithTax);}let myPrescEyeSphereArr = generateSerialNumbersInRange(-10,+10,0.25);let myPrescEyeCylinderArr = generateSerialNumbersInRange(-4,+4,0.25);let myPrescEyeAxisArr = generateSerialNumbersInRange(0,180,1);let myPrescEyeAdditionArr = generateSerialNumbersInRange(0,3.50,0.25);let myPDEyeHalfDistanceArr = generateSerialNumbersInRange(20,40.50,0.50);let eyeSphereOptions = '';for( i=0; i < myPrescEyeSphereArr.length; i++){let selected = '';let plusMinusSign = '';if( myPrescEyeSphereArr[i] == 0 ){selected = ' selected="selected"';}if( myPrescEyeSphereArr[i] > 0 ){plusMinusSign = '+';}eyeSphereOptions += `

`;}let eyeCylinderOptions = '';for( i=0; i < myPrescEyeCylinderArr.length; i++){let selected = '';let plusMinusSign = '';if( myPrescEyeCylinderArr[i] == 0 ){selected = ' selected="selected"';}if( myPrescEyeCylinderArr[i] > 0 ){plusMinusSign = '+';}eyeCylinderOptions += `

`;}let eyeAxisOptions = '';let degreeSymbol = '°';for( i=0; i < myPrescEyeAxisArr.length; i++){let selected = '';if( myPrescEyeAxisArr[i] == 0 ){selected = ' selected="selected"';}eyeAxisOptions += `

`;}let eyeAdditionOptions = '';for( i=0; i < myPrescEyeAdditionArr.length; i++){let selected = '';if( myPrescEyeAdditionArr[i] == 0 ){selected = ' selected="selected"';}eyeAdditionOptions += `

`;}let pdEyeHalfDistanceOptions = `

`;for( i=0; i < myPDEyeHalfDistanceArr.length; i++){pdEyeHalfDistanceOptions += `

`;}const prescAndPDChoiceTypes = {presc: {typeEnter: "enter",typeExists: "exists",typeSendEmail: "send_email",typeNewFilesUpload: "new_files_upload",},pd: {typeEnter: "enter",typeExists: "exists",typeUpload: "upload",typeNewFilesUpload: "new_files_upload",},mut: {typeUpload: "upload",typeNewFilesUpload: "new_files_upload",}};let selectedPrescAndPDData = {prescData: {selectedChoice: [],enterData:{firstName:"",lastName:"",sphericalRightEye:"",sphericalLeftEye:"",cylinderRightEye:"",cylinderLeftEye:"",axisRightEye:"",axisLeftEye:"",additionRightEye:"",additionLeftEye:"",},existsData:{firstName:"",lastName:"",previousOrderHint:""},sendEmailData:{firstName:"",lastName:"",},newFilesUploadData:{firstName:"",lastName:"",},},pdData:{selectedChoice: [],enterData:{halfDistanceRightEye:"",halfDistanceLeftEye:"",},existsData:{firstName:"",lastName:"",previousOrderHint:""},uploadData:{},newFilesUploadData:{},},mutData:{selectedChoice: [],uploadData:{},newFilesUploadData:{},mutDept:{mutDeptName:"",mutDeptNameTwo:""},}};let prescUploadedFilesHtml = ``;let prescUploadedFilesExists = false;let pdUploadedFilesHtml = ``;let pdUploadedFilesExists = false;let mutUploadedFilesHtml = ``;let mutUploadedFilesExists = false;let prescChoiceEnterSelectPrescFeuillesHtml = ``;if(channelCode == 'FR_WEB'){Object.assign(prescAndPDChoiceTypes.pd, {typeSendGlasses: "send_glasses"});Object.assign(selectedPrescAndPDData.pdData, {sendGlassesData: {} });//if(rootSGLenseKeyName == "prescription_all" ){Object.assign(selectedPrescAndPDData.prescData, {requireFeuilles: "" });prescChoiceEnterSelectPrescFeuillesHtml = `

Vous souhaitez une feuilles de soin pour votre mutuelle?
Yes No

`;//}}selectPrescFeuilles = (val)=>{if(val == "1"){$("#presc_require_feuilles_0").attr("checked", "checked");$("#presc_require_feuilles_1").removeAttr("checked");$("#textforfs").show();$("#labelforyes").addClass("is--active--btn");$("#labelforno").removeClass("is--active--btn");} else {$("#presc_require_feuilles_0").removeAttr("checked");$("#presc_require_feuilles_1").attr("checked", "checked");$("#textforfs").hide();$("#labelforyes").removeClass("is--active--btn");$("#labelforno").addClass("is--active--btn");}if(channelCode == 'FR_WEB' && rootSGLenseKeyName == "prescription_all" ){selectedPrescAndPDData.prescData.requireFeuilles = $('input[name="presc_require_feuilles"]:checked').val();}};generatePrescChoicesHtml = ()=>{let fullHtmlAsAString = ``;//let myPrescChoicesHtmls = [];Object.keys(prescAndPDChoiceTypes.presc).forEach((keyName, index) => {let elementHtml = ``;let icn = ``;let lbl = ``;switch(prescAndPDChoiceTypes.presc[keyName]){case prescAndPDChoiceTypes.presc.typeEnter:icn = ``;lbl = `

Enter your prescription

`;break;case prescAndPDChoiceTypes.presc.typeExists:icn = ``;lbl = `

Visionet already has my prescription

`;break;case prescAndPDChoiceTypes.presc.typeSendEmail:icn = ``;lbl = `

Send my prescription later

`;break;case prescAndPDChoiceTypes.presc.typeNewFilesUpload:icn = ``;lbl = `

Upload my prescription now

`;break;}elementHtml = `

${icn}

${lbl}

`;if(channelCode == 'FR_WEB' && rootSGLenseKeyName == "prescription_all"){selectPrescFeuilles('0');}fullHtmlAsAString += elementHtml;/* myPrescChoicesHtmls.push({[prescAndPDChoiceTypes.presc[keyName]]: elementHtml});*/});if(channelCode == 'FR_WEB' && rootSGLenseKeyName == "prescription_all"){fullHtmlAsAString += `

`;} else {fullHtmlAsAString += `

`;}return fullHtmlAsAString;};let myPrescChoiceEnterHtml = `

`;let myPrescChoiceExistsHtml = `

Please indicate your first and last name and if possible your old order number. This will allow us to reproduce the correction identically.
If you do not enter an order number, we will reproduce the most recent order in your customer account with the same first and last name.

Your previous order number or frame number:

`;let myPrescChoiceSendEmailHtml1 = `

You will be able to add your documents and photos to your order later. Go to my account => View the order => My upload documents

`;let myPrescChoiceSendEmailHtml2 = `

`;let myPrescChoiceNewFilesUploadHtml1 = `

`;setupPrescriptionFileUploadForm = ()=>{let imgRequestData = new FormData(); let fType = $('input[name="file_type"]').val();imgRequestData.append('file_type', fType);imgRequestData.append('prescription_id', prescriptionId);/* $inputs = $('#prescFileUploadFrm input[type="text"],#prescFileUploadFrm select,#prescFileUploadFrm input[type="hidden"]'); $inputs.each(function () { imgRequestData.append(this.name, $(this).val()); }); *//* for (var key of imgRequestData.entries()) {console.log(key[0] + ', ' + key[1]);} */let btnContExistingHtml = '';let btnContOnClickFunc = ``;if( fType == "presc" ){btnContExistingHtml = $("#setup-my-presc-btn").html();$("#setup-my-presc-btn").html(``);btnContOnClickFunc = $("#setup-my-presc-btn").attr("onclick");$("#setup-my-presc-btn").removeAttr("onclick");} else if(fType == "pd"){btnContExistingHtml = $("#setup-my-pd-btn").html();$("#setup-my-pd-btn").html(``);btnContOnClickFunc = $("#setup-my-pd-btn").attr("onclick");$("#setup-my-pd-btn").removeAttr("onclick");} else if(fType == "tp"){btnContExistingHtml = $("#setup-my-mut-btn").html();$("#setup-my-mut-btn").html(``);btnContOnClickFunc = $("#setup-my-mut-btn").attr("onclick");$("#setup-my-mut-btn").removeAttr("onclick");}$("p.err").remove(); $.each($('#presc_file')[0].files, function (i, file) { imgRequestData.append('presc_file', file); $.ajax({url: '/setup-prescription-files', type: "POST", data: imgRequestData, processData: false, contentType: false, success: function (t) {if( fType == "presc"){prescUploadedFilesExists = false;}if( fType == "pd" ){pdUploadedFilesExists = false;}if( fType == "tp" ){mutUploadedFilesExists = false;} try { var ans = $.parseJSON(t); if (ans.status == 1) {let filesHtml = `

    `;if( fType == "presc"){selectedPrescAndPDData.prescData.selectedChoice = selectedPrescAndPDData.prescData.selectedChoice.filter(item => item !== prescAndPDChoiceTypes.presc.typeNewFilesUpload);} else if( fType == "pd" ){selectedPrescAndPDData.pdData.selectedChoice = selectedPrescAndPDData.pdData.selectedChoice.filter(item => item !== prescAndPDChoiceTypes.pd.typeNewFilesUpload);} else if( fType == "tp" ){selectedPrescAndPDData.mutData.selectedChoice = selectedPrescAndPDData.mutData.selectedChoice.filter(item => item !== prescAndPDChoiceTypes.mut.typeNewFilesUpload);}jQuery.each(ans.files, (index, item) => {if( fType == "presc" ){prescUploadedFilesExists = true;if( !selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeNewFilesUpload) ){selectedPrescAndPDData.prescData.selectedChoice.push(prescAndPDChoiceTypes.presc.typeNewFilesUpload);}}if( fType == "pd" ){pdUploadedFilesExists = true;if( !selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeNewFilesUpload) ){selectedPrescAndPDData.pdData.selectedChoice.push(prescAndPDChoiceTypes.pd.typeNewFilesUpload);}}if( fType == "tp" ){mutUploadedFilesExists = true;if( !selectedPrescAndPDData.mutData.selectedChoice.includes(prescAndPDChoiceTypes.mut.typeNewFilesUpload) ){selectedPrescAndPDData.mutData.selectedChoice.push(prescAndPDChoiceTypes.mut.typeNewFilesUpload);}}filesHtml += `
  • ${item} Delete
  • `;});filesHtml += `

`;if( fType == "presc" ){prescUploadedFilesHtml = filesHtml;}if( fType == "pd" ){pdUploadedFilesHtml = filesHtml;}if( fType == "tp" ){mutUploadedFilesHtml = filesHtml;}$("#filesListing").html(filesHtml); } else {$("#filesListing").after(`

${ans.msg}

`); } } catch (exc) {alert(t);} },complete: ()=>{if( fType == "presc" ){$("#setup-my-presc-btn").html(btnContExistingHtml);$("#setup-my-presc-btn").attr("onclick", `${btnContOnClickFunc}`);} else if(fType == "pd"){$("#setup-my-pd-btn").html(btnContExistingHtml);$("#setup-my-pd-btn").attr("onclick", `${btnContOnClickFunc}`);} else if(fType == "tp"){$("#setup-my-mut-btn").html(btnContExistingHtml);$("#setup-my-mut-btn").attr("onclick", `${btnContOnClickFunc}`);}}, error: function (jqXHR, textStatus, errorThrown) { alert("Error Occured."); } }); });};deletePrescriptionFile = (flName) => {let fType = $('input[name="file_type"]').val();$("p.err").remove();$.ajax({url: '/delete-prescription-files',type: "POST",data: {'fileKey': encodeURIComponent(flName),'prescription_id': prescriptionId,},success: function (t) {if( fType == "presc"){prescUploadedFilesExists = false;} else if( fType == "pd" ){pdUploadedFilesExists = false;} else if( fType == "mut" ){mutUploadedFilesExists = false;}try {var ans = $.parseJSON(t);if (ans.status == 1) {if( fType == "presc"){selectedPrescAndPDData.prescData.selectedChoice = selectedPrescAndPDData.prescData.selectedChoice.filter(item => item !== prescAndPDChoiceTypes.presc.typeNewFilesUpload);} else if( fType == "pd" ){selectedPrescAndPDData.pdData.selectedChoice = selectedPrescAndPDData.pdData.selectedChoice.filter(item => item !== prescAndPDChoiceTypes.pd.typeNewFilesUpload);} else if( fType == "mut" ){selectedPrescAndPDData.mutData.selectedChoice = selectedPrescAndPDData.mutData.selectedChoice.filter(item => item !== prescAndPDChoiceTypes.mut.typeNewFilesUpload);}let filesHtml = `

    `;jQuery.each(ans.files, (index, item) => {if( fType == "presc" ){prescUploadedFilesExists = true;if( !selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeNewFilesUpload) ){selectedPrescAndPDData.prescData.selectedChoice.push(prescAndPDChoiceTypes.presc.typeNewFilesUpload);}}if( fType == "pd" ){pdUploadedFilesExists = true;if( !selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeNewFilesUpload) ){selectedPrescAndPDData.pdData.selectedChoice.push(prescAndPDChoiceTypes.pd.typeNewFilesUpload);}}if( fType == "mut" ){mutUploadedFilesExists = true;if( !selectedPrescAndPDData.mutData.selectedChoice.includes(prescAndPDChoiceTypes.mut.typeNewFilesUpload) ){selectedPrescAndPDData.mutData.selectedChoice.push(prescAndPDChoiceTypes.mut.typeNewFilesUpload);}}filesHtml += `
  • ${item} Delete
  • `;});filesHtml += `

`;if( fType == "presc" ){prescUploadedFilesHtml = filesHtml;}if( fType == "pd" ){pdUploadedFilesHtml = filesHtml;}if( fType == "mut" ){mutUploadedFilesHtml = filesHtml;}$("#filesListing").html(filesHtml);} else {$("#filesListing").after(`

${ans.msg}

`);}} catch (exc) {alert(t);}},error: function (jqXHR, textStatus, errorThrown) {alert("Error Occured.");}});};loadMyPrescChoices = ()=>{$("#selected-presc-wrapper").hide();$("#selected-pd-wrapper").hide();$("#selected-mut-wrapper").hide();let lastSelectedLens = chosenSGLensesArrForAddToCart.at(-1).key;$('#sg-popup-step-last a.step-back-link').attr("onclick",'loadSGPopupLastStep("'+ lastSelectedLens +'");');if(rootSGLenseKeyName == "prescription_tp"){/* not to show below 2 buttons in case of below 2 options and for other cases, these will kept showing */delete prescAndPDChoiceTypes.presc.typeEnter;delete prescAndPDChoiceTypes.presc.typeExists;} else{if( !('typeEnter' in prescAndPDChoiceTypes.presc) ){Object.assign(prescAndPDChoiceTypes.presc, {typeEnter: "enter"});}if( !('typeExists' in prescAndPDChoiceTypes.presc) ){Object.assign(prescAndPDChoiceTypes.presc, {typeExists: "exists"});}}let prescHtml = prescChoiceEnterSelectPrescFeuillesHtml + generatePrescChoicesHtml();$('#sg-popup-step-last #sg-popup-step-last-inner').html(prescHtml);$("#sg-popup-last-input-prescription-btn").hide();$("#sg-popup-last-input-pupillary-distance-btn").hide();$("#sg-popup-last-input-mut-btn").hide();$("#sg-popup-last-confirm-btn").hide();};markPrescSelectedChoice = (selectionType)=>{/* reseting the new selection except typeNewFilesUpload[ */if( selectedPrescAndPDData.prescData.selectedChoice.length >= 1 ){if( !selectedPrescAndPDData.prescData.selectedChoice.includes(selectionType) && selectionType != prescAndPDChoiceTypes.presc.typeNewFilesUpload ){let choicesMustBeRemoved = Object.values(prescAndPDChoiceTypes.presc);choicesMustBeRemoved = choicesMustBeRemoved.filter(item => item !== prescAndPDChoiceTypes.presc.typeNewFilesUpload );selectedPrescAndPDData.prescData.selectedChoice = selectedPrescAndPDData.prescData.selectedChoice.filter(item => !choicesMustBeRemoved.includes(item));}}if( !selectedPrescAndPDData.prescData.selectedChoice.includes(selectionType) ){selectedPrescAndPDData.prescData.selectedChoice.push(selectionType);}/* ] */};markPDSelectedChoice = (selectionType)=>{/* reseting the new selection except typeNewFilesUpload[ */if( selectedPrescAndPDData.pdData.selectedChoice.length >= 1 ){if( !selectedPrescAndPDData.pdData.selectedChoice.includes(selectionType) && selectionType != prescAndPDChoiceTypes.pd.typeNewFilesUpload ){let choicesMustBeRemoved = Object.values(prescAndPDChoiceTypes.pd);choicesMustBeRemoved = choicesMustBeRemoved.filter(item => item !== prescAndPDChoiceTypes.pd.typeNewFilesUpload );selectedPrescAndPDData.pdData.selectedChoice = selectedPrescAndPDData.pdData.selectedChoice.filter(item => !choicesMustBeRemoved.includes(item));}}if( !selectedPrescAndPDData.pdData.selectedChoice.includes(selectionType) ){selectedPrescAndPDData.pdData.selectedChoice.push(selectionType);}/* ] */};loadMyPrescChoiceDetail = (prescSelectionType)=>{let frm = '';switch (prescSelectionType){case prescAndPDChoiceTypes.presc.typeEnter:frm = myPrescChoiceEnterHtml;break;case prescAndPDChoiceTypes.presc.typeExists:frm = myPrescChoiceExistsHtml;break;case prescAndPDChoiceTypes.presc.typeSendEmail:if( rootSGLenseKeyName == "prescription_tp" ){frm = myPrescChoiceSendEmailHtml1 + `

Vous pouvez bénéficier d’une prise en charge tout les 24 mois sauf en cas de changement de correction sur dérogation après 12 mois. Si vous votre dernière prise en charge date de moins de 24 mois, merci de télécharger votre nouvelle ordonnance ainsi que votre ordonnance précédente si nous ne l’avons pas déjà dans votre dossier.

` + myPrescChoiceSendEmailHtml2;} else {frm = myPrescChoiceSendEmailHtml1 + myPrescChoiceSendEmailHtml2;}/* markPrescSelectedChoice(prescSelectionType);if( ('typeEnter' in prescAndPDChoiceTypes.presc) ){resetSelectedPrescriptionsData(prescAndPDChoiceTypes.presc.typeEnter);}if( ('typeExists' in prescAndPDChoiceTypes.presc) ){resetSelectedPrescriptionsData(prescAndPDChoiceTypes.presc.typeExists);} */break;case prescAndPDChoiceTypes.presc.typeNewFilesUpload:if( rootSGLenseKeyName == "prescription_tp" ){frm = myPrescChoiceNewFilesUploadHtml1 + `

Vous pouvez bénéficier d’une prise en charge tout les 24 mois sauf en cas de changement de correction sur dérogation après 12 mois. Si vous votre dernière prise en charge date de moins de 24 mois, merci de télécharger votre nouvelle ordonnance ainsi que votre ordonnance précédente si nous ne l’avons pas déjà dans votre dossier.

` + myPrescChoiceNewFilesUploadHtml2;} else {frm = myPrescChoiceNewFilesUploadHtml1 + myPrescChoiceNewFilesUploadHtml2;}break;}frm += `

`;$('#sg-popup-step-last a.step-back-link').attr("onclick",'loadMyPrescChoices();');$('#sg-popup-step-last #sg-popup-step-last-inner').html(frm);if( prescSelectionType === prescAndPDChoiceTypes.presc.typeNewFilesUpload ){$('#sg-popup-step-last #sg-popup-step-last-inner #filesListing').html(prescUploadedFilesHtml);}/* code to prefill existing selection if made[ */let fname = '';let lname = '';/*let tempArr = ["firstName", "lastName"];Object.keys(selectedPrescAndPDData.prescData).forEach((outerKeyName, outerIndex) => {if( outerKeyName == "selectedChoice" ){return;}Object.keys(selectedPrescAndPDData.prescData[outerKeyName]).forEach((keyName, index) => {if(!tempArr.includes(keyName) ){return;}if( keyName == "firstName" ){fname = selectedPrescAndPDData.prescData[outerKeyName][keyName];}if( keyName == "lastName" ){lname = selectedPrescAndPDData.prescData[outerKeyName][keyName];}});});console.warn(fname, lname); */if( selectedPrescAndPDData.prescData.enterData['firstName'] != "" ){fname = selectedPrescAndPDData.prescData.enterData['firstName'];}if( selectedPrescAndPDData.prescData.enterData['lastName'] != "" ){lname = selectedPrescAndPDData.prescData.enterData['lastName'];}if( selectedPrescAndPDData.prescData.existsData['firstName'] != "" ){fname = selectedPrescAndPDData.prescData.existsData['firstName'];}if( selectedPrescAndPDData.prescData.existsData['lastName'] != "" ){lname = selectedPrescAndPDData.prescData.existsData['lastName'];}if( selectedPrescAndPDData.prescData.sendEmailData['firstName'] != "" ){fname = selectedPrescAndPDData.prescData.sendEmailData['firstName'];}if( selectedPrescAndPDData.prescData.sendEmailData['lastName'] != "" ){lname = selectedPrescAndPDData.prescData.sendEmailData['lastName'];}if( selectedPrescAndPDData.prescData.newFilesUploadData['firstName'] != "" ){fname = selectedPrescAndPDData.prescData.newFilesUploadData['firstName'];}if( selectedPrescAndPDData.prescData.newFilesUploadData['lastName'] != "" ){lname = selectedPrescAndPDData.prescData.newFilesUploadData['lastName'];}let inputOrSelectEl = '';let elName = '';switch (prescSelectionType){case prescAndPDChoiceTypes.presc.typeEnter:Object.keys(selectedPrescAndPDData.prescData.enterData).forEach((keyName, index) => {inputOrSelectEl = ( keyName == "firstName" || keyName == "lastName") ? "input" : "select";elName = `presc_${camelCaseToUnderScore(keyName)}`;if( selectedPrescAndPDData.prescData.enterData[keyName] != "" ){$(`${inputOrSelectEl}[name='${elName}']`).val(selectedPrescAndPDData.prescData.enterData[keyName]);if( elName == "presc_require_feuilles" ){if( selectedPrescAndPDData.prescData.enterData[keyName] == "1" ){$("#presc_require_feuilles_0").attr("checked", "checked");$("#presc_require_feuilles_1").removeAttr("checked");$("#textforfs").show();$("#labelforyes").addClass("is--active--btn");$("#labelforno").removeClass("is--active--btn");} else {$("#presc_require_feuilles_0").removeAttr("checked");$("#presc_require_feuilles_1").attr("checked", "checked");$("#textforfs").hide();$("#labelforyes").removeClass("is--active--btn");$("#labelforno").addClass("is--active--btn");}}} else {if( keyName == "firstName" ){$(`${inputOrSelectEl}[name='${elName}']`).val(fname);}if( keyName == "lastName" ){$(`${inputOrSelectEl}[name='${elName}']`).val(lname);}}});//enableDisablePrescContinueBtn();/* if(selectedPrescAndPDData.prescData.enterData.firstName == "" || selectedPrescAndPDData.prescData.enterData.lastName == ""){$("#setup-my-presc-btn").addClass("tool-tips btn--disabled unclick");$("#setup-my-presc-btn").attr("title", "Your First Name must contain a minimum of 1 characters. & Your Last Name must contain a minimum of 1 characters.");$("#setup-my-presc-btn").removeAttr("onclick");} else {$("#setup-my-presc-btn").removeClass("tool-tips btn--disabled unclick");$("#setup-my-presc-btn").removeAttr("title");$("#setup-my-presc-btn").attr("onclick", "setUpMyPrescriptionData();");} */break;case prescAndPDChoiceTypes.presc.typeExists:Object.keys(selectedPrescAndPDData.prescData.existsData).forEach((keyName, index) => {inputOrSelectEl = ( keyName == "firstName" || keyName == "lastName") ? "input" : "select";elName = `presc_exists_${camelCaseToUnderScore(keyName)}`;if( selectedPrescAndPDData.prescData.existsData[keyName] != "" ){$(`${inputOrSelectEl}[name='${elName}']`).val(selectedPrescAndPDData.prescData.existsData[keyName]);} else {if( keyName == "firstName" ){$(`${inputOrSelectEl}[name='${elName}']`).val(fname);}if( keyName == "lastName" ){$(`${inputOrSelectEl}[name='${elName}']`).val(lname);}}});$("#presc_previous_order_hint").val(selectedPrescAndPDData.prescData.existsData.previousOrderHint);//enableDisablePrescContinueBtn();/* if(selectedPrescAndPDData.prescData.existsData.firstName == "" || selectedPrescAndPDData.prescData.existsData.lastName == ""){$("#setup-my-presc-btn").addClass("tool-tips btn--disabled unclick");$("#setup-my-presc-btn").attr("title", "Your First Name must contain a minimum of 1 characters. & Your Last Name must contain a minimum of 1 characters.");$("#setup-my-presc-btn").removeAttr("onclick");} else {$("#setup-my-presc-btn").removeClass("tool-tips btn--disabled unclick");$("#setup-my-presc-btn").removeAttr("title");$("#setup-my-presc-btn").attr("onclick", "setUpMyPrescriptionData();");} */break;case prescAndPDChoiceTypes.presc.typeSendEmail:Object.keys(selectedPrescAndPDData.prescData.sendEmailData).forEach((keyName, index) => {inputOrSelectEl = ( keyName == "firstName" || keyName == "lastName") ? "input" : "select";elName = `presc_send_email_${camelCaseToUnderScore(keyName)}`;if( selectedPrescAndPDData.prescData.sendEmailData[keyName] != "" ){$(`${inputOrSelectEl}[name='${elName}']`).val(selectedPrescAndPDData.prescData.sendEmailData[keyName]);} else {if( keyName == "firstName" ){$(`${inputOrSelectEl}[name='${elName}']`).val(fname);}if( keyName == "lastName" ){$(`${inputOrSelectEl}[name='${elName}']`).val(lname);}}});break;case prescAndPDChoiceTypes.presc.typeNewFilesUpload:Object.keys(selectedPrescAndPDData.prescData.newFilesUploadData).forEach((keyName, index) => {inputOrSelectEl = ( keyName == "firstName" || keyName == "lastName") ? "input" : "select";elName = `presc_new_files_upload_${camelCaseToUnderScore(keyName)}`;if( selectedPrescAndPDData.prescData.newFilesUploadData[keyName] != "" ){$(`${inputOrSelectEl}[name='${elName}']`).val(selectedPrescAndPDData.prescData.newFilesUploadData[keyName]);} else {if( keyName == "firstName" ){$(`${inputOrSelectEl}[name='${elName}']`).val(fname);}if( keyName == "lastName" ){$(`${inputOrSelectEl}[name='${elName}']`).val(lname);}}});break;}/* ] */};resetSelectedPrescriptionsData = (prescType)=>{let dataKeys = '';/* reset whole selection of captured prescription and captured PD Data, when prescType is not passed[ */if( prescType == "" || typeof(prescType) == "undefined" ){let prescRootKeys = Object.keys(selectedPrescAndPDData.prescData);prescRootKeys.forEach((keyName, index) => {if( keyName == "selectedChoice" ){selectedPrescAndPDData.prescData[keyName] = [];return;}let prescTypeKey = camelCaseToUnderScore(keyName);prescTypeKey = prescTypeKey.replace("_data","");let prescTypes = Object.values(prescAndPDChoiceTypes.presc);if( !prescTypes.includes(prescTypeKey) ){return;}resetSelectedPrescriptionsData(prescTypeKey);});return;}/* ] */switch(prescType){case prescAndPDChoiceTypes.presc.typeEnter:dataKeys = Object.keys(selectedPrescAndPDData.prescData.enterData);dataKeys.forEach((keyName, index) => {selectedPrescAndPDData.prescData.enterData[keyName] = "";});selectedPrescAndPDData.prescData.selectedChoice = selectedPrescAndPDData.prescData.selectedChoice.filter(item => (item !== prescAndPDChoiceTypes.presc.typeEnter));break;case prescAndPDChoiceTypes.presc.typeExists:dataKeys = Object.keys(selectedPrescAndPDData.prescData.existsData);dataKeys.forEach((keyName, index) => {selectedPrescAndPDData.prescData.existsData[keyName] = "";});selectedPrescAndPDData.prescData.selectedChoice = selectedPrescAndPDData.prescData.selectedChoice.filter(item => (item !== prescAndPDChoiceTypes.presc.typeExists));break;case prescAndPDChoiceTypes.presc.typeSendEmail:dataKeys = Object.keys(selectedPrescAndPDData.prescData.sendEmailData);dataKeys.forEach((keyName, index) => {selectedPrescAndPDData.prescData.sendEmailData[keyName] = "";});selectedPrescAndPDData.prescData.selectedChoice = selectedPrescAndPDData.prescData.selectedChoice.filter(item => (item !== prescAndPDChoiceTypes.presc.typeSendEmail));break;}};resetSelectedPDData = (pdType)=>{let dataKeys = '';/* reset whole selection of captured PD Data, when pdType is not passed[ */if( pdType == "" || typeof(pdType) == "undefined" ){let pdRootKeys = Object.keys(selectedPrescAndPDData.pdData);pdRootKeys.forEach((keyName, index) => {if( keyName == "selectedChoice" ){selectedPrescAndPDData.pdData[keyName] = [];return;}let pdTypeKey = camelCaseToUnderScore(keyName);pdTypeKey = pdTypeKey.replace("_data","");let pdTypes = Object.values(prescAndPDChoiceTypes.pd);if( !pdTypes.includes(pdTypeKey) ){return;}resetSelectedPDData(pdTypeKey);});return;}/* ] */switch(pdType){case prescAndPDChoiceTypes.pd.typeEnter:dataKeys = Object.keys(selectedPrescAndPDData.pdData.enterData);dataKeys.forEach((keyName, index) => {selectedPrescAndPDData.pdData.enterData[keyName] = "";});break;case prescAndPDChoiceTypes.pd.typeExists:dataKeys = Object.keys(selectedPrescAndPDData.pdData.existsData);dataKeys.forEach((keyName, index) => {selectedPrescAndPDData.pdData.existsData[keyName] = "";});break;case prescAndPDChoiceTypes.pd.typeUpload:dataKeys = Object.keys(selectedPrescAndPDData.pdData.uploadData);dataKeys.forEach((keyName, index) => {selectedPrescAndPDData.pdData.uploadData[keyName] = "";});break;}if(channelCode == 'FR_WEB' && ('typeSendGlasses' in prescAndPDChoiceTypes.pd) && pdType == prescAndPDChoiceTypes.pd.typeSendGlasses){dataKeys = Object.keys(selectedPrescAndPDData.pdData.sendGlassesData);dataKeys.forEach((keyName, index) => {selectedPrescAndPDData.pdData.sendGlassesData[keyName] = "";});}};resetSelectedMutData = (mutType)=>{let dataKeys = '';/* reset whole selection of captured mut Data, when mutType is not passed[ */if( mutType == "" || typeof(mutType) == "undefined" ){let mutRootKeys = Object.keys(selectedPrescAndPDData.mutData);mutRootKeys.forEach((keyName, index) => {if( keyName == "selectedChoice" ){selectedPrescAndPDData.mutData[keyName] = [];return;}let mutTypeKey = camelCaseToUnderScore(keyName);mutTypeKey = mutTypeKey.replace("_data","");let mutTypes = Object.values(prescAndPDChoiceTypes.mut);if( !mutTypes.includes(mutTypeKey) ){return;}resetSelectedPDData(mutTypeKey);});return;}/* ] */switch(mutType){case prescAndPDChoiceTypes.mut.typeUpload:dataKeys = Object.keys(selectedPrescAndPDData.mutData.uploadData);dataKeys.forEach((keyName, index) => {selectedPrescAndPDData.mutData.uploadData[keyName] = "";});break;}};setUpMyPrescriptionData = ()=>{if( $(`input[name="prescSelectionType"]`).val() == prescAndPDChoiceTypes.presc.typeEnter ){selectedPrescAndPDData.prescData.enterData.firstName = $("input[name='presc_first_name']").val();selectedPrescAndPDData.prescData.enterData.lastName = $("input[name='presc_last_name']").val();selectedPrescAndPDData.prescData.enterData.sphericalRightEye = $("select[name='presc_spherical_right_eye']").val();selectedPrescAndPDData.prescData.enterData.sphericalLeftEye = $("select[name='presc_spherical_left_eye']").val();selectedPrescAndPDData.prescData.enterData.cylinderRightEye = $("select[name='presc_cylinder_right_eye']").val();selectedPrescAndPDData.prescData.enterData.cylinderLeftEye = $("select[name='presc_cylinder_left_eye']").val();selectedPrescAndPDData.prescData.enterData.axisRightEye = $("select[name='presc_axis_right_eye']").val();selectedPrescAndPDData.prescData.enterData.axisLeftEye = $("select[name='presc_axis_left_eye']").val();selectedPrescAndPDData.prescData.enterData.additionRightEye = $("select[name='presc_addition_right_eye']").val();selectedPrescAndPDData.prescData.enterData.additionLeftEye = $("select[name='presc_addition_left_eye']").val();let prescEnterErr=false;$(".fst-name-err").remove();$(".lst-name-err").remove();if( selectedPrescAndPDData.prescData.enterData.firstName == '' ){$("input[name='presc_first_name']").after(`Your First Name must contain a minimum of 1 characters.`);prescEnterErr = true;}if( selectedPrescAndPDData.prescData.enterData.lastName == '' ){$("input[name='presc_last_name']").after(`Your Last Name must contain a minimum of 1 characters.`);prescEnterErr = true;}if( prescEnterErr ){return;}markPrescSelectedChoice($(`input[name="prescSelectionType"]`).val());let isSelectedChoicePrescTypeEnter = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeEnter);let isSelectedChoicePrescTypeExists = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeExists);let isSelectedChoicePrescTypeSendEmail = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeSendEmail);let isSelectedChoicePrescTypeNewFilesUpload = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeNewFilesUpload);if( ('typeExists' in prescAndPDChoiceTypes.presc) ){resetSelectedPrescriptionsData(prescAndPDChoiceTypes.presc.typeExists);}if( ('typeSendEmail' in prescAndPDChoiceTypes.presc) ){resetSelectedPrescriptionsData(prescAndPDChoiceTypes.presc.typeSendEmail);}if( isSelectedChoicePrescTypeNewFilesUpload && selectedPrescAndPDData.prescData.newFilesUploadData['firstName'] != "" && selectedPrescAndPDData.prescData.newFilesUploadData['lastName'] != "" ){selectedPrescAndPDData.prescData.newFilesUploadData['firstName'] = selectedPrescAndPDData.prescData.enterData.firstName;selectedPrescAndPDData.prescData.newFilesUploadData['lastName'] = selectedPrescAndPDData.prescData.enterData.lastName;}}if( $(`input[name="prescSelectionType"]`).val() == prescAndPDChoiceTypes.presc.typeExists ){selectedPrescAndPDData.prescData.existsData.firstName = $("input[name='presc_exists_first_name']").val();selectedPrescAndPDData.prescData.existsData.lastName = $("input[name='presc_exists_last_name']").val();let prescExistsErr = false;$(".fst-name-err").remove();$(".lst-name-err").remove();if( selectedPrescAndPDData.prescData.existsData.firstName == '' ){$("input[name='presc_exists_first_name']").after(`Your First Name must contain a minimum of 1 characters.`);prescExistsErr = true;}if( selectedPrescAndPDData.prescData.existsData.lastName == '' ){$("input[name='presc_exists_last_name']").after(`Your Last Name must contain a minimum of 1 characters.`);prescExistsErr = true;}if( prescExistsErr ){return;}markPrescSelectedChoice($(`input[name="prescSelectionType"]`).val());let isSelectedChoicePrescTypeEnter = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeEnter);let isSelectedChoicePrescTypeExists = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeExists);let isSelectedChoicePrescTypeSendEmail = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeSendEmail);let isSelectedChoicePrescTypeNewFilesUpload = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeNewFilesUpload);selectedPrescAndPDData.prescData.existsData.previousOrderHint = $("#presc_previous_order_hint").val();if( ('typeEnter' in prescAndPDChoiceTypes.presc) ){resetSelectedPrescriptionsData(prescAndPDChoiceTypes.presc.typeEnter);}if( ('typeSendEmail' in prescAndPDChoiceTypes.presc) ){resetSelectedPrescriptionsData(prescAndPDChoiceTypes.presc.typeSendEmail);}if( isSelectedChoicePrescTypeNewFilesUpload && selectedPrescAndPDData.prescData.newFilesUploadData['firstName'] != "" && selectedPrescAndPDData.prescData.newFilesUploadData['lastName'] != "" ){selectedPrescAndPDData.prescData.newFilesUploadData['firstName'] = selectedPrescAndPDData.prescData.existsData.firstName;selectedPrescAndPDData.prescData.newFilesUploadData['lastName'] = selectedPrescAndPDData.prescData.existsData.lastName;}}if( $(`input[name="prescSelectionType"]`).val() == prescAndPDChoiceTypes.presc.typeSendEmail ){selectedPrescAndPDData.prescData.sendEmailData.firstName = $("input[name='presc_send_email_first_name']").val();selectedPrescAndPDData.prescData.sendEmailData.lastName = $("input[name='presc_send_email_last_name']").val();let prescTypeSendEmailErr = false;$(".fst-name-err").remove();$(".lst-name-err").remove();if( selectedPrescAndPDData.prescData.sendEmailData.firstName == '' ){$("input[name='presc_send_email_first_name']").after(`Your First Name must contain a minimum of 1 characters.`);prescTypeSendEmailErr = true;}if( selectedPrescAndPDData.prescData.sendEmailData.lastName == '' ){$("input[name='presc_send_email_last_name']").after(`Your Last Name must contain a minimum of 1 characters.`);prescTypeSendEmailErr = true;}if( prescTypeSendEmailErr ){return;}markPrescSelectedChoice($(`input[name="prescSelectionType"]`).val());let isSelectedChoicePrescTypeEnter = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeEnter);let isSelectedChoicePrescTypeExists = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeExists);let isSelectedChoicePrescTypeSendEmail = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeSendEmail);let isSelectedChoicePrescTypeNewFilesUpload = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeNewFilesUpload);if( ('typeEnter' in prescAndPDChoiceTypes.presc) ){resetSelectedPrescriptionsData(prescAndPDChoiceTypes.presc.typeEnter);}if( ('typeExists' in prescAndPDChoiceTypes.presc) ){resetSelectedPrescriptionsData(prescAndPDChoiceTypes.presc.typeExists);}if( isSelectedChoicePrescTypeNewFilesUpload && selectedPrescAndPDData.prescData.newFilesUploadData['firstName'] != "" && selectedPrescAndPDData.prescData.newFilesUploadData['lastName'] != "" ){selectedPrescAndPDData.prescData.newFilesUploadData['firstName'] = selectedPrescAndPDData.prescData.sendEmailData.firstName;selectedPrescAndPDData.prescData.newFilesUploadData['lastName'] = selectedPrescAndPDData.prescData.sendEmailData.lastName;}}if( $(`input[name="prescSelectionType"]`).val() == prescAndPDChoiceTypes.presc.typeNewFilesUpload ){selectedPrescAndPDData.prescData.newFilesUploadData.firstName = $("input[name='presc_new_files_upload_first_name']").val();selectedPrescAndPDData.prescData.newFilesUploadData.lastName = $("input[name='presc_new_files_upload_last_name']").val();let prescFileUploadErr = false;$(".fst-name-err").remove();$(".lst-name-err").remove();$(".presc-file-err").remove();if( selectedPrescAndPDData.prescData.newFilesUploadData.firstName == '' ){$("input[name='presc_new_files_upload_first_name']").after(`Your First Name must contain a minimum of 1 characters.`);prescFileUploadErr = true;}if( selectedPrescAndPDData.prescData.newFilesUploadData.lastName == '' ){$("input[name='presc_new_files_upload_last_name']").after(`Your Last Name must contain a minimum of 1 characters.`);prescFileUploadErr = true;}if( !prescUploadedFilesExists ){$("input[name='presc_file']").after(`entry_presc_required_file_error`);prescFileUploadErr = true;}if( prescFileUploadErr ){return;}markPrescSelectedChoice($(`input[name="prescSelectionType"]`).val());let isSelectedChoicePrescTypeEnter = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeEnter);let isSelectedChoicePrescTypeExists = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeExists);let isSelectedChoicePrescTypeSendEmail = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeSendEmail);let isSelectedChoicePrescTypeNewFilesUpload = selectedPrescAndPDData.prescData.selectedChoice.includes(prescAndPDChoiceTypes.presc.typeNewFilesUpload);if( isSelectedChoicePrescTypeEnter && selectedPrescAndPDData.prescData.enterData['firstName'] != "" && selectedPrescAndPDData.prescData.enterData['lastName'] != "" ){selectedPrescAndPDData.prescData.enterData['firstName'] = selectedPrescAndPDData.prescData.newFilesUploadData.firstName;selectedPrescAndPDData.prescData.enterData['lastName'] = selectedPrescAndPDData.prescData.newFilesUploadData.lastName;}if( isSelectedChoicePrescTypeExists && selectedPrescAndPDData.prescData.existsData['firstName'] != "" && selectedPrescAndPDData.prescData.existsData['lastName'] != "" ){selectedPrescAndPDData.prescData.existsData['firstName'] = selectedPrescAndPDData.prescData.newFilesUploadData.firstName;selectedPrescAndPDData.prescData.existsData['lastName'] = selectedPrescAndPDData.prescData.newFilesUploadData.lastName;}if( isSelectedChoicePrescTypeSendEmail && selectedPrescAndPDData.prescData.sendEmailData['firstName'] != "" && selectedPrescAndPDData.prescData.sendEmailData['lastName'] != "" ){selectedPrescAndPDData.prescData.sendEmailData['firstName'] = selectedPrescAndPDData.prescData.newFilesUploadData.firstName;selectedPrescAndPDData.prescData.sendEmailData['lastName'] = selectedPrescAndPDData.prescData.newFilesUploadData.lastName;}}/* if( selectedPrescAndPDData.pdData.selectedChoice.length == 0 ){loadMyPDChoices();return;} */let lastSelectedLens = chosenSGLensesArrForAddToCart.at(-1).key;loadSGPopupLastStep(lastSelectedLens);$("#sg-popup-last-confirm-btn").show();};let myPDChoiceEnterHtml = `

If you know your PD, please enter them

Important : please only enter them if they were measured by an optician, do not attemp to measure them yourself. If you have just one number, divide it in 2.

`;let myPDChoiceExistsHtml = `

The measurement of pupillary distance never changes, if you have already placed an order on Visionet, please indicate your name and surname and if possible your old order number. This will allow us to replicate the pupillary distances identically.

Your previous order number or frame number:

`;let myPDChoiceUploadHtml = `

Please upload a document showing your pupillary distance or some photos of you face with a ruler or card (credit card size).

How to take a good photo


You will be able to add your documents and photos to your order later. Go to my account => View the order => My upload documents

`;let myPDChoicesSendGlassesHtml = `

We can measure your PD on one of your old glasses, even if it was done with an old prescription

`;let myPDChoicesNewFilesUploadHtml = `

`;loadMyPDChoices =()=>{let myPDChoicesHtml = ``;if(channelCode == 'FR_WEB'){myPDChoicesHtml += `

Learn more about measuring your pupillary distance

`;}Object.keys(prescAndPDChoiceTypes.pd).forEach((keyName, index) => {let icn = ``;let lbl = ``;switch(prescAndPDChoiceTypes.pd[keyName]){case prescAndPDChoiceTypes.pd.typeEnter:icn = ``;lbl = `

Enter the PD yourself

`;break;case prescAndPDChoiceTypes.pd.typeExists:icn = ``;lbl = `

Visionet already has your pupillary distance

`;break;case prescAndPDChoiceTypes.pd.typeUpload:icn = ``;lbl = `

Send a photo or document later

`;break;case prescAndPDChoiceTypes.pd.typeSendGlasses:icn = ``;lbl = `

Send us an old pair of your glasses

`;break;case prescAndPDChoiceTypes.pd.typeNewFilesUpload:icn = ``;lbl = `

Upload a photo or document now

`;break;}myPDChoicesHtml += `

${icn}

${lbl}

`;});$("#selected-presc-wrapper").hide();$("#selected-pd-wrapper").hide();$("#selected-mut-wrapper").hide();let lastSelectedLens = chosenSGLensesArrForAddToCart.at(-1).key;$('#sg-popup-step-last a.step-back-link').attr("onclick",'loadSGPopupLastStep("'+ lastSelectedLens +'");');$('#sg-popup-step-last #sg-popup-step-last-inner').html(myPDChoicesHtml);$("#sg-popup-last-input-prescription-btn").hide();$("#sg-popup-last-input-pupillary-distance-btn").hide();$("#sg-popup-last-input-mut-btn").hide();$("#sg-popup-last-confirm-btn").hide();};loadMyPDChoiceDetail = (pdSelectionType)=>{let frm = '';switch (pdSelectionType){case prescAndPDChoiceTypes.pd.typeEnter:frm = myPDChoiceEnterHtml;break;case prescAndPDChoiceTypes.pd.typeExists:frm = myPDChoiceExistsHtml;break;case prescAndPDChoiceTypes.pd.typeUpload:frm = myPDChoiceUploadHtml;/* markPDSelectedChoice(pdSelectionType);resetSelectedPDData(prescAndPDChoiceTypes.pd.typeEnter);resetSelectedPDData(prescAndPDChoiceTypes.pd.typeExists);if(channelCode == 'FR_WEB' && !('typeSendGlasses' in prescAndPDChoiceTypes.pd)){resetSelectedPDData(prescAndPDChoiceTypes.pd.typeSendGlasses);} */break;case prescAndPDChoiceTypes.pd.typeSendGlasses:frm = myPDChoicesSendGlassesHtml;/* markPDSelectedChoice(pdSelectionType);resetSelectedPDData(prescAndPDChoiceTypes.pd.typeEnter);resetSelectedPDData(prescAndPDChoiceTypes.pd.typeExists);resetSelectedPDData(prescAndPDChoiceTypes.pd.typeUpload); */break;case prescAndPDChoiceTypes.pd.typeNewFilesUpload:frm = myPDChoicesNewFilesUploadHtml;break;}frm += `

`;$('#sg-popup-step-last a.step-back-link').attr("onclick",'loadMyPDChoices();');$('#sg-popup-step-last #sg-popup-step-last-inner').html(frm);if( pdSelectionType === prescAndPDChoiceTypes.pd.typeNewFilesUpload ){$('#sg-popup-step-last #sg-popup-step-last-inner #filesListing').html(pdUploadedFilesHtml);}/* code to prefill existing selection if made[ */switch (pdSelectionType){case prescAndPDChoiceTypes.pd.typeEnter:Object.keys(selectedPrescAndPDData.pdData.enterData).forEach((keyName, index) => {if( selectedPrescAndPDData.pdData.enterData[keyName] != "" ){let inputOrSelectEl = "select";let elName = (inputOrSelectEl == "input") ? `pd_enter_${camelCaseToUnderScore(keyName)}` : `pd_${camelCaseToUnderScore(keyName)}`;$(`${inputOrSelectEl}[name='${elName}']`).val(selectedPrescAndPDData.pdData.enterData[keyName]);}});//enableDisablePDContinueBtn();break;case prescAndPDChoiceTypes.pd.typeExists:Object.keys(selectedPrescAndPDData.pdData.existsData).forEach((keyName, index) => {if( selectedPrescAndPDData.pdData.existsData[keyName] != "" ){let inputOrSelectEl = ( keyName == "firstName" || keyName == "lastName") ? "input" : "select";let elName = `pd_exists_${camelCaseToUnderScore(keyName)}`;$(`${inputOrSelectEl}[name='${elName}']`).val(selectedPrescAndPDData.pdData.existsData[keyName]);}});$("#pd_previous_order_hint").val(selectedPrescAndPDData.pdData.existsData.previousOrderHint);//enableDisablePDContinueBtn();/* if(selectedPrescAndPDData.pdData.existsData.firstName == "" || selectedPrescAndPDData.pdData.existsData.lastName == ""){$("#setup-my-pd-btn").addClass("tool-tips btn--disabled unclick");$("#setup-my-pd-btn").attr("title", "Your First Name must contain a minimum of 1 characters. & Your Last Name must contain a minimum of 1 characters.");$("#setup-my-pd-btn").removeAttr("onclick");} else {$("#setup-my-pd-btn").removeClass("tool-tips btn--disabled unclick");$("#setup-my-pd-btn").removeAttr("title");$("#setup-my-pd-btn").attr("onclick", "setUpMyPDData();");} */break;}/* ] */};setUpMyPDData =()=>{if( $(`input[name="pdSelectionType"]`).val() == prescAndPDChoiceTypes.pd.typeEnter){selectedPrescAndPDData.pdData.enterData.halfDistanceRightEye = $('select[name="pd_half_distance_right_eye"]').val();selectedPrescAndPDData.pdData.enterData.halfDistanceLeftEye = $('select[name="pd_half_distance_left_eye"]').val();let pdEnterErr=false;$(".pd-half-distance-right-eye-err").remove();$(".pd-half-distance-right-left-err").remove();if( selectedPrescAndPDData.pdData.enterData.halfDistanceRightEye == '0' ){$('select[name="pd_half_distance_right_eye"]').after(`visionet.legacy.entry_presc_lefteye_error`);pdEnterErr = true;}if( selectedPrescAndPDData.pdData.enterData.halfDistanceLeftEye == '0' ){$('select[name="pd_half_distance_left_eye"]').after(`visionet.legacy.entry_presc_righteye_error`);pdEnterErr = true;}if( pdEnterErr ){return;}markPDSelectedChoice($(`input[name="pdSelectionType"]`).val());let isSelectedChoicePDTypeEnter = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeEnter);let isSelectedChoicePDTypeExists = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeExists);let isSelectedChoicePDTypeUpload = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeUpload);let isSelectedChoicePDTypeSendGlasses = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeSendGlasses);resetSelectedPDData(prescAndPDChoiceTypes.pd.typeExists);resetSelectedPDData(prescAndPDChoiceTypes.pd.typeUpload);if(channelCode == 'FR_WEB' && ('typeSendGlasses' in prescAndPDChoiceTypes.pd)){resetSelectedPDData(prescAndPDChoiceTypes.pd.typeSendGlasses);}}if( $(`input[name="pdSelectionType"]`).val() == prescAndPDChoiceTypes.pd.typeExists){selectedPrescAndPDData.pdData.existsData.firstName = $('input[name="pd_exists_first_name"]').val();selectedPrescAndPDData.pdData.existsData.lastName = $('input[name="pd_exists_last_name"]').val();let pdExistsErr=false;$(".fst-name-err").remove();$(".lst-name-err").remove();if( selectedPrescAndPDData.pdData.existsData.firstName == '' ){$("input[name='pd_exists_first_name']").after(`Your First Name must contain a minimum of 1 characters.`);pdExistsErr = true;}if( selectedPrescAndPDData.pdData.existsData.lastName == '' ){$("input[name='pd_exists_last_name']").after(`Your Last Name must contain a minimum of 1 characters.`);pdExistsErr = true;}if( pdExistsErr ){return;}markPDSelectedChoice($(`input[name="pdSelectionType"]`).val());let isSelectedChoicePDTypeEnter = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeEnter);let isSelectedChoicePDTypeExists = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeExists);let isSelectedChoicePDTypeUpload = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeUpload);let isSelectedChoicePDTypeSendGlasses = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeSendGlasses);selectedPrescAndPDData.pdData.existsData.previousOrderHint = $("#pd_previous_order_hint").val();resetSelectedPDData(prescAndPDChoiceTypes.pd.typeEnter);resetSelectedPDData(prescAndPDChoiceTypes.pd.typeUpload);if(channelCode == 'FR_WEB' && ('typeSendGlasses' in prescAndPDChoiceTypes.pd)){resetSelectedPDData(prescAndPDChoiceTypes.pd.typeSendGlasses);}}if( $(`input[name="pdSelectionType"]`).val() == prescAndPDChoiceTypes.pd.typeUpload){markPDSelectedChoice($(`input[name="pdSelectionType"]`).val());let isSelectedChoicePDTypeEnter = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeEnter);let isSelectedChoicePDTypeExists = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeExists);let isSelectedChoicePDTypeUpload = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeUpload);let isSelectedChoicePDTypeSendGlasses = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeSendGlasses);resetSelectedPDData(prescAndPDChoiceTypes.pd.typeEnter);resetSelectedPDData(prescAndPDChoiceTypes.pd.typeExists);if(channelCode == 'FR_WEB' && ('typeSendGlasses' in prescAndPDChoiceTypes.pd)){resetSelectedPDData(prescAndPDChoiceTypes.pd.typeSendGlasses);}}if( $(`input[name="pdSelectionType"]`).val() == prescAndPDChoiceTypes.pd.typeSendGlasses){markPDSelectedChoice($(`input[name="pdSelectionType"]`).val());let isSelectedChoicePDTypeEnter = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeEnter);let isSelectedChoicePDTypeExists = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeExists);let isSelectedChoicePDTypeUpload = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeUpload);let isSelectedChoicePDTypeSendGlasses = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeSendGlasses);resetSelectedPDData(prescAndPDChoiceTypes.pd.typeEnter);resetSelectedPDData(prescAndPDChoiceTypes.pd.typeExists);if(channelCode == 'FR_WEB' && ('typeSendGlasses' in prescAndPDChoiceTypes.pd)){resetSelectedPDData(prescAndPDChoiceTypes.pd.typeUpload);}}if( $(`input[name="pdSelectionType"]`).val() == prescAndPDChoiceTypes.pd.typeNewFilesUpload ){let pdFileUploadErr = false;$(".pd-file-err").remove();if( !pdUploadedFilesExists ){$("input[name='presc_file']").after(`No document has been added`);pdFileUploadErr = true;}if( pdFileUploadErr ){return;}markPDSelectedChoice($(`input[name="pdSelectionType"]`).val());let isSelectedChoicePDTypeEnter = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeEnter);let isSelectedChoicePDTypeExists = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeExists);let isSelectedChoicePDTypeUpload = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeUpload);let isSelectedChoicePDTypeSendGlasses = selectedPrescAndPDData.pdData.selectedChoice.includes(prescAndPDChoiceTypes.pd.typeSendGlasses);}/* if( selectedPrescAndPDData.prescData.selectedChoice.length == 0 ){loadMyPrescChoices();return;} */let lastSelectedLens = chosenSGLensesArrForAddToCart.at(-1).key;loadSGPopupLastStep(lastSelectedLens);$("#sg-popup-last-confirm-btn").show();};$(".box-panel__body").delegate(".mypresc-choice-js","click",function(){$('.action-list__item').removeClass('active');$(this).children('.action-list__item').addClass('active');loadMyPrescChoiceDetail($(this).children('input[name="mypresc_choice"]').val());});$(".box-panel__body").delegate(".mypd-choice-js","click",function(){$('.action-list__item').removeClass('active');$(this).children('.action-list__item').addClass('active');loadMyPDChoiceDetail($(this).children('input[name="mypd_choice"]').val());});$(".box-panel__body").delegate(".mymut-choice-js","click",function(){$('.action-list__item').removeClass('active');$(this).children('.action-list__item').addClass('active');mutSelectionType = $(this).children('input[name="mymut_choice"]').val();loadMyMutChoiceDetail(mutSelectionType);});/* $(".box-panel__body").delegate("#presc_first_name, #presc_last_name, #presc_exists_first_name, #presc_exists_last_name","keyup", function(){enableDisablePrescContinueBtn();}); *//* $(".box-panel__body").delegate("#pd_exists_first_name, #pd_exists_last_name","keyup", function(){enableDisablePDContinueBtn();});$(".box-panel__body").delegate("#pd_half_distance_right_eye, #pd_half_distance_left_eye","change", function(){enableDisablePDContinueBtn();}); *//* enableDisablePrescContinueBtn = ()=>{let firstName = '';let lastName = '';let isSelectedChoicePrescTypeEnter = $(`input[name="prescSelectionType"]`).val() == prescAndPDChoiceTypes.presc.typeEnter;let isSelectedChoicePrescTypeExists = $(`input[name="prescSelectionType"]`).val() == prescAndPDChoiceTypes.presc.typeExists;let isSelectedChoicePrescTypeSendEmail = $(`input[name="prescSelectionType"]`).val() == prescAndPDChoiceTypes.presc.typeSendEmail;if( isSelectedChoicePrescTypeEnter ){firstName = $("#presc_first_name").val();lastName = $("#presc_last_name").val();}if( isSelectedChoicePrescTypeExists ){firstName = $("#presc_exists_first_name").val();lastName = $("#presc_exists_last_name").val();}if( firstName != "" && lastName != "" ){$("#setup-my-presc-btn").removeClass("tool-tips btn--disabled unclick");$("#setup-my-presc-btn").removeAttr("title");$("#setup-my-presc-btn").attr("onclick", "setUpMyPrescriptionData();");}if( firstName == "" || lastName == "" ){$("#setup-my-presc-btn").addClass("tool-tips btn--disabled unclick");$("#setup-my-presc-btn").attr("title", "Your First Name must contain a minimum of 1 characters. & Your Last Name must contain a minimum of 1 characters.");$("#setup-my-presc-btn").removeAttr("onclick");}if( firstName != "" ){$(".fst-name-err").remove();}if( lastName != "" ){$(".lst-name-err").remove();}}; *//* enableDisablePDContinueBtn = ()=>{let isSelectedChoicePDTypeEnter = $(`input[name="pdSelectionType"]`).val() == prescAndPDChoiceTypes.pd.typeEnter;let isSelectedChoicePDTypeExists = $(`input[name="pdSelectionType"]`).val() == prescAndPDChoiceTypes.pd.typeExists;let isSelectedChoicePDTypeUpload = $(`input[name="pdSelectionType"]`).val() == prescAndPDChoiceTypes.pd.typeUpload;let isSelectedChoicePDTypeSendGlasses = $(`input[name="pdSelectionType"]`).val() == prescAndPDChoiceTypes.pd.typeSendGlasses;if( isSelectedChoicePDTypeEnter ){let pd_half_distance_right_eye = $("#pd_half_distance_right_eye :selected").val();let pd_half_distance_left_eye = $("#pd_half_distance_left_eye :selected").val();if( pd_half_distance_right_eye == "0" || pd_half_distance_left_eye == "0" ){$("#setup-my-pd-btn").addClass("tool-tips btn--disabled unclick");$("#setup-my-pd-btn").attr("title", "Left eye: & Right eye:");$("#setup-my-pd-btn").removeAttr("onclick");} else {$("#setup-my-pd-btn").removeClass("tool-tips btn--disabled unclick");$("#setup-my-pd-btn").removeAttr("title");$("#setup-my-pd-btn").attr("onclick", "setUpMyPDData();");}}if( isSelectedChoicePDTypeExists ){firstName = $("#pd_exists_first_name").val();lastName = $("#pd_exists_last_name").val();if( firstName != "" && lastName != "" ){$("#setup-my-pd-btn").removeClass("tool-tips btn--disabled unclick");$("#setup-my-pd-btn").removeAttr("title");$("#setup-my-pd-btn").attr("onclick", "setUpMyPDData();");}if( firstName == "" || lastName == "" ){$("#setup-my-pd-btn").addClass("tool-tips btn--disabled unclick");$("#setup-my-pd-btn").attr("title", "Your First Name must contain a minimum of 1 characters. & Your Last Name must contain a minimum of 1 characters.");$("#setup-my-pd-btn").removeAttr("onclick");}if( firstName != "" ){$(".fst-name-err").remove();}if( lastName != "" ){$(".lst-name-err").remove();}}}; */loadMyMutChoices = ()=>{let mutChoicesHtml = ``;Object.keys(prescAndPDChoiceTypes.mut).forEach((keyName, index) => {let icn = ``;let lbl = ``;switch(prescAndPDChoiceTypes.mut[keyName]){case prescAndPDChoiceTypes.mut.typeUpload:icn = ``;lbl = `

Send my document later

`;break;case prescAndPDChoiceTypes.mut.typeNewFilesUpload:icn = ``;lbl = `

Upload my document now

`;break;}mutChoicesHtml += `

${icn}

${lbl}

`;});$("#selected-presc-wrapper").hide();$("#selected-pd-wrapper").hide();$("#selected-mut-wrapper").hide();let lastSelectedLens = chosenSGLensesArrForAddToCart.at(-1).key;$('#sg-popup-step-last a.step-back-link').attr("onclick",'loadSGPopupLastStep("'+ lastSelectedLens +'");');$('#sg-popup-step-last #sg-popup-step-last-inner').html(mutChoicesHtml);$("#sg-popup-last-input-prescription-btn").hide();$("#sg-popup-last-input-pupillary-distance-btn").hide();$("#sg-popup-last-input-mut-btn").hide();$("#sg-popup-last-confirm-btn").hide();};loadMyMutChoiceDetail = (mutSelectionType)=>{let frm = ``;let heading = ``;let lastSelectedLens = chosenSGLensesArrForAddToCart.at(-1).key;switch (mutSelectionType){case prescAndPDChoiceTypes.mut.typeUpload://markMutSelectedChoice(mutSelectionType);if( lastSelectedLens.toLowerCase().includes("css") == true ){heading = `Please upload a copy of your insurance document`;} else {heading = `Please upload a copy of your insurance document`;}frm = myMutChoiceUploadHtml(heading);break;case prescAndPDChoiceTypes.mut.typeNewFilesUpload:if( lastSelectedLens.toLowerCase().includes("css") == true ){heading = `Please upload a copy of your insurance document`;} else {heading = `Please upload a copy of your insurance document`;}frm = myMutChoiceNewFilesUploadHtml(heading);break;}frm += `

`;$('#sg-popup-step-last a.step-back-link').attr("onclick",'loadMyMutChoices();');$('#sg-popup-step-last #sg-popup-step-last-inner').html(frm);if( mutSelectionType === prescAndPDChoiceTypes.mut.typeNewFilesUpload ){$('#sg-popup-step-last #sg-popup-step-last-inner #filesListing').html(mutUploadedFilesHtml);}};markMutSelectedChoice = (selectionType)=>{/* reseting the new selection except typeNewFilesUpload[ */if( selectedPrescAndPDData.mutData.selectedChoice.length >= 1 ){if( !selectedPrescAndPDData.mutData.selectedChoice.includes(selectionType) && selectionType != prescAndPDChoiceTypes.mut.typeNewFilesUpload ){let choicesMustBeRemoved = Object.values(prescAndPDChoiceTypes.mut);choicesMustBeRemoved = choicesMustBeRemoved.filter(item => item !== prescAndPDChoiceTypes.mut.typeNewFilesUpload );selectedPrescAndPDData.mutData.selectedChoice = selectedPrescAndPDData.mutData.selectedChoice.filter(item => !choicesMustBeRemoved.includes(item));}}if( !selectedPrescAndPDData.mutData.selectedChoice.includes(selectionType) ){selectedPrescAndPDData.mutData.selectedChoice.push(selectionType);}/* ] */};setUpMyMutData =()=>{if( $(`input[name="mutSelectionType"]`).val() == prescAndPDChoiceTypes.mut.typeNewFilesUpload ){let mutFileUploadErr = false;$(".mut-file-err").remove();if( !mutUploadedFilesExists ){$("input[name='presc_file']").after(`Veuillez indiquer les informations concernant votre caisse de régime obligatoire et le département`);mutFileUploadErr = true;}if ($("input[name='mut_dept_info_two']").length > 0) {selectedPrescAndPDData.mutData.mutDept.mutDeptNameTwo = $("input[name='mut_dept_info_two']").val();$(".mut-dept-err").remove();if( selectedPrescAndPDData.mutData.mutDept.mutDeptNameTwo == '' ){$("input[name='mut_dept_info_two']").after(`Veuillez indiquer les informations concernant votre caisse de régime obligatoire et le département`);mutFileUploadErr = true;}}if( mutFileUploadErr ){return;}} else if( $(`input[name="mutSelectionType"]`).val() == prescAndPDChoiceTypes.mut.typeUpload ) {let mutFileUploadErr = false;if ( $("input[name='mut_dept_info']").length > 0){selectedPrescAndPDData.mutData.mutDept.mutDeptName = $("input[name='mut_dept_info']").val();$(".mut-dept-err").remove();if( selectedPrescAndPDData.mutData.mutDept.mutDeptName == '' ){$("input[name='mut_dept_info']").after(`Veuillez indiquer les informations concernant votre caisse de régime obligatoire et le département`);mutFileUploadErr = true;}}if( mutFileUploadErr ){return;}}markMutSelectedChoice($(`input[name="mutSelectionType"]`).val());//let isSelectedChoiceMutTypeUpload = selectedPrescAndPDData.mutData.selectedChoice.includes(prescAndPDChoiceTypes.mut.typeUpload);//if( isSelectedChoiceMutTypeUpload ){//resetSelectedPDData(prescAndPDChoiceTypes.pd.typeEnter);//resetSelectedPDData(prescAndPDChoiceTypes.pd.typeExists);//}let lastSelectedLens = chosenSGLensesArrForAddToCart.at(-1).key;loadSGPopupLastStep(lastSelectedLens);$("#sg-popup-last-confirm-btn").show();};myMutChoiceUploadHtml = (heading)=>{let lastSelectedLens = chosenSGLensesArrForAddToCart.at(-1).key;if( lastSelectedLens.toLowerCase().includes("css") == true ){return `

${heading}

You will be able to add your documents and photos to your order later. Go to my account => View the order => My upload documents

`;} else {return `

${heading}

Pourriez-vous nous indiquer à quelle caisse de régime obligatoire, vous êtes rattaché (CPAM, MSA, MGEN), ainsi que le département.

You will be able to add your documents and photos to your order later. Go to my account => View the order => My upload documents

`;}};myMutChoiceNewFilesUploadHtml = (heading)=>{let lastSelectedLens = chosenSGLensesArrForAddToCart.at(-1).key;if( lastSelectedLens.toLowerCase().includes("css") == true ){return `

`;} else {return `

`;}};function sunglass_addtoCart(e){// THIS is the main lens popup formlet ajxCounter = 1;let curretForm = $('form#sunglass_addToCart_form');let myURL = curretForm.attr('action');let dt = curretForm.serialize();$(e).html(``);dt += `&selectedPrescAndPDData=`+JSON.stringify(selectedPrescAndPDData);dt += `&prescription_id=${prescriptionId}`;if(1 == ajxCounter){jQuery.ajax({type: "PUT",url: myURL,data: dt,cache: false,async: false,success: function (response) {if(response ){console.log("here" + response);setTimeout(addToCart, 500);}}});ajxCounter = 2;}}$(document.body).on('click', '.carousellens__navigation-button, .carousellens__prev, .carousellens__next', function (e) {e.stopPropagation();//e.preventDefault();});

Tom Ford Glasses FT-5665-B 001 (2025)

References

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Kimberely Baumbach CPA

Last Updated:

Views: 5944

Rating: 4 / 5 (61 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Kimberely Baumbach CPA

Birthday: 1996-01-14

Address: 8381 Boyce Course, Imeldachester, ND 74681

Phone: +3571286597580

Job: Product Banking Analyst

Hobby: Cosplaying, Inline skating, Amateur radio, Baton twirling, Mountaineering, Flying, Archery

Introduction: My name is Kimberely Baumbach CPA, I am a gorgeous, bright, charming, encouraging, zealous, lively, good person who loves writing and wants to share my knowledge and understanding with you.