/** * Deletes an existing Application model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionAssignTo($id_app_task) { $model = AppTask::findOne($id_app_task); $task = new AppTask(); $assignTo = new AssigntoForm(); if ($assignTo->load(Yii::$app->request->post()) && $assignTo->validate()) { $owner_type = $assignTo->owner_type; $task->AssignTo($id_app_task, $owner_type); if ($this->user->id_user_role == Dict::USER_ROLE_CLIENT) { return $this->redirect(['/loan/application']); } else { return $this->redirect(['/application/view', 'id' => $model->id_application]); } } if (Yii::$app->request->post() && !$assignTo->owner_type) { if ($this->user->id_user_role == Dict::USER_ROLE_CLIENT) { return $this->redirect(['/loan/application']); } else { return $this->redirect(['/application/view', 'id' => $model->id_application]); } } return $this->renderAjax('assign_to', ['model' => $model, 'assignTo' => $assignTo]); }