fix một số bug nhỏ
This commit is contained in:
parent
758b8d29c3
commit
02418afb11
|
@ -21,7 +21,7 @@ class AreaController extends Controller {
|
||||||
parent::init();
|
parent::init();
|
||||||
if (time() > Yii::$app->params["time"])
|
if (time() > Yii::$app->params["time"])
|
||||||
$this->redirect(["/dashboard"]);
|
$this->redirect(["/dashboard"]);
|
||||||
|
|
||||||
if (Yii::$app->user->isGuest)
|
if (Yii::$app->user->isGuest)
|
||||||
return $this->redirect(['/site/login']);
|
return $this->redirect(['/site/login']);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,8 @@ class AreaController extends Controller {
|
||||||
$oldCode = $model->code;
|
$oldCode = $model->code;
|
||||||
$model->name = $data["Name"];
|
$model->name = $data["Name"];
|
||||||
$model->code = $data["Code"];
|
$model->code = $data["Code"];
|
||||||
$model->pid = $data["Pid"];
|
if ($model->pid != 0)
|
||||||
|
$model->pid = $data["Pid"];
|
||||||
$model->description = $data["Description"];
|
$model->description = $data["Description"];
|
||||||
$model->modified_at = time();
|
$model->modified_at = time();
|
||||||
if ($model->save()) {
|
if ($model->save()) {
|
||||||
|
|
|
@ -89,7 +89,7 @@ class DepartmentController extends Controller {
|
||||||
$oldCode = $model->code;
|
$oldCode = $model->code;
|
||||||
$model->name = $data["Name"];
|
$model->name = $data["Name"];
|
||||||
$model->code = $data["Code"];
|
$model->code = $data["Code"];
|
||||||
if ($model->pid != 1) {
|
if ($model->pid != 0) {
|
||||||
$model->pid = $data["Pid"] !== "" ? $data["Pid"] : 0;
|
$model->pid = $data["Pid"] !== "" ? $data["Pid"] : 0;
|
||||||
}
|
}
|
||||||
$model->modified_at = time();
|
$model->modified_at = time();
|
||||||
|
|
|
@ -247,26 +247,26 @@ class DeviceController extends Controller {
|
||||||
if (Yii::$app->request->post()) {
|
if (Yii::$app->request->post()) {
|
||||||
$data = Yii::$app->request->post();
|
$data = Yii::$app->request->post();
|
||||||
$OldIpAddress = $model->ip_address;
|
$OldIpAddress = $model->ip_address;
|
||||||
if ($OldIpAddress !== $data["Ip"]) {
|
// if ($OldIpAddress !== $data["Ip"]) {
|
||||||
$check = Device::findOne(['ip_address' => $data['Ip']]);
|
$check = Device::findOne(['ip_address' => $data['Ip']]);
|
||||||
if ($check)
|
if ($check && $check->id != $id)
|
||||||
return ["status" => false, "type" => "ip"];
|
return ["status" => false, "type" => "ip"];
|
||||||
|
|
||||||
$res = common::requestToCardService("/ModifyIPAddress", [
|
$res = common::requestToCardService("/ModifyIPAddress", [
|
||||||
"OldIPAddress" => $OldIpAddress,
|
"OldIPAddress" => $OldIpAddress,
|
||||||
"NewIPAddress" => $data["Ip"],
|
"NewIPAddress" => $data["Ip"],
|
||||||
"NetMask" => $data["SubnetMask"],
|
"NetMask" => $data["SubnetMask"],
|
||||||
"GATEIPAddress" => $data["Gateway"],
|
"GATEIPAddress" => $data["Gateway"],
|
||||||
"MAC" => $model->mac_address
|
"MAC" => $model->mac_address
|
||||||
]);
|
]);
|
||||||
if ($res == 0) {
|
if ($res == 0) {
|
||||||
$model->ip_address = $data["Ip"];
|
$model->ip_address = $data["Ip"];
|
||||||
$model->subnet_mask = $data["SubnetMask"];
|
$model->subnet_mask = $data["SubnetMask"];
|
||||||
$model->gateway = $data["Gateway"];
|
$model->gateway = $data["Gateway"];
|
||||||
$model->save();
|
$model->save();
|
||||||
return ["status" => true];
|
return ["status" => true];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
return ["status" => true];
|
return ["status" => true];
|
||||||
} else {
|
} else {
|
||||||
return [
|
return [
|
||||||
|
@ -282,9 +282,10 @@ class DeviceController extends Controller {
|
||||||
public function actionSearch() {
|
public function actionSearch() {
|
||||||
if (Yii::$app->request->post()) {
|
if (Yii::$app->request->post()) {
|
||||||
Yii::$app->response->format = "json";
|
Yii::$app->response->format = "json";
|
||||||
|
$data = Yii::$app->request->post();
|
||||||
$NetMask = "255.255.255.255";
|
$NetMask = "255.255.255.255";
|
||||||
if (Yii::$app->request->post("SubnetMask") != "") {
|
if ($data["SubnetMask"] != "" && $data["Checked"] !== "0") {
|
||||||
$NetMask = Yii::$app->request->post("SubnetMask");
|
$NetMask = $data["SubnetMask"];
|
||||||
}
|
}
|
||||||
$datas = json_decode(common::requestToCardService("/SearchDevice", ["NetMask" => $NetMask]), true);
|
$datas = json_decode(common::requestToCardService("/SearchDevice", ["NetMask" => $NetMask]), true);
|
||||||
return [
|
return [
|
||||||
|
@ -445,6 +446,11 @@ class DeviceController extends Controller {
|
||||||
"AuthorizeTimezoneId" => $value["schedule_id"],
|
"AuthorizeTimezoneId" => $value["schedule_id"],
|
||||||
"AuthorizeDoorId" => $v->code
|
"AuthorizeDoorId" => $v->code
|
||||||
];
|
];
|
||||||
|
$UserAuthorizeInfosDelete[] = [
|
||||||
|
"Pin" => "",
|
||||||
|
"AuthorizeTimezoneId" => "",
|
||||||
|
"AuthorizeDoorId" => ""
|
||||||
|
];
|
||||||
}
|
}
|
||||||
if ($value["door_access_old"] != null) {
|
if ($value["door_access_old"] != null) {
|
||||||
if (in_array($v->id, $doorsOld) && !in_array($v->id, $doors)) {
|
if (in_array($v->id, $doorsOld) && !in_array($v->id, $doors)) {
|
||||||
|
|
|
@ -54,12 +54,15 @@ class StaffSearch extends Staff {
|
||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->department_id) {
|
||||||
|
$m = new Department();
|
||||||
|
$departmentChild = $m->departmentChilds($this->department_id);
|
||||||
|
$query->andFilterWhere(["IN", "department_id", $departmentChild]);
|
||||||
|
}
|
||||||
// grid filtering conditions
|
// grid filtering conditions
|
||||||
$query->andFilterWhere([
|
$query->andFilterWhere([
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'code' => $this->code,
|
|
||||||
'card_number' => $this->card_number,
|
'card_number' => $this->card_number,
|
||||||
'department_id' => $this->department_id,
|
|
||||||
'birthday' => $this->birthday,
|
'birthday' => $this->birthday,
|
||||||
'date_in' => $this->date_in,
|
'date_in' => $this->date_in,
|
||||||
'created_at' => $this->created_at,
|
'created_at' => $this->created_at,
|
||||||
|
@ -70,6 +73,7 @@ class StaffSearch extends Staff {
|
||||||
->andFilterWhere(['like', 'gender', $this->gender])
|
->andFilterWhere(['like', 'gender', $this->gender])
|
||||||
->andFilterWhere(['like', 'email', $this->email])
|
->andFilterWhere(['like', 'email', $this->email])
|
||||||
->andFilterWhere(['like', 'phone', $this->phone])
|
->andFilterWhere(['like', 'phone', $this->phone])
|
||||||
|
->andFilterWhere(['like', 'code', $this->code])
|
||||||
->andFilterWhere(['like', 'address', $this->address]);
|
->andFilterWhere(['like', 'address', $this->address]);
|
||||||
|
|
||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
|
|
|
@ -65,7 +65,14 @@
|
||||||
'attribute' => 'modified_at',
|
'attribute' => 'modified_at',
|
||||||
'value' => \app\helpers\CommonGrid::modifiedAt()
|
'value' => \app\helpers\CommonGrid::modifiedAt()
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
|
'pager' => [
|
||||||
|
'firstPageLabel' => "<i class='fa fa-backward'></i>",
|
||||||
|
'lastPageLabel' => "<i class='fa fa-forward'></i>",
|
||||||
|
'nextPageLabel' => "<i class='fa fa-chevron-right'></i>",
|
||||||
|
'prevPageLabel' => "<i class='fa fa-chevron-left'></i>",
|
||||||
|
'maxButtonCount' => 5
|
||||||
|
]
|
||||||
])}
|
])}
|
||||||
{/Pjax}
|
{/Pjax}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -46,6 +46,13 @@
|
||||||
'contentOptions' => \app\helpers\StaffGrid::doorsHeader(),
|
'contentOptions' => \app\helpers\StaffGrid::doorsHeader(),
|
||||||
'value' => \app\helpers\StaffGrid::doors($doorsArray)
|
'value' => \app\helpers\StaffGrid::doors($doorsArray)
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
|
'pager' => [
|
||||||
|
'firstPageLabel' => "<i class='fa fa-backward'></i>",
|
||||||
|
'lastPageLabel' => "<i class='fa fa-forward'></i>",
|
||||||
|
'nextPageLabel' => "<i class='fa fa-chevron-right'></i>",
|
||||||
|
'prevPageLabel' => "<i class='fa fa-chevron-left'></i>",
|
||||||
|
'maxButtonCount' => 5
|
||||||
|
]
|
||||||
])}
|
])}
|
||||||
{/Pjax}
|
{/Pjax}
|
|
@ -58,7 +58,14 @@
|
||||||
'attribute' => 'card_register_time',
|
'attribute' => 'card_register_time',
|
||||||
'value' => \app\helpers\StaffGrid::cardRegisterTime()
|
'value' => \app\helpers\StaffGrid::cardRegisterTime()
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
|
'pager' => [
|
||||||
|
'firstPageLabel' => "<i class='fa fa-backward'></i>",
|
||||||
|
'lastPageLabel' => "<i class='fa fa-forward'></i>",
|
||||||
|
'nextPageLabel' => "<i class='fa fa-chevron-right'></i>",
|
||||||
|
'prevPageLabel' => "<i class='fa fa-chevron-left'></i>",
|
||||||
|
'maxButtonCount' => 5
|
||||||
|
]
|
||||||
])}
|
])}
|
||||||
{/Pjax}
|
{/Pjax}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -71,7 +71,14 @@
|
||||||
'attribute' => 'modified_at',
|
'attribute' => 'modified_at',
|
||||||
'value' => \app\helpers\CommonGrid::modifiedAt()
|
'value' => \app\helpers\CommonGrid::modifiedAt()
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
|
'pager' => [
|
||||||
|
'firstPageLabel' => "<i class='fa fa-backward'></i>",
|
||||||
|
'lastPageLabel' => "<i class='fa fa-forward'></i>",
|
||||||
|
'nextPageLabel' => "<i class='fa fa-chevron-right'></i>",
|
||||||
|
'prevPageLabel' => "<i class='fa fa-chevron-left'></i>",
|
||||||
|
'maxButtonCount' => 5
|
||||||
|
]
|
||||||
])}
|
])}
|
||||||
{/Pjax}
|
{/Pjax}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -104,7 +104,14 @@
|
||||||
'headerOptions' => ['style' => 'width:10%'],
|
'headerOptions' => ['style' => 'width:10%'],
|
||||||
'value' => \app\helpers\DeviceGrid::openDoor()
|
'value' => \app\helpers\DeviceGrid::openDoor()
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
|
'pager' => [
|
||||||
|
'firstPageLabel' => "<i class='fa fa-backward'></i>",
|
||||||
|
'lastPageLabel' => "<i class='fa fa-forward'></i>",
|
||||||
|
'nextPageLabel' => "<i class='fa fa-chevron-right'></i>",
|
||||||
|
'prevPageLabel' => "<i class='fa fa-chevron-left'></i>",
|
||||||
|
'maxButtonCount' => 5
|
||||||
|
]
|
||||||
])}
|
])}
|
||||||
{/Pjax}
|
{/Pjax}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row" style="padding: 0 10px;">
|
<div class="row" style="padding: 0 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type='checkbox' value='0' class='checkbox-use-subnetmask' checked="">
|
<input type='checkbox' value='0' class='checkbox-use-subnetmask' name="checkbox-use-subnetmask" checked="">
|
||||||
Sử dụng Subnet Mask
|
Sử dụng Subnet Mask
|
||||||
<input type='text' value="255.255.255.255" name='SubnetMask'>
|
<input type='text' value="255.255.255.255" name='SubnetMask'>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -108,7 +108,14 @@
|
||||||
'filter' => $eventTypeArray,
|
'filter' => $eventTypeArray,
|
||||||
'value' => \app\helpers\LogsGrid::eventType($eventTypeArray)
|
'value' => \app\helpers\LogsGrid::eventType($eventTypeArray)
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
|
'pager' => [
|
||||||
|
'firstPageLabel' => "<i class='fa fa-backward'></i>",
|
||||||
|
'lastPageLabel' => "<i class='fa fa-forward'></i>",
|
||||||
|
'nextPageLabel' => "<i class='fa fa-chevron-right'></i>",
|
||||||
|
'prevPageLabel' => "<i class='fa fa-chevron-left'></i>",
|
||||||
|
'maxButtonCount' => 5
|
||||||
|
]
|
||||||
])}
|
])}
|
||||||
{/Pjax}
|
{/Pjax}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -72,7 +72,14 @@
|
||||||
'contentOptions' => ['class' => 'text-center'],
|
'contentOptions' => ['class' => 'text-center'],
|
||||||
'value' => \app\helpers\StaffGrid::manDay($staffLogs)
|
'value' => \app\helpers\StaffGrid::manDay($staffLogs)
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
|
'pager' => [
|
||||||
|
'firstPageLabel' => "<i class='fa fa-backward'></i>",
|
||||||
|
'lastPageLabel' => "<i class='fa fa-forward'></i>",
|
||||||
|
'nextPageLabel' => "<i class='fa fa-chevron-right'></i>",
|
||||||
|
'prevPageLabel' => "<i class='fa fa-chevron-left'></i>",
|
||||||
|
'maxButtonCount' => 5
|
||||||
|
]
|
||||||
])}
|
])}
|
||||||
{/Pjax}
|
{/Pjax}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -50,7 +50,14 @@
|
||||||
'attribute' => 'modified_at',
|
'attribute' => 'modified_at',
|
||||||
'value' => \app\helpers\CommonGrid::modifiedAt()
|
'value' => \app\helpers\CommonGrid::modifiedAt()
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
|
'pager' => [
|
||||||
|
'firstPageLabel' => "<i class='fa fa-backward'></i>",
|
||||||
|
'lastPageLabel' => "<i class='fa fa-forward'></i>",
|
||||||
|
'nextPageLabel' => "<i class='fa fa-chevron-right'></i>",
|
||||||
|
'prevPageLabel' => "<i class='fa fa-chevron-left'></i>",
|
||||||
|
'maxButtonCount' => 5
|
||||||
|
]
|
||||||
])}
|
])}
|
||||||
{/Pjax}
|
{/Pjax}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -77,7 +77,14 @@
|
||||||
'value' => \app\helpers\StaffGrid::dateIn()
|
'value' => \app\helpers\StaffGrid::dateIn()
|
||||||
],
|
],
|
||||||
'address'
|
'address'
|
||||||
]
|
],
|
||||||
|
'pager' => [
|
||||||
|
'firstPageLabel' => "<i class='fa fa-backward'></i>",
|
||||||
|
'lastPageLabel' => "<i class='fa fa-forward'></i>",
|
||||||
|
'nextPageLabel' => "<i class='fa fa-chevron-right'></i>",
|
||||||
|
'prevPageLabel' => "<i class='fa fa-chevron-left'></i>",
|
||||||
|
'maxButtonCount' => 5
|
||||||
|
]
|
||||||
])}
|
])}
|
||||||
{/Pjax}
|
{/Pjax}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,7 +13,8 @@ function _search(e) {
|
||||||
url: $(e).attr('data-href'),
|
url: $(e).attr('data-href'),
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: {
|
data: {
|
||||||
SubnetMask: $("input[name='SubnetMask']").val()
|
SubnetMask: $("input[name='SubnetMask']").val(),
|
||||||
|
Checked: $("input[name='checkbox-use-subnetmask']:checked").length
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
common.modalBlock(false);
|
common.modalBlock(false);
|
||||||
|
|
|
@ -20,4 +20,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div class="text-right">
|
||||||
|
<button class="btn btn-default" data-dismiss="modal">
|
||||||
|
<span class="fa fa-remove"></span> Đóng
|
||||||
|
</button>
|
||||||
|
</div>
|
Loading…
Reference in New Issue
Block a user