fix bug ErrorCode -1

This commit is contained in:
2020-10-20 11:32:50 +07:00
parent b5619f7a5f
commit 9719e836f8
3 changed files with 13 additions and 4 deletions

View File

@@ -327,8 +327,14 @@ function syncSchedule(schedule, ip) {
console.log("sync schedule: ", data.res);
var html = "";
html = "<span class='text-green'><i class='fa fa-check'></i> Đồng bộ lịch trình tới thiết bị <b>" + data.IP + "</b>.</span><br>";
$("#logs-response").append(html);
progress++;
if (data.res.ErrorCode == "-1") {
html = "<span class='text-red'><i class='fa fa-remove'></i> Đồng bộ tới thiết bị <b>" + data.IP + "</b> thất bại.</span><br>";
progress++;
} else {
syncStaffs(ip);
}
$("#logs-response").append(html);
var percent = parseInt(progress / totals * 100);
$("#progress").attr("aria-valuenow", percent);
$("#progress").attr("style", "width: " + percent + "%");
@@ -337,7 +343,6 @@ function syncSchedule(schedule, ip) {
progress = 0;
$("#close-modal").attr("disabled", false);
}
syncStaffs(ip);
},
error: function (jqXHR, textStatus, errorThrown) {
common.ajaxError();
@@ -356,6 +361,9 @@ function syncStaffs(ip) {
console.log("sync user: ", data.resUser);
var html = "";
html = "<span class='text-green'><i class='fa fa-check'></i> Đồng bộ nhân viên tới thiết bị <b>" + data.IP + "</b>.</span><br>";
if (data.res.ErrorCode == "-1") {
html = "<span class='text-red'><i class='fa fa-remove'></i> Đồng bộ nhân viên tới thiết bị <b>" + data.IP + "</b> thất bại.</span><br>";
}
$("#logs-response").append(html);
progress++;
var percent = parseInt(progress / totals * 100);