var currency = [];
currency[2] = "USD";
currency[9] = "KSH";
currency[1] = "₹";
currency[23] = "Rp";
currency[8] = "AED";
var currencyIdArray = [];
currencyIdArray['MENA'] = 8;
currencyIdArray['MENA-AR'] = 8;
currencyIdArray['SSA'] = 9;
currencyIdArray['ID'] = 2;
currencyIdArray['BD'] = 2;
currencyIdArray['BD-EN'] = 2;
currencyIdArray['US'] = 2;
currencyIdArray['IN'] = 1;
currencyIdArray['APAC'] = 2;
currencyIdArray['GLOBAL'] = 2;
var forCountry = [];
forCountry['MENA'] = 2;
forCountry['MENA-AR'] = 2;
forCountry['SSA'] = 4;
forCountry['ID'] = 2;
forCountry['BD'] = 3;//saarc
forCountry['BD-EN'] = 3;//saarc
forCountry['US'] = 5;
forCountry['IN'] = 1;
forCountry['APAC'] = 2;
forCountry['GLOBAL'] = 2;
var countryId = [];
countryId['MENA'] = 5;
countryId['MENA-AR'] = 5;
countryId['SSA'] = 8;
countryId['ID'] = 21;
countryId['BD'] = 6;//saarc
countryId['BD-EN'] = 6;//saarc
countryId['US'] = 14;
countryId['IN'] = 1;
countryId['APAC'] = 5;
countryId['GLOBAL'] = 5;
function currency_format_ind(amount) {
//if currencyid is not defined then get it from the currencyCheckBox
if (!currencyid) {
if ($(".currencyCheckBox").length > 0) {
currencyid = $(".currencyCheckBox:checked").val();
}
else {
currencyid = currencyIdArray[window.TALLY_WEBSITE_COUNTRY_INITIAL];
if (!currencyid) {
currencyid = 2;
}
}
}
// var currencyid = $(".countryCheckBox:checked").attr('currencyid');
if (amount) {
var x = amount;
x = x.toString();
amt = x;
// var amt = x.split('.');
// x = amt[0];
// if(currencyid != 2)
x = Math.round(x);
x = x.toString();
var lastThree = x.substring(x.length - 3);
var otherNumbers = x.substring(0, x.length - 3);
if (currencyid == 23)//for indonesia we need 3 digit format
{
if (otherNumbers != '')
lastThree = '.' + lastThree;
var res = otherNumbers.replace(/\B(?=(\d{3})+(?!\d))/g, ".") + lastThree;
}
else
if (currencyid == 9)//for Kenya we need 3 digit format
{
if (otherNumbers != '')
lastThree = ',' + lastThree;
var res = otherNumbers.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + lastThree;
}
else {
if (otherNumbers != '')
lastThree = ',' + lastThree;
var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree;
}
if (amt.length > 1 && currencyid == 2)
return res;
else
return res;
}
}
document.addEventListener("DOMContentLoaded", function () {
if ($(".currencyCheckBox").length > 0) {
currencyid = $(".currencyCheckBox:checked").val();
}
else {
currencyid = currencyIdArray[window.TALLY_WEBSITE_COUNTRY_INITIAL];
if (!currencyid) {
currencyid = 2;
}
}
// instead of form create a json structure to send all data in json string
let form = document.createElement("form");
form.id = "idUrlSubmitForm";
form.action = "https://tipl." + window.location.host + "/tallyweb/checkout.php"; // Set form action
form.method = "post"; // Set method to POST
// Function to create hidden input fields
function createHiddenInput(id, name, value) {
let input = document.createElement("input");
input.type = "hidden";
input.id = id;
input.name = name;
input.value = value;
return input;
}
// Add input fields
// form.appendChild(createHiddenInput("strItem", "strItem", " "));
// form.appendChild(createHiddenInput("monthQty", "monthQty[]", " "));
// form.appendChild(createHiddenInput("strItemAction", "ItemAction", ""));
// form.appendChild(createHiddenInput("strTpAwsType", "strTpAwsType", ""));
// form.appendChild(createHiddenInput("strHiddenMultiYearTSS", "strHiddenMultiYearTSS", ""));
if (window.TALLY_WEBSITE_COUNTRY_INITIAL == 'IN') {
//update json structure for only geo location and country and for country
sku_details['GEO_LOCATION'] = 11;
sku_details['COUNTRY'] = 1;
sku_details['FOR_COUNTRY'] = 1;
// form.appendChild(createHiddenInput("strGeoLocation", "strGeoLocation", "11"));
// form.appendChild(createHiddenInput("strHdnCountry", "strHdnCountry", "1"));
// form.appendChild(createHiddenInput("strHdnForCountry", "strHdnForCountry", "1"));
let pid_details = localStorage.getItem("pid_details");
if (pid_details) {
let pid_json = JSON.parse(pid_details);
if (pid_json.length > 0) {
// form.appendChild(createHiddenInput("affiliate_pid", "affiliate_pid", pid_json[0].pid));
sku_details['AFFILIATE_PID'] = pid_json[0].pid;
}
}
}
else
if (window.TALLY_WEBSITE_COUNTRY_INITIAL == 'MENA' || window.TALLY_WEBSITE_COUNTRY_INITIAL == 'MENA-AR') {
// form.appendChild(createHiddenInput("strGeoLocation", "strGeoLocation", "12"));
// form.appendChild(createHiddenInput("strPgCurrencyId", "strPgCurrencyId", "8"));
// form.appendChild(createHiddenInput("strHdnCountry", "strHdnCountry", "5"));
// form.appendChild(createHiddenInput("strHdnForCountry", "strHdnForCountry", "2"));
sku_details['GEO_LOCATION'] = 12;
sku_details['COUNTRY'] = 5;
sku_details['FOR_COUNTRY'] = 2;
sku_details['CURRENCY'] = 8;
}
else
if (window.TALLY_WEBSITE_COUNTRY_INITIAL == 'SSA') {
sku_details['GEO_LOCATION'] = 17;
sku_details['COUNTRY'] = 8;
sku_details['FOR_COUNTRY'] = 4;
// sku_details['CURRENCY'] = 9;
// form.appendChild(createHiddenInput("strGeoLocation", "strGeoLocation", "17"));
// form.appendChild(createHiddenInput("strHdnCountry", "strHdnCountry", "8"));
// form.appendChild(createHiddenInput("strHdnForCountry", "strHdnForCountry", "4"));
}
else
if (window.TALLY_WEBSITE_COUNTRY_INITIAL == 'BD' || window.TALLY_WEBSITE_COUNTRY_INITIAL == 'BD-EN') {
sku_details['GEO_LOCATION'] = 15;
sku_details['COUNTRY'] = 6;
sku_details['FOR_COUNTRY'] = 3;
// sku_details['CURRENCY'] = 2;
// form.appendChild(createHiddenInput("strGeoLocation", "strGeoLocation", "15"));
// form.appendChild(createHiddenInput("strHdnCountry", "strHdnCountry", "6"));
// form.appendChild(createHiddenInput("strHdnForCountry", "strHdnForCountry", "3"));
}
else
if (window.TALLY_WEBSITE_COUNTRY_INITIAL == 'APAC') {
sku_details['GEO_LOCATION'] = 18;
sku_details['COUNTRY'] = 7;
sku_details['FOR_COUNTRY'] = 2;
// sku_details['CURRENCY'] = 2;
// form.appendChild(createHiddenInput("strGeoLocation", "strGeoLocation", "18"));
// form.appendChild(createHiddenInput("strHdnCountry", "strHdnCountry", "7"));
// form.appendChild(createHiddenInput("strHdnForCountry", "strHdnForCountry", "2"));
}
else
if (window.TALLY_WEBSITE_COUNTRY_INITIAL == 'US') {
sku_details['GEO_LOCATION'] = 19;
sku_details['COUNTRY'] = 14;
sku_details['FOR_COUNTRY'] = 5;
// sku_details['CURRENCY'] = 2;
// form.appendChild(createHiddenInput("strGeoLocation", "strGeoLocation", "19"));
// form.appendChild(createHiddenInput("strHdnCountry", "strHdnCountry", "14"));
// form.appendChild(createHiddenInput("strHdnForCountry", "strHdnForCountry", "5"));
}
else
if (window.TALLY_WEBSITE_COUNTRY_INITIAL == 'GLOBAL') {
sku_details['GEO_LOCATION'] = 20;
sku_details['COUNTRY'] = 22;
sku_details['FOR_COUNTRY'] = 2;
// sku_details['CURRENCY'] = 2;
// form.appendChild(createHiddenInput("strGeoLocation", "strGeoLocation", "20"));
// form.appendChild(createHiddenInput("strHdnCountry", "strHdnCountry", "22"));
// form.appendChild(createHiddenInput("strHdnForCountry", "strHdnForCountry", "2"));
}
// Dynamically get the hostname for strBackUrl
let backUrl = window.location.href;
sku_details['BACK_URL'] = backUrl;
// form.appendChild(createHiddenInput("strBackUrl", "strBackUrl", backUrl));
// Append form to the body or a specific container
// document.body.appendChild(form);
// let postJsonObj = getPreloadSkuDetails();
// if (postJsonObj && postJsonObj.FOR_COUNTRY) {
// var targetForCountry = String(postJsonObj.FOR_COUNTRY);
// // Select the correct country option
// $('.countryCheckBox').prop('checked', false);
// $('.countryCheckBox[value="' + targetForCountry + '"]').prop('checked', true);
// // Keep runtime payload in sync
// sku_details['FOR_COUNTRY'] = targetForCountry;
// setCountryChangeDetails();
// }
// else
if ($(".countryCheckBox:checked").length > 0) {
getPricedata($(".countryCheckBox:checked").val());
}
else {
getPricedata(forCountry[window.TALLY_WEBSITE_COUNTRY_INITIAL]);
}
});
function call_bypage_submit(el) {
var el = el;
//get me the nearest parent element that has the itemId class
var pid = $(el).closest('.cardContainer').find('.itemId').html();
// if empty check the current parent and parent's parent and parent's parent's parent and so on until you find the itemId class without cardContainer class
if (!pid || pid == undefined) {
pid = $(el).parent().find('.itemId').html();
}
if (!pid || pid == undefined) {
pid = $(el).parent().parent().find('.itemId').html();
}
if (!pid || pid == undefined) {
pid = $(el).parent().parent().parent().find('.itemId').html();
}
call_submit(pid, el);
}
function stripSpecialCharacters(str) {
return str.replace(/[^a-zA-Z0-9-_.~:/?#@!$&'()*+,;=%]/g, ''); // Allow URL-safe characters
}
function call_submit(pid, cur = "") {
// 0) {
sku_item['MONTH_QTY'] = clsNumOfMonths;
// $("#monthQty").val(clsNumOfMonths);
}
// if(pid=='41628')
// {
// $("#monthQty").val($(".clsSilverRentalMonth:checked").val());
// }
// if(pid=='41629')
// {
// $("#monthQty").val($(".clsGoldRentalMonth:checked").val());
// }
// if(pid=='41638')// add silver rental months for US
// {
// $("#monthQty").val($(".clsUSSilverRentalMonth:checked").val());
// }
// if(pid=='41639')// add gold rental months for US
// {
// $("#monthQty").val($(".clsUSGoldRentalMonth:checked").val());
// }
// if(pid=='5656' || pid=='5657' || pid=='5658')
// {
// $("#monthQty").val($(cur).parents('.cardContainer').find('.clsMonths:checked').val());
// }
if ($(".currencyCheckBox").length > 0) {
var currencyid = $(".currencyCheckBox:checked").val();
$("#strPgCurrencyId").val(currencyid);
}
//for global website nepal/bhutan whatsapp subscription cannot be bought for other geos
let lic_type = countryId[window.TALLY_WEBSITE_COUNTRY_INITIAL];
if ((lic_type == 13) && (pid == '51638' || pid == '51639') && (countryid != 13 && countryid != 25)) {
alert("whatsapp subscription for nepal/bhutan can be bought only for Nepal or bhutan billing country.")
return false;
}
//for global website nepal/bhutan whatsapp subscription cannot be bought for other geos ends
// EcommerceDataPush(pid);
// if(countryid != 29)
$("#strHdnCountry").val(countryid);
if ($(".countryCheckBox").length > 0) {
var forCountryVal = $(".countryCheckBox:checked").val();
sku_details['FOR_COUNTRY'] = forCountryVal;
// $("#strHdnForCountry").val(forCountryVal);
}
else {
forCountryVal = forCountry[window.TALLY_WEBSITE_COUNTRY_INITIAL];
sku_details['FOR_COUNTRY'] = forCountryVal;
// $("#strHdnForCountry").val(forCountryVal);
}
//action item sent only for US skus
// if(pid=='29513' || pid=='29514' || pid=='29515' || pid=='29519' || pid=='29520')
// {
// if class found then set the value to the value of the class
if (forCountryVal != 4 && $(cur).parents('.cardContainer').find('.clsNumOfYears').length > 0)
sku_item['TSS_YEAR'] = $(cur).parents('.cardContainer').find('.clsNumOfYears').val();
// $("#strHiddenMultiYearTSS").val($(cur).parents('.cardContainer').find('.clsNumOfYears').val());
// }
//add subscribe key if its te9 rental india items
if (pid == '41628' || pid == '41629') {
sku_item['SUBSCRIBE'] = "1";
}
else {
sku_item['SUBSCRIBE'] = "0";
}
/*if(pid == 57781)
{*/
//if current item parent cardContainer or pricingCard class has product_qty then set the product quantity to the value of product_qty
if ($(cur).parents('.cardContainer, .pricing-card').find('input[name="product_qty"]').val() > 1) {
sku_item['PRODUCT_QTY'] = $(cur).parents('.cardContainer, .pricing-card').find('input[name="product_qty"]').val();
// $("#idUrlSubmitForm").append(input);
}
else {
sku_item['PRODUCT_QTY'] = 1;
}
/* }*/
if ($(cur).hasClass('new')) {
sku_item['TP_AWS_TYPE'] = "NEW";
// $("#strTpAwsType").val("NEW");
sku_item['MONTH_QTY'] = '';
// $("#monthQty").val('');
sku_item['TSS_YEAR'] = '';
// $("#strHiddenMultiYearTSS").val('');
sku_item['ITEM_ACTION'] = '';
// $("#strItemAction").val('');
}
else
if ($(cur).hasClass('renew')) {
sku_item['TP_AWS_TYPE'] = "RENEWAL";
// $("#strTpAwsType").val("RENEWAL");
sku_item['MONTH_QTY'] = '';
// $("#monthQty").val('');
sku_item['TSS_YEAR'] = '';
// $("#strHiddenMultiYearTSS").val('');
sku_item['ITEM_ACTION'] = '';
// $("#strItemAction").val('');
}
sku_item['ITEM_ID'] = pid;
// $("#strItem").val(pid);
// var checkouturl = `https://${window.location.host}/cart/checkout/`;
// $("#idUrlSubmitForm").attr('action',checkouturl);
//each item will be pushed to the item_list array
// if any if the keys are not set then set it to empty string
if (!sku_item['TP_AWS_TYPE']) {
sku_item['TP_AWS_TYPE'] = '';
}
if (!sku_item['MONTH_QTY']) {
sku_item['MONTH_QTY'] = '';
}
if (!sku_item['TSS_YEAR']) {
sku_item['TSS_YEAR'] = '';
}
if (!sku_item['RENEWAL_TYPE']) {
sku_item['RENEWAL_TYPE'] = '';
}
// add selected quantity to the existing cart count
var cart_count = parseInt(localStorage.getItem('cart_count'), 10) || 0;
var productQtyToAdd = parseInt(sku_item['PRODUCT_QTY'], 10) || 1;
//if tallydrive then add 1 to the cart count
if (pid == 57781 || pid == 61604) {
sku_item['TALLYDRIVE_QTY'] = $('#quantity3').val();
}
var updatedCartCount = cart_count + productQtyToAdd;
localStorage.setItem('cart_count', updatedCartCount);
var headerCartCountEl = document.getElementById("idHeaderCartCount");
if (headerCartCountEl) {
headerCartCountEl.innerHTML = updatedCartCount;
}
sku_details['ITEM_LIST'].push(sku_item);
persistSkuDetailsToStorage();
$(cur).addClass('view-cart');
$(cur).removeClass('add-to-cart');
$(cur).attr('style', 'background-color: var(--color-light-blue) !important; color: var(--color-white) !important;');
$(cur).html('View Cart');
$(cur).attr('onclick', 'call_view_cart()');
// let sku_details_json = JSON.stringify(sku_details);
// //add a hidden input element called json_data and value as sku_details_json
// let input = document.createElement("input");
// input.type = "hidden";
// input.id = "json_data";
// input.name = "json_data";
// input.value = sku_details_json;
// $("#idUrlSubmitForm").append(input);
// $('#idUrlSubmitForm').find('input[type="hidden"]').each(function() {
// var currentVal = $(this).val();
// var cleanedVal = stripSpecialCharacters(currentVal);
// $(this).val(cleanedVal);
// });
//analytics tracking code
try {
websiteAnalytics('purchase', cur, pid);
} catch (e) {
console.error('websiteAnalytics error:', e);
}
// $("#idUrlSubmitForm").submit();
}
//add it under function document ready
function TE9_rental_months_change(months) {
// $(".te9_rental").show();
// $(".te9_perpetual").hide();
let currencyid = $(".countryCheckBox:checked").attr("currencyid");
let countryid = $(".countryCheckBox:checked").val();
var monthIdentifier = months == 3 && countryid == 5 ? "1" : months == 6 && countryid == 5 ? "3" : months;
$("#TE9_RENT_1_" + monthIdentifier).find('.clsNumOfMonths').val(months);
$("#TE9_RENT_2_" + monthIdentifier).find('.clsNumOfMonths').val(months);
$("#TE9_RENT_1_" + monthIdentifier).find('.clsMonthText').html(months + ' Month');
$("#TE9_RENT_2_" + monthIdentifier).find('.clsMonthText').html(months + ' Month');
if (countryid == 5) {
var te9Silver = $("#TE9_RENT_1_" + monthIdentifier);
var te9Gold = $("#TE9_RENT_2_" + monthIdentifier);
te9Silver.find('.price').html('' + currency[currencyid] + ' ' + currency_format_ind(te9Silver.find('.baseprice_' + months).val()));
te9Silver.find('.gst').html('+18% GST (' + currency[currencyid] + ' ' + currency_format_ind(te9Silver.find('.baseprice_' + months).val() * .18) + ')');
te9Gold.find('.price').html('' + currency[currencyid] + ' ' + currency_format_ind(te9Gold.find('.baseprice_' + months).val()));
te9Gold.find('.gst').html('+18% GST (' + currency[currencyid] + ' ' + currency_format_ind(te9Gold.find('.baseprice_' + months).val() * .18) + ')');
}
else {
let sil_rent_price = $("#TE9_RENT_1_" + months).find('.baseprice').val() * months;
let gold_rent_price = $("#TE9_RENT_2_" + months).find('.baseprice').val() * months;
var disc = 1;
if ((months == 3 || months == 12) && countryid == 1) {
var disc = (months == 3 ? 0.05 : 0.10);
$("#TE9_RENT_1_" + months).find('.price').html('' + currency[currencyid] + ' ' + currency_format_ind(sil_rent_price) + '');
$("#TE9_RENT_1_" + months).find('.gst').html('+18% GST (' + currency[currencyid] + ' ' + currency_format_ind((sil_rent_price - (sil_rent_price * disc)) * .18) + ')');
$("#TE9_RENT_1_" + months).find('.price').append(' ' + currency[currencyid] + ' ' + currency_format_ind(sil_rent_price - (sil_rent_price * disc)));
$("#TE9_RENT_1_" + months).find('.clsRentalEffPrice').html(`Effective price ` + ((sil_rent_price - (sil_rent_price * disc)) / months) + `/Month`);
$('.rentalofferBadge').html('');
$("#TE9_RENT_2_" + months).find('.price').html('
' + currency[currencyid] + ' ' + currency_format_ind(gold_rent_price) + '');
$("#TE9_RENT_2_" + months).find('.gst').html('+18% GST (' + currency[currencyid] + ' ' + currency_format_ind((gold_rent_price - (gold_rent_price * disc)) * .18) + ')');
$("#TE9_RENT_2_" + months).find('.price').append(' ' + currency[currencyid] + ' ' + currency_format_ind(gold_rent_price - (gold_rent_price * disc)));
$("#TE9_RENT_2_" + months).find('.clsRentalEffPrice').html(`Effective price ` + ((gold_rent_price - (gold_rent_price * disc)) / months) + `/Month`);
}
else {
$('.rentalofferBadge').html('');
$('.clsRentalEffPrice').html('');
$("#TE9_RENT_1_" + months).find('.price').html('' + currency[currencyid] + ' ' + currency_format_ind(sil_rent_price));
$("#TE9_RENT_1_" + months).find('.gst').html('+18% GST (' + currency[currencyid] + ' ' + currency_format_ind(sil_rent_price * disc * .18) + ')');
$("#TE9_RENT_2_" + months).find('.price').html('' + currency[currencyid] + ' ' + currency_format_ind(gold_rent_price));
$("#TE9_RENT_2_" + months).find('.gst').html('+18% GST (' + currency[currencyid] + ' ' + currency_format_ind(gold_rent_price * disc * .18) + ')');
}
}
}
function tss_year_change(years) {
if (years == 1) {
$(".tss_pricing_template_1").show();
$(".tss_pricing_template_2").hide();
// $(".clsEffPrice").hide();
// $(".offerBadge").hide();
// $(".clsTssDiscText").hide();
// $(".price1").show();
// $(".price2").hide();
// $('.clsNumOfYears').val(1);
}
else
if (years == 2) {
$(".tss_pricing_template_1").hide();
$(".tss_pricing_template_2").show();
// $(".clsEffPrice").show();
// $(".offerBadge").show();
// $(".clsTssDiscText").show();
// $(".price2").show();
// $(".price1").hide();
// $('.clsNumOfYears').val(2);
}
if (window.TALLY_WEBSITE_COUNTRY_INITIAL == 'IN' || window.TALLY_WEBSITE_COUNTRY_INITIAL == 'KE') {
$(".gst").show();
}
else {
$(".gst").hide();
}
}
function shopper9_rental_months_change(months) {
if (!currencyid) {
if ($(".currencyCheckBox").length > 0) {
currencyid = $(".currencyCheckBox:checked").val();
}
else {
currencyid = currencyIdArray[window.TALLY_WEBSITE_COUNTRY_INITIAL];
if (!currencyid) {
currencyid = 2;
}
}
}
$("#SHOPER_RENT_1").find('.clsNumOfMonths').val(months);
$("#SHOPER_RENT_2").find('.clsNumOfMonths').val(months);
$("#SHOPER_RENT_3").find('.clsNumOfMonths').val(months);
// let currencyid = $(".countryCheckBox:checked").attr("currencyid");
$("#SHOPER_RENT_1").find('.price').html('' + currency[currencyid] + ' ' + currency_format_ind($("#SHOPER_RENT_1").find('.baseprice').val() * months));
$("#SHOPER_RENT_2").find('.price').html('' + currency[currencyid] + ' ' + currency_format_ind($("#SHOPER_RENT_2").find('.baseprice').val() * months));
$("#SHOPER_RENT_3").find('.price').html('' + currency[currencyid] + ' ' + currency_format_ind($("#SHOPER_RENT_3").find('.baseprice').val() * months));
}
$(document).ready(function () {
shopper9_rental_months_change(1);
// TE9_rental_months_change(12);
$(".awsPackageSelect,.awsRenewPackageSelect").change(function () {
let itemname = $(this).attr('name');
// var currencyid = 1;//as its only for india
if (itemname == 'tponawsPersonal' || itemname == 'tponawsServer' || itemname == 'tponawsEnterprise') {
let users = $(this).val();
if (users == 1)
$("." + itemname + "_usercount").html("For 1 User");
else
$("." + itemname + "_usercount").html(" Upto " + users + " Users");
$("." + itemname).hide();
$("." + itemname + "_" + users).show();
$("." + itemname + "_" + users).find('.clsCloudRam').html('' + $(this).find("option:selected").attr("ram") + ' GB RAM');
rentalprice = $(this).find("option:selected").attr("rentalPrice");
gst = $(this).find("option:selected").attr("gst");
var package_name = $(this).find("option:selected").attr("pack");
var awsitemid = $(this).find("option:selected").attr("itemid");
var renew_awsitemid = $(this).find("option:selected").attr("renew_itemid");
if ($("#tp-powered-by-aws-renew").is(':checked'))
$(this).parents('.cardContainer').find('.itemId').html(renew_awsitemid);
else
$(this).parents('.cardContainer').find('.itemId').html(awsitemid);
$(this).parents('.cardContainer').find('.clsPackType').html(package_name);
$(this).parents('.cardContainer').find('.price').html('' + currency[currencyid] + ' ' + currency_format_ind(rentalprice));
$(this).parents('.cardContainer').find('.gst').html('+18% GST (' + currency[currencyid] + ' ' + currency_format_ind(gst) + ')');
}
})
$(".clsRecharge").change(function () {
// let currencyid = $(".countryCheckBox:checked").attr("currencyid");
let price = $(this).attr('rechargeprice');
let tax = $(this).attr('tax');
let pid = $(this).attr('pid');
$(this).parents('.cardContainer').find('.price').html('' + currency[currencyid] + ' ' + currency_format_ind(price));
$(this).parents('.cardContainer').find('.itemId').html(pid);
if (currencyid == 1)
$(this).parents('.cardContainer').find('.gst').html('+18% GST (' + currency[currencyid] + ' ' + currency_format_ind(tax) + ')');
})
$(".countryCheckBox,.currencyCheckBox").on('change', function () {
// during country change clear the cart
//throw a confirm alert th changing country will clear the cart
//if cart is not empty then show a confirm alert
// if(sku_details['ITEM_LIST'].length > 0)
// {
// if(!confirm("Changing country will clear the cart. Are you sure you want to continue?"))
// {
// return false;
// }
// }
// sku_details['ITEM_LIST'] = [];
// persistSkuDetailsToStorage();
// //reset cart count to 0
// localStorage.setItem('cart_count', 0);
// //update cart counter
// update_cart_counter();
// //find all .view-cart button and reset it with onclick="call_bypage_submit(this)" and remove view-cart class and add add-to-cart class
$(".view-cart").each(function () {
$(this).attr('onclick', 'call_bypage_submit(this)');
$(this).removeClass('view-cart');
$(this).removeAttr('style');
$(this).html('Add to Cart');
$(this).addClass('add-to-cart');
});
setCountryChangeDetails();
// checkFilterOptionSelectedorNot();
})
})
function setCountryChangeDetails() {
if ($(".currencyCheckBox").length > 0)
currencyid = $(".currencyCheckBox:checked").val();
else
currencyid = $(".countryCheckBox:checked").attr('currencyid');
// var info={};
// info[1]="India license can be used only in India";
// info[2]="International license can be used in all countries except US/Canada";
// info[3]="SAARC license can be used in all SAARC Countries";
// info[4]="Kenya license can be used only in Kenya";
// info[5]="North America License can be used in all countries";
// $("#idCountryToolTip").attr("data-original-title",info[$(this).val()]);
var forCountryval = $(".countryCheckBox:checked").val();
switch (forCountryval) {
case '1'://india
$(".cls_IN_RentalMonths").show();
$(".cls_US_RentalMonths").hide();
$("#TS9_RENT_1").hide();
$(".clsEffPrice").show();
$(".clsRentalEffPrice").show();
$(".off-tag").show();
$("#TSS_10_1").show();
$("#TSS_10_2").show();
$(".alltabs").show();
$(".allProductSections").addClass('d-none');
// $(".clsExtensions").show();
$(".alltabs").removeClass('active');
if (window.TALLY_WEBSITE_COUNTRY_INITIAL == 'IN') {
$("#tallyprime").removeClass('d-none');
$(".tallyprime").addClass('active');
$(".te9_rental").show();
$(".te9_perpetual").show();
}
else {
$("#tss").removeClass('d-none');
$(".tss").addClass('active');
$(".te9_rental").hide();
$(".te9_perpetual").show();
}
break;
case '2'://international
$(".cls_IN_RentalMonths").hide();
$(".cls_US_RentalMonths").hide();
$("#TS9_RENT_1").hide();
$(".clsEffPrice").hide();
$(".clsRentalEffPrice").hide();
$(".off-tag").hide();
$(".te9_rental").hide();
$(".te9_perpetual").show();
$(".alltabs").hide();
$(".tallyprime").show();
$(".whatsapp").show();
$("#TSS_10_1").hide();
$("#TSS_10_2").hide();
$(".tss").show();
$(".server").show();
$(".addon").show();
$(".developer").show();
$(".upgrades").show();
// $(".clsExtensions").hide();
$(".connected-backup").show();
break;
case '5'://US
$(".cls_IN_RentalMonths").hide();
$(".cls_US_RentalMonths").show();
$("#TS9_RENT_1").show();
$(".alltabs").hide();
$(".clsEffPrice").hide();
$(".clsRentalEffPrice").hide();
$(".off-tag").hide();
$("#TSS_10_1").hide();
$("#TSS_10_2").hide();
$(".tallyprime").show();
$(".tss").show();
$(".server").show();
$(".addon").show();
$(".te9_rental").show();
$(".te9_perpetual").show();
$(".connected-backup").show();
$(".upgrades").show();
$(".allProductSections").addClass('d-none');
$("#tallyprime").removeClass('d-none');
$(".alltabs").removeClass('active');
$(".tallyprime").addClass('active');
// $(".clsExtensions").hide();
break;
}
// changeLayout($(this).val());
// $("#idBuyTPSilverRental").text("Buy Now");
// $("#idBuyTPGoldRental").text("Buy Now");
getPricedata(forCountryval);
}
// var cms_url = 'https://${window.location.host}'
var serialsearch_server_awspicklist = "";
var serialsearch_tp_awspicklist = "";
function getPricedata(fCountry) {
// var total=$("#silver_rate").val();
// var silver_price=$('#silver_gst').val();
// var gst_value =(total * silver_price);
// var tot_price = parseInt(total) + parseInt(gst_value);
var gst = 0;
// var countryid =($(".countryCheckBox").length > 0 ? $(".countryCheckBox:checked").attr('countryid') : 1);
// var currencyid =($(".countryCheckBox").length > 0 ? $(".countryCheckBox:checked").attr('currencyid') : 1);
if (!currencyid)
currencyid = currencyIdArray[window.TALLY_WEBSITE_COUNTRY_INITIAL];
var countryid = countryId[window.TALLY_WEBSITE_COUNTRY_INITIAL];
var args = "strForCountry=" + fCountry + "&strCurrencyID=" + currencyid + "&strCountry=" + countryid;
var geoid = forCountry[window.TALLY_WEBSITE_COUNTRY_INITIAL];
var url = `https://${window.location.host}/wp-content/themes/tally/api/getPriceData_api.php`;
var selected = "";
$.ajax({
type: 'post',
url: url + '?' + args,
success: function (data) {
// console.log(data)
//new silver
window.upgradeListData = JSON.parse(data)['UPGRADE'];
impression_data = JSON.parse(data);
var str = ' ';
if (currencyid == 9) {
$('.gst').show();
$('.emiLabel').hide();
}
else
if (currencyid == 1) {
$('.gst').show();
$('.emiLabel').show();
}
else {
$('.gst').hide();
$('.emiLabel').hide();
}
$(".awsPackageSelect").html("");
$(".awsRenewPackageSelect").html("");
for (var key in impression_data) {
if (key == 'TVU')
continue;
if (impression_data.hasOwnProperty(key)) {
for (var item in impression_data[key]) {
let product = impression_data[key][item];
let price = product.FLD_PRICE;
if (currencyid == 1)
gst = product.GST_AMOUNT;
else
if (currencyid == 9)
gst = price * 0.16;
if (key == 'TDE') {
price = price * 12;
gst = gst * 12;
}
if (key == 'TSS' && (fCountry == 4 || fCountry == 5)) {
price = price * 12;
gst = gst * 12;
// show tss_pricing_template_1 and hide tss_pricing_template_2
$(".tss_pricing_template_1").show();
$(".tss_pricing_template_2").hide();
$(".clsYears").hide();
$(".clsEffPrice").hide();
$(".offerBadge").hide();
$(".clsTssDiscText").hide();
$("#" + key + '_' + item + '_' + '1').find('.price').html('' + currency[currencyid] + ' ' + currency_format_ind(price));
$("#" + key + '_' + item + '_' + '1').find('.itemId').html(product.ITEM_ID);
// $("#"+key+'_'+item+'_'+year).find('.price2').html(''+currency[currencyid]+' '+currency_format_ind(product.PRICE[year]*12));
$("#" + key + '_' + item + '_' + '1').find('.gst').html('' + currency[currencyid] + ' 18% GST (' + currency[currencyid] + ' ' + currency_format_ind(price * 0.18) + ')');
if ($("#" + key + '_' + item + '_' + '1').find('.btn-primary, .btn-secondary').length > 0) {
$("#" + key + '_' + item + '_' + '1').find('.btn-primary, .btn-secondary')[0].innerHTML = 'Add to Cart
';
}
}
else
if (key == 'TSS') {
$(".clsYears").show();
$(".clsEffPrice").show();
$(".clsTssDiscText").show();
$(".offerBadge").show();
yearsarr = ['1', '2', '10'];
if (currencyid == 1 || currencyid == 9)//tax is calculated only for india and kenya
gst = product.TAX['2'] * 12 * 2;// 2 years default price while loading
yearsarr.forEach(year => {
if (window.TALLY_WEBSITE_COUNTRY_INITIAL == 'IN' && year == '2') {
$("#" + key + '_' + item + '_' + year).find('.price').html('' + currency[currencyid] + ' ' + currency_format_ind(product.PRICE['1'] * 12 * year) + '' + currency[currencyid] + ' ' + currency_format_ind(product.PRICE[year] * 12 * year));
$("#" + key + '_' + item + '_' + year).find('.clsEffPrice').html('
Effective price ' + currency_format_ind(product.PRICE[year] * 12) + '/Year
'); } else $("#" + key + '_' + item + '_' + year).find('.price').html('' + currency[currencyid] + ' ' + currency_format_ind(product.PRICE[year] * 12 * year)); $("#" + key + '_' + item + '_' + year).find('.itemId').html(product.ITEM_ID); // $("#"+key+'_'+item+'_'+year).find('.price2').html(''+currency[currencyid]+' '+currency_format_ind(product.PRICE[year]*12)); $("#" + key + '_' + item + '_' + year).find('.gst').html('' + currency[currencyid] + ' 18% GST (' + currency[currencyid] + ' ' + currency_format_ind(product.PRICE[year] * 12 * year * 0.18) + ')'); // $("#"+key+'_'+item+'_'+year).find('.gst2').html(''+currency[currencyid]+' +18% GST ('+currency[currencyid]+' '+currency_format_ind(product.PRICE[year]*12*0.18)+')'); if ($("#" + key + '_' + item + '_' + year).find('.btn-primary, .btn-secondary').length > 0) { $("#" + key + '_' + item + '_' + year).find('.btn-primary, .btn-secondary')[0].innerHTML = 'Add to CartEffective price '+currency_format_ind(product.PRICE['2']*12)+'/Year
'); // $("#"+key+'_'+item+'_'+item).find('.price1').html(''+currency[currencyid]+' '+currency_format_ind(product.PRICE['1']*12)); // //add only for india // if(window.TALLY_WEBSITE_COUNTRY_INITIAL == 'IN') // $("#"+key+'_'+item+'_'+item).find('.price2').html('+ 18% GST (` + currency[currencyid] + ' ' + currency_format_ind(gst.toString()) + `)
`; // offer_str += `` + product.ITEM_ID + `
// //`+product.ITEM_ID+`
// //`+ '' + currency[currencyid] + ' ' + currency_format_ind(price) + `
`; if (window.TALLY_WEBSITE_COUNTRY_INITIAL == 'IN' || window.TALLY_WEBSITE_COUNTRY_INITIAL == 'KE') str += `+18% GST (` + currency[currencyid] + ` ` + currency_format_ind(gst.toString()) + `)
`; str += `` + product.ITEM_ID + `
`; //if item_id_json is not empty and item_id_json[product.ITEM_ID] is not undefined then add the onclick event to call_bypage_submit(this) if (item_id_json && item_id_json[product.ITEM_ID]) { str += ` `; } else { str += ` `; } str += `