Commit be640cd4 by Pham Huy

add style loading icon

parent bc677d21
...@@ -332,3 +332,9 @@ p.title-item-sidebar { ...@@ -332,3 +332,9 @@ p.title-item-sidebar {
background: #56BC86; background: #56BC86;
border-color: #56BC86; border-color: #56BC86;
} }
.woocommerce form[name="checkout"] .loading{
position: absolute;
left: calc(50% - 100px);
top: 0;
}
...@@ -69,7 +69,7 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir ...@@ -69,7 +69,7 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir
var loading = $('.loading'); var loading = $('.loading');
var noti = $('.notify-mst'); var noti = $('.notify-mst');
$( 'i#search-taxcode' ).on( 'click', function() { $( 'i#search-taxcode' ).on( 'click', function() {
$(this).append(loading); $('#mst_checkout_field').append(loading);
$('#mst_checkout_field_field').append(noti); $('#mst_checkout_field_field').append(noti);
var taxcode = $('input#mst_checkout_field').val(); var taxcode = $('input#mst_checkout_field').val();
$('input#mst_checkout_field').val(taxcode.trim()); $('input#mst_checkout_field').val(taxcode.trim());
...@@ -77,12 +77,12 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir ...@@ -77,12 +77,12 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir
if( taxcode.length < 1 ){ if( taxcode.length < 1 ){
noti.text('Mã số thuế không hợp lệ'); noti.text('Mã số thuế không hợp lệ');
noti.css('display','block'); noti.css('display','block');
$('.loading').css('display','none'); loading.css('display','none');
}else{ }else{
if (!$.isNumeric(taxcode)) { if (!$.isNumeric(taxcode)) {
noti.text('Mã số thuế không hợp lệ'); noti.text('Mã số thuế không hợp lệ');
noti.css('display','block'); noti.css('display','block');
$('.loading').css('display','none'); loading.css('display','none');
}else{ }else{
$.ajax({ $.ajax({
url: "<?=get_site_url()?>/wp-json/ahoadon/v1/taxcode/"+taxcode, url: "<?=get_site_url()?>/wp-json/ahoadon/v1/taxcode/"+taxcode,
...@@ -92,10 +92,12 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir ...@@ -92,10 +92,12 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir
dataType: "json", dataType: "json",
type: 'GET', type: 'GET',
beforeSend: function () { beforeSend: function () {
$('.loading').css('display','block'); loading.css('display','block');
$('i#search-taxcode').css('display','none');
}, },
success: function( response ) { success: function( response ) {
$('.loading').css('display','none'); loading.css('display','none');
$('i#search-taxcode').css('display','block');
// console.log(response); // console.log(response);
if (response.status == 400) { if (response.status == 400) {
noti.text(response.message); noti.text(response.message);
...@@ -127,7 +129,7 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir ...@@ -127,7 +129,7 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir
error: function (xhr, ajaxOptions, thrownError) { error: function (xhr, ajaxOptions, thrownError) {
noti.text('Mã số thuế không hợp lệ'); noti.text('Mã số thuế không hợp lệ');
noti.css('display','block'); noti.css('display','block');
$('.loading').css('display','none'); loading.css('display','none');
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment