dong bo du lieu mau khuon mat len may chu
This commit is contained in:
@@ -484,4 +484,65 @@ function chooseStaff(e) {
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _syncToServerForm(e) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
common.modalOpenFullScreen(data.form, data.title);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var progressToServer = 0;
|
||||
var totalsToServer = 0;
|
||||
function _syncToServer() {
|
||||
var lists = [];
|
||||
$.each($("#sync-lists").find(".success"), function () {
|
||||
lists.push($(this).attr("data-id"));
|
||||
});
|
||||
if (lists.length == 0) {
|
||||
alert("Không có dữ liệu đồng bộ!");
|
||||
return;
|
||||
}
|
||||
common.modalBlock(true);
|
||||
$("#progress-totals").html(lists.length);
|
||||
$("#progress-form").removeClass("hidden");
|
||||
totalsToServer = lists.length;
|
||||
for (var i = 0; i < lists.length; i++) {
|
||||
syncFeatureToServer(lists[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function syncFeatureToServer(id) {
|
||||
$.ajax({
|
||||
url: $("input[name='sync_feature_to_server_url']").val(),
|
||||
type: 'POST',
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
success: function (data) {
|
||||
progressToServer++;
|
||||
$("#progress-current").html(parseInt($("#progress-current").html()) + 1);
|
||||
var percent = parseInt(progressToServer / totalsToServer * 100);
|
||||
$("#progress").attr("aria-valuenow", percent);
|
||||
$("#progress").attr("style", "width: " + percent + "%");
|
||||
$("#progress").html(percent + "%");
|
||||
if (percent >= 100) {
|
||||
common.modalBlock(false);
|
||||
alert("Đồng bộ dữ liệu hoàn thành");
|
||||
window.location.reload(true);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user