update điều chỉnh thời gian mở cửa
This commit is contained in:
@@ -498,40 +498,50 @@ function openDoor(e) {
|
||||
});
|
||||
}
|
||||
|
||||
function openFormEditDoorName(e) {
|
||||
function openFormEditDoor(e, stt) {
|
||||
var id = $(e).attr("data");
|
||||
var stt = $(e).attr("data-stt");
|
||||
if (stt === "false") {
|
||||
$("#name-text-" + id).addClass("hidden");
|
||||
$("#name-input-" + id).removeClass("hidden");
|
||||
$(e).attr("data-stt", "true");
|
||||
if (stt) {
|
||||
$(".real-" + id).addClass("hidden");
|
||||
$(".edit-" + id).removeClass("hidden");
|
||||
} else {
|
||||
$("#name-text-" + id).removeClass("hidden");
|
||||
$("#name-input-" + id).addClass("hidden");
|
||||
$(e).attr("data-stt", "false");
|
||||
$(".real-" + id).removeClass("hidden");
|
||||
$(".edit-" + id).addClass("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
function editDoorName(e) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr('data-href'),
|
||||
type: 'POST',
|
||||
data: {
|
||||
name: $(e).val()
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
var id = parseInt(data);
|
||||
$("#name-text-" + id).html($(e).val());
|
||||
$("#name-text-" + id).removeClass("hidden");
|
||||
$("#name-input-" + id).addClass("hidden");
|
||||
$("#btn-edit-" + id).attr("data-stt", "false");
|
||||
notification.success("Đã lưu thông tin", 2000);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
function editDoor(e) {
|
||||
var id = $(e).attr("data");
|
||||
var name = $("#name-input-" + id).val();
|
||||
if (name === "") {
|
||||
alert("Tên thiết bị không được để trống");
|
||||
return;
|
||||
}
|
||||
var duration = $("#duration-input-" + id).val();
|
||||
if (parseInt(duration) > 0 && parseInt(duration) < 255) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr('data-href'),
|
||||
type: 'POST',
|
||||
data: {
|
||||
duration: duration,
|
||||
name: name
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
var id = parseInt(data);
|
||||
$("#name-text-" + id).html(name);
|
||||
$("#duration-text-" + id).html(duration);
|
||||
$(".real-" + id).removeClass("hidden");
|
||||
$(".edit-" + id).addClass("hidden");
|
||||
notification.success("Đã lưu thông tin", 2000);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert("Thời gian mở cửa phải từ 1-254 giây");
|
||||
return;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user