jQuery(function($){var nbt_ajaxcart_load={block:function($el){$el.block({message:null,overlayCSS:{background:'#fff',opacity:0.6}});},unblock:function($el){$el.unblock();}}
var nbt_ajaxcart={init:function(){$(window).load(function(){nbt_ajaxcart.load_cal();});if($('body').hasClass('single-product')&&!$('body .single-product-wrap .entry-summary').hasClass('js_open_desginer_in_new_page')){if($('[name="variation_id"]').length||$('[name="add-to-cart"]').length){$(document).on('submit','.single-product form.cart',this.add_to_cart);}}
$(document).on('added_to_cart',this.added_to_cart);$(document).on('click','.nbt-ajax-cart-icon',this.show_ajaxcart_popup);$(document).on('click','.nbt-ajax-cart-popup .remove',this.remove_to_cart);$(document).mouseup(function(e)
{if($(".nbt-ajax-cart").length){var container=$(".nbt-ajax-cart-popup");var icon=$(".nbt-ajax-cart-icon");if(!container.is(e.target)&&container.has(e.target).length===0&&!icon.is(e.target)&&icon.has(e.target).length===0)
{container.hide();container.removeClass('open');container.closest('.nbt-ajax-cart').removeClass('active');}}});$(document).on('click','.button.product_type_simple',this.trigger_add_to_cart);},trigger_add_to_cart:function(event){event.preventDefault();var $this=$(this);$this.block({message:null,overlayCSS:{background:'#fff',opacity:0.5,cursor:'none'}});var product_data=[];product_data.push({name:'action',value:'nbt_add_to_cart'});product_data.push({name:'add-to-cart',value:$this.attr('data-product_id')});product_data.push({name:'quantity',value:1});$.ajax({url:nbt_solutions.ajax_url,data:$.param(product_data),type:'POST',datatype:'json',success:function(response){$this.unblock();if(response.fragments){$(document.body).trigger('added_to_cart',[response.fragments]);if(response.fragments.ajax_completed!=undefined){Cookies.set('ajax_count',response.fragments.ajax_count);nbt_ajaxcart.notification('<div class="text-notice"><a href="'+response.fragments.url+'" class="button wc-forward nbt-ac-carturl">'+nbt_ajaxcart_params.label.view_cart+'</a> <div>'+response.fragments.title+' '+nbt_ajaxcart_params.label.message_success+'</div></div>');}}
if(response.error!=undefined){alert(response.error);}
$(".cart_list").mCustomScrollbar({theme:"dark"});},error:function(){alert('There was an error when processing data, please try again !');nbt_ajaxcart_load.unblock($li);}});},load_cal:function(){if($(".nbt-ajax-cart").length){var $width=$(window).width()-300;$('.nbt-ajax-cart').each(function(){var $wrap=$(this);var position=$wrap.offset();if($width<position.left){$wrap.find(".nbt-ajax-cart-popup").addClass('nbt-ajaxcart-right');$wrap.find(".nbt-ajax-cart-popup").css({right:'-20px'});}else{$wrap.find(".nbt-ajax-cart-popup").addClass('nbt-ajaxcart-left');$wrap.find(".nbt-ajax-cart-popup").css({left:0});}});}},show_ajaxcart_popup:function(){var $el=$(this).closest('.nbt-ajax-cart-icon').next();var $wrap=$(this).closest('.nbt-ajax-cart');if($el.hasClass('open')){$el.hide();$el.removeClass('open');$wrap.removeClass('active');}else{$el.show();$el.addClass('open');$wrap.addClass('active');nbt_ajaxcart.load_cal();$wrap.find(".cart_list").mCustomScrollbar({theme:"dark"});}},add_to_cart:function(event){if(nbt_ajaxcart_params.enable_ajax!='yes'){return;}
event.preventDefault();var product_data=$(this).serializeArray();var btn_submit=$(this).find('button[type="submit"]');if(btn_submit.attr('name')&&btn_submit.attr('name')=='add-to-cart'&&btn_submit.attr('value')){product_data.push({name:'add-to-cart',value:btn_submit.attr('value')});}
product_data.push({name:'action',value:'nbt_add_to_cart'});if(Cookies.get('ajax_count')==undefined){Cookies.set('ajax_count',nbt_ajaxcart_params.ajax_count);}
nbt_ajaxcart_load.block(btn_submit);$.ajax({url:nbt_solutions.ajax_url,data:$.param(product_data),type:'POST',datatype:'json',success:function(response){if(response.fragments){$(document.body).trigger('added_to_cart',[response.fragments,btn_submit]);if(response.fragments.ajax_completed!=undefined){btn_submit.prop('disabled',false);nbt_ajaxcart_load.unblock(btn_submit);Cookies.set('ajax_count',response.fragments.ajax_count);nbt_ajaxcart.notification('<div class="text-notice"><a href="'+response.fragments.url+'" class="button wc-forward nbt-ac-carturl">'+nbt_ajaxcart_params.label.view_cart+'</a> <div>'+response.fragments.title+' '+nbt_ajaxcart_params.label.message_success+'</div></div>');}else{btn_submit.prop('disabled',true);nbt_ajaxcart_load.unblock(btn_submit);alert('You can\'t add to cart this product!');}}
$(".cart_list").mCustomScrollbar({theme:"dark"});},error:function(){alert('There was an error when processing data, please try again !');nbt_ajaxcart_load.unblock($li);}});},added_to_cart:function(event,fragments,btn_submit){},remove_to_cart:function(){var $this=$(this).closest('li');var $wrap=$(this).closest('.nbt-ajax-cart');nbt_ajaxcart_load.block($wrap.find('.nbt-ajax-cart-popup'));var product_data=[];product_data.push({name:'action',value:'nbt_remove_cart'});product_data.push({name:'product_id',value:$(this).attr('data-product_id')});product_data.push({name:'variation_id',value:$(this).attr('data-variation_id')});$.ajax({url:nbt_solutions.ajax_url,data:$.param(product_data),type:'POST',datatype:'json',success:function(response){if(response.fragments){$wrap.find('.nbt-ajax-cart-count, .counter-number').text(response.fragments.ajax_count);$wrap.find('div.nbt-ajax-cart-popup').replaceWith(response.fragments.ajax_popup);nbt_ajaxcart.load_cal();$wrap.find(".cart_list").mCustomScrollbar({theme:"dark"});}
nbt_ajaxcart_load.unblock($wrap.find('.nbt-ajax-cart-popup'));},error:function(){alert('There was an error when processing data, please try again !');nbt_ajaxcart_load.unblock();}});return false;},notification:function(content){$('.ajaxcart-notification').remove();$('body').append('<div id="growls" class="ajaxcart-notification default" style="top: '+nbt_ajaxcart_params.top_notification+'px;"><div class="growl growl-notice growl-medium"><div class="growl-message"><div class="growl-close">×</div>'+content+'</div></div>');$('.ajaxcart-notification').hide().show('slow').delay(2000).hide('slow');}}
nbt_ajaxcart.init();});
var x=false;jQuery(function($){var nbtcs_frontend={init:function(){$('.variations_form').addClass('swatches-support');$('.variations_form').on('click','.swatch',this.select_attributes);$('.variations_form').on('click','.reset_variations',this.reset_attributes);$(document).ajaxComplete(this.ajax_quick_view);$(document).ajaxStop(function(){x=false;});$(document).ajaxComplete(function(event,xhr,options){if(typeof(options.url)=="string"&&options.url.includes("get_variation")){if(xhr.status==200){nbtcs_frontend.trigger_price_matrix();}}});},ajax_quick_view:function(event,request,settings){if(!x&&typeof(settings.data)=="string"&&settings.data&&settings.data.includes("action=yith_load_product_quick_view")){nbtcs_frontend.init();x=true;}},select_attributes:function(){var selected=[];var $el=$(this);var attr=$el.closest('.nbtcs-swatches');var $select=attr.prev().find('select'),$nbtcs_swatches=$el.closest('.nbtcs-swatches'),attribute_name=$select.data('attribute_name')||$select.attr('name'),value=$el.attr('data-value');$select.trigger('focusin');if(!$select.find('option[value="'+value+'"]').length){$el.siblings('.swatch').removeClass('selected');$select.val('').change();$('.variations_form').trigger('tawcvs_no_matching_variations',[$el]);return;}
clicked=attribute_name;if(selected.indexOf(attribute_name)===-1){selected.push(attribute_name);}
if($el.hasClass('swatch-radio')){$select.val(value);}else{if($el.hasClass('selected')){$select.val('');$el.removeClass('selected');delete selected[selected.indexOf(attribute_name)];}else{$el.addClass('selected').siblings('.selected').removeClass('selected');$select.val(value);}}
var table_variation=$('.variations_form table.variations td.value select'),total_variations=table_variation.length,total_selected=0,new_push=[];table_variation.each(function(index){var attribute_name=$(this).attr('data-attribute_name'),attribute_value=$(this).val(),attribute_name=attribute_name.replace("attribute_","");if((total_variations-1)==index&&$('.pm-select-last').length<=0){$(this).addClass('pm-select-last');}
if(attribute_value){total_selected+=1;new_push.push(md5(attribute_name+attribute_value));}});if(total_variations==total_selected){$select.trigger('change');nbtcs_frontend.trigger_price_matrix();}},trigger_price_matrix:function(){var $this=$(this);if($('.price-matrix-table').length>0){$('.pm-td-price').removeClass('selected');var variation_id='pm-price-'+$('.variation_id').val();$('#'+variation_id).addClass('selected');$('table.un-variations td.value select').each(function(index){var attr_name=$(this).attr('data-attribute_name'),attr_value=$('[data-attribute_name="attribute_'+attr_name+'"]').val();$(this).val(attr_value);});}},select_attributes_radio:function(){var $el=$(this);alert(2);},reset_attributes:function(){$(this).closest('.variations_form').find('.swatch.selected').removeClass('selected');$(this).closest('.variations_form').find('[type="radio"]').prop('checked',false);selected=[];}}
nbtcs_frontend.init();});
jQuery(document).ready(function($){var x=false;var nbtou_load={block:function($el){$el.block({message:null,overlayCSS:{background:'#fff',opacity:0.6}});},unblock:function($el){$el.unblock();}}
var nbtfaq_js={init:function(){$(document).on('click','.nbt-faq-title',this.faq_triggle);},faq_triggle:function(e){e.preventDefault();if($(this).hasClass('active')){$(this).removeClass('active');$(this).closest('li').find('.nbt-faq-content').slideUp();}else{$(this).addClass('active');$(this).closest('li').find('.nbt-faq-content').slideDown();}}}
nbtfaq_js.init();});;(function($){$(document).ready(function(){"use strict";var items=$('.nbcs-list-items'),item=$('.nbcs-list-items li'),first_item=$('.nbcs-list-items li:first-child'),checkbox=items.find('input'),total_price_wrap=$('.nbcs-price-box'),total_price_class=total_price_wrap.find('.nbcs-display-total-price'),total_price_html=total_price_class.find('.amount');Number.prototype.format=function(n,x){var re='(\\d)(?=(\\d{'+(x||3)+'})+'+(n>0?'\\.':'$')+')';return this.toFixed(Math.max(0,~~n)).replace(new RegExp(re,'g'),'$1,');};var get_total=function(total){var html='';if(nb_fbt.currency_pos==='left'){html=nb_fbt.currency_symbol+total.format(2);}
else if(nb_fbt.currency_pos==='left_space'){html=nb_fbt.currency_symbol+' '+total.format(2);}
else if(nb_fbt.currency_pos==='right'){html=total.format(2)+nb_fbt.currency_symbol;}
else if(nb_fbt.currency_pos==='right_space'){html=total.format(2)+' '+nb_fbt.currency_symbol;}
return html;};checkbox.on('change',function(){var t=$(this),id=t.attr('id'),total_price_attr=total_price_class.attr('data-total-price'),product_price=t.attr('data-price'),to_show=[],checked=items.find('input:checked'),thumb=$('.nbcs-list-images li.nbcs-thumb[data-rel="'+id+'"]'),plus_icon=$('li.nbcs-plus-icon'),total=0;t.parents('li').toggleClass('unchecked');checked.each(function(i){to_show[i]=this.id;total+=parseFloat($(this).attr('data-price'));});total_price_class.attr('data-total-price',total);thumb.fadeToggle();if(to_show.length==0||to_show.length==1){plus_icon.fadeOut();}
else if(to_show.length==item.length){plus_icon.fadeIn();}
else if(id=='offeringID_0'){if(to_show[0]!=id){$('li.nbcs-plus-icon[data-rel="'+to_show[0]+'"]').fadeOut();}
else
{thumb.next(plus_icon).fadeIn();}}
else if(to_show[0]==id||to_show[0]==thumb.next(plus_icon).data('rel')){thumb.next(plus_icon).fadeToggle();}
else{thumb.prev(plus_icon).fadeToggle();}
total_price_html.html(get_total(total));var combox_checked=checked.length;if(combox_checked==0){total_price_wrap.hide();}
else{total_price_wrap.show();}
if(combox_checked<=3){total_price_wrap.removeClass('clear-price-box');}
else{total_price_wrap.addClass('clear-price-box');}});var variations_form=$('form.variations_form');if(variations_form.length==1)
{$(document).on('change','table.variations select',function(){var target=document.body;var config={childList:true,subtree:true,attributes:true,characterData:true};observer.observe(target,config);setTimeout(function(){observer.disconnect();},1000);});var variations_data=JSON.parse($('form.variations_form').attr('data-product_variations'));var observer=new MutationObserver(function(mutationRecords,observer){mutationRecords.forEach(function(mutation){var first_id=$('.variations tr:first-child select').attr('id');if(mutation.attributeName=='current-image'){var select_id=mutation.target[0].id,image_id=$('.variations_form').attr('current-image');if(select_id==first_id&&image_id){var new_variation_data={};$.each(variations_data,function(i){$.each(variations_data[i],function(key,val){if(key=='image_id'&&val==image_id){new_variation_data[i]=variations_data[i];}});});var new_thumb='',new_srcset='',new_price=0,new_price_html='',new_variation_id=0;$.each(new_variation_data,function(k){new_thumb=new_variation_data[k].image.thumb_src;new_srcset=new_variation_data[k].image.srcset;new_price=new_variation_data[k].display_price;new_price_html=new_variation_data[k].price_html;new_variation_id=new_variation_data[k].variation_id;});if(new_thumb!=''&&new_srcset!=''){$('.nbcs-list-images li:first-child a img').attr('src',new_thumb).attr('srcset',new_srcset);}
var total_price=total_price_class.attr('data-total-price'),first_combo_box=first_item.find('input[name="cb-item[]"]'),first_input=first_item.find('input[name="offeringID[]"]'),first_product_price=first_combo_box.attr('data-price'),first_product_price_html=first_item.find('.amount'),new_total_price=parseFloat(total_price)-parseFloat(first_product_price)+parseFloat(new_price);if(!first_item.hasClass('unchecked')){total_price_html.html(get_total(new_total_price));total_price_class.attr('data-total-price',new_total_price);}
first_combo_box.attr('data-price',new_price).val(new_variation_id);first_product_price_html.html(new_price_html);first_input.val(new_variation_id).removeClass().addClass('offeringID-'+new_variation_id);}}});});}})}(jQuery));
jQuery(document).ready(function($){var x=false;var nbtou_load={block:function($el){$el.block({message:null,overlayCSS:{background:'#fff',opacity:0.6}});},unblock:function($el){$el.unblock();}}
var nbtou_js={init:function(){$(document).on('dragover','.nbt-upload-zone',this.dragover_files);$(document).on('dragleave','.nbt-upload-zone',this.dragleave_files);$(document).on('drop','.nbt-upload-zone',this.drop_files);$(document).on('click','.nbt-oupload-target',this.click_files);$(document).on('change','.nbt-upload-input',this.change_files);$(document).on('click','.nbt-icon-cancel',this.remove_files);$(document).on('click','.toggle-order-upload',this.toggle_order_upload);$(document).on('click','.nbt-ou-fast button',this.show_order_upload);if($('#nbt-order-upload').length>0){var useAjax=false===$('form.variations_form').data('product_variations');if(useAjax){$(document).ajaxComplete(function(event,xhr,options){if(typeof(options.url)=="string"&&options.url.includes("get_variation")){if(xhr.status==200){nbtou_js.change_variations_ajax();}}});}else{$(document).on('change','.variations select',this.change_variations);}}
if($('body').hasClass('single-product')&&$('form.variations_form').length>0){nbtou_js.change_variations();}
if($('.nbt-ou-fast').length){$('#nbt-orderupload-popup').remove();$('body').append('<div id="nbt-orderupload-popup" class="white-popup mfp-hide"><h2>'+nbt_solutions.nbt_ou_label+'</h2><div class="nbt-orderupload-popup-wrapper"></div></div>');}
this.require_upload();},file_extension:function(file){return file.split('.').pop();},change_variations_ajax:function(){var currentVariations='';$('form.variations_form .variations select').each(function(){var attribute_name=$(this).data('attribute_name')||$(this).attr('name');var value=$(this).val()||'';currentVariations+=attribute_name+value;});$('#nb-orderupload-wrapper').show();nbtou_load.block($('form.variations_form'));$.ajax({url:nbt_solutions.ajax_url,data:{action:'nbt_ou_variations_show',variation_id:md5(currentVariations)},type:'POST',datatype:'json',success:function(response){nbtou_load.unblock($('form.variations_form'));$('.nbt-oupload-body').html('');if(response.complete!=undefined&&response.tpl!=''){$('.nbt-oupload-body').html(response.tpl);if($('.nbt-oupload-body .nbt-file').length>3){$('.nbt-oupload-output .nbt-oupload-body').slimScroll({height:'184px'});}}else{$('.nbt-oupload-body').removeAttr('style');$(".nbt-oupload-output .nbt-oupload-body").slimScroll({destroy:true});}},error:function(){nbtou_load.unblock($('form.variations_form'));}});},change_variations:function(){var count=$('.variations select').length;var selected=0;$('.variations select').each(function(index){if($(this).val()){selected+=1;}});if(count==selected){$('#nb-orderupload-wrapper').show();nbtou_load.block($('form.variations_form'));var $form=$('form.variations_form'),variationData=$form.data('product_variations'),attributeFields=$form.find('.variations select'),currentVariations='';attributeFields.each(function(){var attribute_name=$(this).data('attribute_name')||$(this).attr('name');var value=$(this).val()||'';currentVariations+=attribute_name+value;});$.ajax({url:nbt_solutions.ajax_url,data:{action:'nbt_ou_variations_show',variation_id:md5(currentVariations)},type:'POST',datatype:'json',success:function(response){nbtou_load.unblock($('form.variations_form'));$('.nbt-oupload-body').html('');if(response.complete!=undefined&&response.tpl!=''){$('.nbt-oupload-body').html(response.tpl);if($('.nbt-oupload-body .nbt-file').length>3){$('.nbt-oupload-output .nbt-oupload-body').slimScroll({height:'184px'});}else{nbtou_js.destroy_upload();}}else{nbtou_js.destroy_upload();}},error:function(){nbtou_load.unblock($('form.variations_form'));}});}else{if(nbtou.require_variation){$('#nb-orderupload-wrapper').hide();}}},destroy_upload:function(){$('.nbt-oupload-body').removeAttr('style');$(".nbt-oupload-output .nbt-oupload-body").slimScroll({destroy:true});},toggle_order_upload:function(){var $div=$(this).closest('.nbt-show-files');if($(this).hasClass('active')){$div.find('ul').slideUp();$(this).removeClass('active');}else{$div.find('ul').slideDown();$(this).addClass('active');}},show_order_upload:function(e){e.preventDefault();nbtou_load.block($('.shop_table'));var product_fast=$(this).closest('.nbt-ou-fast');var product_id=product_fast.attr('id').replace("nbt-upload-cart-","");$.ajax({url:nbt_solutions.ajax_url,data:{action:'nbt_ou_show',product_id:product_id},type:'POST',datatype:'json',success:function(response){if(response.complete!=undefined){$('#nbt-orderupload-popup .nbt-orderupload-popup-wrapper').html(response.tpl);}},complete:function(){nbtou_load.unblock($('.shop_table'));$.magnificPopup.open({items:{src:'#nbt-orderupload-popup'},type:'inline',midClick:true,mainClass:'mfp-fade',closeOnBgClick:false,callbacks:{open:function(){var $current_window=$(window).width()-50;var $width_table=$('.price-matrix-table').width()+60;if($width_table>500&&$current_window>$width_table){$('#price-matrix-popup').css({"maxWidth":$width_table});}}}});},error:function(){alert('There was an error when processing data, please try again !');}});},require_upload:function(){if(nbtou.require_upload&&$('body').hasClass('has-order-upload')){var $file=$('.nbt-oupload-body .nbt-file').length;var $file_success=$('.nbt-oupload-body .nbt-file.success').length;if($file==$file_success&&$file!=0){$('.single_add_to_cart_button').prop('disabled',false);}else{$('.single_add_to_cart_button').prop('disabled',true);}}},dragover_files:function(e){e.preventDefault();e.stopPropagation();$(this).addClass('dragover');},dragleave_files:function(e){e.preventDefault();e.stopPropagation();$(this).removeClass('dragover');},drop_files:function(e){e.preventDefault();e.stopPropagation();$(this).removeClass('dragover');nbtou_js.triggerCallback(e);},binarySearch:function(items,value){return items.indexOf(value);},triggerCallback:function(e){var show_error=false;var $product_id=$('[name="add-to-cart"]').val();var files;if(e.originalEvent.dataTransfer){files=e.originalEvent.dataTransfer.files;}else if(e.target){files=e.target.files;}
var fail_filename='';$.each(files,function(key,file){var extension=file.name.replace(/^.*\./,'').toLowerCase();if(nbtou_js.binarySearch(nbtou.file_extension,extension)<0){fail_filename+=file.name.toLowerCase()+', ';files=jQuery.grep(files,function(k,value){return value!=key;});}});var number_files=files.length;if(number_files>nbtou.file_of_number){var file_of_number=nbtou.label_numfiles.replace("%s",nbtou.file_of_number);alert(file_of_number);show_error=true;}
if(fail_filename&&!show_error){var label_restrict=nbtou.label_restrict.replace("%s",fail_filename.slice(', ',-2));}
if(!show_error){if(typeof nbt_solutions!=='undefined'&&nbt_solutions.customer_id!=undefined){customer_id=nbt_solutions.customer_id;}else{customer_id=nbtou.customer_id;}
var data=new FormData(),timestamp=new Date().getUTCMilliseconds(),currentVariations='',$html='';for(var i=0;i<files.length;i++){var attr_id=md5(timestamp+i);var fileext=nbtou_js.file_extension(files[i].name);data.append("nbt_id[]",attr_id);$html+='<div id="'+md5(customer_id+files[i].name)+'" attr-id="'+attr_id+'" class="nbt-file"><div class="nbt-file-left">';if(files[i].type.indexOf('image/')===0&&fileext!='svg'){$html+='<img width="50" src="'+URL.createObjectURL(files[i])+'" />';}else{var img_src=nbtou.file_extension_src['default'];if(typeof nbtou.file_extension_src[fileext]!='undefined'){img_src=nbtou.file_extension_src[fileext];}
$html+='<img width="50" src="'+img_src+'" />';}
$html+='</div><div class="nbt-file-right">';$html+='<div class="name">'+files[i].name+' <i class="nbt-icon-cancel"></i></div><div class="size"> '+nbtou_js.calcSize(files[i].size)+'</div><div class="nbt-ou-msg" style="display: none;"></div></div>';$html+='</div>';}
$('.nbt-oupload-body').append($html);if($('.nbt-oupload-output .nbt-oupload-body .nbt-file').length>3){$('.nbt-oupload-output .nbt-oupload-body').slimScroll({height:'184px'});}
data.append("action","nbt_order_upload");data.append("product_id",$product_id);$.each(files,function(key,value){data.append("nbt_files[]",value);});if(typeof nbt_solutions!=='undefined'&&nbt_solutions.ajax_url!=undefined){ajax_url=nbt_solutions.ajax_url;}else{ajax_url=nbtou.ajax_url;}
$('form.variations_form .variations select').each(function(){var attribute_name=$(this).data('attribute_name')||$(this).attr('name');var value=$(this).val()||'';currentVariations+=attribute_name+value;});if($('.variation_id').length>0){data.append("variation_id",md5(currentVariations));}
nbtou_load.block($('#nbt-order-upload'));$.ajax({url:ajax_url,type:'POST',data:data,cache:false,dataType:'json',processData:false,contentType:false,xhr:function(){var xhr=new window.XMLHttpRequest();var started_at=new Date();xhr.upload.addEventListener("progress",function(evt){if(evt.lengthComputable){var loaded=evt.loaded;var total=evt.total;var seconds_elapsed=(new Date().getTime()-started_at.getTime())/1000;var bytes_per_second=seconds_elapsed?loaded/seconds_elapsed:0;var Kbytes_per_second=bytes_per_second/1000;var remaining_bytes=total-loaded;var seconds_remaining=seconds_elapsed?remaining_bytes/bytes_per_second:'calculating';jQuery('.timeRemaining').html('');jQuery('.timeRemaining').append(Math.round(seconds_remaining));$('.progress').show();$('.progress').find('.progress-bar').css('width',Math.round((evt.loaded/evt.total)*100)+"%");}},false);return xhr;},success:function(data,textStatus,jqXHR){nbtou_load.unblock($('#nbt-order-upload'));if(data.msg!=undefined){alert(data.msg);return;}
if(typeof data.response!='undefined'){$.each(data.response,function(index,value){if(value.complete!=undefined){$('.progress').hide();$('[attr-id="'+index+'"]').addClass('success');$('[attr-id="'+index+'"]').attr('id',value.file_id);}else{if($('#'+index).length>0){$('#'+index+' .nbt-ou-msg').show();$('#'+index).addClass('error');$('#'+index+' .nbt-ou-msg').html(value);}else{$('.nbt-file[attr-id="'+index+'"] .nbt-ou-msg').show();$('.nbt-file[attr-id="'+index+'"]').addClass('error');$('.nbt-file[attr-id="'+index+'"] .nbt-ou-msg').html(value);}}});}
nbtou_js.require_upload();}});}},click_files:function(){var isUpload=true;if(nbtou.file_of_number!=undefined&&$('.nbt-oupload-output .nbt-oupload-body .nbt-file').length>=nbtou.file_of_number){var isUpload=false;var file_of_number=nbtou.label_numfiles.replace("%s",nbtou.file_of_number);alert(file_of_number);}
if(nbtou.require_variation&&$('.single_add_to_cart_button.disabled').length>0){var isUpload=false;alert(nbtou.label_variation);}
if(isUpload){$('.nbt-upload-input').val('');$('.nbt-upload-input').trigger('click');}},change_files:function(e){nbtou_js.triggerCallback(e);nbtou_js.require_upload();},calcSize:function(nBytes){if(nBytes==0){return{size:'',label:''}}
for(var aMultiples=["Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],nMultiple=0,nApprox=nBytes/1024;nApprox>1000;nApprox/=1000,nMultiple++){}
return nApprox.toFixed(2)+' '+aMultiples[nMultiple];},remove_files:function(){var $li=$(this).closest('.nbt-file'),$id=$li.attr('id'),currentVariations='';nbtou_load.block($('#nbt-order-upload'));if(typeof nbt_solutions!=='undefined'&&nbt_solutions.ajax_url!=undefined){ajax_url=nbt_solutions.ajax_url;}else{ajax_url=nbtou.ajax_url;}
var isValid=true;if($li.hasClass("error")){var $id=$li.attr('attr-id');isValid=false;}
$('form.variations_form .variations select').each(function(){var attribute_name=$(this).data('attribute_name')||$(this).attr('name');var value=$(this).val()||'';currentVariations+=attribute_name+value;});$.ajax({url:ajax_url,data:{action:'nbt_ou_remove',product_id:$('[name="add-to-cart"]').val(),variation_id:currentVariations!=''?md5(currentVariations):'',file:$id,valid:isValid},type:'POST',datatype:'json',success:function(rs){nbtou_load.unblock($('#nbt-order-upload'));if(rs.complete!=undefined){$('#'+rs.file_id).remove();nbtou_js.require_upload();}else{if(isValid){$('#'+rs.file_id).remove();}else{$('.nbt-file[attr-id="'+rs.file_id+'"]').remove();}}
if($('.nbt-oupload-body .nbt-file').length<3){$('.nbt-oupload-body').removeAttr('style');$(".nbt-oupload-output .nbt-oupload-body").slimScroll({destroy:true});}else{$('.nbt-oupload-output .nbt-oupload-body').slimScroll({height:'184px'});}},error:function(){alert('There was an error when processing data, please try again !');nbtou_load.unblock($('#nbt-order-upload'));}});return false;}}
nbtou_js.init();var picker='file',oauthToken,driveclientId=nbtou.g_drive_clientid,driveapiKey=nbtou.g_drive_apikey,dropboxApi=nbtou.dropbox_apikey,boxApi=nbtou.box_apikey,service_order=['drive','upload'],service_list={'drive':1,'upload':1},origin=window.location.protocol+'//'+window.location.host;var ol_services_js={init:function(){this.support();this.bind_functions();},bind_functions:function(){$(document).on('click','#add-g-drive',this.g_drive_handler);$(document).on('click','#add-button-no-api',this.no_api_handle);$(document).on('click','#add-dropbox',this.dropbox_handler);$(document).on('click','#add-box',this.box_handler);$(document).on('click','.tablinks',function(event){event.preventDefault();$('.ou-tabcontent > div').css('display','none');$('.ou-tab > button').removeClass('activated');$(this).addClass('activated');var tab_rel=$(this).attr('tab-rel');$('.ou-tabcontent '+'#'+tab_rel).fadeIn('slow');});},support:function(){if(driveapiKey&&driveclientId){$("head").append("<script type='text/javascript' src='https://apis.google.com/js/api.js'></script>");}
if(dropboxApi){$("head").append("<script type='text/javascript' src='https://www.dropbox.com/static/api/2/dropins.js'></script>");}
if(boxApi){$("head").append("<script type='text/javascript' src='https://app.box.com/js/static/select.js'></script>");}},g_drive_handler:function(){picker='file';ol_services_js.load_gapi();},load_gapi:function(){if(!oauthToken){gapi.load('auth',{'callback':ol_services_js.onAuthApiLoad});gapi.load('picker',1);}
else{ol_services_js.open_file_picker();}},onAuthApiLoad:function(){window.gapi.auth.authorize({'client_id':driveclientId,'scope':['https://www.googleapis.com/auth/drive'],},ol_services_js.callback_auth_result);},open_file_picker:function(){var picker=new google.picker.PickerBuilder().setOrigin(origin).setOAuthToken(oauthToken).setCallback(ol_services_js.picker_callback);picker.addView(new google.picker.DocsView().setIncludeFolders(true));picker.addView(new google.picker.DocsUploadView().setIncludeFolders(true));picker.build().setVisible(true);},callback_auth_result:function(authResult){if(authResult&&!authResult.error){oauthToken=authResult.access_token;ol_services_js.open_file_picker();}},picker_callback:function(data){if(data[google.picker.Response.ACTION]==google.picker.Action.PICKED){driverDocs=data[google.picker.Response.DOCUMENTS];var driver_url=driverDocs[0].url;var driver_name=driverDocs[0].name;var driver_id=driverDocs[0].id;ol_services_js.process_file(driver_url,driver_name,driver_id);}},process_file:function(os_url,os_name,os_id){if(typeof nbt_solutions!=='undefined'&&nbt_solutions.ajax_url!=undefined){ajax_url=nbt_solutions.ajax_url;}else{ajax_url=nbtou.ajax_url;}
var product_id=$('[name="add-to-cart"]').val();var variation_id=0;if($('.variation_id').length>0){var variation_id=$('.variation_id').val();}
$.ajax({url:ajax_url,type:'POST',dataType:'json',data:{action:'nbt_order_upload',os_url:os_url,os_name:os_name,os_id:os_id,product_id:product_id,variation_id:variation_id,attached_from_outsoure:1},beforeSend:function(){nbtou_load.block($('#from_online_services'));},success:function(response){nbtou_load.unblock($('#from_online_services'));var $html='';$html+='<div id="'+os_id+'" class="nbt-file success">';$html+='<div class="nbt-file-left file-icon"><i class="fa fa-file-o fa-3x" aria-hidden="true"></i></div>';$html+='<div class="nbt-file-right">';$html+='<div class="name">'+os_name+' <i class="nbt-icon-cancel"></i></div><div class="nbt-ou-msg" style="display: none;"></div></div>';$html+='</div>';$('.nbt-oupload-body').append($html);nbtou_js.require_upload();},error:function(){alert('There was an error when processing data, please try again !');nbtou_load.unblock($('#nbt-order-upload'));}})},no_api_handle:function(){tb_show("NO API","#TB_inline?inlineId=g-drive-popup-wrap",null);ol_services_js.popup_position();return false;},dropbox_handler:function(event){event.preventDefault();Dropbox.init({appKey:dropboxApi});Dropbox.choose({linkType:"preview",multiselect:false,success:function(files){var dbFile=files[0];var dbURL=dbFile.link.replace("?dl=0","");var dbFileName=dbFile.name;var dbFileID=dbFile.id;ol_services_js.process_file(dbURL,dbFileName,dbFileID);}});},box_handler:function(){var boxoptions={clientId:boxApi,linkType:'shared',multiselect:false};var boxSelect=new BoxSelect(boxoptions);boxSelect.launchPopup();boxSelect.success(function(response){var boxFile=response[0];var boxURL=boxFile.url;var boxFileName=boxFile.name;var boxFileID=boxFile.id;ol_services_js.process_file(boxURL,boxFileName,boxFileID);});},popup_position:function(){var tbWindow=$('#TB_window');var width=$(window).width();var H=$(window).height();var W=(1080<width)?1080:width;if(tbWindow.size()){tbWindow.width(W-50).height(H-45);$('#TB_ajaxContent').css({'width':'100%','height':'100%','padding':'0'});tbWindow.css({'margin-left':'-'+parseInt(((W-50)/2),10)+'px'});if(typeof document.body.style.maxWidth!='undefined')
tbWindow.css({'top':'20px','margin-top':'0'});$('#TB_title').css({'background-color':'#fff','color':'#cfcfcf'});};}}
ol_services_js.init();});
jQuery(document).ready(function($){var x=false;var nbtpdf_js={init:function(){$(document).on('click','.btn-pdf-preview',this.save_id);$(document).on('click','.btn-print-pdf',this.download_file);},save_id:function(){if($(this).hasClass('active')){$(this).next().slideUp();$(this).removeClass('active');}else{$(this).next().slideDown();$(this).addClass('active');}},download_file:function(){$('.preview').block({message:null,overlayCSS:{background:'#fff',opacity:0.6}});$.ajax({url:admin_ajax,data:{action:'nbtpdf_download',order_id:order_id,_wpnonce:nonce},type:'POST',datatype:'json',success:function(response){$('.preview').unblock();if(response.complete!=undefined){window.location.href=response.redirect;}},error:function(){$('.preview').unblock();}});return false;}}
nbtpdf_js.init();});
jQuery(function($){var $el=$('.variations_form');var pm_load={block:function(){$el.block({message:null,overlayCSS:{background:'#fff',opacity:0.6}});},unblock:function(){$el.unblock();}}
var pm_frontend={init:function(){$(document).on('click','.pure-table .pm-td-price',this.selected_price);$(document).on('change','table.un-variations tr:visible select',this.change_attr);Tippy('.tippy',{animation:'scale',duration:200,arrow:true,position:'bottom'});$(window).load(this.window_load);if(nbt_solutions.isCalculatorText!=undefined&&nbt_solutions.isCalculatorText!==''){$(document).on('change','body.single-product input[name="quantity"]',this.change_price_calculator);}
$(window).load(function(){setTimeout(function(){pm_frontend.removeMissingAttribute();},1000);});},removeMissingAttribute:function(){$(".has-price-matrix table.variations select").each(function(index){var $attribute_id=$(this).attr('id');console.log($attribute_id);$(this).find('option').each(function(index){var $val=$(this).attr('value');$('table.un-variations select#'+$attribute_id+' option[value="'+$val+'"]').addClass('show');});});$("table.un-variations select").each(function(index){$(this).find('option:not(.show)').remove();});},change_price_calculator:function(){var wrapper_selected=$('#price-matrix-wrapper td.selected'),qty=$('body.single-product input[name="quantity"]').val(),format_price=$('#price-matrix-wrapper').attr('data-format_price'),_decimal=nbt_solutions.decimal;if(wrapper_selected.length>0){var price_selected=wrapper_selected.attr('data-price'),total_price=price_selected*qty;var total_price_format=accounting.formatMoney(total_price,{symbol:'',decimal:_decimal,thousand:nbt_solutions.thousand,precision:nbt_solutions.precision,format:''});var html_price=format_price.replace('{price}',total_price_format)
$('.woocommerce-variation-price > .price').html(html_price);if(nbt_solutions.isCalculatorText!=undefined&&nbt_solutions.isCalculatorText!==''){var price_format=accounting.formatMoney(price_selected,{symbol:nbt_solutions.format.symbol,decimal:_decimal,thousand:nbt_solutions.format.thousand,precision:nbt_solutions.format.precision,format:nbt_solutions.format.format});var total_price_format_cal=accounting.formatMoney(total_price,{symbol:nbt_solutions.format.symbol,decimal:_decimal,thousand:nbt_solutions.format.thousand,precision:nbt_solutions.format.precision,format:nbt_solutions.format.format});var _html='';_html+='<label>'+nbt_solutions.pricematrix.total_label+':</label>';_html+=' '+price_format+' x '+qty;_html+=' = '+total_price_format_cal;$('.nbpm-calculator').html('<p class="nbpm-calculator-price">'+_html+'</p>');}}
if(nbt_solutions.isCalculatorText!=undefined&&nbt_solutions.isCalculatorText!==''){$('table.price-matrix-table td.pm-td-price').each(function(index){var price=$(this).attr('data-price'),tooltip=$(this).attr('data-original-title'),total_tooltip_price=price*qty,remake_tooltips=tooltip.replace(/<td class="total_price">(.*)<\/td>/gm,'<td class="total_price">'+format_price.replace('{price}',total_tooltip_price)+'</td>');$(this).attr('title',remake_tooltips);});Tippy('.tippy',{animation:'scale',duration:200,arrow:true,position:'bottom'});}},autoload_pm:function(){if($('#single-product_variations').length){var $product_variations=$('#single-product_variations').attr('data-product_variations');var $product_attr=$('#single-product_variations').attr('data-attr');var $product_count=$('#single-product_variations').attr('data-count');$.ajax({url:nbt_solutions.ajax_url,data:{action:'pm_autoload',security:$('[name="security"]').val(),product_id:$('[name="add-to-cart"]').val(),vacant:$.parseJSON($product_variations),attr:$.parseJSON($product_attr),count:$product_count,suffix:$('.un-variations').attr('data-suffix')},type:'POST',success:function(response){pm_load.unblock();$('body').append(response);},error:function(){}});}},window_load:function(){pm_frontend.set_last_attribtutes();pm_frontend.set_default_attributes();},set_default_attributes:function(vacant=false){if($('.un-variations').length>0){if(!vacant){var total_unvariations=$(".un-variations td.value select").length;var total_setvariations=0;$(".un-variations td.value select").each(function(index){var attribute_name=$(this).attr('data-attribute_name');var attribute_value=$(this).val();if(typeof nbt_solutions.default_attributes[attribute_name]!='undefined'){total_setvariations+=1;}});if(total_unvariations==total_setvariations){$('.un-variations tr:last-child select').trigger('change');if(nbt_solutions.debug){console.log('%c Turn on debug!','background: #222; color: #bada55');console.log('trigger select variations default!');}}}else{pm_frontend.trigger_default_attributes();}}else{if(!vacant){pm_frontend.trigger_default_attributes();}}},set_last_attribtutes:function(){if($("form.variations_form .variations select.pm-select-last").length<=0){var variations_form_length=($("form.variations_form .variations select").length-1);$("form.variations_form .variations select").each(function(index){if($(this).is('[data-attribute_name]')&&index==variations_form_length){$(this).addClass('pm-select-last');}});if(nbt_solutions.debug){console.log('%c Turn on debug!','background: #222; color: #bada55');console.log('set_last_attribtutes!');}}},trigger_default_attributes:function(){if(nbt_solutions.debug){console.log('%c Turn on debug!','background: #222; color: #bada55');console.log('trigger_default_attributes!');}
var total_variations=$('table.variations td.value select').length;var total_default_variations=0;$('table.variations td.value select').each(function(index){var attribute_name=$(this).attr('data-attribute_name'),attribute_value=$(this).val(),attribute_name=attribute_name.replace("attribute_","");if(typeof nbt_solutions.default_attributes[attribute_name]!='undefined'){$(this).val(attribute_value);total_default_variations+=1;}});if(total_variations==total_default_variations){console.log('trigger now!');$('.pm-select-last').trigger('change');}},change_attr:function(){var $this=$(this).val();pm_load.block();var $total=$('table.un-variations tr:visible select').length;var optionVal={};var pmid='';var count=0;$('table.un-variations tr:visible select').each(function(index){if($(this).val()){var $id=$(this).closest('select').attr('id');var $val=$(this).val();optionVal[$id]=$val;pmid+=$id+$val;count+=1;}});if($this&&$total==count){$.ajax({url:nbt_solutions.ajax_url,data:{action:'pm_load_matrix',security:$('[name="security"]').val(),product_id:$('[name="add-to-cart"]').val(),attr:optionVal},type:'POST',datatype:'json',success:function(response){if(response.complete!=undefined){$('.price_attr').remove();$('.table-responsive, [name="price_attr"], [name="security"]').remove();$('#price-matrix-wrapper .load-table-pm').show().html(response.return);Tippy('.tippy',{animation:'scale',duration:200,arrow:true,position:'bottom'});pm_frontend.set_default_attributes(true);}
pm_load.unblock();},error:function(){alert('There was an error when processing data, please try again !');}});}else{$('.table-responsive').remove();pm_load.unblock();}},selected_price:function(){var price=$(this).html();var total_length=$("form.variations_form select").length;if($('.pure-table td.pm-td-price').not($(this)).hasClass('selected')){$('.pure-table td.pm-td-price.selected').removeAttr('style');}
$('.pure-table .pm-td-price').removeClass('selected');$(this).addClass('selected');var $attr=$(this).attr('data-attr');$('.nbtcs-swatches .swatch').removeClass('selected');$.each(JSON.parse($attr),function(key,pm){$('[name="attribute_'+pm.name+'"]').val(pm.value);console.log('attribute_'+pm.name+'');console.log(pm.value);console.log('----------------');if($('.nbtcs-swatches').length){$('.nbtcs-swatches [data-value="'+pm.value+'"]').addClass('selected');}});$("form.variations_form .variations select.pm-select-last").trigger('change');if(nbt_solutions.is_scroll){$('html,body').animate({scrollTop:$("form.variations_form").find('[type="submit"]').offset().top-150},'slow');}
pm_frontend.change_price_calculator();}}
if($(".pure-table").length>0){pm_frontend.init();}});
jQuery(document).ready(function($){$(document).on('click','.pnotisubmit',function(){$('.nbt-alert-msg').hide();$.ajax({url:nbt_solutions.ajax_url,data:{action:'nbtpn_notification',product_id:$('#alert_id').val(),email:$('#alert_email').val(),},type:'POST',datatype:'json',success:function(response){var rs=JSON.parse(response);if(rs.complete!=undefined){$('.nbt-alert-msg').html(rs.msg).hide().slideToggle(500);}else{$('.nbt-alert-msg').html(rs.msg).hide().slideToggle(500);}},error:function(){alert('There was an error when processing data, please try again !');}});return false;});});