phan trang dong bo du lieu

This commit is contained in:
2020-12-24 15:43:24 +07:00
parent b26814bb97
commit 22f3a3f650
3 changed files with 12 additions and 11 deletions

View File

@@ -425,12 +425,10 @@ function _syncFromServer() {
$("#progress-totals").html(lists.length);
$("#progress-form").removeClass("hidden");
totals = lists.length;
for (var i = 0; i < lists.length; i++) {
syncFeature(lists[i]);
}
syncFeature(lists[0], lists);
}
function syncFeature(id) {
function syncFeature(id, fullData) {
$.ajax({
url: $("input[name='sync_feature_url']").val(),
type: 'POST',
@@ -438,6 +436,7 @@ function syncFeature(id) {
id: id
},
success: function (data) {
console.log(data, progress);
progress++;
$("#progress-current").html(parseInt($("#progress-current").html()) + 1);
var percent = parseInt(progress / totals * 100);
@@ -448,6 +447,8 @@ function syncFeature(id) {
common.modalBlock(false);
updateFeature();
progress = 0;
} else {
syncFeature(fullData[progress], fullData);
}
},
error: function (jqXHR, textStatus, errorThrown) {
@@ -521,12 +522,10 @@ function _syncToServer() {
$("#progress-totals").html(lists.length);
$("#progress-form").removeClass("hidden");
totalsToServer = lists.length;
for (var i = 0; i < lists.length; i++) {
syncFeatureToServer(lists[i]);
}
syncFeatureToServer(lists[0], lists);
}
var error = 0;
function syncFeatureToServer(id) {
function syncFeatureToServer(id, fullData) {
$.ajax({
url: $("input[name='sync_feature_to_server_url']").val(),
type: 'POST',
@@ -550,6 +549,8 @@ function syncFeatureToServer(id) {
alert("Đồng bộ dữ liệu hoàn thành");
window.location.reload(true);
}, 2000)
} else {
syncFeature(fullData[progressToServer], fullData);
}
},
error: function (jqXHR, textStatus, errorThrown) {