$(window).on('load', function () { console.log("sdsdsd") changeRegion('North America') }); let exchangeRate = 1; function changePrice(id) { let currency = '' let symbol = '' if (id !== '' || id !== null) { currency = id; symbol = $('#' + id).data('symbol') } else { currency = 'USD'; symbol = '$' } var myHeaders = new Headers(); myHeaders.append("apikey", "AvBeVMAJoFAx0i8L3oG5sD8tbV9dI3YZ"); var requestOptions = { method: 'GET', redirect: 'follow', headers: myHeaders }; fetch(`https://api.apilayer.com/fixer/convert?from=USD&to=${id}&amount=1`, requestOptions) .then(response => response.text()) .then(result => { let data = JSON.parse(result); console.log(data.result); if (data.result !== '' || data.result !== null) { exchangeRate = data.result; } else { exchangeRate = 1; } $('.cSybmol').html(symbol); $('.icon-curr').html(symbol); $('#selCurr').html(currency); calculatePlan(); }) .catch(error => console.log('error', error)); } // Base prices for each plan let liteBasePrice = 100; // Base price for Lite Plan let standardBasePrice = 200; // Base price for Standard Plan let suiteBasePrice = 400; // Base price for Suite Plan let singleDoctor_basic = 5; let singleDoctor = 10; let singleDoctor_pro = 20; let singleOutlet = 100; let singleOutlet_b = 25; function calculatePlan() { let period = $('input[name=duration-1]:checked').val(); let noofoutlets = $('#out-number').val(); if (period == 'Monthly') { // Lite Plan: Base Price + ((no of outlets - 1) * 50) let cp1Price = Math.round((liteBasePrice * exchangeRate) + (noofoutlets - 1) * 50); $('#cp-1').html(cp1Price); // Standard Plan: Base Price + ((no of outlets - 1) * 100) let cp2price = Math.round((standardBasePrice * exchangeRate) + (noofoutlets - 1) * 100); $('#cp-2').html(cp2price); // Suite Plan: Base Price + ((no of outlets - 1) * 150) let cp3price = Math.round((suiteBasePrice * exchangeRate) + (noofoutlets - 1) * 150); $('#cp-3').html(cp3price); $('.plan-validity').html($('#p-pm').val()); } else if (period == 'Annually') { // Lite Plan: (Base Price + ((no of outlets - 1) * 50)) * 10 let cp1Price = Math.round(((liteBasePrice * exchangeRate) + (noofoutlets - 1) * 50) * 10); $('#cp-1').html(cp1Price); // Standard Plan: (Base Price + ((no of outlets - 1) * 100)) * 10 let cp2price = Math.round(((standardBasePrice * exchangeRate) + (noofoutlets - 1) * 100) * 10); $('#cp-2').html(cp2price); // Suite Plan: (Base Price + ((no of outlets - 1) * 150)) * 10 let cp3price = Math.round(((suiteBasePrice * exchangeRate) + (noofoutlets - 1) * 150) * 10); $('#cp-3').html(cp3price); $('.plan-validity').html($('#p-py').val()); } DIYPrie(); } function DIYPrie() { const planB = 5000; let noOfOutlets = parseInt($('#out-number').val()) || 1; let noOfDoctors = parseInt($('#doc-number').val()) || 5; let outletCount = noOfOutlets - 1; let doctorCount = noOfDoctors - 5; const DIY1Price = (2000 * outletCount) * exchangeRate; const DIY2Price = (1000 * doctorCount) * exchangeRate; let outlet_price = DIY1Price; let doctor_price = DIY2Price; if (outletCount > 0 || doctorCount > 0) { $('#diy_price_0').html("0.00"); $('#diy_price_d_0').html("1000"); $('#diy_price_1').html("5000"); $('#diy_price_d_1').html("10000"); } else { $('#diy_price_0').html("0.00"); $('#diy_price_d_0').html("1000"); $('#diy_price_1').html("5000"); $('#diy_price_d_1').html("10000"); } } function changeRegion(region) { const pricing = { 'india': { plan: { lite: 25, standard: 50, suite: 100 }, singleDoctor_basic: 5, singleDoctor: 10, singleDoctor_pro: 20, singleOutlet_b: 25, singleOutlet: 100, currency: 'INR', }, 'Southeast Asia': { plan: { lite: 50, standard: 100, suite: 200 }, singleDoctor_basic: 10, singleDoctor: 20, singleDoctor_pro: 40, singleOutlet_b: 25, singleOutlet: 100, currency: 'USD', }, 'Middle East': { plan: { lite: 50, standard: 100, suite: 200 }, singleDoctor_basic: 10, singleDoctor: 20, singleDoctor_pro: 40, singleOutlet_b: 25, singleOutlet: 100, currency: 'USD', }, 'South America': { plan: { lite: 50, standard: 100, suite: 200 }, singleDoctor_basic: 10, singleDoctor: 20, singleDoctor_pro: 40, singleOutlet_b: 25, singleOutlet: 100, currency: 'USD', }, 'North America': { plan: { lite: 100, standard: 200, suite: 400 }, singleDoctor_basic: 20, singleDoctor: 40, singleDoctor_pro: 80, singleOutlet_b: 25, singleOutlet: 100, currency: 'USD', }, 'Europe': { plan: { lite: 100, standard: 200, suite: 400 }, singleDoctor_basic: 20, singleDoctor: 40, singleDoctor_pro: 80, singleOutlet_b: 25, singleOutlet: 100, currency: 'EUR', }, 'Oceania': { plan: { lite: 100, standard: 200, suite: 400 }, singleDoctor_basic: 20, singleDoctor: 40, singleDoctor_pro: 80, singleOutlet_b: 25, singleOutlet: 100, currency: 'AUD', }, 'Africa': { plan: { lite: 25, standard: 50, suite: 100 }, singleDoctor_basic: 5, singleDoctor: 10, singleDoctor_pro: 20, singleOutlet_b: 25, singleOutlet: 100, currency: 'USD', }, }; if (pricing.hasOwnProperty(region)) { const regionPricing = pricing[region]; liteBasePrice = regionPricing.plan.lite; standardBasePrice = regionPricing.plan.standard; suiteBasePrice = regionPricing.plan.suite; singleDoctor_basic = regionPricing.singleDoctor_basic; singleDoctor = regionPricing.singleDoctor; singleDoctor_pro = regionPricing.singleDoctor_pro; singleOutlet = regionPricing.singleOutlet; singleOutlet_b = regionPricing.singleOutlet_b; changePrice(regionPricing.currency); } else { liteBasePrice = 25; standardBasePrice = 50; suiteBasePrice = 100; singleDoctor_basic = 5; singleDoctor = 10; singleDoctor_pro = 20; singleOutlet = 100; singleOutlet_b = 25; } $('#selectedRegion').html(region); calculatePlan(); } function changeSlide(index) { var contentCarousel = new bootstrap.Carousel(document.getElementById('contentCarousel'), { interval: false // Disable auto-play }); contentCarousel.to(index); var priceCarousel = new bootstrap.Carousel(document.getElementById('priceCarousel'), { interval: false // Disable auto-play }); priceCarousel.to(index); var diySelectButtons = document.querySelectorAll('.diy_select div'); diySelectButtons.forEach(function (button, i) { if (i === index) { button.classList.add('active'); } else { button.classList.remove('active'); } }); } function acctualPrice(price, discount) { const actual_price = Math.round(price / (1 - discount)); return actual_price; } $('input[name=duration-1]').on('change', function () { calculatePlan(); }); $('#noofoutlet').on('change', function () { calculatePlan(); }); function cartbtn(i) { let preval = $('#out-number').val(); let newVal = +preval + i; if (newVal > 0) { $('#out-number').val(newVal); calculatePlan(); } } const $slider1 = document.getElementById('slider-1'); $slider1.addEventListener('change', (evt) => { $('#out-number').val(evt.detail.value1); calculatePlan(); }); $("div.pricelr").mouseover(function () { if ($('#gold').hasClass('active')) { $('#gold').removeClass('active'); } });