2015-07-10 04:32:30 +00:00
|
|
|
/*global wc_setup_params */
|
2015-04-15 15:34:03 +00:00
|
|
|
jQuery(function( $ ) {
|
|
|
|
|
|
|
|
var locale_info = $.parseJSON( wc_setup_params.locale_info );
|
|
|
|
|
|
|
|
$('select[name="store_location"]').change(function(){
|
|
|
|
var country_option = $(this).val();
|
|
|
|
var country = country_option.split( ':' )[0];
|
|
|
|
var country_locale_info = locale_info[ country ];
|
2015-04-17 13:56:34 +00:00
|
|
|
var hide_if_set = [ 'thousand_sep', 'decimal_sep', 'num_decimals', 'currency_pos' ];
|
2015-04-15 15:34:03 +00:00
|
|
|
|
|
|
|
if ( country_locale_info ) {
|
2015-04-17 13:56:34 +00:00
|
|
|
$.each( country_locale_info, function( index, value) {
|
|
|
|
$(':input[name="' + index + '"]').val( value ).change();
|
|
|
|
|
2015-07-10 04:32:30 +00:00
|
|
|
if ( -1 !== $.inArray( index, hide_if_set ) ) {
|
2015-04-17 13:56:34 +00:00
|
|
|
$(':input[name="' + index + '"]').closest('tr').hide();
|
|
|
|
}
|
|
|
|
} );
|
2015-04-15 15:34:03 +00:00
|
|
|
} else {
|
2015-04-29 13:55:12 +00:00
|
|
|
$(':input[name="currency_pos"]').closest('tr').show();
|
|
|
|
$(':input[name="thousand_sep"]').closest('tr').show();
|
|
|
|
$(':input[name="decimal_sep"]').closest('tr').show();
|
|
|
|
$(':input[name="num_decimals"]').closest('tr').show();
|
2015-04-15 15:34:03 +00:00
|
|
|
}
|
|
|
|
}).change();
|
|
|
|
|
2015-04-27 12:56:30 +00:00
|
|
|
$('input[name="woocommerce_calc_shipping"]').change(function(){
|
2015-04-22 14:30:50 +00:00
|
|
|
if ( $(this).is( ':checked' ) ) {
|
|
|
|
$(':input[name="shipping_cost_domestic"]').closest('tr').show();
|
|
|
|
$(':input[name="shipping_cost_international"]').closest('tr').show();
|
|
|
|
} else {
|
|
|
|
$(':input[name="shipping_cost_domestic"]').closest('tr').hide();
|
|
|
|
$(':input[name="shipping_cost_international"]').closest('tr').hide();
|
|
|
|
}
|
|
|
|
}).change();
|
|
|
|
|
|
|
|
$('input[name="woocommerce_calc_taxes"]').change(function(){
|
|
|
|
if ( $(this).is( ':checked' ) ) {
|
2015-04-27 15:33:52 +00:00
|
|
|
$(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest('tr').show();
|
2015-04-22 14:30:50 +00:00
|
|
|
$('tr.tax-rates').show();
|
|
|
|
} else {
|
2015-04-27 15:33:52 +00:00
|
|
|
$(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest('tr').hide();
|
2015-04-22 14:30:50 +00:00
|
|
|
$('tr.tax-rates').hide();
|
|
|
|
}
|
|
|
|
}).change();
|
|
|
|
|
2015-08-21 18:12:36 +00:00
|
|
|
$('.button-next').on( 'click', function() {
|
|
|
|
$('.wc-setup-content').block({
|
|
|
|
message: null,
|
|
|
|
overlayCSS: {
|
|
|
|
background: '#fff',
|
|
|
|
opacity: 0.6
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
|
2015-07-10 04:32:30 +00:00
|
|
|
});
|