diff --git a/controllers/AreaController.php b/controllers/AreaController.php index f72daa35..8cbde951 100644 --- a/controllers/AreaController.php +++ b/controllers/AreaController.php @@ -21,7 +21,7 @@ class AreaController extends Controller { parent::init(); if (time() > Yii::$app->params["time"]) $this->redirect(["/dashboard"]); - + if (Yii::$app->user->isGuest) return $this->redirect(['/site/login']); } @@ -89,7 +89,8 @@ class AreaController extends Controller { $oldCode = $model->code; $model->name = $data["Name"]; $model->code = $data["Code"]; - $model->pid = $data["Pid"]; + if ($model->pid != 0) + $model->pid = $data["Pid"]; $model->description = $data["Description"]; $model->modified_at = time(); if ($model->save()) { diff --git a/controllers/DepartmentController.php b/controllers/DepartmentController.php index 71f84648..8446a696 100644 --- a/controllers/DepartmentController.php +++ b/controllers/DepartmentController.php @@ -89,7 +89,7 @@ class DepartmentController extends Controller { $oldCode = $model->code; $model->name = $data["Name"]; $model->code = $data["Code"]; - if ($model->pid != 1) { + if ($model->pid != 0) { $model->pid = $data["Pid"] !== "" ? $data["Pid"] : 0; } $model->modified_at = time(); diff --git a/controllers/DeviceController.php b/controllers/DeviceController.php index abde1abc..8a836be8 100644 --- a/controllers/DeviceController.php +++ b/controllers/DeviceController.php @@ -247,26 +247,26 @@ class DeviceController extends Controller { if (Yii::$app->request->post()) { $data = Yii::$app->request->post(); $OldIpAddress = $model->ip_address; - if ($OldIpAddress !== $data["Ip"]) { - $check = Device::findOne(['ip_address' => $data['Ip']]); - if ($check) - return ["status" => false, "type" => "ip"]; +// if ($OldIpAddress !== $data["Ip"]) { + $check = Device::findOne(['ip_address' => $data['Ip']]); + if ($check && $check->id != $id) + return ["status" => false, "type" => "ip"]; - $res = common::requestToCardService("/ModifyIPAddress", [ - "OldIPAddress" => $OldIpAddress, - "NewIPAddress" => $data["Ip"], - "NetMask" => $data["SubnetMask"], - "GATEIPAddress" => $data["Gateway"], - "MAC" => $model->mac_address - ]); - if ($res == 0) { - $model->ip_address = $data["Ip"]; - $model->subnet_mask = $data["SubnetMask"]; - $model->gateway = $data["Gateway"]; - $model->save(); - return ["status" => true]; - } + $res = common::requestToCardService("/ModifyIPAddress", [ + "OldIPAddress" => $OldIpAddress, + "NewIPAddress" => $data["Ip"], + "NetMask" => $data["SubnetMask"], + "GATEIPAddress" => $data["Gateway"], + "MAC" => $model->mac_address + ]); + if ($res == 0) { + $model->ip_address = $data["Ip"]; + $model->subnet_mask = $data["SubnetMask"]; + $model->gateway = $data["Gateway"]; + $model->save(); + return ["status" => true]; } +// } return ["status" => true]; } else { return [ @@ -282,9 +282,10 @@ class DeviceController extends Controller { public function actionSearch() { if (Yii::$app->request->post()) { Yii::$app->response->format = "json"; + $data = Yii::$app->request->post(); $NetMask = "255.255.255.255"; - if (Yii::$app->request->post("SubnetMask") != "") { - $NetMask = Yii::$app->request->post("SubnetMask"); + if ($data["SubnetMask"] != "" && $data["Checked"] !== "0") { + $NetMask = $data["SubnetMask"]; } $datas = json_decode(common::requestToCardService("/SearchDevice", ["NetMask" => $NetMask]), true); return [ @@ -445,6 +446,11 @@ class DeviceController extends Controller { "AuthorizeTimezoneId" => $value["schedule_id"], "AuthorizeDoorId" => $v->code ]; + $UserAuthorizeInfosDelete[] = [ + "Pin" => "", + "AuthorizeTimezoneId" => "", + "AuthorizeDoorId" => "" + ]; } if ($value["door_access_old"] != null) { if (in_array($v->id, $doorsOld) && !in_array($v->id, $doors)) { diff --git a/models/StaffSearch.php b/models/StaffSearch.php index ff99b60c..5281199d 100644 --- a/models/StaffSearch.php +++ b/models/StaffSearch.php @@ -54,12 +54,15 @@ class StaffSearch extends Staff { return $dataProvider; } + if ($this->department_id) { + $m = new Department(); + $departmentChild = $m->departmentChilds($this->department_id); + $query->andFilterWhere(["IN", "department_id", $departmentChild]); + } // grid filtering conditions $query->andFilterWhere([ 'id' => $this->id, - 'code' => $this->code, 'card_number' => $this->card_number, - 'department_id' => $this->department_id, 'birthday' => $this->birthday, 'date_in' => $this->date_in, 'created_at' => $this->created_at, @@ -70,6 +73,7 @@ class StaffSearch extends Staff { ->andFilterWhere(['like', 'gender', $this->gender]) ->andFilterWhere(['like', 'email', $this->email]) ->andFilterWhere(['like', 'phone', $this->phone]) + ->andFilterWhere(['like', 'code', $this->code]) ->andFilterWhere(['like', 'address', $this->address]); return $dataProvider; diff --git a/views/area/index.tpl b/views/area/index.tpl index b00380f6..9071c10d 100644 --- a/views/area/index.tpl +++ b/views/area/index.tpl @@ -65,7 +65,14 @@ 'attribute' => 'modified_at', 'value' => \app\helpers\CommonGrid::modifiedAt() ] - ] + ], + 'pager' => [ + 'firstPageLabel' => "", + 'lastPageLabel' => "", + 'nextPageLabel' => "", + 'prevPageLabel' => "", + 'maxButtonCount' => 5 + ] ])} {/Pjax} diff --git a/views/assign/staff.tpl b/views/assign/staff.tpl index 10412d98..33746643 100644 --- a/views/assign/staff.tpl +++ b/views/assign/staff.tpl @@ -46,6 +46,13 @@ 'contentOptions' => \app\helpers\StaffGrid::doorsHeader(), 'value' => \app\helpers\StaffGrid::doors($doorsArray) ] - ] + ], + 'pager' => [ + 'firstPageLabel' => "", + 'lastPageLabel' => "", + 'nextPageLabel' => "", + 'prevPageLabel' => "", + 'maxButtonCount' => 5 + ] ])} {/Pjax} \ No newline at end of file diff --git a/views/card-register/index.tpl b/views/card-register/index.tpl index db014c7c..8d1721aa 100644 --- a/views/card-register/index.tpl +++ b/views/card-register/index.tpl @@ -58,7 +58,14 @@ 'attribute' => 'card_register_time', 'value' => \app\helpers\StaffGrid::cardRegisterTime() ] - ] + ], + 'pager' => [ + 'firstPageLabel' => "", + 'lastPageLabel' => "", + 'nextPageLabel' => "", + 'prevPageLabel' => "", + 'maxButtonCount' => 5 + ] ])} {/Pjax} diff --git a/views/department/index.tpl b/views/department/index.tpl index 1109383b..ed603ad4 100644 --- a/views/department/index.tpl +++ b/views/department/index.tpl @@ -71,7 +71,14 @@ 'attribute' => 'modified_at', 'value' => \app\helpers\CommonGrid::modifiedAt() ] - ] + ], + 'pager' => [ + 'firstPageLabel' => "", + 'lastPageLabel' => "", + 'nextPageLabel' => "", + 'prevPageLabel' => "", + 'maxButtonCount' => 5 + ] ])} {/Pjax} diff --git a/views/device/index.tpl b/views/device/index.tpl index cb9bc07a..9e18f023 100644 --- a/views/device/index.tpl +++ b/views/device/index.tpl @@ -104,7 +104,14 @@ 'headerOptions' => ['style' => 'width:10%'], 'value' => \app\helpers\DeviceGrid::openDoor() ] - ] + ], + 'pager' => [ + 'firstPageLabel' => "", + 'lastPageLabel' => "", + 'nextPageLabel' => "", + 'prevPageLabel' => "", + 'maxButtonCount' => 5 + ] ])} {/Pjax} diff --git a/views/device/search.tpl b/views/device/search.tpl index 37db5d30..306d376c 100644 --- a/views/device/search.tpl +++ b/views/device/search.tpl @@ -38,7 +38,7 @@
- + Sử dụng Subnet Mask
diff --git a/views/logs/index.tpl b/views/logs/index.tpl index 42e0b4ed..be60db56 100644 --- a/views/logs/index.tpl +++ b/views/logs/index.tpl @@ -108,7 +108,14 @@ 'filter' => $eventTypeArray, 'value' => \app\helpers\LogsGrid::eventType($eventTypeArray) ] - ] + ], + 'pager' => [ + 'firstPageLabel' => "", + 'lastPageLabel' => "", + 'nextPageLabel' => "", + 'prevPageLabel' => "", + 'maxButtonCount' => 5 + ] ])} {/Pjax}
diff --git a/views/logs/statistics.tpl b/views/logs/statistics.tpl index 4cafb795..abce6891 100644 --- a/views/logs/statistics.tpl +++ b/views/logs/statistics.tpl @@ -72,7 +72,14 @@ 'contentOptions' => ['class' => 'text-center'], 'value' => \app\helpers\StaffGrid::manDay($staffLogs) ] - ] + ], + 'pager' => [ + 'firstPageLabel' => "", + 'lastPageLabel' => "", + 'nextPageLabel' => "", + 'prevPageLabel' => "", + 'maxButtonCount' => 5 + ] ])} {/Pjax} diff --git a/views/schedule/index.tpl b/views/schedule/index.tpl index 022adb76..a2998d63 100644 --- a/views/schedule/index.tpl +++ b/views/schedule/index.tpl @@ -50,7 +50,14 @@ 'attribute' => 'modified_at', 'value' => \app\helpers\CommonGrid::modifiedAt() ] - ] + ], + 'pager' => [ + 'firstPageLabel' => "", + 'lastPageLabel' => "", + 'nextPageLabel' => "", + 'prevPageLabel' => "", + 'maxButtonCount' => 5 + ] ])} {/Pjax} diff --git a/views/staff/index.tpl b/views/staff/index.tpl index 21a77097..40e90b5e 100644 --- a/views/staff/index.tpl +++ b/views/staff/index.tpl @@ -77,7 +77,14 @@ 'value' => \app\helpers\StaffGrid::dateIn() ], 'address' - ] + ], + 'pager' => [ + 'firstPageLabel' => "", + 'lastPageLabel' => "", + 'nextPageLabel' => "", + 'prevPageLabel' => "", + 'maxButtonCount' => 5 + ] ])} {/Pjax} diff --git a/web/js/device_search.js b/web/js/device_search.js index d18a9dd4..3c405a5d 100644 --- a/web/js/device_search.js +++ b/web/js/device_search.js @@ -13,7 +13,8 @@ function _search(e) { url: $(e).attr('data-href'), type: 'POST', data: { - SubnetMask: $("input[name='SubnetMask']").val() + SubnetMask: $("input[name='SubnetMask']").val(), + Checked: $("input[name='checkbox-use-subnetmask']:checked").length }, success: function (data) { common.modalBlock(false); diff --git a/widgets/views/system-logs-view.tpl b/widgets/views/system-logs-view.tpl index 2faa4b94..f9a51e84 100644 --- a/widgets/views/system-logs-view.tpl +++ b/widgets/views/system-logs-view.tpl @@ -20,4 +20,9 @@ {/foreach} - \ No newline at end of file + +
+ +
\ No newline at end of file