1 line
2.3 KiB
JavaScript
1 line
2.3 KiB
JavaScript
jQuery(function(e){var t=e.parseJSON(wc_setup_params.locale_info);e('select[name="store_location"]').change(function(){var a=e(this).val().split(":"),c=a[0],n=a[1]||!1,s=t[c],i=["thousand_sep","decimal_sep","num_decimals","currency_pos"];if(s){if(e.each(s,function(t,a){e(':input[name="'+t+'"]').val(a).change(),-1!==e.inArray(t,i)&&e(':input[name="'+t+'"]').closest("tr").hide()}),!e.isArray(s.tax_rates)){var o=[];if(n&&s.tax_rates[n]?o=o.concat(s.tax_rates[n]):s.tax_rates[""]&&(o=o.concat(s.tax_rates[""])),(o=o.concat(s.tax_rates["*"]||[])).length){var r=e("table.tax-rates tbody").empty();e.each(o,function(t,a){e("<tr>",{html:[e("<td>",{"class":"readonly",text:a.country||""}),e("<td>",{"class":"readonly",text:a.state||"*"}),e("<td>",{"class":"readonly",text:a.rate||""}),e("<td>",{"class":"readonly",text:a.name||""})]}).appendTo(r)}),e(".tax-rates").show()}else e(".tax-rates").hide()}}else e(':input[name="currency_pos"]').closest("tr").show(),e(':input[name="thousand_sep"]').closest("tr").show(),e(':input[name="decimal_sep"]').closest("tr").show(),e(':input[name="num_decimals"]').closest("tr").show(),e(".tax-rates").hide()}).change(),e('input[name="woocommerce_calc_taxes"]').change(function(){e(this).is(":checked")?(e(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest("tr").show(),e("tr.tax-rates").show()):(e(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest("tr").hide(),e("tr.tax-rates").hide())}).change(),e(".button-next").on("click",function(){return e(".wc-setup-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),!0}),e(".wc-wizard-payment-gateways, .wc-wizard-shipping-methods").on("change",".wc-wizard-gateway-enable input, .wc-wizard-shipping-enable input",function(){e(this).is(":checked")?e(this).closest("li").addClass("checked"):e(this).closest("li").removeClass("checked")}),e(".wc-wizard-payment-gateways, .wc-wizard-shipping-methods").on("click","li.wc-wizard-gateway, li.wc-wizard-shipping",function(){var t=e(this).find(".wc-wizard-gateway-enable input, .wc-wizard-shipping-enable input");t.prop("checked",!t.prop("checked")).change()}),e(".wc-wizard-payment-gateways li, .wc-wizard-shipping-methods li").on("click","table, a",function(e){e.stopPropagation()})}); |