From 7aa76bb29a9e0a5dad6ff02206d92cec0375ef12 Mon Sep 17 00:00:00 2001 From: marina Date: Thu, 23 Jan 2025 16:31:35 +0300 Subject: [PATCH] =?utf8?q?ERP-282=20=D0=9D=D1=83=D0=B6=D0=BD=D0=BE=20?= =?utf8?q?=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D1=82=D1=8C=20=D0=B8=D0=BD=D1=82?= =?utf8?q?=D0=B5=D1=80=D1=84=D0=B5=D0=B9=D1=81=20=D0=BD=D0=B0=D1=81=D1=82?= =?utf8?q?=D1=80=D0=BE=D0=B9=D0=BA=D0=B8=20=D0=BC=D0=B0=D0=B3=D0=B0=D0=B7?= =?utf8?q?=D0=B8=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../controllers/CityStoreParamsController.php | 4 + erp24/controllers/StoreTypeController.php | 73 +++++++++++++++++++ erp24/views/city-store-params/index.php | 2 +- erp24/views/city-store-params/view.php | 58 +++++++++++---- erp24/views/store-type/create.php | 28 +++++++ erp24/views/store-type/index.php | 44 +++++++++++ erp24/views/store-type/update.php | 28 +++++++ erp24/views/store-type/view.php | 40 ++++++++++ 8 files changed, 261 insertions(+), 16 deletions(-) create mode 100644 erp24/controllers/StoreTypeController.php create mode 100644 erp24/views/store-type/create.php create mode 100644 erp24/views/store-type/index.php create mode 100644 erp24/views/store-type/update.php create mode 100644 erp24/views/store-type/view.php diff --git a/erp24/controllers/CityStoreParamsController.php b/erp24/controllers/CityStoreParamsController.php index bf8df638..b0565ef7 100644 --- a/erp24/controllers/CityStoreParamsController.php +++ b/erp24/controllers/CityStoreParamsController.php @@ -49,6 +49,9 @@ class CityStoreParamsController extends Controller : new CityStoreParams(); if ($model->load(Yii::$app->request->post())) { + if (is_array($model->matrix_type)) { + $model->matrix_type = implode(',', $model->matrix_type); + } if ($model->validate()) { $model->save(); return $this->redirect(['view', 'id' => $model->id]); @@ -182,6 +185,7 @@ class CityStoreParamsController extends Controller 'showcaseVolume' => $params->showcase_volume ?? null, 'freezeArea' => $params->freeze_area ?? null, 'freezeVolume' => $params->freeze_volume ?? null, + 'matrixType' => $params->matrix_type ?? null, 'storeTypeArray' => ArrayHelper::map(StoreType::find()->all(), 'id', 'name'), 'regionArray' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_REGION]), 'id', 'name'), 'cityArray' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_CITY]), 'id', 'name'), diff --git a/erp24/controllers/StoreTypeController.php b/erp24/controllers/StoreTypeController.php new file mode 100644 index 00000000..52249124 --- /dev/null +++ b/erp24/controllers/StoreTypeController.php @@ -0,0 +1,73 @@ +all(); + return $this->render('index', [ + 'storeTypes' => $storeTypes, + ]); + } + + public function actionCreate() + { + $model = new StoreType(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + Yii::$app->session->setFlash('success', 'Тип магазина успешно создан!'); + return $this->redirect(['index']); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + Yii::$app->session->setFlash('success', 'Тип магазина успешно обновлен!'); + return $this->redirect(['index']); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + public function actionDelete($id) + { + $this->findModel($id)->delete(); + Yii::$app->session->setFlash('success', 'Тип магазина удален!'); + return $this->redirect(['index']); + } + + public function actionView($id) + { + $model = $this->findModel($id); + + return $this->render('view', [ + 'model' => $model, + ]); + } + + protected function findModel($id) + { + if (($model = StoreType::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('Тип магазина не найден!'); + } +} diff --git a/erp24/views/city-store-params/index.php b/erp24/views/city-store-params/index.php index 11a3db41..a92efd2f 100644 --- a/erp24/views/city-store-params/index.php +++ b/erp24/views/city-store-params/index.php @@ -27,7 +27,7 @@ $this->registerJsFile('/js/city-store-params/city-store-params.js', ['position' ['prompt' => 'Выберите регион', 'class' => 'form-select', 'id' => 'address_region']); ?> 'd-block mt-2 text-decoration-none']); + Url::to('/store-city-list')], ['class' => 'd-block mt-2 text-decoration-none']); ?> diff --git a/erp24/views/city-store-params/view.php b/erp24/views/city-store-params/view.php index ca6ae92d..dbf9c58e 100644 --- a/erp24/views/city-store-params/view.php +++ b/erp24/views/city-store-params/view.php @@ -1,31 +1,59 @@ title = 'View City Store Param: ' . $model->id; -$this->params['breadcrumbs'][] = ['label' => 'City Store Params', 'url' => ['index']]; +$this->title = "Параметры магазина: " . $model->store_id; +$this->params['breadcrumbs'][] = ['label' => 'Параметры магазинов', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> +

title) ?>

