fix bug đồng bộ dữ liệu nhân viên
This commit is contained in:
parent
ad30699a52
commit
018ca540d5
|
@ -97,7 +97,7 @@ class AssignController extends Controller {
|
|||
Yii::$app->response->format = "json";
|
||||
return [
|
||||
"schedule" => Schedule::findOne($post['schedule'])->name,
|
||||
"doors" => implode(", ", $doors)
|
||||
"doors" => implode("<br>", $doors)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -418,6 +418,8 @@ class DeviceController extends Controller {
|
|||
$UserInfos = [];
|
||||
$UserAuthorizeInfos = [];
|
||||
|
||||
$doorOfDevice = Door::find()->andWhere(['device_id' => $device_id])->all();
|
||||
|
||||
foreach ($staff_lists as $key => $value) {
|
||||
$UserInfos[] = [
|
||||
"CardNo" => $value["card_number"],
|
||||
|
@ -428,13 +430,14 @@ class DeviceController extends Controller {
|
|||
"EndTime" => ""
|
||||
];
|
||||
$doors = json_decode($value["door_access"], true);
|
||||
foreach ($doors as $k => $v) {
|
||||
$doorInfo = Door::findOne($v);
|
||||
$UserAuthorizeInfos[] = [
|
||||
"Pin" => $value["id"],
|
||||
"AuthorizeTimezoneId" => $value["schedule_id"],
|
||||
"AuthorizeDoorId" => $doorInfo->code
|
||||
];
|
||||
foreach ($doorOfDevice as $k => $v) {
|
||||
if (in_array($v->id, $doors)) {
|
||||
$UserAuthorizeInfos[] = [
|
||||
"Pin" => $value["id"],
|
||||
"AuthorizeTimezoneId" => $value["schedule_id"],
|
||||
"AuthorizeDoorId" => $v->code
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
$resUser = json_decode(common::requestToCardService("/SetDeviceData/User", [
|
||||
|
|
|
@ -97,4 +97,16 @@ class StaffGrid extends CommonGrid {
|
|||
};
|
||||
}
|
||||
|
||||
public static function scheduleHeader() {
|
||||
return function($model) {
|
||||
return ["id" => "schedule-staff-results-" . $model->id];
|
||||
};
|
||||
}
|
||||
|
||||
public static function doorsHeader() {
|
||||
return function($model) {
|
||||
return ["id" => "schedule-door-results-" . $model->id];
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
'class' => 'table table-striped table-bordered table-hover',
|
||||
'style' => 'background:#fff;min-width:700px;'
|
||||
],
|
||||
'rowOptions' => \app\helpers\CommonGrid::rows("staff", true),
|
||||
'columns' => [
|
||||
[
|
||||
'class' => 'yii\grid\SerialColumn',
|
||||
|
@ -37,12 +36,14 @@
|
|||
],
|
||||
[
|
||||
'attribute' => 'schedule',
|
||||
'contentOptions' => \app\helpers\StaffGrid::scheduleHeader(),
|
||||
'value' => \app\helpers\StaffGrid::schedule($scheduleArray)
|
||||
],
|
||||
[
|
||||
'attribute' => 'doors',
|
||||
'format' => 'raw',
|
||||
'headerOptions' => ['style' => 'width:15%'],
|
||||
'contentOptions' => \app\helpers\StaffGrid::doorsHeader(),
|
||||
'value' => \app\helpers\StaffGrid::doors($doorsArray)
|
||||
]
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue
Block a user