]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Удаляем AdminPositionsController.php
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 31 Oct 2025 06:13:00 +0000 (09:13 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 31 Oct 2025 06:13:00 +0000 (09:13 +0300)
erp24/controllers/AdminPositionsController.php [deleted file]
erp24/migrations/m251027_071121_create_admin_positions_table.php [deleted file]
erp24/views/admin-positions/_form.php [deleted file]
erp24/views/admin-positions/create.php [deleted file]
erp24/views/admin-positions/index.php [deleted file]
erp24/views/admin-positions/update.php [deleted file]
erp24/views/admin-positions/view.php [deleted file]

diff --git a/erp24/controllers/AdminPositionsController.php b/erp24/controllers/AdminPositionsController.php
deleted file mode 100644 (file)
index a1868f9..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-<?php
-
-namespace app\controllers;
-
-use yii_app\records\AdminPositions;
-use yii\data\ActiveDataProvider;
-use yii\web\Controller;
-use yii\web\NotFoundHttpException;
-use yii\filters\VerbFilter;
-
-/**
- * AdminPositionsController implements the CRUD actions for AdminPositions model.
- */
-class AdminPositionsController extends Controller
-{
-    /**
-     * @inheritDoc
-     */
-    public function behaviors()
-    {
-        return array_merge(
-            parent::behaviors(),
-            [
-                'verbs' => [
-                    '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 (file)
index c805a67..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-use yii\db\Migration;
-
-/**
- * Handles the creation of table `{{%admin_positions}}`.
- */
-class m251027_071121_create_admin_positions_table extends Migration
-{
-    /**
-     * {@inheritdoc}
-     */
-    const TABLE_NAME = 'erp24.admin_positions';
-
-    /**
-     * {@inheritdoc}
-     */
-    public function safeUp()
-    {
-        $tableSchema = $this->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 (file)
index f55150e..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-
-use yii\helpers\Html;
-use yii\widgets\ActiveForm;
-
-/** @var yii\web\View $this */
-/** @var yii_app\records\AdminPositions $model */
-/** @var yii\widgets\ActiveForm $form */
-?>
-
-<div class="admin-positions-form">
-
-    <?php $form = ActiveForm::begin(); ?>
-
-    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
-
-    <?= $form->field($model, 'alias')->hiddenInput()->label(false) ?>
-
-    <?= $form->field($model, 'salary')->textInput() ?>
-
-    <div class="form-group">
-        <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
-    </div>
-
-    <?php ActiveForm::end(); ?>
-
-</div>
-
-<?php
-$this->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 (file)
index 1f45d4f..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-use yii\helpers\Html;
-
-/** @var yii\web\View $this */
-/** @var yii_app\records\AdminPositions $model */
-
-$this->title = 'Создание должности сотрудников';
-$this->params['breadcrumbs'][] = ['label' => 'Admin Positions', 'url' => ['index']];
-$this->params['breadcrumbs'][] = $this->title;
-?>
-<div class="admin-positions-create p-4">
-
-    <h1><?= Html::encode($this->title) ?></h1>
-
-    <?= $this->render('_form', [
-        'model' => $model,
-    ]) ?>
-
-</div>
diff --git a/erp24/views/admin-positions/index.php b/erp24/views/admin-positions/index.php
deleted file mode 100644 (file)
index 38ada63..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-use yii_app\records\AdminPositions;
-use yii\helpers\Html;
-use yii\helpers\Url;
-use yii\grid\ActionColumn;
-use yii\grid\GridView;
-
-/** @var yii\web\View $this */
-/** @var yii\data\ActiveDataProvider $dataProvider */
-
-$this->title = 'Должности сотрудников';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-<div class="admin-positions-index p-4">
-
-    <h1><?= Html::encode($this->title) ?></h1>
-
-    <p>
-        <?= Html::a('Добавить должность', ['create'], ['class' => 'btn btn-success']) ?>
-    </p>
-
-
-    <?= GridView::widget([
-        'dataProvider' => $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]);
-                 }
-            ],
-        ],
-    ]); ?>
-
-
-</div>
diff --git a/erp24/views/admin-positions/update.php b/erp24/views/admin-positions/update.php
deleted file mode 100644 (file)
index 1321d77..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-use yii\helpers\Html;
-
-/** @var yii\web\View $this */
-/** @var yii_app\records\AdminPositions $model */
-
-$this->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';
-?>
-<div class="admin-positions-update p-4">
-
-    <h1><?= Html::encode($this->title) ?></h1>
-
-    <?= $this->render('_form', [
-        'model' => $model,
-    ]) ?>
-
-</div>
diff --git a/erp24/views/admin-positions/view.php b/erp24/views/admin-positions/view.php
deleted file mode 100644 (file)
index 7cd6bfd..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-use yii\helpers\Html;
-use yii\widgets\DetailView;
-
-/** @var yii\web\View $this */
-/** @var yii_app\records\AdminPositions $model */
-
-$this->title = $model->name;
-$this->params['breadcrumbs'][] = ['label' => 'Admin Positions', 'url' => ['index']];
-$this->params['breadcrumbs'][] = $this->title;
-\yii\web\YiiAsset::register($this);
-?>
-<div class="admin-positions-view p-4">
-<?= Html::a('Назад', ['index'], ['class' => 'btn btn-primary mb-4']) ?>
-    <h1><?= Html::encode($this->title) ?></h1>
-
-    <p>
-        <?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
-        <?= Html::a('Удалить', ['delete', 'id' => $model->id], [
-            'class' => 'btn btn-danger',
-            'data' => [
-                'confirm' => 'Вы уверены что хотите удалить?',
-                'method' => 'post',
-            ],
-        ]) ?>
-    </p>
-
-    <?= DetailView::widget([
-        'model' => $model,
-        'attributes' => [
-            'id',
-            'name',
-            'alias',
-            'salary',
-            'created_at',
-            'created_by',
-            'updated_at',
-            'updated_by',
-        ],
-    ]) ?>
-
-</div>