+ +
+
Детали параметров магазина
+
+ $model, + 'attributes' => [ + 'id', + 'store_id', + 'stores_type', + 'address_city', + 'address_region', + 'address_district', + 'territorial_manager', + 'bush_chef_florist', + 'store_area', + 'showcase_volume', + 'freeze_area', + 'freeze_volume', + 'matrix_type', + 'created_by', + 'created_at', + 'updated_by', + 'updated_at', + ], + ]) ?> +
+
+

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

- - - - - - - - - - -
IDid) ?>
Store IDstore_id) ?>
diff --git a/erp24/views/store-type/create.php b/erp24/views/store-type/create.php new file mode 100644 index 00000000..d08fc283 --- /dev/null +++ b/erp24/views/store-type/create.php @@ -0,0 +1,28 @@ +title = 'Создать тип магазина'; +$this->params['breadcrumbs'][] = ['label' => 'Типы магазинов', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + + + field($model, 'name')->textInput(['maxlength' => true]) ?> + +
+ 'btn btn-success']) ?> +
+ + + +
diff --git a/erp24/views/store-type/index.php b/erp24/views/store-type/index.php new file mode 100644 index 00000000..43c91e1e --- /dev/null +++ b/erp24/views/store-type/index.php @@ -0,0 +1,44 @@ +title = 'Типы магазинов'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

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

+ + new yii\data\ArrayDataProvider([ + 'allModels' => $storeTypes, + ]), + 'columns' => [ + 'id', + 'name', + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{update} {delete}', + 'buttons' => [ + 'update' => function ($url, $model) { + return Html::a('Редактировать', ['update', 'id' => $model->id]); + }, + 'delete' => function ($url, $model) { + return Html::a('Удалить', ['delete', 'id' => $model->id], [ + 'data' => [ + 'confirm' => 'Вы уверены, что хотите удалить этот тип магазина?', + 'method' => 'post', + ], + ]); + }, + ], + ], + ], + ]); ?> +
diff --git a/erp24/views/store-type/update.php b/erp24/views/store-type/update.php new file mode 100644 index 00000000..ebbb734f --- /dev/null +++ b/erp24/views/store-type/update.php @@ -0,0 +1,28 @@ +title = 'Редактировать тип магазина: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Типы магазинов', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + + + field($model, 'name')->textInput(['maxlength' => true]) ?> + +
+ 'btn btn-success']) ?> +
+ + + +
diff --git a/erp24/views/store-type/view.php b/erp24/views/store-type/view.php new file mode 100644 index 00000000..7c0b399a --- /dev/null +++ b/erp24/views/store-type/view.php @@ -0,0 +1,40 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Типы магазинов', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + $model, + 'attributes' => [ + 'id', + 'name', + 'created_by', + 'created_at', + 'updated_by', + 'updated_at', + ], + ]) ?> + +

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

+ +
-- 2.39.5