update: lấy dữ liệu mã thẻ từ thiết bị, mở cửa từ phần mềm

This commit is contained in:
2020-10-26 14:25:49 +07:00
parent 579ec676cb
commit 2b88dbb695
7 changed files with 138 additions and 7 deletions

View File

@@ -478,3 +478,22 @@ function processProgress(ai) {
$("#close-modal").attr("disabled", false);
}
}
function openDoor(e) {
common.modalBlock(true);
$.ajax({
url: $(e).attr('data-href'),
type: 'POST',
success: function (data) {
common.modalBlock(false);
if (data.ErrorCode === "0")
notification.success("Mở cửa thành công", 2000);
else
notification.error("Mở cửa thất bại, không có kết nối tới thiết bị", 2000);
},
error: function (jqXHR, textStatus, errorThrown) {
common.modalBlock(false);
common.ajaxError();
}
});
}

View File

@@ -257,4 +257,39 @@ function btnImage() {
}
}).addInstance('AnhNhanVien');
}
;
function formGetRTLog(e) {
var stt = $(e).attr("data-stt");
if (stt === "true") {
$("#device-lists").removeClass("hidden");
$(e).attr("data-stt", false);
} else {
$("#device-lists").addClass("hidden");
$(e).attr("data-stt", true);
}
}
function getRTLog(e) {
common.modalBlock(true);
$.ajax({
url: $(e).attr('data-href'),
type: 'POST',
data: {
device: $("select[name='Device']").val()
},
success: function (data) {
common.modalBlock(false);
if (data.ErrorCode === "1") {
$("input[name='CardNumber']").val(data.CardNumber);
$("#device-lists").addClass("hidden");
$("#btn-get-rtlog").attr("data-stt", true);
} else {
alert("Không có tín hiệu thẻ");
}
},
error: function (jqXHR, textStatus, errorThrown) {
common.modalBlock(false);
alert("Không có tín hiệu thẻ");
}
});
}