Setup wizard: Add toggle for manual payment list

This commit is contained in:
Valerie 2017-09-07 16:24:49 -07:00 committed by Jeff Stieler
parent 04574700a5
commit e23aefef13
6 changed files with 43 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -482,7 +482,7 @@ body {
}
}
.wc-wizard-service-item {
.wc-wizard-service-item, .wc-wizard-services-list-toggle {
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
@ -558,3 +558,26 @@ body {
}
}
}
// Toggle display a list of services
.wc-wizard-service-enable input {
visibility: hidden;
&:before {
content: "\f347"; // down chevron
font-family: "dashicons";
visibility: initial;
color: #666;
font-size: 25px;
margin-left: -5px; // center it
}
}
.wc-wizard-service-enable input:checked {
&:before {
content: "\f343"; // up chevron
}
}
.wc-wizard-services.manual .wc-wizard-service-item {
display: none;
}

View File

@ -95,4 +95,10 @@ jQuery( function( $ ) {
$( '.wc-wizard-services' ).on( 'click', '.wc-wizard-service-enable input', function( e ) {
e.stopPropagation();
} );
$( '.wc-wizard-services-list-toggle' ).on( 'change', '.wc-wizard-service-enable input', function() {
$( this ).closest( '.wc-wizard-services' ).find( '.wc-wizard-service-item' )
.slideToggle()
.css( 'display', 'flex' );
} );
} );

View File

@ -1 +1 @@
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],s=a[1]||!1,n=t[c],r=["thousand_sep","decimal_sep","num_decimals","currency_pos"];if(n){if(e.each(n,function(t,a){e(':input[name="'+t+'"]').val(a).change(),-1!==e.inArray(t,r)&&e(':input[name="'+t+'"]').closest("tr").hide()}),!e.isArray(n.tax_rates)){var i=[];if(s&&n.tax_rates[s]?i=i.concat(n.tax_rates[s]):n.tax_rates[""]&&(i=i.concat(n.tax_rates[""])),(i=i.concat(n.tax_rates["*"]||[])).length){var o=e("table.tax-rates tbody").empty();e.each(i,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(o)}),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-services").on("change",".wc-wizard-service-enable input",function(){e(this).is(":checked")?e(this).closest(".wc-wizard-service-toggle").removeClass("disabled"):e(this).closest(".wc-wizard-service-toggle").addClass("disabled")}),e(".wc-wizard-services").on("click",".wc-wizard-service-item",function(){var t=e(this).find(".wc-wizard-service-enable input");t.prop("checked",!t.prop("checked")).change()}),e(".wc-wizard-services").on("click",".wc-wizard-service-enable input",function(e){e.stopPropagation()})});
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],s=a[1]||!1,i=t[c],n=["thousand_sep","decimal_sep","num_decimals","currency_pos"];if(i){if(e.each(i,function(t,a){e(':input[name="'+t+'"]').val(a).change(),-1!==e.inArray(t,n)&&e(':input[name="'+t+'"]').closest("tr").hide()}),!e.isArray(i.tax_rates)){var r=[];if(s&&i.tax_rates[s]?r=r.concat(i.tax_rates[s]):i.tax_rates[""]&&(r=r.concat(i.tax_rates[""])),(r=r.concat(i.tax_rates["*"]||[])).length){var o=e("table.tax-rates tbody").empty();e.each(r,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(o)}),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-services").on("change",".wc-wizard-service-enable input",function(){e(this).is(":checked")?e(this).closest(".wc-wizard-service-toggle").removeClass("disabled"):e(this).closest(".wc-wizard-service-toggle").addClass("disabled")}),e(".wc-wizard-services").on("click",".wc-wizard-service-item",function(){var t=e(this).find(".wc-wizard-service-enable input");t.prop("checked",!t.prop("checked")).change()}),e(".wc-wizard-services").on("click",".wc-wizard-service-enable input",function(e){e.stopPropagation()}),e(".wc-wizard-services-list-toggle").on("change",".wc-wizard-service-enable input",function(){e(this).closest(".wc-wizard-services").find(".wc-wizard-service-item").slideToggle().css("display","flex")})});

View File

@ -763,6 +763,16 @@ class WC_Admin_Setup_Wizard {
} ?>
</ul>
<ul class="wc-wizard-services manual">
<li class="wc-wizard-services-list-toggle">
<div class="wc-wizard-service-name">Manual Payments</div>
<div class="wc-wizard-service-description">
Collect payments from customers outside your online store.
</div>
<div class="wc-wizard-service-enable">
<input class="wc-wizard-service-list-toggle" id="wc-wizard-service-list-toggle" type="checkbox">
<label for="wc-wizard-service-list-toggle"></label>
</div>
</li>
<?php foreach ( $manual_gateways as $gateway_id => $gateway ) {
$this->display_service_item( $gateway_id, $gateway );
} ?>