complete the manager module

This commit is contained in:
iIronside
2021-11-22 15:34:46 +03:00
parent 957e777da5
commit 12648f16f8
4 changed files with 46 additions and 14 deletions

View File

@ -54,14 +54,6 @@ class ManagerController extends Controller
*/
public function actionView($id)
{
// $model = $this->findModel($id);
// $questionSearchModel = new QuestionSearch();
// $questionDataProvider = new ActiveDataProvider([
// 'query' => $model->getQuestions()->with('questionType'),
// 'pagination' => [
// 'pageSize' => 20,
// ],
// ]);
$model = $this->findModel($id);
$managerEmployeeSearchModel = new ManagerEmployeeSearch();
$managerEmployeeDataProvider = new ActiveDataProvider([

View File

@ -82,11 +82,15 @@ class ManagerEmployeeController extends Controller
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate($id)
public function actionUpdate($id, $manager_id = null)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
if ($manager_id !== null)
{
return $this->redirect(['manager/view', 'id' => $manager_id]);
}
return $this->redirect(['view', 'id' => $model->id]);
}
@ -102,10 +106,15 @@ class ManagerEmployeeController extends Controller
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionDelete($id)
public function actionDelete($id, $manager_id = null)
{
$this->findModel($id)->delete();
if ($manager_id !== null)
{
return $this->redirect(['manager/view', 'id' => $manager_id]);
}
return $this->redirect(['index']);
}