--- /dev/null
+<?php
+
+namespace app\controllers;
+
+use yii\data\ActiveDataProvider;
+use yii\filters\VerbFilter;
+use yii\web\Controller;
+use yii\web\NotFoundHttpException;
+use yii_app\records\StoresTypeList;
+
+/**
+ * StoresTypeListController implements the CRUD actions for StoresTypeList model.
+ */
+class StoresTypeListController extends Controller
+{
+ /**
+ * @inheritDoc
+ */
+ public function behaviors()
+ {
+ return array_merge(
+ parent::behaviors(),
+ [
+ 'verbs' => [
+ 'class' => VerbFilter::class,
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ]
+ );
+ }
+
+ /**
+ * Lists all StoresTypeList models.
+ *
+ * @return string
+ */
+ public function actionIndex()
+ {
+ $dataProvider = new ActiveDataProvider([
+ 'query' => StoresTypeList::find(),
+ /*
+ 'pagination' => [
+ 'pageSize' => 50
+ ],
+ 'sort' => [
+ 'defaultOrder' => [
+ 'id' => SORT_DESC,
+ ]
+ ],
+ */
+ ]);
+
+ return $this->render('index', [
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single StoresTypeList 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 StoresTypeList model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return string|\yii\web\Response
+ */
+ public function actionCreate()
+ {
+ $model = new StoresTypeList();
+
+ 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 StoresTypeList 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 StoresTypeList 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 StoresTypeList 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 StoresTypeList the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = StoresTypeList::findOne(['id' => $id])) !== null) {
+ return $model;
+ }
+
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+}
--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%stores_type_list}}`.
+ */
+class m250115_114940_create_stores_type_list_table extends Migration
+{
+ const TABLE_NAME = 'erp24.stores_type_list';
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+
+ if (!isset($tableSchema)) {
+ $this->createTable(self::TABLE_NAME, [
+ 'id' => $this->bigPrimaryKey()->comment('ID'),
+ 'type_name' => $this->string()->notNull()->comment('Наименование типа магазина'),
+ 'type_alias' => $this->string()->notNull()->comment('Алиас типа магазина'),
+ 'type_description' => $this->string()->null()->comment('Описание типа магазина'),
+ 'created_at' => $this->dateTime()
+ ->notNull()
+ ->defaultExpression('CURRENT_TIMESTAMP')
+ ->comment('Дата создания записи'),
+ ]);
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+ if (isset($tableSchema)) {
+ $this->dropTable(self::TABLE_NAME);
+ }
+ }
+}
--- /dev/null
+<?php
+
+namespace yii_app\records;
+
+use Yii;
+
+/**
+ * This is the model class for table "stores_type_list".
+ *
+ * @property int $id ID
+ * @property string $type_name Наименование типа магазина
+ * @property string $type_alias Алиас типа магазина
+ * @property string|null $type_description Описание типа магазина
+ * @property string $created_at Дата создания записи
+ */
+class StoresTypeList extends \yii\db\ActiveRecord
+{
+ /**
+ * {@inheritdoc}
+ */
+ public static function tableName()
+ {
+ return 'stores_type_list';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['type_name', 'type_alias'], 'required'],
+ [['created_at'], 'safe'],
+ [['type_name', 'type_alias', 'type_description'], 'string', 'max' => 255],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => 'ID',
+ 'type_name' => 'Наименование типа магазина',
+ 'type_alias' => 'Алиас типа магазина',
+ 'type_description' => 'Описание типа магазина',
+ 'created_at' => 'Дата создания записи',
+ ];
+ }
+}
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\StoresTypeList $model */
+/** @var yii\widgets\ActiveForm $form */
+?>
+
+<div class="stores-type-list-form">
+
+ <?php $form = ActiveForm::begin(); ?>
+
+ <?= $form->field($model, 'type_name')->textInput(['maxlength' => true]) ?>
+
+ <?= $form->field($model, 'type_alias')->textInput(['maxlength' => true]) ?>
+
+ <?= $form->field($model, 'type_description')->textInput(['maxlength' => true]) ?>
+
+
+ <div class="form-group">
+ <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
+ </div>
+
+ <?php ActiveForm::end(); ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\StoresTypeList $model */
+
+$this->title = 'Создание типа магазина';
+$this->params['breadcrumbs'][] = ['label' => 'Stores Type Lists', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="stores-type-list-create p-4">
+ <?= Html::a('Назад', ['index'], ['class' => 'btn btn-primary m-5']) ?>
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <?= $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii_app\records\StoresTypeList;
+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="stores-type-list-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',
+ 'type_name',
+ 'type_alias',
+ 'type_description',
+ 'created_at',
+ [
+ 'class' => ActionColumn::class,
+ 'urlCreator' => function ($action, StoresTypeList $model, $key, $index, $column) {
+ return Url::toRoute([$action, 'id' => $model->id]);
+ }
+ ],
+ ],
+ ]); ?>
+
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\StoresTypeList $model */
+
+$this->title = 'Редактирование типа магазина: ' . $model->type_name;
+$this->params['breadcrumbs'][] = ['label' => 'Stores Type Lists', 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
+$this->params['breadcrumbs'][] = 'Update';
+?>
+<div class="stores-type-list-update p-4">
+ <?= Html::a('Назад', ['index'], ['class' => 'btn btn-primary m-5']) ?>
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <?= $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\DetailView;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\StoresTypeList $model */
+
+$this->title = 'Тип магазина: ' . $model->type_name;
+$this->params['breadcrumbs'][] = ['label' => 'Stores Type Lists', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+\yii\web\YiiAsset::register($this);
+?>
+<div class="stores-type-list-view p-4">
+ <?= Html::a('Назад', ['index'], ['class' => 'btn btn-primary m-5']) ?>
+ <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',
+ 'type_name',
+ 'type_alias',
+ 'type_description',
+ 'created_at',
+ ],
+ ]) ?>
+
+</div>