From 2bd2aa9fe1061e19f654ff087da98319e7d4f8a2 Mon Sep 17 00:00:00 2001 From: fomichev Date: Thu, 28 Nov 2024 17:27:25 +0300 Subject: [PATCH] =?utf8?q?=D0=98=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5=D0=B9?= =?utf8?q?=D1=81=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8=D1=80=D0=BE?= =?utf8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BD=D0=B0=D0=B8=D0=BC=D0=B5?= =?utf8?q?=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B9=20=D1=81=D0=B2=D0=BE?= =?utf8?q?=D0=B9=D1=81=D1=82=D0=B2=20=D1=82=D0=BE=D0=B2=D0=B0=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../crud/Products1cPropTypeController.php | 144 ++++++++++++++++++ .../views/crud/products1c-prop-type/_form.php | 26 ++++ .../crud/products1c-prop-type/create.php | 20 +++ .../views/crud/products1c-prop-type/index.php | 42 +++++ .../crud/products1c-prop-type/update.php | 21 +++ .../views/crud/products1c-prop-type/view.php | 37 +++++ 6 files changed, 290 insertions(+) create mode 100644 erp24/controllers/crud/Products1cPropTypeController.php create mode 100644 erp24/views/crud/products1c-prop-type/_form.php create mode 100644 erp24/views/crud/products1c-prop-type/create.php create mode 100644 erp24/views/crud/products1c-prop-type/index.php create mode 100644 erp24/views/crud/products1c-prop-type/update.php create mode 100644 erp24/views/crud/products1c-prop-type/view.php diff --git a/erp24/controllers/crud/Products1cPropTypeController.php b/erp24/controllers/crud/Products1cPropTypeController.php new file mode 100644 index 00000000..c891489b --- /dev/null +++ b/erp24/controllers/crud/Products1cPropTypeController.php @@ -0,0 +1,144 @@ + [ + '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 index 00000000..660a5030 --- /dev/null +++ b/erp24/views/crud/products1c-prop-type/_form.php @@ -0,0 +1,26 @@ + + +
+ + + + field($model, 'id')->textInput(['maxlength' => true, 'readonly' => true]) ?> + + field($model, 'name')->textInput(['maxlength' => true]) ?> + +
+ 'btn btn-success']) ?> + +
+ + + +
diff --git a/erp24/views/crud/products1c-prop-type/create.php b/erp24/views/crud/products1c-prop-type/create.php new file mode 100644 index 00000000..9ba786ff --- /dev/null +++ b/erp24/views/crud/products1c-prop-type/create.php @@ -0,0 +1,20 @@ +title = 'Create Products1c Prop Type'; +$this->params['breadcrumbs'][] = ['label' => 'Products1c Prop Types', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/erp24/views/crud/products1c-prop-type/index.php b/erp24/views/crud/products1c-prop-type/index.php new file mode 100644 index 00000000..617c15ae --- /dev/null +++ b/erp24/views/crud/products1c-prop-type/index.php @@ -0,0 +1,42 @@ +title = 'Характеристики товаров'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ 'btn btn-success']) */?> +

+ + + $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]); + } + ], + ], + ]); ?> + + +
diff --git a/erp24/views/crud/products1c-prop-type/update.php b/erp24/views/crud/products1c-prop-type/update.php new file mode 100644 index 00000000..73f6fc40 --- /dev/null +++ b/erp24/views/crud/products1c-prop-type/update.php @@ -0,0 +1,21 @@ +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'; +?> +
+ 'btn btn-danger mb-4']) ?> +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/erp24/views/crud/products1c-prop-type/view.php b/erp24/views/crud/products1c-prop-type/view.php new file mode 100644 index 00000000..85da48eb --- /dev/null +++ b/erp24/views/crud/products1c-prop-type/view.php @@ -0,0 +1,37 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Products1c Prop Types', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ 'btn btn-danger mb-4']) ?> +

Свойство товара: title) ?>

+ +

+ $model->id], ['class' => 'btn btn-primary']) ?> + $model->id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => 'Are you sure you want to delete this item?', + 'method' => 'post', + ], + ]) */?> +

+ + $model, + 'attributes' => [ + 'id', + 'name', + ], + ]) ?> + +
-- 2.39.5