From: marina Date: Thu, 23 Jan 2025 13:31:35 +0000 (+0300) Subject: ERP-282 Нужно сделать интерфейс настройки магазина X-Git-Tag: 1.7~35^2~32 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=7aa76bb29a9e0a5dad6ff02206d92cec0375ef12;p=erp24_rep%2Fyii-erp24%2F.git ERP-282 Нужно сделать интерфейс настройки магазина --- 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', + ], + ]) ?> +

+ +