From 9ac16a4b1ab0d50fc53873c70550d6a034673ef7 Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Fri, 31 Oct 2025 09:13:00 +0300 Subject: [PATCH] =?utf8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D1=8F=D0=B5=D0=BC=20Adm?= =?utf8?q?inPositionsController.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../controllers/AdminPositionsController.php | 144 ------------------ ...27_071121_create_admin_positions_table.php | 43 ------ erp24/views/admin-positions/_form.php | 60 -------- erp24/views/admin-positions/create.php | 20 --- erp24/views/admin-positions/index.php | 47 ------ erp24/views/admin-positions/update.php | 21 --- erp24/views/admin-positions/view.php | 43 ------ 7 files changed, 378 deletions(-) delete mode 100644 erp24/controllers/AdminPositionsController.php delete mode 100644 erp24/migrations/m251027_071121_create_admin_positions_table.php delete mode 100644 erp24/views/admin-positions/_form.php delete mode 100644 erp24/views/admin-positions/create.php delete mode 100644 erp24/views/admin-positions/index.php delete mode 100644 erp24/views/admin-positions/update.php delete mode 100644 erp24/views/admin-positions/view.php diff --git a/erp24/controllers/AdminPositionsController.php b/erp24/controllers/AdminPositionsController.php deleted file mode 100644 index a1868f90..00000000 --- a/erp24/controllers/AdminPositionsController.php +++ /dev/null @@ -1,144 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['POST'], - ], - ], - ] - ); - } - - /** - * Lists all AdminPositions models. - * - * @return string - */ - public function actionIndex() - { - $dataProvider = new ActiveDataProvider([ - 'query' => AdminPositions::find(), - /* - 'pagination' => [ - 'pageSize' => 50 - ], - 'sort' => [ - 'defaultOrder' => [ - 'id' => SORT_DESC, - ] - ], - */ - ]); - - return $this->render('index', [ - 'dataProvider' => $dataProvider, - ]); - } - - /** - * Displays a single AdminPositions model. - * @param int $id ID - * @return string - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** - * Creates a new AdminPositions model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return string|\yii\web\Response - */ - public function actionCreate() - { - $model = new AdminPositions(); - - if ($this->request->isPost) { - if ($model->load($this->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id]); - } - } else { - $model->loadDefaultValues(); - } - - return $this->render('create', [ - 'model' => $model, - ]); - } - - /** - * Updates an existing AdminPositions model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param int $id ID - * @return string|\yii\web\Response - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - - if ($this->request->isPost && $model->load($this->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id]); - } - - return $this->render('update', [ - 'model' => $model, - ]); - } - - /** - * Deletes an existing AdminPositions model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param int $id ID - * @return \yii\web\Response - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the AdminPositions model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param int $id ID - * @return AdminPositions the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = AdminPositions::findOne(['id' => $id])) !== null) { - return $model; - } - - throw new NotFoundHttpException('The requested page does not exist.'); - } -} diff --git a/erp24/migrations/m251027_071121_create_admin_positions_table.php b/erp24/migrations/m251027_071121_create_admin_positions_table.php deleted file mode 100644 index c805a672..00000000 --- a/erp24/migrations/m251027_071121_create_admin_positions_table.php +++ /dev/null @@ -1,43 +0,0 @@ -db->getTableSchema(self::TABLE_NAME); - - if (!isset($tableSchema)) { - $this->createTable(self::TABLE_NAME, [ - 'id' => $this->primaryKey(), - 'name' => $this->string()->notNull()->comment('Наименование должности'), - 'alias' => $this->string()->notNull()->comment('Алиас должности'), - 'salary' => $this->decimal(10, 2)->notNull()->comment('Ставка в рублях'), - 'created_at' => $this->dateTime()->notNull()->comment('Дата создания'), - 'created_by' => $this->integer()->notNull()->comment('ИД создателя'), - 'updated_at' => $this->dateTime()->null()->comment('Дата обновления'), - 'updated_by' => $this->integer()->null()->comment('ИД редактировавшего'), - ]); - } - } - - /** - * {@inheritdoc} - */ - public function safeDown() - { - $this->dropTable('{{%admin_positions}}'); - } -} diff --git a/erp24/views/admin-positions/_form.php b/erp24/views/admin-positions/_form.php deleted file mode 100644 index f55150ee..00000000 --- a/erp24/views/admin-positions/_form.php +++ /dev/null @@ -1,60 +0,0 @@ - - -
- - - - field($model, 'name')->textInput(['maxlength' => true]) ?> - - field($model, 'alias')->hiddenInput()->label(false) ?> - - field($model, 'salary')->textInput() ?> - -
- 'btn btn-success']) ?> -
- - - -
- -registerJs(" -$(document).ready(function() { - // Функция транслитерации русского текста в латиницу - function transliterate(text) { - var translitMap = { - 'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', 'е': 'e', 'ё': 'e', - 'ж': 'zh', 'з': 'z', 'и': 'i', 'й': 'y', 'к': 'k', 'л': 'l', 'м': 'm', - 'н': 'n', 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't', 'у': 'u', - 'ф': 'f', 'х': 'kh', 'ц': 'ts', 'ч': 'ch', 'ш': 'sh', 'щ': 'shch', - 'ъ': '', 'ы': 'y', 'ь': '', 'э': 'e', 'ю': 'yu', 'я': 'ya', - 'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D', 'Е': 'E', 'Ё': 'E', - 'Ж': 'Zh', 'З': 'Z', 'И': 'I', 'Й': 'Y', 'К': 'K', 'Л': 'L', 'М': 'M', - 'Н': 'N', 'О': 'O', 'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T', 'У': 'U', - 'Ф': 'F', 'Х': 'Kh', 'Ц': 'Ts', 'Ч': 'Ch', 'Ш': 'Sh', 'Щ': 'Shch', - 'Ъ': '', 'Ы': 'Y', 'Ь': '', 'Э': 'E', 'Ю': 'Yu', 'Я': 'Ya' - }; - - return text.split('').map(function(char) { - return translitMap[char] || char; - }).join('').replace(/[^a-zA-Z0-9-_]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, ''); - } - - // Обработчик изменения поля name - $('#adminpositions-name').on('input', function() { - var nameValue = $(this).val(); - var aliasValue = transliterate(nameValue); - $('#adminpositions-alias').val(aliasValue); - }); -}); -"); -?> diff --git a/erp24/views/admin-positions/create.php b/erp24/views/admin-positions/create.php deleted file mode 100644 index 1f45d4fa..00000000 --- a/erp24/views/admin-positions/create.php +++ /dev/null @@ -1,20 +0,0 @@ -title = 'Создание должности сотрудников'; -$this->params['breadcrumbs'][] = ['label' => 'Admin Positions', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -?> -
- -

title) ?>

