diff --git a/frontend/controllers/CabinetController.php b/frontend/controllers/CabinetController.php index 994ef88..22b446d 100755 --- a/frontend/controllers/CabinetController.php +++ b/frontend/controllers/CabinetController.php @@ -269,6 +269,40 @@ ]; } } + + public function actionUpdateRole() + { + $request = \Yii::$app->request; + $response = \Yii::$app->response; + $response->format = $response::FORMAT_JSON; + + $role = CreativeRole::findOne($request->get('id')); + + if ($role->load($request->post()) && $role->save()) { + return [ + 'success' => true, + 'message' => 'Данные успешно сохранены', + ]; + } else { + return [ + 'error' => true, + 'message' => 'Ошибка сохранения данных', + ]; + } + } + + public function actionGetRoleForm() + { + $request = \Yii::$app->request; + $response = \Yii::$app->response; + $response->format = $response::FORMAT_JSON; + + $model = CreativeRole::findOne($request->post('id')); + + return [ + 'answer' => $this->renderPartial('_update_form', ['model' => $model]) + ]; + } public function actionDeleteRole() { diff --git a/frontend/views/cabinet/_update_form.php b/frontend/views/cabinet/_update_form.php new file mode 100644 index 0000000..060cb31 --- /dev/null +++ b/frontend/views/cabinet/_update_form.php @@ -0,0 +1,68 @@ + + +