fix một số bug nhỏ

This commit is contained in:
dongpd 2020-10-27 17:34:09 +07:00
parent 758b8d29c3
commit 02418afb11
16 changed files with 117 additions and 37 deletions

View File

@ -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()) {

View File

@ -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();

View File

@ -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)) {

View File

@ -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;

View File

@ -65,6 +65,13 @@
'attribute' => 'modified_at',
'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}

View File

@ -46,6 +46,13 @@
'contentOptions' => \app\helpers\StaffGrid::doorsHeader(),
'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}

View File

@ -58,6 +58,13 @@
'attribute' => 'card_register_time',
'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}

View File

@ -71,6 +71,13 @@
'attribute' => 'modified_at',
'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}

View File

@ -104,6 +104,13 @@
'headerOptions' => ['style' => 'width:10%'],
'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}

View File

@ -38,7 +38,7 @@
</div>
<div class="row" style="padding: 0 10px;">
<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
<input type='text' value="255.255.255.255" name='SubnetMask'>
</div>

View File

@ -108,6 +108,13 @@
'filter' => $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}

View File

@ -72,6 +72,13 @@
'contentOptions' => ['class' => 'text-center'],
'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}

View File

@ -50,6 +50,13 @@
'attribute' => 'modified_at',
'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}

View File

@ -77,6 +77,13 @@
'value' => \app\helpers\StaffGrid::dateIn()
],
'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}

View File

@ -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);

View File

@ -21,3 +21,8 @@
{/foreach}
</tbody>
</table>
<div class="text-right">
<button class="btn btn-default" data-dismiss="modal">
<span class="fa fa-remove"></span> Đóng
</button>
</div>