]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Интерфейс редактирования наименований свойств товара
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 28 Nov 2024 14:27:25 +0000 (17:27 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 28 Nov 2024 14:27:25 +0000 (17:27 +0300)
erp24/controllers/crud/Products1cPropTypeController.php [new file with mode: 0644]
erp24/views/crud/products1c-prop-type/_form.php [new file with mode: 0644]
erp24/views/crud/products1c-prop-type/create.php [new file with mode: 0644]
erp24/views/crud/products1c-prop-type/index.php [new file with mode: 0644]
erp24/views/crud/products1c-prop-type/update.php [new file with mode: 0644]
erp24/views/crud/products1c-prop-type/view.php [new file with mode: 0644]

diff --git a/erp24/controllers/crud/Products1cPropTypeController.php b/erp24/controllers/crud/Products1cPropTypeController.php
new file mode 100644 (file)
index 0000000..c891489
--- /dev/null
@@ -0,0 +1,144 @@
+<?php
+
+namespace yii_app\controllers\crud;
+
+use yii_app\records\Products1cPropType;
+use yii\data\ActiveDataProvider;
+use yii\web\Controller;
+use yii\web\NotFoundHttpException;
+use yii\filters\VerbFilter;
+
+/**
+ * Products1cPropTypeController implements the CRUD actions for Products1cPropType model.
+ */
+class Products1cPropTypeController extends Controller
+{
+    /**
+     * @inheritDoc
+     */
+    public function behaviors()
+    {
+        return array_merge(
+            parent::behaviors(),
+            [
+                'verbs' => [
+                    'class' => VerbFilter::className(),
+                    'actions' => [
+                        'delete' => ['POST'],
+                    ],
+                ],
+            ]
+        );
+    }
+
+    /**
+     * Lists all Products1cPropType models.
+     *
+     * @return string
+     */
+    public function actionIndex()
+    {
+        $dataProvider = new ActiveDataProvider([
+            'query' => Products1cPropType::find(),
+            /*
+            'pagination' => [
+                'pageSize' => 50
+            ],
+            'sort' => [
+                'defaultOrder' => [
+                    'id' => SORT_DESC,
+                ]
+            ],
+            */
+        ]);
+
+        return $this->render('index', [
+            'dataProvider' => $dataProvider,
+        ]);
+    }
+
+    /**
+     * Displays a single Products1cPropType model.
+     * @param string $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 Products1cPropType model.
+     * If creation is successful, the browser will be redirected to the 'view' page.
+     * @return string|\yii\web\Response
+     */
+    public function actionCreate()
+    {
+        $model = new Products1cPropType();
+
+        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 Products1cPropType model.
+     * If update is successful, the browser will be redirected to the 'view' page.
+     * @param string $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 Products1cPropType model.
+     * If deletion is successful, the browser will be redirected to the 'index' page.
+     * @param string $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 Products1cPropType model based on its primary key value.
+     * If the model is not found, a 404 HTTP exception will be thrown.
+     * @param string $id ID
+     * @return Products1cPropType the loaded model
+     * @throws NotFoundHttpException if the model cannot be found
+     */
+    protected function findModel($id)
+    {
+        if (($model = Products1cPropType::findOne(['id' => $id])) !== null) {
+            return $model;
+        }
+
+        throw new NotFoundHttpException('The requested page does not exist.');
+    }
+}
diff --git a/erp24/views/crud/products1c-prop-type/_form.php b/erp24/views/crud/products1c-prop-type/_form.php
new file mode 100644 (file)
index 0000000..660a503
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\Products1cPropType $model */
+/** @var yii\widgets\ActiveForm $form */
+?>
+
+<div class="products1c-prop-type-form">
+
+    <?php $form = ActiveForm::begin(); ?>
+
+    <?= $form->field($model, 'id')->textInput(['maxlength' => true, 'readonly' => true]) ?>
+
+    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
+
+    <div class="form-group">
+        <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
+
+    </div>
+
+    <?php ActiveForm::end(); ?>
+
+</div>
diff --git a/erp24/views/crud/products1c-prop-type/create.php b/erp24/views/crud/products1c-prop-type/create.php
new file mode 100644 (file)
index 0000000..9ba786f
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+
+use yii\helpers\Html;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\Products1cPropType $model */
+
+$this->title = 'Create Products1c Prop Type';
+$this->params['breadcrumbs'][] = ['label' => 'Products1c Prop Types', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="products1c-prop-type-create">
+
+    <h1><?= Html::encode($this->title) ?></h1>
+
+    <?= $this->render('_form', [
+        'model' => $model,
+    ]) ?>
+
+</div>
diff --git a/erp24/views/crud/products1c-prop-type/index.php b/erp24/views/crud/products1c-prop-type/index.php
new file mode 100644 (file)
index 0000000..617c15a
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+
+use yii_app\records\Products1cPropType;
+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="products1c-prop-type-index p-4">
+
+    <h1><?= Html::encode($this->title) ?></h1>
+
+    <p>
+        <?php /*= Html::a('Создать', ['create'], ['class' => 'btn btn-success']) */?>
+    </p>
+
+
+    <?= GridView::widget([
+        'dataProvider' => $dataProvider,
+        'columns' => [
+            ['class' => 'yii\grid\SerialColumn'],
+
+            'id',
+            'name',
+            [
+                'class' => ActionColumn::class,
+                'template' => '{view} {update}',
+                'urlCreator' => function ($action, Products1cPropType $model, $key, $index, $column) {
+                    return Url::toRoute([$action, 'id' => $model->id]);
+                 }
+            ],
+        ],
+    ]); ?>
+
+
+</div>
diff --git a/erp24/views/crud/products1c-prop-type/update.php b/erp24/views/crud/products1c-prop-type/update.php
new file mode 100644 (file)
index 0000000..73f6fc4
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+use yii\helpers\Html;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\Products1cPropType $model */
+
+$this->title = 'Редактирование свойства товара: ' . $model->name;
+$this->params['breadcrumbs'][] = ['label' => 'Products1c Prop Types', 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
+$this->params['breadcrumbs'][] = 'Update';
+?>
+<div class="products1c-prop-type-update p-4">
+    <?= Html::a('Назад', ['index'], ['class' => 'btn btn-danger mb-4']) ?>
+    <h1><?= Html::encode($this->title) ?></h1>
+
+    <?= $this->render('_form', [
+        'model' => $model,
+    ]) ?>
+
+</div>
diff --git a/erp24/views/crud/products1c-prop-type/view.php b/erp24/views/crud/products1c-prop-type/view.php
new file mode 100644 (file)
index 0000000..85da48e
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\DetailView;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\Products1cPropType $model */
+
+$this->title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => 'Products1c Prop Types', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+\yii\web\YiiAsset::register($this);
+?>
+<div class="products1c-prop-type-view p-4">
+    <?= Html::a('Назад', ['index'], ['class' => 'btn btn-danger mb-4']) ?>
+    <h1>Свойство товара: <?= Html::encode($this->title) ?></h1>
+
+    <p>
+        <?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
+        <?php /*= Html::a('Delete', ['delete', 'id' => $model->id], [
+            'class' => 'btn btn-danger',
+            'data' => [
+                'confirm' => 'Are you sure you want to delete this item?',
+                'method' => 'post',
+            ],
+        ]) */?>
+    </p>
+
+    <?= DetailView::widget([
+        'model' => $model,
+        'attributes' => [
+            'id',
+            'name',
+        ],
+    ]) ?>
+
+</div>