- - render('_form', [ - 'model' => $model, - ]) ?> - -
diff --git a/erp24/views/admin-positions/index.php b/erp24/views/admin-positions/index.php deleted file mode 100644 index 38ada630..00000000 --- a/erp24/views/admin-positions/index.php +++ /dev/null @@ -1,47 +0,0 @@ -title = 'Должности сотрудников'; -$this->params['breadcrumbs'][] = $this->title; -?> -
- -

title) ?>

- -

- 'btn btn-success']) ?> -

- - - $dataProvider, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], - - 'id', - 'name', - 'alias', - 'salary', - 'created_at', - 'created_by', - 'updated_at', - 'updated_by', - [ - 'class' => ActionColumn::class, - 'urlCreator' => function ($action, AdminPositions $model, $key, $index, $column) { - return Url::toRoute([$action, 'id' => $model->id]); - } - ], - ], - ]); ?> - - -
diff --git a/erp24/views/admin-positions/update.php b/erp24/views/admin-positions/update.php deleted file mode 100644 index 1321d776..00000000 --- a/erp24/views/admin-positions/update.php +++ /dev/null @@ -1,21 +0,0 @@ -title = 'Изменение должности: ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Admin Positions', 'url' => ['index']]; -$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; -$this->params['breadcrumbs'][] = 'Update'; -?> -
- -

title) ?>

- - render('_form', [ - 'model' => $model, - ]) ?> - -
diff --git a/erp24/views/admin-positions/view.php b/erp24/views/admin-positions/view.php deleted file mode 100644 index 7cd6bfd4..00000000 --- a/erp24/views/admin-positions/view.php +++ /dev/null @@ -1,43 +0,0 @@ -title = $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Admin Positions', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -\yii\web\YiiAsset::register($this); -?> -
- 'btn btn-primary mb-4']) ?> -

title) ?>

- -

- $model->id], ['class' => 'btn btn-primary']) ?> - $model->id], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => 'Вы уверены что хотите удалить?', - 'method' => 'post', - ], - ]) ?> -

- - $model, - 'attributes' => [ - 'id', - 'name', - 'alias', - 'salary', - 'created_at', - 'created_by', - 'updated_at', - 'updated_by', - ], - ]) ?> - -
-- 2.39.5