From 030ac9c50ea9dd05ad3dc824f4dffa8a8a4c2ff6 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 22 Apr 2015 15:30:50 +0100 Subject: [PATCH] HTML for shipping and tax options --- assets/css/wc-setup.css | 2 +- assets/css/wc-setup.scss | 142 ++++++++++++++++++---- assets/js/admin/wc-setup.js | 20 +++ assets/js/admin/wc-setup.min.js | 2 +- i18n/locale-info.php | 10 +- includes/admin/class-wc-admin-welcome.php | 103 ++++++++++++++-- 6 files changed, 243 insertions(+), 36 deletions(-) diff --git a/assets/css/wc-setup.css b/assets/css/wc-setup.css index 12272dd84ed..b332f91f36d 100644 --- a/assets/css/wc-setup.css +++ b/assets/css/wc-setup.css @@ -1 +1 @@ -.wc-install-content p,.wc-install-content table{font-size:1em;line-height:1.75em;color:#666}body{margin:100px auto 24px;box-shadow:none;background:#f1f1f1;padding:0}#wc-logo{border:0;margin:0 0 24px;padding:0;text-align:center}#wc-logo img{max-width:50%}.wc-install-content{box-shadow:0 1px 3px rgba(0,0,0,.13);padding:24px 24px 0;background:#fff;overflow:hidden;zoom:1}.wc-install-content h1,.wc-install-content h2,.wc-install-content h3,.wc-install-content table{margin:0 0 24px;border:0;padding:0;color:#666}.wc-install-content p{margin:0 0 24px}.wc-install-content a{color:#A16696}.wc-install-content a:focus,.wc-install-content a:hover{color:#111}.wc-install-content .form-table tbody th{width:40%;vertical-align:top;font-weight:400}.wc-install-content .form-table tbody td{vertical-align:top}.wc-install-content .form-table tbody td input,.wc-install-content .form-table tbody td select{width:100%;box-sizing:border-box}.wc-install-content .form-table tbody td input[size]{width:auto}.wc-install-content .form-table tbody td .description{line-height:1.5em;display:block;margin-top:.25em;color:#999;font-style:italic}.wc-install-content .form-table tbody td,.wc-install-content .form-table tbody th{padding:12px 0;margin:0;border:0}.wc-install-content .form-table tbody td:first-child,.wc-install-content .form-table tbody th:first-child{padding-right:1em}.wc-install-content .wc-install-pages{width:100%;border-top:1px solid #eee}.wc-install-content .wc-install-pages thead th{display:none}.wc-install-content .wc-install-pages .page-name{width:30%;font-weight:700}.wc-install-content .wc-install-pages td,.wc-install-content .wc-install-pages th{padding:14px 0;border-bottom:1px solid #eee}.wc-install-content .wc-install-pages td:first-child,.wc-install-content .wc-install-pages th:first-child{padding-right:9px}.wc-install-content .wc-install-pages th{padding-top:0}.wc-install-content .wc-install-pages .page-options p{margin:6px 0 0 24px}@media screen and (max-width:782px){.wc-install-content .form-table tbody th{width:auto}}.wc-install-steps{padding:0 0 24px;margin:0;list-style:none;overflow:hidden;color:#ccc}.wc-install-steps li{width:20%;float:left;padding:0 0 1em;margin:0;text-align:center;position:relative;border-bottom:4px solid #ccc;line-height:1}.wc-install-steps li:before{content:"";border:4px solid #ccc;border-radius:100%;width:4px;height:4px;position:absolute;bottom:0;left:50%;margin-left:-6px;margin-bottom:-8px;background:#fff}.wc-install-steps li.active{border-color:#A16696;color:#A16696}.wc-install-steps li.active:before{border-color:#A16696}.wc-install-steps li.done{border-color:#A16696;color:#A16696}.wc-install-steps li.done:before{border-color:#A16696;background:#A16696}.wc-setup .wc-install-actions{overflow:hidden}.wc-setup .wc-install-actions .button{float:left;font-size:1.5em;padding:.5em 1em;line-height:1em;height:auto}.wc-setup .wc-install-actions .button-primary{float:right;opacity:1;background-color:#A16696;border-color:#A16696;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 0 rgba(0,0,0,.15)} \ No newline at end of file +body{margin:100px auto 24px;box-shadow:none;background:#f1f1f1;padding:0}#wc-logo{border:0;margin:0 0 24px;padding:0;text-align:center}#wc-logo img{max-width:50%}.wc-install-content{box-shadow:0 1px 3px rgba(0,0,0,.13);padding:24px 24px 0;background:#fff;overflow:hidden;zoom:1}.wc-install-content h1,.wc-install-content h2,.wc-install-content h3,.wc-install-content table{margin:0 0 24px;border:0;padding:0;color:#666}.wc-install-content p{margin:0 0 24px;font-size:1em;line-height:1.75em;color:#666}.wc-install-content table{font-size:1em;line-height:1.75em;color:#666}.wc-install-content a{color:#A16696}.wc-install-content a:focus,.wc-install-content a:hover{color:#111}.wc-install-content .form-table th{width:35%;vertical-align:top;font-weight:400}.wc-install-content .form-table td{vertical-align:top}.wc-install-content .form-table td input,.wc-install-content .form-table td select{width:100%;box-sizing:border-box}.wc-install-content .form-table td input[size]{width:auto}.wc-install-content .form-table td .description{line-height:1.5em;display:block;margin-top:.25em;color:#999;font-style:italic}.wc-install-content .form-table td .input-checkbox,.wc-install-content .form-table td .input-radio{width:auto;box-sizing:inherit;padding:inherit;margin:0 .5em 0 0;box-shadow:none}.wc-install-content .form-table .section_title td{padding:0}.wc-install-content .form-table .section_title td h2,.wc-install-content .form-table .section_title td p{margin:12px 0 0}.wc-install-content .form-table td,.wc-install-content .form-table th{padding:12px 0;margin:0;border:0}.wc-install-content .form-table td:first-child,.wc-install-content .form-table th:first-child{padding-right:1em}.wc-install-content .form-table table.tax-rates{width:100%;margin:12px 0}.wc-install-content .form-table table.tax-rates th{padding:0 6px;text-align:center;width:auto;vertical-align:middle}.wc-install-content .form-table table.tax-rates td{border:1px solid #eee;padding:6px;text-align:center;vertical-align:middle}.wc-install-content .form-table table.tax-rates td input{outline:0;border:0;padding:0;box-shadow:none;text-align:center}.wc-install-content .form-table table.tax-rates td.sort{cursor:move;color:#ccc}.wc-install-content .form-table table.tax-rates td.sort:before{content:"\f333";font-family:dashicons}.wc-install-content .form-table table.tax-rates .add{padding:1em 0 0 1em;line-height:1em;font-size:1em;width:0;margin:6px 0 0;height:0;overflow:hidden;position:relative;display:inline-block}.wc-install-content .form-table table.tax-rates .add:before{content:"\f502";font-family:dashicons;position:absolute;left:0;top:0}.wc-install-content .form-table table.tax-rates .remove{padding:1em 0 0 1em;line-height:1em;font-size:1em;width:0;margin:0;height:0;overflow:hidden;position:relative;display:inline-block}.wc-install-content .form-table table.tax-rates .remove:before{content:"\f182";font-family:dashicons;position:absolute;left:0;top:0}.wc-install-content .wc-install-pages{width:100%;border-top:1px solid #eee}.wc-install-content .wc-install-pages thead th{display:none}.wc-install-content .wc-install-pages .page-name{width:30%;font-weight:700}.wc-install-content .wc-install-pages td,.wc-install-content .wc-install-pages th{padding:14px 0;border-bottom:1px solid #eee}.wc-install-content .wc-install-pages td:first-child,.wc-install-content .wc-install-pages th:first-child{padding-right:9px}.wc-install-content .wc-install-pages th{padding-top:0}.wc-install-content .wc-install-pages .page-options p{color:#777;margin:6px 0 0 24px;line-height:1.75em}.wc-install-content .wc-install-pages .page-options p input{vertical-align:middle;margin:1px 0 0;height:1.75em;width:1.75em;line-height:1.75em}.wc-install-content .wc-install-pages .page-options p label{line-height:1}@media screen and (max-width:782px){.wc-install-content .form-table tbody th{width:auto}}.wc-install-steps{padding:0 0 24px;margin:0;list-style:none;overflow:hidden;color:#ccc}.wc-install-steps li{width:20%;float:left;padding:0 0 1em;margin:0;text-align:center;position:relative;border-bottom:4px solid #ccc;line-height:1}.wc-install-steps li:before{content:"";border:4px solid #ccc;border-radius:100%;width:4px;height:4px;position:absolute;bottom:0;left:50%;margin-left:-6px;margin-bottom:-8px;background:#fff}.wc-install-steps li.active{border-color:#A16696;color:#A16696}.wc-install-steps li.active:before{border-color:#A16696}.wc-install-steps li.done{border-color:#A16696;color:#A16696}.wc-install-steps li.done:before{border-color:#A16696;background:#A16696}.wc-setup .wc-install-actions{overflow:hidden}.wc-setup .wc-install-actions .button{float:right;font-size:1.25em;padding:.5em 1em;line-height:1em;margin-right:.5em;height:auto}.wc-setup .wc-install-actions .button-primary{margin:0;float:right;opacity:1;background-color:#A16696;border-color:#A16696;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 0 rgba(0,0,0,.15)} \ No newline at end of file diff --git a/assets/css/wc-setup.scss b/assets/css/wc-setup.scss index 4dc3e7872d5..6feb7d11c24 100644 --- a/assets/css/wc-setup.scss +++ b/assets/css/wc-setup.scss @@ -44,35 +44,115 @@ body { } } .form-table { - tbody { + th { + width: 35%; + vertical-align: top; + font-weight: normal; + } + td { + vertical-align: top; + select, input { + width: 100%; + box-sizing: border-box; + } + input[size] { + width: auto; + } + .description { + line-height: 1.5em; + display: block; + margin-top: .25em; + color: #999; + font-style: italic; + } + .input-checkbox, .input-radio { + width: auto; + box-sizing: inherit; + padding: inherit; + margin: 0 .5em 0 0; + box-shadow: none; + } + } + .section_title { + td { + padding: 0; + h2, p { + margin: 12px 0 0; + } + } + } + th, td { + padding: 12px 0; + margin: 0; + border: 0; + &:first-child { + padding-right: 1em; + } + } + table.tax-rates { + width: 100%; + margin: 12px 0; th { - width: 40%; - vertical-align: top; - font-weight: normal; + padding: 0 6px; + text-align: center; + width: auto; + vertical-align: middle; } td { - vertical-align: top; - select, input { - width: 100%; - box-sizing: border-box; + border: 1px solid #eee; + padding: 6px 6px; + text-align: center; + vertical-align: middle; + input { + outline: 0; + border: 0; + padding: 0; + box-shadow: none; + text-align: center; } - input[size] { - width: auto; - } - .description { - line-height: 1.5em; - display: block; - margin-top: .25em; - color: #999; - font-style: italic; + &.sort { + cursor: move; + color: #ccc; + &:before { + content: "\f333"; + font-family: 'dashicons'; + } } } - th, td { - padding: 12px 0; + .add { + padding: 1em 0 0 1em; + line-height: 1em; + font-size: 1em; + width: 0; + margin: 6px 0 0; + height: 0; + overflow: hidden; + position: relative; + display: inline-block; + &:before { + content: "\f502"; + font-family: 'dashicons'; + position: absolute; + left: 0; + top: 0; + } + } + .remove { + padding: 1em 0 0 1em; + line-height: 1em; + font-size: 1em; + width: 0; margin: 0; - border: 0; - &:first-child { - padding-right: 1em; + height: 0; + overflow: hidden; + position: relative; + display: inline-block; + &:before { + content: "\f182"; + font-family: 'dashicons'; + position: absolute; + left: 0; + top: 0; } } } @@ -99,7 +179,19 @@ body { } .page-options { p { + color: #777; margin: 6px 0 0 24px; + line-height: 1.75em; + input { + vertical-align: middle; + margin: 1px 0 0 0; + height: 1.75em; + width: 1.75em; + line-height: 1.75em; + } + label { + line-height: 1; + } } } } @@ -161,13 +253,15 @@ body { .wc-setup .wc-install-actions { overflow: hidden; .button { - float: left; - font-size: 1.5em; + float: right; + font-size: 1.25em; padding: .5em 1em; line-height: 1em; + margin-right: .5em; height: auto; } .button-primary { + margin: 0; float: right; opacity: 1; background-color: #A16696; diff --git a/assets/js/admin/wc-setup.js b/assets/js/admin/wc-setup.js index a0afb067a3c..bdd00e771da 100644 --- a/assets/js/admin/wc-setup.js +++ b/assets/js/admin/wc-setup.js @@ -25,4 +25,24 @@ jQuery(function( $ ) { } }).change(); + $('input[name="enable_shipping"]').change(function(){ + 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' ) ) { + $(':input[name="woocommerce_prices_include_tax"]').closest('tr').show(); + $('tr.tax-rates').show(); + } else { + $(':input[name="woocommerce_prices_include_tax"]').closest('tr').hide(); + $('tr.tax-rates').hide(); + } + }).change(); + }); \ No newline at end of file diff --git a/assets/js/admin/wc-setup.min.js b/assets/js/admin/wc-setup.min.js index 91ca73ff9bf..82c67edc03d 100644 --- a/assets/js/admin/wc-setup.min.js +++ b/assets/js/admin/wc-setup.min.js @@ -1 +1 @@ -jQuery(function(a){var b=a.parseJSON(wc_setup_params.locale_info);a('select[name="store_location"]').change(function(){var c=a(this).val(),d=c.split(":")[0],e=b[d],f=["thousand_sep","decimal_sep","num_decimals","currency_pos"];e?a.each(e,function(b,c){a(':input[name="'+b+'"]').val(c).change(),-1!=a.inArray(b,f)&&a(':input[name="'+b+'"]').closest("tr").hide()}):(a(':input[name="currency_code"]').val("").change(),a(':input[name="currency_pos"]').val("left").change().closest("tr").show(),a(':input[name="thousand_sep"]').val(",").change().closest("tr").show(),a(':input[name="decimal_sep"]').val(".").change().closest("tr").show(),a(':input[name="num_decimals"]').val("2").change().closest("tr").show())}).change()}); \ No newline at end of file +jQuery(function(a){var b=a.parseJSON(wc_setup_params.locale_info);a('select[name="store_location"]').change(function(){var c=a(this).val(),d=c.split(":")[0],e=b[d],f=["thousand_sep","decimal_sep","num_decimals","currency_pos"];e?a.each(e,function(b,c){a(':input[name="'+b+'"]').val(c).change(),-1!=a.inArray(b,f)&&a(':input[name="'+b+'"]').closest("tr").hide()}):(a(':input[name="currency_code"]').val("").change(),a(':input[name="currency_pos"]').val("left").change().closest("tr").show(),a(':input[name="thousand_sep"]').val(",").change().closest("tr").show(),a(':input[name="decimal_sep"]').val(".").change().closest("tr").show(),a(':input[name="num_decimals"]').val("2").change().closest("tr").show())}).change(),a('input[name="enable_shipping"]').change(function(){a(this).is(":checked")?(a(':input[name="shipping_cost_domestic"]').closest("tr").show(),a(':input[name="shipping_cost_international"]').closest("tr").show()):(a(':input[name="shipping_cost_domestic"]').closest("tr").hide(),a(':input[name="shipping_cost_international"]').closest("tr").hide())}).change(),a('input[name="woocommerce_calc_taxes"]').change(function(){a(this).is(":checked")?(a(':input[name="woocommerce_prices_include_tax"]').closest("tr").show(),a("tr.tax-rates").show()):(a(':input[name="woocommerce_prices_include_tax"]').closest("tr").hide(),a("tr.tax-rates").hide())}).change()}); \ No newline at end of file diff --git a/i18n/locale-info.php b/i18n/locale-info.php index 00a96c8c072..cc179f16cd2 100644 --- a/i18n/locale-info.php +++ b/i18n/locale-info.php @@ -8,7 +8,15 @@ return array( 'decimal_sep' => '.', 'num_decimals' => 2, 'weight_unit' => 'kg', - 'dimension_unit' => 'cm' + 'dimension_unit' => 'cm', + 'tax_rates' => array( + 'GB' => array( + '' => array( + 'rate' => '20.0000', + 'name' => 'VAT' + ) + ) + ) ), 'NL' => array( 'currency_code' => 'EUR', diff --git a/includes/admin/class-wc-admin-welcome.php b/includes/admin/class-wc-admin-welcome.php index 33115cb56c8..9e366e6071c 100644 --- a/includes/admin/class-wc-admin-welcome.php +++ b/includes/admin/class-wc-admin-welcome.php @@ -97,6 +97,8 @@ class WC_Admin_Welcome { 'locale_info' => json_encode( include( WC()->plugin_path() . '/i18n/locale-info.php' ) ) ) ); + wp_enqueue_style( 'dashicons' ); + if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) { call_user_func( $this->steps[ $this->step ]['handler'] ); } @@ -128,7 +130,7 @@ class WC_Admin_Welcome { - +

WooCommerce

@@ -201,7 +203,7 @@ class WC_Admin_Welcome {
- + - + - + - + - + - + @@ -339,7 +341,7 @@ class WC_Admin_Welcome { @@ -376,7 +378,90 @@ class WC_Admin_Welcome { * Shipping and taxes */ public function wc_setup_shipping_taxes() { + ?> +

+ +

', '', '' ); ?>

+

-

+

-

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+
+ + +
+ +
+ +
+

+
+ + +
+
+ +
+

+ + + + + + + + + + + + + + + + + + + + + +
 +
X
+

', '', '' ); ?>

+
+

+ + +

+
+