update gán lịch trình toàn bộ

This commit is contained in:
2020-11-04 16:35:39 +07:00
parent fe639c34fc
commit a57039f7d0
7 changed files with 17 additions and 8 deletions

View File

@@ -78,7 +78,7 @@ class AssignController extends Controller {
$searchModel = new StaffSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$dataProvider->query->andFilterWhere(['OR', ["LIKE", "name", $post['key']], ["LIKE", "code", $post['key']]]);
$dataProvider->pagination->pageSize = 200;
$dataProvider->pagination->pageSize = Yii::$app->params["pageSize"];
return $this->renderAjax("staff", [
'searchModel' => $searchModel,
@@ -93,7 +93,13 @@ class AssignController extends Controller {
public function actionSetSchedule() {
if (Yii::$app->request->post()) {
$post = Yii::$app->request->post();
$lists = Staff::find()->andWhere(["IN", "id", $post["staffs"]])->all();
if ($post['currentDepartment'] !== "" && count($post["staffs"]) >= Yii::$app->params["pageSize"]) {
$model = new Department();
$childs = $model->departmentChilds($post["currentDepartment"]);
$lists = Staff::find()->andWhere(["IN", "department_id", $childs])->all();
} else {
$lists = Staff::find()->andWhere(["IN", "id", $post["staffs"]])->all();
}
foreach ($lists as $key => $value) {
$value->schedule_id = $post["schedule"];
if ($value->door_access !== json_encode($post["doors"])) {