Thêm nút chọn tất cả
This commit is contained in:
@@ -2,6 +2,16 @@ $(function () {
|
||||
$("#schedule-department-tree").height($("#create-schedule-main").height() - 28);
|
||||
$("#schedule-door-lists").height($("#create-schedule-main").height() - 28);
|
||||
common.checkboxInit("door-schedule");
|
||||
$('#checkbox-staff-schedule-all').iCheck({
|
||||
checkboxClass: 'icheckbox_flat-red'
|
||||
});
|
||||
$('#checkbox-staff-schedule-all').on('ifChanged', function (event) {
|
||||
if (event.target.checked) {
|
||||
$('.checkbox-staff-schedule').iCheck('check');
|
||||
} else {
|
||||
$('.checkbox-staff-schedule').iCheck('uncheck');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var schedule = {};
|
||||
@@ -22,12 +32,15 @@ schedule.chooseDepartment = function (e) {
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
$("#btn-check-all").removeClass("hidden");
|
||||
$("input[name='currentDepartment']").val($(e).attr("data"));
|
||||
$("#schedule-search-staff").html(data);
|
||||
$(".department-schedule").removeClass("department-schedule-active");
|
||||
$(e).addClass("department-schedule-active");
|
||||
$("#staff-list").on('pjax:success', function () {
|
||||
common.checkboxInit("staff-schedule");
|
||||
if ($("#checkbox-staff-schedule-all:checked").length > 0)
|
||||
$('.checkbox-staff-schedule').iCheck('check');
|
||||
});
|
||||
common.checkboxInit("staff-schedule");
|
||||
},
|
||||
@@ -47,6 +60,7 @@ schedule.searchStaff = function (e) {
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
$("#btn-check-all").addClass("hidden");
|
||||
$("#schedule-search-staff").html(data);
|
||||
$(".department-schedule").removeClass("department-schedule-active");
|
||||
common.checkboxInit("staff-schedule");
|
||||
@@ -78,6 +92,9 @@ schedule.setSchedule = function (e) {
|
||||
alert("Hãy chọn cửa");
|
||||
return;
|
||||
}
|
||||
var all = false;
|
||||
if ($("#checkbox-staff-schedule-all:checked").length > 0)
|
||||
all = true;
|
||||
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
@@ -87,7 +104,8 @@ schedule.setSchedule = function (e) {
|
||||
schedule: $("select[name='ScheduleLists']").val(),
|
||||
doors: doors,
|
||||
staffs: staffs,
|
||||
currentDepartment: $("input[name='currentDepartment']").val()
|
||||
currentDepartment: $("input[name='currentDepartment']").val(),
|
||||
all: all
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
|
||||
@@ -2,6 +2,18 @@ $(function () {
|
||||
common.checkboxInit("device");
|
||||
$("#device-list").on('pjax:success', function () {
|
||||
common.checkboxInit("device");
|
||||
if ($("#checkbox-device-all:checked").length > 0)
|
||||
$('.checkbox-device').iCheck('check');
|
||||
});
|
||||
$('#checkbox-device-all').iCheck({
|
||||
checkboxClass: 'icheckbox_flat-red'
|
||||
});
|
||||
$('#checkbox-device-all').on('ifChanged', function (event) {
|
||||
if (event.target.checked) {
|
||||
$('.checkbox-device').iCheck('check');
|
||||
} else {
|
||||
$('.checkbox-device').iCheck('uncheck');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -78,6 +90,8 @@ function save(e) {
|
||||
$.pjax.reload({container: '#device-list'});
|
||||
$("#device-list").on('pjax:success', function () {
|
||||
common.checkboxInit("device");
|
||||
if ($("#checkbox-device-all:checked").length > 0)
|
||||
$('.checkbox-device').iCheck('check');
|
||||
});
|
||||
$("#myModal").modal("hide");
|
||||
} else {
|
||||
@@ -155,6 +169,8 @@ function _delete(e) {
|
||||
$.pjax.reload({container: '#device-list'});
|
||||
$("#device-list").on('pjax:success', function () {
|
||||
common.checkboxInit("device");
|
||||
if ($("#checkbox-device-all:checked").length > 0)
|
||||
$('.checkbox-device').iCheck('check');
|
||||
});
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
@@ -240,6 +256,8 @@ function changeIP(e) {
|
||||
$.pjax.reload({container: '#device-list'});
|
||||
$("#device-list").on('pjax:success', function () {
|
||||
common.checkboxInit("device");
|
||||
if ($("#checkbox-device-all:checked").length > 0)
|
||||
$('.checkbox-device').iCheck('check');
|
||||
});
|
||||
$("#myModal").modal("hide");
|
||||
} else {
|
||||
@@ -266,9 +284,8 @@ var currentPage = 1;
|
||||
var secondIncrement = 0;
|
||||
|
||||
async function _sync(e) {
|
||||
var checkAll = $("#checkall-device:checked").length;
|
||||
var all = false;
|
||||
if (checkAll > 0)
|
||||
if ($("#checkbox-device-all:checked").length > 0)
|
||||
all = true;
|
||||
var lists = [];
|
||||
$.each($("input[name='checkbox-device']:checked"), function () {
|
||||
@@ -406,9 +423,8 @@ function getDataSync(data) {
|
||||
var progressLogs = 0;
|
||||
var totalsLogs = 0;
|
||||
function _getLogs(e) {
|
||||
var checkAll = $("#checkall-device:checked").length;
|
||||
var all = false;
|
||||
if (checkAll > 0)
|
||||
if ($("#checkbox-device-all:checked").length > 0)
|
||||
all = true;
|
||||
var lists = [];
|
||||
$.each($("input[name='checkbox-device']:checked"), function () {
|
||||
|
||||
Reference in New Issue
Block a user