fix bug init icheck after pjax load

This commit is contained in:
dongpd 2020-10-15 10:06:51 +07:00
parent 37ab48f055
commit 278f2387c0
7 changed files with 37 additions and 1 deletions

View File

@ -1,5 +1,8 @@
$(function () { $(function () {
common.checkboxInit("area"); common.checkboxInit("area");
$("#area-list").on('pjax:success', function () {
common.checkboxInit("area");
});
}); });
function validate() { function validate() {

View File

@ -1,5 +1,8 @@
$(function () { $(function () {
common.checkboxInit("staff"); common.checkboxInit("staff");
$("#staff-list").on('pjax:success', function () {
common.checkboxInit("staff");
});
}); });
function validate() { function validate() {

View File

@ -25,7 +25,10 @@ common.modalOpen = function (data, lg, title) {
$("#myModalLabel").html(title); $("#myModalLabel").html(title);
} }
$("#myModalFooter").addClass("hidden"); $("#myModalFooter").addClass("hidden");
$("#myModal").modal(); $("#myModal").modal({
keyboard: false,
backdrop: false
});
}; };
common.modalOpenFullScreen = function (data, title) { common.modalOpenFullScreen = function (data, title) {
$("input[name='ReLoadFullScreen']").val("false"); $("input[name='ReLoadFullScreen']").val("false");

View File

@ -1,6 +1,9 @@
$(function () { $(function () {
common.checkboxInit("department"); common.checkboxInit("department");
btnUpload($("input[name='upload_file_url']").val(), "", '.xls,.xlsx', 3500); btnUpload($("input[name='upload_file_url']").val(), "", '.xls,.xlsx', 3500);
$("#department-list").on('pjax:success', function () {
common.checkboxInit("department");
});
}); });
function validate() { function validate() {

View File

@ -1,5 +1,8 @@
$(function () { $(function () {
common.checkboxInit("device"); common.checkboxInit("device");
$("#device-list").on('pjax:success', function () {
common.checkboxInit("device");
});
}); });
function validate() { function validate() {
@ -291,6 +294,21 @@ function getDataSync(data) {
var html = ""; var html = "";
html = "<span class='text-blue'><i class='fa fa-minus'></i> Bắt đầu đồng bộ dữ liệu tới thiết bị <b>" + data.IP + "</b>.</span><br>"; html = "<span class='text-blue'><i class='fa fa-minus'></i> Bắt đầu đồng bộ dữ liệu tới thiết bị <b>" + data.IP + "</b>.</span><br>";
$("#logs-response").append(html); $("#logs-response").append(html);
if (data.schedule.length == 0 && data.staffs.length == 0) {
var html = "";
html = "<span class='text-red'><i class='fa fa-remove'></i> Không có dữ liệu cần đồng bộ tới thiết bị <b>" + data.IP + "</b>.</span><br>";
$("#logs-response").append(html);
progress += 2;
var percent = parseInt(progress / totals * 100);
$("#progress").attr("aria-valuenow", percent);
$("#progress").attr("style", "width: " + percent + "%");
$("#progress").html(percent + "%");
if (percent >= 100) {
progress = 0;
$("#close-modal").attr("disabled", false);
}
return;
}
syncSchedule(data.schedule, data.staffs, data.IP); syncSchedule(data.schedule, data.staffs, data.IP);
}, },
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {

View File

@ -1,5 +1,8 @@
$(function () { $(function () {
common.checkboxInit("schedule"); common.checkboxInit("schedule");
$("#schedule-list").on('pjax:success', function () {
common.checkboxInit("schedule");
});
}); });
function _create(e) { function _create(e) {

View File

@ -1,6 +1,9 @@
$(function () { $(function () {
common.checkboxInit("staff"); common.checkboxInit("staff");
btnUpload($("input[name='upload_file_url']").val(), "", '.xls,.xlsx', 3500); btnUpload($("input[name='upload_file_url']").val(), "", '.xls,.xlsx', 3500);
$("#staff-list").on('pjax:success', function () {
common.checkboxInit("staff");
});
}); });
function validate() { function validate() {