$(document).ready(function(){
//default annualy
$('.plan-switch-check').attr('checked', true);
var country_code = '';
if(country_code && country_code != ''){
$('.currency-select-options').attr('data-selected-country', country_code);
}
//laod templates
$('.grey-section > .container.w-container').append($('.currency-select-template').html());
var countries_currency_map = {"US":"USD","AU":"AUD","NZ":"NZD","CA":"CAD","GB":"GBP","EU":"EUR"};
$('.grey-section .currency-select-options').flagStrap({
countries: {
"US":"USD - United States Dollar $", "AU":"AUD - Australian Dollar $", "NZ":"NZD - New Zealand Dollar $", "CA":"CAD - Canadian Dollar $", "GB":"GBP - Pound Sterling £", "EU":"EUR - Euro €", },
buttonSize: "btn-sm",
buttonType: "btn-default",
labelMargin: "10px",
scrollable: false,
scrollableHeight: "350px",
placeholder: false
});
var get_currency = function(){
return countries_currency_map[$('select[name="billing_currency"]').val()];
}
var calc_total_price = function(){
var selected_currency = get_currency();
var billing_plans = {"AUD":[{"plan_id":"6","plan_title":"0-50","plan_title_original":"50 Client Plan","amount":"80","original_plan_amount":"80","symbol":"$","plan_currency":"AUD","disabled_plan":false,"yearly_amount_1month":72,"yearly_amount_12months":864,"current_users_plan":false},{"plan_id":"7","plan_title":"51-100","plan_title_original":"100 Client Plan","amount":"131","original_plan_amount":"131","symbol":"$","plan_currency":"AUD","disabled_plan":false,"yearly_amount_1month":117,"yearly_amount_12months":1414,"current_users_plan":false},{"plan_id":"8","plan_title":"101-150","plan_title_original":"150 Client Plan","amount":"174","original_plan_amount":"174","symbol":"$","plan_currency":"AUD","disabled_plan":false,"yearly_amount_1month":156,"yearly_amount_12months":1879,"current_users_plan":false},{"plan_id":"9","plan_title":"151-200","plan_title_original":"200 Client Plan","amount":"233","original_plan_amount":"233","symbol":"$","plan_currency":"AUD","disabled_plan":false,"yearly_amount_1month":209,"yearly_amount_12months":2516,"current_users_plan":false},{"plan_id":"10","plan_title":"200+","plan_title_original":"Unlimited Plan","amount":"337","original_plan_amount":"337","symbol":"$","plan_currency":"AUD","disabled_plan":false,"yearly_amount_1month":303,"yearly_amount_12months":3639,"current_users_plan":false}],"CAD":[{"plan_id":"16","plan_title":"0-50","plan_title_original":"50 Client Plan","amount":"80","original_plan_amount":"80","symbol":"$","plan_currency":"CAD","disabled_plan":false,"yearly_amount_1month":72,"yearly_amount_12months":864,"current_users_plan":false},{"plan_id":"17","plan_title":"51-100","plan_title_original":"100 Client Plan","amount":"107","original_plan_amount":"107","symbol":"$","plan_currency":"CAD","disabled_plan":false,"yearly_amount_1month":96,"yearly_amount_12months":1155,"current_users_plan":false},{"plan_id":"18","plan_title":"101-150","plan_title_original":"150 Client Plan","amount":"162","original_plan_amount":"162","symbol":"$","plan_currency":"CAD","disabled_plan":false,"yearly_amount_1month":145,"yearly_amount_12months":1749,"current_users_plan":false},{"plan_id":"19","plan_title":"151-200","plan_title_original":"200 Client Plan","amount":"220","original_plan_amount":"220","symbol":"$","plan_currency":"CAD","disabled_plan":false,"yearly_amount_1month":198,"yearly_amount_12months":2376,"current_users_plan":false},{"plan_id":"20","plan_title":"200+","plan_title_original":"Unlimited Plan","amount":"310","original_plan_amount":"310","symbol":"$","plan_currency":"CAD","disabled_plan":false,"yearly_amount_1month":279,"yearly_amount_12months":3348,"current_users_plan":false}],"EUR":[{"plan_id":"26","plan_title":"0-50","plan_title_original":"50 Client Plan","amount":"57","original_plan_amount":"57","symbol":"€","plan_currency":"EUR","disabled_plan":false,"yearly_amount_1month":51,"yearly_amount_12months":615,"current_users_plan":false},{"plan_id":"27","plan_title":"51-100","plan_title_original":"100 Client Plan","amount":"83","original_plan_amount":"83","symbol":"€","plan_currency":"EUR","disabled_plan":false,"yearly_amount_1month":74,"yearly_amount_12months":896,"current_users_plan":false},{"plan_id":"28","plan_title":"101-150","plan_title_original":"150 Client Plan","amount":"112","original_plan_amount":"112","symbol":"€","plan_currency":"EUR","disabled_plan":false,"yearly_amount_1month":100,"yearly_amount_12months":1209,"current_users_plan":false},{"plan_id":"29","plan_title":"151-200","plan_title_original":"200 Client Plan","amount":"142","original_plan_amount":"142","symbol":"€","plan_currency":"EUR","disabled_plan":false,"yearly_amount_1month":127,"yearly_amount_12months":1533,"current_users_plan":false},{"plan_id":"30","plan_title":"200+","plan_title_original":"Unlimited Plan","amount":"215","original_plan_amount":"215","symbol":"€","plan_currency":"EUR","disabled_plan":false,"yearly_amount_1month":193,"yearly_amount_12months":2322,"current_users_plan":false}],"GBP":[{"plan_id":"21","plan_title":"0-50","plan_title_original":"50 Client Plan","amount":"45","original_plan_amount":"45","symbol":"£","plan_currency":"GBP","disabled_plan":false,"yearly_amount_1month":40,"yearly_amount_12months":486,"current_users_plan":false},{"plan_id":"22","plan_title":"51-100","plan_title_original":"100 Client Plan","amount":"71","original_plan_amount":"71","symbol":"£","plan_currency":"GBP","disabled_plan":false,"yearly_amount_1month":63,"yearly_amount_12months":766,"current_users_plan":false},{"plan_id":"23","plan_title":"101-150","plan_title_original":"150 Client Plan","amount":"99","original_plan_amount":"99","symbol":"£","plan_currency":"GBP","disabled_plan":false,"yearly_amount_1month":89,"yearly_amount_12months":1069,"current_users_plan":false},{"plan_id":"24","plan_title":"151-200","plan_title_original":"200 Client Plan","amount":"142","original_plan_amount":"142","symbol":"£","plan_currency":"GBP","disabled_plan":false,"yearly_amount_1month":127,"yearly_amount_12months":1533,"current_users_plan":false},{"plan_id":"25","plan_title":"200+","plan_title_original":"Unlimited Plan","amount":"188","original_plan_amount":"188","symbol":"£","plan_currency":"GBP","disabled_plan":false,"yearly_amount_1month":169,"yearly_amount_12months":2030,"current_users_plan":false}],"NZD":[{"plan_id":"11","plan_title":"0-50","plan_title_original":"50 Client Plan","amount":"80","original_plan_amount":"80","symbol":"$","plan_currency":"NZD","disabled_plan":false,"yearly_amount_1month":72,"yearly_amount_12months":864,"current_users_plan":false},{"plan_id":"12","plan_title":"51-100","plan_title_original":"100 Client Plan","amount":"131","original_plan_amount":"131","symbol":"$","plan_currency":"NZD","disabled_plan":false,"yearly_amount_1month":117,"yearly_amount_12months":1414,"current_users_plan":false},{"plan_id":"13","plan_title":"101-150","plan_title_original":"150 Client Plan","amount":"174","original_plan_amount":"174","symbol":"$","plan_currency":"NZD","disabled_plan":false,"yearly_amount_1month":156,"yearly_amount_12months":1879,"current_users_plan":false},{"plan_id":"14","plan_title":"151-200","plan_title_original":"200 Client Plan","amount":"233","original_plan_amount":"233","symbol":"$","plan_currency":"NZD","disabled_plan":false,"yearly_amount_1month":209,"yearly_amount_12months":2516,"current_users_plan":false},{"plan_id":"15","plan_title":"200+","plan_title_original":"Unlimited Plan","amount":"337","original_plan_amount":"337","symbol":"$","plan_currency":"NZD","disabled_plan":false,"yearly_amount_1month":303,"yearly_amount_12months":3639,"current_users_plan":false}],"USD":[{"plan_id":"1","plan_title":"0-50","plan_title_original":"50 Client Plan","amount":"68","original_plan_amount":"68","symbol":"$","plan_currency":"USD","disabled_plan":false,"yearly_amount_1month":61,"yearly_amount_12months":734,"current_users_plan":false},{"plan_id":"2","plan_title":"51-100","plan_title_original":"100 Client Plan","amount":"83","original_plan_amount":"83","symbol":"$","plan_currency":"USD","disabled_plan":false,"yearly_amount_1month":74,"yearly_amount_12months":896,"current_users_plan":false},{"plan_id":"3","plan_title":"101-150","plan_title_original":"150 Client Plan","amount":"137","original_plan_amount":"137","symbol":"$","plan_currency":"USD","disabled_plan":false,"yearly_amount_1month":123,"yearly_amount_12months":1479,"current_users_plan":false},{"plan_id":"4","plan_title":"151-200","plan_title_original":"200 Client Plan","amount":"168","original_plan_amount":"168","symbol":"$","plan_currency":"USD","disabled_plan":false,"yearly_amount_1month":151,"yearly_amount_12months":1814,"current_users_plan":false},{"plan_id":"5","plan_title":"200+","plan_title_original":"Unlimited Plan","amount":"242","original_plan_amount":"242","symbol":"$","plan_currency":"USD","disabled_plan":false,"yearly_amount_1month":217,"yearly_amount_12months":2613,"current_users_plan":false}]};
var pricing_wrap = $('.pricing-v3.page');
for(var currency in billing_plans){
if(selected_currency === currency){
//console.log(billing_plans[currency]);
var currency_signs_map = {"USD":"$","CAD":"$","AUD":"$","NZD":"$","EUR":"€","GBP":"£","ZAR":"R","BRL":"R$","IDR":"Rp","THB":"฿","INR":"₹","TRY":"₺","DKK":"kr","SAR":"SR","AED":"DH","NOK":"kr","SEK":"kr","CHF":"Fr","SGD":"$","BHD":"BD","HKD":"$","MVR":"Rf","GTQ":"Q","BND":"B$","OMR":"OMR","HRK":"kn","MYR":"RM","KWD":"KD","ANG":"f","ILS":"ILS","BGN":"BGN","GIB":"£","CZK":"CZK","MUR":"MUR"};
for(var i in billing_plans[currency]){
//plan_title_original, amount etc
var section = pricing_wrap.find('.pricing-v3-plan:nth-child('+(parseInt(i)+1)+')');
var plan_data = billing_plans[currency][i];
var annualy = '';
var amount = plan_data['amount'];
if($('.plan-switch-check:visible').is(':checked')){
annualy = '
(billed annually)';
amount = plan_data['yearly_amount_1month'];
}
section.find('.pricing-v3-price').html(currency_signs_map[currency] + amount);
section.find('.pricing-v3-name').html(plan_data['plan_title_original']);
section.find('.pricing-v3-per-text').html('Per Month'+annualy);
section.find('.pricing-v3-feature').html(plan_data['plan_title']+' Clients');
}
}
}
//pricing section
var child = 1;
$('.compare-section .table').find('.table-column').each(function(){
if($(this).find('.column-header').length > 0){
$(this).find('.table-cell:nth-child(3) > div').html(
$('.pricing-v3 .pricing-v3-plan:nth-child('+(child++)+')').find('.pricing-v3-price').html()
)
}
});
//\\
}
//dd logic
$('.select-currency-wrap button[data-toggle="dropdown"]').on("click", function() {
$('.select-currency-wrap .dropdown-menu').toggle();
});
$('.select-currency-wrap ul.dropdown-menu > li').click(function(){
$(this).parents('ul.dropdown-menu').toggle();
calc_total_price();
sms_packages_show();
});
//\\
$('.plan-switch-check').mSwitch({
onTurnOn:function(){//YEARLY
calc_total_price();
},
onTurnOff:function(){//MONTHLY
calc_total_price();
}
});
calc_total_price();
//load SMS pricing
var sms_packages = {"NZD":[{"title":"100 SMS text package","price":"NZD $15","cost_per_sms":"15 cents per message"},{"title":"250 SMS text package","price":"NZD $35","cost_per_sms":"14 cents per message"},{"title":"500 SMS text package","price":"NZD $65","cost_per_sms":"13 cents per message"},{"title":"1000 SMS text package","price":"NZD $120","cost_per_sms":"12 cents per message"}],"AUD":[{"title":"100 SMS text package","price":"AUD $13","cost_per_sms":"13 cents per message"},{"title":"250 SMS text package","price":"AUD $30","cost_per_sms":"12 cents per message"},{"title":"500 SMS text package","price":"AUD $55","cost_per_sms":"11 cents per message"},{"title":"1000 SMS text package","price":"AUD $100","cost_per_sms":"10 cents per message"}],"USD":[{"title":"100 SMS text package","price":"USD $7","cost_per_sms":"7 cents per message"},{"title":"250 SMS text package","price":"USD $15","cost_per_sms":"6 cents per message"},{"title":"500 SMS text package","price":"USD $25","cost_per_sms":"5 cents per message"},{"title":"1000 SMS text package","price":"USD $40","cost_per_sms":"4 cents per message"}],"CAD":[{"title":"100 SMS text package","price":"CAD $8","cost_per_sms":"8 cents per message"},{"title":"250 SMS text package","price":"CAD $17.5","cost_per_sms":"7 cents per message"},{"title":"500 SMS text package","price":"CAD $30","cost_per_sms":"6 cents per message"},{"title":"1000 SMS text package","price":"CAD $50","cost_per_sms":"5 cents per message"}],"GBP":[{"title":"100 SMS text package","price":"GBP £8","cost_per_sms":"8 pence per message"},{"title":"250 SMS text package","price":"GBP £17.5","cost_per_sms":"7 pence per message"},{"title":"500 SMS text package","price":"GBP £30","cost_per_sms":"6 pence per message"},{"title":"1000 SMS text package","price":"GBP £50","cost_per_sms":"5 pence per message"}],"ALL":[{"title":"100 SMS text package","price":"USD $15","cost_per_sms":"15 cents per message"},{"title":"250 SMS text package","price":"USD $35","cost_per_sms":"14 cents per message"},{"title":"500 SMS text package","price":"USD $65","cost_per_sms":"13 cents per message"},{"title":"1000 SMS text package","price":"USD $120","cost_per_sms":"12 cents per message"}]};
var sms_packages_show = function(){
var packages_wrap = $('.compare-section').find('.sms-packages-wrap');
var currency = get_currency();
if(currency && sms_packages && sms_packages[currency] === undefined){
currency = 'ALL';//show by default
}
if(packages_wrap.length > 0 && currency && sms_packages && sms_packages[currency]){
packages_wrap.html($('.sms-table-template').html());
packages_wrap.prepend('