From: marina Date: Tue, 21 Jan 2025 12:14:33 +0000 (+0300) Subject: ERP-282 Нужно сделать интерфейс настройки магазина X-Git-Tag: 1.7~35^2~40 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=74b8e3d5437c1c87da43349bf8f26b62af5271fe;p=erp24_rep%2Fyii-erp24%2F.git ERP-282 Нужно сделать интерфейс настройки магазина --- diff --git a/erp24/composer.json b/erp24/composer.json index d8d2dae3..6fc06647 100644 --- a/erp24/composer.json +++ b/erp24/composer.json @@ -34,7 +34,8 @@ "kartik-v/yii2-grid": "@dev", "kartik-v/yii2-widget-datepicker": "dev-master", "phpoffice/phpspreadsheet": "^2.2", - "ext-xmlreader": "*" + "ext-xmlreader": "*", + "softark/yii2-dual-listbox": "^1.0" }, "require-dev": { "yiisoft/yii2-debug": "~2.1.0", diff --git a/erp24/controllers/CityStoreParamsController.php b/erp24/controllers/CityStoreParamsController.php new file mode 100644 index 00000000..b8987a8e --- /dev/null +++ b/erp24/controllers/CityStoreParamsController.php @@ -0,0 +1,110 @@ + [ + 'class' => VerbFilter::class, + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + } + + /** + * Список всех записей + * @return mixed + */ + public function actionIndex() + { + $dataProvider = new ActiveDataProvider([ + 'query' => CityStoreParams::find(), + ]); + + return $this->render('index', [ + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Просмотр конкретной записи + * @param int $id + * @return mixed + * @throws NotFoundHttpException + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Создание новой записи + * @return mixed + */ + public function actionCreate() + { + $model = new CityStoreParams(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Обновление существующей записи + * @param int $id + * @return mixed + * @throws NotFoundHttpException + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + /** + * Находит модель по первичному ключу + * @param int $id + * @return CityStoreParams + * @throws NotFoundHttpException + */ + protected function findModel($id) + { + if (($model = CityStoreParams::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } +} diff --git a/erp24/migrations/m250116_063609_create_city_store_params_table.php b/erp24/migrations/m250116_063609_create_city_store_params_table.php new file mode 100644 index 00000000..3506658e --- /dev/null +++ b/erp24/migrations/m250116_063609_create_city_store_params_table.php @@ -0,0 +1,43 @@ +createTable('{{%erp24.city_store_params}}', [ + 'id' => $this->primaryKey(), + 'store_id' => $this->integer()->notNull()->comment('ИД Магазина'), + 'stores_type' => $this->integer()->comment('Тип магазина'), + 'address_city' => $this->text()->comment('Город, где расположен магазин'), + 'address_region' => $this->text()->comment('Регион, где расположен магазин'), + 'address_district' => $this->text()->comment('Район, где расположен магазин'), + 'territorial_manager' => $this->integer()->comment('Территориально управляющий'), + 'bush_chef_florist' => $this->integer()->comment('Кустовой шеф-флорист'), + 'store_area' => $this->float()->comment('Площадь магазина'), + 'showcase_volume' => $this->float()->comment('Объем витрины'), + 'freeze_area' => $this->float()->comment('Площадь холодильника'), + 'freeze_volume' => $this->float()->comment('Объем холодильника'), + 'matrix_type' => $this->string()->comment('Тип матрицы'), + 'created_by' => $this->integer()->notNull()->comment('ИД создателя'), + 'created_at' => $this->timestamp()->notNull()->comment('Дата создания'), + 'updated_by' => $this->integer()->null()->comment('ИД редактировавшего'), + 'updated_at' => $this->timestamp()->null()->comment('Дата обновления') + ]); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropTable('{{%erp24.city_store_params}}'); + } +} diff --git a/erp24/records/AdminGroup.php b/erp24/records/AdminGroup.php index 1a5ff1ab..e9b87abd 100755 --- a/erp24/records/AdminGroup.php +++ b/erp24/records/AdminGroup.php @@ -30,6 +30,8 @@ class AdminGroup extends ActiveRecord const GROUP_WORKERS_ARCHIVE = 90; const GROUP_ADMINISTRATORS = 50; const GROUP_FLORIST_SUPPORT_NIGHT = 72; + const GROUP_BUSH_CHEF_FLORIST = 18; + const GROUP_BUSH_DIRECTOR = 7; const GROUP_OPERATIONAL_DIRECTOR = 51; const GROUP_IT = 81; const GROUP_FINANCE_DIRECTOR = 9; diff --git a/erp24/records/CityStoreParams.php b/erp24/records/CityStoreParams.php new file mode 100644 index 00000000..8ef05165 --- /dev/null +++ b/erp24/records/CityStoreParams.php @@ -0,0 +1,78 @@ + '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' => 'Дата обновления', + ]; + } +} diff --git a/erp24/views/city-store-params/_form.php b/erp24/views/city-store-params/_form.php new file mode 100644 index 00000000..659e299c --- /dev/null +++ b/erp24/views/city-store-params/_form.php @@ -0,0 +1,45 @@ + + +
+ + + + field($model, 'store_id')->textInput() ?> + + field($model, 'stores_type')->textInput() ?> + + field($model, 'address_city')->textInput() ?> + + field($model, 'address_region')->textInput() ?> + + field($model, 'address_district')->textInput() ?> + + field($model, 'territorial_manager')->textInput() ?> + + field($model, 'bush_chef_florist')->textInput() ?> + + field($model, 'store_area')->textInput() ?> + + field($model, 'showcase_volume')->textInput() ?> + + field($model, 'freeze_area')->textInput() ?> + + field($model, 'freeze_volume')->textInput() ?> + + field($model, 'matrix_type')->textInput() ?> + +
+ isNewRecord ? 'Create' : 'Save', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/erp24/views/city-store-params/create.php b/erp24/views/city-store-params/create.php new file mode 100644 index 00000000..d205694d --- /dev/null +++ b/erp24/views/city-store-params/create.php @@ -0,0 +1,20 @@ +title = 'Create City Store Param'; +$this->params['breadcrumbs'][] = ['label' => 'City Store Params', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/erp24/views/city-store-params/index.php b/erp24/views/city-store-params/index.php new file mode 100644 index 00000000..0e24789d --- /dev/null +++ b/erp24/views/city-store-params/index.php @@ -0,0 +1,190 @@ +title = 'City Store Params'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+
+
+ all(), 'id_city', 'city_name_ru'), ['prompt' => 'Выберите город', 'class' => 'form-select']); ?> +
+
+ +
+
+ where(['!=', 'region_name', ''])->all(), 'id_region', 'region_name'), ['prompt' => 'Выберите регион', 'class' => 'form-select']); ?> + 'd-block mt-2 text-decoration-none']); ?> +
+
+ +
+
+ where(['!=', 'region_name', ''])->all(), 'id_region', 'region_name'), ['prompt' => 'Выберите район', 'class' => 'form-select']); ?> +
+
+ +
+
+ where(['!=', 'region_name', ''])->all(), 'id_region', 'region_name'), ['prompt' => 'Выберите тип магазина', 'class' => 'form-select']); ?> + 'd-block mt-2 text-decoration-none']); ?> +
+
+ +
+
+ \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Выберите территориального управляющего', 'class' => 'form-select']); ?> +
+
+
+ +
+
+ +
+ +
+ +
+
+ \yii_app\records\AdminGroup::GROUP_BUSH_CHEF_FLORIST]), 'id', 'name_full'), ['prompt' => 'Выберите кустового шеф флориста', 'class' => 'form-select']); ?> +
+
+ +
+ +
+
+ 'btn btn-primary w-100']); ?> +
+
+
+
+ + +
+
+
+
+ 'Option 1', + '2' => 'Option 2', + '3' => 'Option 3', + '4' => 'Option 4', + ], [ + 'multiple' => true, + 'size' => 10, // Количество отображаемых строк + 'class' => 'form-control', // Стиль для кнопки + 'id' => 'selectedValues', // ID для элемента + ]) ?> +
+
+
+
+
+
+
+ +
+
+ \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Тип магазина', 'class' => 'form-select']); ?> + 'd-block mt-2 text-decoration-none']); ?> +
+
+
+
+ 'h5']) ?> +
+
+ + \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?> +
+
+ + \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?> +
+
+ + \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?> +
+
+
+
+ + 'd-block mb-5 text-decoration-none']); ?> + +
+
+ \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?> +
+
+
+
+ + 'd-block mb-5 text-decoration-none']); ?> + +
+
+ \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?> +
+
+
+ +
+ + 'form-label']); ?> + \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?> + + + 'form-label']); ?> + \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?> + + + 'form-label']); ?> + \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?> + + + 'form-label']); ?> + \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?> +
+ + +
+
+ 'matrix_type', + 'items' => \yii\helpers\ArrayHelper::map( + \yii_app\api3\modules\v1\models\Admin::findAll(['group_id' => \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), + 'id', 'name_full' + ), + 'options' => [ + 'size' => false + ], + 'clientOptions' => [ + 'moveOnSelect' => false, + 'nonSelectedListLabel' => "Тип матрицы
" . Html::a('Редактировать', '#'), // Перенос строки с ссылкой + 'selectedListLabel' => " 

", + 'showFilterInputs' => false, + 'clearButton' => false, + ], + ]); ?> +
+
+
+ +
+
+
+
+ + +title = 'Update City Store Param: ' . $model->id; +$this->params['breadcrumbs'][] = ['label' => 'City Store Params', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/erp24/views/city-store-params/view.php b/erp24/views/city-store-params/view.php new file mode 100644 index 00000000..ca6ae92d --- /dev/null +++ b/erp24/views/city-store-params/view.php @@ -0,0 +1,31 @@ +title = 'View City Store Param: ' . $model->id; +$this->params['breadcrumbs'][] = ['label' => 'City Store Params', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ $model->id], ['class' => 'btn btn-primary']) ?> +

+ + + + + + + + + + + +
IDid) ?>
Store IDstore_id) ?>
+