Thêm nút chọn tất cả
This commit is contained in:
parent
d447e460c0
commit
d420323d4b
|
@ -93,7 +93,7 @@ class AssignController extends Controller {
|
|||
public function actionSetSchedule() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->post();
|
||||
if ($post['currentDepartment'] !== "" && count($post["staffs"]) >= Yii::$app->params["pageSize"]) {
|
||||
if ($post['all'] == "true") {
|
||||
$model = new Department();
|
||||
$childs = $model->departmentChilds($post["currentDepartment"]);
|
||||
$lists = Staff::find()->andWhere(["IN", "department_id", $childs])->all();
|
||||
|
|
|
@ -383,7 +383,7 @@ class DeviceController extends Controller {
|
|||
Yii::$app->response->format = "json";
|
||||
$post = Yii::$app->request->post();
|
||||
$lists = $post["lists"];
|
||||
if ($post["all"] && count($lists) >= 20) {
|
||||
if ($post["all"] === "true") {
|
||||
$temp = [];
|
||||
$devices = Device::find()->all();
|
||||
foreach ($devices as $key => $value) {
|
||||
|
@ -548,7 +548,7 @@ class DeviceController extends Controller {
|
|||
Yii::$app->response->format = "json";
|
||||
$post = Yii::$app->request->post();
|
||||
$lists = $post["lists"];
|
||||
if ($post["all"] && count($lists) >= 20) {
|
||||
if ($post["all"] === "true") {
|
||||
$temp = [];
|
||||
$devices = Device::find()->all();
|
||||
foreach ($devices as $key => $value) {
|
||||
|
|
|
@ -73,6 +73,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 text-right hidden" id="btn-check-all">
|
||||
<input type='checkbox' value='0' class='checkbox-staff-schedule-all' id='checkbox-staff-schedule-all'> Chọn tất cả
|
||||
</div>
|
||||
</div>
|
||||
<div id='schedule-search-staff'>
|
||||
<table class="table table-bordered table-striped table-staff-schedule">
|
||||
|
|
|
@ -53,6 +53,9 @@
|
|||
<label class="action-button" onclick="_logs(this);" data-href="{Url::to(['logs'])}">
|
||||
<i class="fa fa-file fa-1-5x"></i> Ghi nhận hệ thống
|
||||
</label>
|
||||
<div class="pull-right" id="btn-check-all" style="padding: 10px;">
|
||||
<input type='checkbox' value='0' class='checkbox-device-all' id='checkbox-device-all'> Chọn tất cả
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden">
|
||||
<input type="file" name="file" id="file">
|
||||
|
|
|
@ -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 () {
|
||||
|
|
Loading…
Reference in New Issue
Block a user