diff --git a/views/device/index.tpl b/views/device/index.tpl
index e8f76871..c9911ecf 100644
--- a/views/device/index.tpl
+++ b/views/device/index.tpl
@@ -53,6 +53,9 @@
+
+ Chọn tất cả
+
diff --git a/web/js/assign.js b/web/js/assign.js
index 293ca3b1..d12b1e6e 100644
--- a/web/js/assign.js
+++ b/web/js/assign.js
@@ -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);
diff --git a/web/js/device.js b/web/js/device.js
index be899fd2..dbbb1f87 100644
--- a/web/js/device.js
+++ b/web/js/device.js
@@ -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 () {