Commit be640cd4 by Pham Huy

add style loading icon

parent bc677d21
......@@ -332,3 +332,9 @@ p.title-item-sidebar {
background: #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
var loading = $('.loading');
var noti = $('.notify-mst');
$( 'i#search-taxcode' ).on( 'click', function() {
$(this).append(loading);
$('#mst_checkout_field').append(loading);
$('#mst_checkout_field_field').append(noti);
var taxcode = $('input#mst_checkout_field').val();
$('input#mst_checkout_field').val(taxcode.trim());
......@@ -77,12 +77,12 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir
if( taxcode.length < 1 ){
noti.text('Mã số thuế không hợp lệ');
noti.css('display','block');
$('.loading').css('display','none');
loading.css('display','none');
}else{
if (!$.isNumeric(taxcode)) {
noti.text('Mã số thuế không hợp lệ');
noti.css('display','block');
$('.loading').css('display','none');
loading.css('display','none');
}else{
$.ajax({
url: "<?=get_site_url()?>/wp-json/ahoadon/v1/taxcode/"+taxcode,
......@@ -92,10 +92,12 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir
dataType: "json",
type: 'GET',
beforeSend: function () {
$('.loading').css('display','block');
loading.css('display','block');
$('i#search-taxcode').css('display','none');
},
success: function( response ) {
$('.loading').css('display','none');
loading.css('display','none');
$('i#search-taxcode').css('display','block');
// console.log(response);
if (response.status == 400) {
noti.text(response.message);
......@@ -127,7 +129,7 @@ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_requir
error: function (xhr, ajaxOptions, thrownError) {
noti.text('Mã số thuế không hợp lệ');
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