Lunettes de vue Ray-Ban RX-7047 5482 (2024)

84,00€

Taille:

`;}}$("#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_fr);$('#app_lense_form_step_5_1 #app_lenses_step1_products_options_values').val( 'Lunettes loupe de lecture' );$('#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_fr);$('#app_lense_form_step_5_1 #app_lenses_step3_products_options_values').val(eyeGlassLensesJsonData.lens_step_3.name_fr);$('#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_fr);price_step_3 = `%${eyeGlassLensesJsonData.lens_step_3.name_fr}%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_fr);$('#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_fr);$('#app_lense_form_step_5_2 #app_lenses_step3_products_options_values').val(eyeGlassLensesJsonData.lens_step_3.name_fr);$('#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_fr);price_step_3 = `%${eyeGlassLensesJsonData.lens_step_3.name_fr}%0`;$('#app_lense_form_step_5_2 #app_lenses_step3_lenses').val(price_step_3);}});}/* Popup hide Show Functionality *//* 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('Ajouter au panier');}else{$('.confirm__btn_js').text('Continuer');} // 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','Choisissez le traitement Choisissez la puissance des verres').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 = 'Choisissez le traitement \n Choisissez la puissance des verres ';if(undefined == lensePower && undefined == OtionVal){$(this).attr('title', lblTitle).addClass('tool-tips');}else if(undefined == lensePower || '' == lensePower){$(this).attr('title', 'Choisissez la puissance des verres').addClass('tool-tips');}else if(undefined == OtionVal) {$(this).attr('title', 'Choisissez le traitement').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('Continuer');$(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': `23519`,'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 = 100 / 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){if( typeof sepator == "undefined" ){sepator = `
`;}let theExchangeRate = 100 / 100;let breadCrumbString = ``;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 += `${ 'Ray-Ban RX-7047 5482' }: ${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 += `Retour`;}html +=`

`;$("#sg-popup-step-multi-level .breadcrumb").html(getSGPopUpBreadCrumb());let topSummaryPrice = getSGPopUpSelectedLensesPrice();let theExchangeRate = 100 / 100;/* get frame price[ */let productPriceRaw = parseInt($('#sg-popup-step-last').attr('data-product-price'));let productPriceWithTax = parseFloat(getTaxableAmount(productPriceRaw));productPriceWithTax = (productPriceWithTax * theExchangeRate).toFixed(2);/* ] */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 = `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`;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( isProductPercee == '1' && isThisNodePercee == '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= '100' / 100;lenseFormattedPrice = (lenseFormattedPrice * theExchangeRate).toFixed(2);lenseCrossedPriceFormatted = (lenseCrossedPriceFormatted * theExchangeRate).toFixed(2);html += `

Lunettes de vue Ray-Ban RX-7047 5482 (1)${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 += ` (économisez ${discountPercentage} %)`;}html += ``;} else if( elePrice == 0 && lenseUniqueName != rootSGLenseKeyName ){html += `(inclus)`;}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') {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 = `

Monture incompatible pour verres progressifs. Merci de choisir une monture ayant une hauteur de verres de minimum 29 mm si vous souhaitez des verres progressifs.

`;}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 += "Ajouter mon ordonnance ";counter++;}if( true == showPrescTitle && true == showPDTitle ){title += " & ";}if( true == showPDTitle ){title += "Ajouter mon écart pupillaire ";counter++;}if( true == showMutTitle ){if( counter > 0 ){title += " & ";}title += "Ajouter ma carte mutuelle ou CSS ";}$("#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(`Lunettes de vue Ray-Ban RX-7047 5482 (2) Ajouter au panier`);$("#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 = 100 / 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);/* 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(`Ajouter mon attestation CSS`);} else {$("#sg-popup-last-input-mut-btn").text(`Ajouter ma carte mutuelle ou CSS`);}$("#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 = `
Prénom: ${selectedPrescAndPDData.prescData.enterData.firstName}Nom : ${selectedPrescAndPDData.prescData.enterData.lastName}

oeil DROIT :oeil GAUCHE :
Sphère :${selectedPrescAndPDData.prescData.enterData.sphericalRightEye}${selectedPrescAndPDData.prescData.enterData.sphericalLeftEye}
Cylindre :${selectedPrescAndPDData.prescData.enterData.cylinderRightEye}${selectedPrescAndPDData.prescData.enterData.cylinderLeftEye}
Axe :${selectedPrescAndPDData.prescData.enterData.axisRightEye}${selectedPrescAndPDData.prescData.enterData.axisLeftEye}
Addition :${selectedPrescAndPDData.prescData.enterData.additionRightEye}${selectedPrescAndPDData.prescData.enterData.additionLeftEye}

`;}if( isSelectedChoicePrescTypeExists ){selectedPrescDetail += `
Prénom: ${selectedPrescAndPDData.prescData.existsData.firstName}Nom : ${selectedPrescAndPDData.prescData.existsData.lastName}
Reprendre sur un ancien dossier Visionet : ${selectedPrescAndPDData.prescData.existsData.previousOrderHint}`;}if( isSelectedChoicePrescTypeSendEmail ){selectedPrescDetail += `
Prénom: ${selectedPrescAndPDData.prescData.sendEmailData.firstName}Nom : ${selectedPrescAndPDData.prescData.sendEmailData.lastName}
Envoyer mon ordonnance plus tard`;}if( isSelectedChoicePrescTypeNewFileUpload && prescUploadedFilesExists ){selectedPrescDetail += `
Prénom: ${selectedPrescAndPDData.prescData.newFilesUploadData.firstName}Nom : ${selectedPrescAndPDData.prescData.newFilesUploadData.lastName}
Télécharger mon ordonnance maintenant`;if(prescUploadedFilesExists){selectedPrescDetail += `${prescUploadedFilesHtml}`;}}if( selectedPrescDetail != '' ){let selectedPrescWrapperHtml = `

Ordonnance${selectedPrescDetail}

modifier

`;$("#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 = `

oeil DROIT :${selectedPrescAndPDData.pdData.enterData.halfDistanceRightEye}
oeil GAUCHE :${selectedPrescAndPDData.pdData.enterData.halfDistanceLeftEye}

`;}if(isSelectedChoicePDTypeExists){selectedPDDetail = `
Prénom: ${selectedPrescAndPDData.pdData.existsData.firstName}Nom : ${selectedPrescAndPDData.pdData.existsData.lastName}

Previous Order details: ${selectedPrescAndPDData.pdData.existsData.previousOrderHint}`;}if(isSelectedChoicePDTypeUpload){selectedPDDetail = `
Mesurer avec une photo`;}if(isSelectedChoicePDTypeSendGlasses){selectedPDDetail = `
Nous envoyer une ancienne paire plus tard`;}if( isSelectedChoicePDTypeNewFileUpload && pdUploadedFilesExists ){selectedPDDetail += `
Télécharger une photo ou ancienne facture`;if(pdUploadedFilesExists){selectedPDDetail += `${pdUploadedFilesHtml}`;}}if( selectedPDDetail != '' ){let selectedPDWrapperHtml = `

Distance pupillaire${selectedPDDetail}

Modifier la distance pupillaire

`;$("#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 = `
Envoyer mon document plus tard`;}if( isSelectedChoiceMutTypeNewFileUpload && mutUploadedFilesExists ){selectedMutDetail += `
Télécharger mon document maintenant`;if(mutUploadedFilesExists){selectedMutDetail += `${mutUploadedFilesHtml}`;}}if( selectedMutDetail != '' ){let selectedMutWrapperHtml = `

Documents mutuelle / CSS${selectedMutDetail}

Modifier mon 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(`Ajouter mon attestation CSS`);} else {$("#sg-popup-last-input-mut-btn").text(`Ajouter ma carte mutuelle ou CSS`);}$("#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 = `

Remise sur les verres-${crossedPriceHtml}

`;lensesPrice = lensesWithoutDiscountedAmtWithTax;}productPriceWithTax = (productPriceWithTax * theExchangeRate).toFixed(2);lensesPriceWithTax = (lensesPriceWithTax * theExchangeRate).toFixed(2);totalAmountWithTax = (totalAmountWithTax * theExchangeRate).toFixed(2);/* apply extra disc*nts(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 = `

Votre commande

${ 'Ray-Ban RX-7047 5482' }${displayMoneyFormat(productPriceWithTax)}

`;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 monture et verres${displayMoneyFormat(totalAmountWithTax) + ''}

`;}html += `

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

${lensTypeWarningLbls[loadedSGLenseTypeName]}

`;}if(false == isShowLensesCartInfoAndTotal){html += `

Le prix des verres Panier A, 100% santé, dépend de votre ordonnance. Nos opticiens le renseignerons dès réception de votre demande de devis. Il sera pris en charge à 100% (RAC 0€ garantis).

`;}/* 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 += `

Cette monture n’est pas éligible à la remise seconde paire (Solde / black Friday)

`;}$('#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?
Oui Non

`;//}}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 = `

Entrer vos corrections vous même

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

Reprendre sur un ancien dossier Visionet

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

Envoyer mon ordonnance plus tard

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

Télécharger mon ordonnance maintenant

`;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 = `

Indiquez votre nom et prénom et si possible votre ancien numéro de commande. Nous pourrons ainsi répliquer la correction à l’identique.
Si vous n’indiquez pas de numéro de commande, nous répliquerons la plus récente commande dans votre compte client au même nom et prénom.

Numéro de votre commande précédente ou référence de la monture:

`;let myPrescChoiceSendEmailHtml1 = `

Vous pourrez ajouter vosdocuments et photosaprès avoir passé votre commande.
(Mon compte => Consulter la commande => Mes documents téléchargés)

`;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", "Votre prénom doit avoir un minimum de 1 caractères. & Votre nom doit avoir un minimum de 1 caractères.");$("#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", "Votre prénom doit avoir un minimum de 1 caractères. & Votre nom doit avoir un minimum de 1 caractères.");$("#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(`Votre prénom doit avoir un minimum de 1 caractères.`);prescEnterErr = true;}if( selectedPrescAndPDData.prescData.enterData.lastName == '' ){$("input[name='presc_last_name']").after(`Votre nom doit avoir un minimum de 1 caractères.`);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(`Votre prénom doit avoir un minimum de 1 caractères.`);prescExistsErr = true;}if( selectedPrescAndPDData.prescData.existsData.lastName == '' ){$("input[name='presc_exists_last_name']").after(`Votre nom doit avoir un minimum de 1 caractères.`);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(`Votre prénom doit avoir un minimum de 1 caractères.`);prescTypeSendEmailErr = true;}if( selectedPrescAndPDData.prescData.sendEmailData.lastName == '' ){$("input[name='presc_send_email_last_name']").after(`Votre nom doit avoir un minimum de 1 caractères.`);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(`Votre prénom doit avoir un minimum de 1 caractères.`);prescFileUploadErr = true;}if( selectedPrescAndPDData.prescData.newFilesUploadData.lastName == '' ){$("input[name='presc_new_files_upload_last_name']").after(`Votre nom doit avoir un minimum de 1 caractères.`);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 = `

Si vous connaissez vos demi-écarts pupillaires, inscrivez-les. Ne divisez pas une mesure totale par deux.

Très important : entrez-les uniquement si vous avez obtenus les demis écarts œil droit et œil gauche auprès d’un opticien, ne les mesurez pas vous-même et ne divisez pas une mesure totale.

`;let myPDChoiceExistsHtml = `

La mesure des écarts pupillaire ne change jamais, si vous avez déjà passé une commande sur Visionet, indiquez votre nom et prénom et si possible votre ancien numéro de commande. Nous pourrons ainsi répliquer les écarts pupillaires à l’identique.

Numéro de votre commande précédente ou référence de la monture:

`;let myPDChoiceUploadHtml = `

Veuillez télécharger un document indiquant vos demis écarts pupillaires (œil droit et œil gauche séparés) ou des photos de votre visage avec une règle ou une carte (format carte de crédit).

Comment faire une bonne photo ?


Vous pourrez ajouter vosdocuments et photosaprès avoir passé votre commande.
(Mon compte => Consulter la commande => Mes documents téléchargés)

`;let myPDChoicesSendGlassesHtml = `

Merci de nous envoyer une de vos anciennes paires correctrices (verres blancs ou solaires):

Visionet
1 Allée du Rocheteur
44590 Derval

`;let myPDChoicesNewFilesUploadHtml = `

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

En savoir plus sur les écarts pupillaires

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

Vous connaissez vos demi-écarts pupillaires

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

Visionet a déjà vos écarts pupillaires

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

Envoyer une photo ou ancienne facture plus tard

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

Nous envoyer une ancienne paire plus tard

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

Télécharger une photo ou ancienne facture

`;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", "Votre prénom doit avoir un minimum de 1 caractères. & Votre nom doit avoir un minimum de 1 caractères.");$("#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(`Votre prénom doit avoir un minimum de 1 caractères.`);pdExistsErr = true;}if( selectedPrescAndPDData.pdData.existsData.lastName == '' ){$("input[name='pd_exists_last_name']").after(`Votre nom doit avoir un minimum de 1 caractères.`);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(`entry_pd_required_file_error`);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", "Votre prénom doit avoir un minimum de 1 caractères. & Votre nom doit avoir un minimum de 1 caractères.");$("#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", "oeil GAUCHE : & oeil DROIT :");$("#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", "Votre prénom doit avoir un minimum de 1 caractères. & Votre nom doit avoir un minimum de 1 caractères.");$("#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 = `

Envoyer mon document plus tard

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

Télécharger mon document maintenant

`;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 = `Veuillez télécharger votre attestation à complementaire santé solidaire`;} else {heading = `Veuillez télécharger les copies recto et verso de votre carte mutuelle tiers payant`;}frm = myMutChoiceUploadHtml(heading);break;case prescAndPDChoiceTypes.mut.typeNewFilesUpload:if( lastSelectedLens.toLowerCase().includes("css") == true ){heading = `Veuillez télécharger votre attestation à complementaire santé solidaire`;} else {heading = `Veuillez télécharger les copies recto et verso de votre carte mutuelle tiers payant`;}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}

Vous pourrez ajouter vosdocuments et photosaprès avoir passé votre commande.
(Mon compte => Consulter la commande => Mes documents téléchargés)

`;} else {return `

${heading}

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

Vous pourrez ajouter vosdocuments et photosaprès avoir passé votre commande.
(Mon compte => Consulter la commande => Mes documents téléchargés)

`;}};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();});

Lunettes de vue Ray-Ban RX-7047 5482 (2024)
Top Articles
Latest Posts
Article information

Author: Frankie Dare

Last Updated:

Views: 6496

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Frankie Dare

Birthday: 2000-01-27

Address: Suite 313 45115 Caridad Freeway, Port Barabaraville, MS 66713

Phone: +3769542039359

Job: Sales Manager

Hobby: Baton twirling, Stand-up comedy, Leather crafting, Rugby, tabletop games, Jigsaw puzzles, Air sports

Introduction: My name is Frankie Dare, I am a funny, beautiful, proud, fair, pleasant, cheerful, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.