From: marina Date: Tue, 28 Jan 2025 06:34:30 +0000 (+0300) Subject: ERP-282 Нужно сделать интерфейс настройки магазина X-Git-Tag: 1.7~35^2~13 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=c6f33405a91eeb58b5b9af1544a3a8dc282e0aac;p=erp24_rep%2Fyii-erp24%2F.git ERP-282 Нужно сделать интерфейс настройки магазина --- diff --git a/erp24/controllers/CityStoreParamsController.php b/erp24/controllers/CityStoreParamsController.php index f549d26a..c9b1b571 100644 --- a/erp24/controllers/CityStoreParamsController.php +++ b/erp24/controllers/CityStoreParamsController.php @@ -166,8 +166,6 @@ class CityStoreParamsController extends Controller $store = CityStore::findOne($storeId); if (!$store) return ['success' => false, 'message' => 'Магазин не найден']; - $bushId = StoreDynamic::findOne(['store_id' => $storeId, 'category' => 1, 'active' => 1])->value_int ?? null; - return [ 'success' => true, 'data' => [ @@ -185,7 +183,10 @@ class CityStoreParamsController extends Controller 'freezeArea' => $params->freeze_area ?? null, 'freezeVolume' => $params->freeze_volume ?? null, 'matrixType' => !empty($params->matrix_type) ? explode(',', $params->matrix_type) : null, - 'territorialManagerArray' => ArrayHelper::map(Admin::findAll(['id' => StoreDynamic::find()->andWhere(['category' => 3, 'active' => 1])->select('value_int')->column()]), 'id', 'name'), + 'territorialManagerArray' => array_unique(array_merge( + ArrayHelper::map(Admin::findAll(['group_id' => AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name'), + ArrayHelper::map(Admin::findAll(['id' => StoreDynamic::find()->andWhere(['category' => 3, 'active' => 1])->select('value_int')->column()]), 'id', 'name') + ), SORT_REGULAR), '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/views/city-store-params/index.php b/erp24/views/city-store-params/index.php index 8b8598a1..f3cd0a03 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'
-
+
'address_region', 'value' => null, @@ -48,53 +48,109 @@ $this->registerJsFile('/js/city-store-params/city-store-params.js', ['position'
-
- StoreCityList::TYPE_CITY]), 'id', 'name'), - ['prompt' => 'Город', 'class' => 'form-select', 'id' => 'address_city']); +
+ 'address_city', + 'value' => null, + 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_CITY]), 'id', 'name'), + 'options' => [ + 'placeholder' => 'Город', + 'class' => 'form-select', + 'id' => 'address_city', + ], + 'pluginOptions' => [ + 'allowClear' => true, + ], + ]); + ?> + 'd-block mt-2 text-decoration-none']); ?>
-
- StoreCityList::TYPE_DISTRICT]), 'id', 'name'), - ['prompt' => 'Район', 'class' => 'form-select', 'id' => 'address_district']); +
+ 'address_district', + 'value' => null, + 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_DISTRICT]), 'id', 'name'), + 'options' => [ + 'placeholder' => 'Район', + 'class' => 'form-select', + 'id' => 'address_district', + ], + 'pluginOptions' => [ + 'allowClear' => true, + ], + ]); + ?> + 'd-block mt-2 text-decoration-none']); ?>
-
- all(), 'id', 'name'), - ['prompt' => 'Тип магазина', 'class' => 'form-select', 'id' => 'store_type']); +
+ 'store_type', + 'value' => null, + 'data' => ArrayHelper::map(StoreType::find()->all(), 'id', 'name'), + 'options' => [ + 'placeholder' => 'Тип магазина', + 'class' => 'form-select', + 'id' => 'store_type', + ], + 'pluginOptions' => [ + 'allowClear' => true, + ], + ]); ?> 'd-block mt-2 text-decoration-none']); ?>
-
- AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), - ['prompt' => 'Территориального управляющего', 'class' => 'form-select', 'id' => 'territorial_manager']); - ?> +
+ 'territorial_manager', + 'value' => null, + 'data' => ArrayHelper::map(Admin::findAll(['group_id' => AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), + 'options' => [ + 'placeholder' => 'Территориальный управляющий', + 'class' => 'form-select', + 'id' => 'territorial_manager', + ], + 'pluginOptions' => [ + 'allowClear' => true, + ], + ]); ?>
-
- \yii_app\records\AdminGroup::GROUP_BUSH_CHEF_FLORIST]), 'id', 'name_full'), - ['prompt' => 'Кустового шеф флориста', 'class' => 'form-select', 'id' => 'bush_chef_florist']); - ?> +
+ 'bush_chef_florist', + 'value' => null, + 'data' => ArrayHelper::map(Admin::findAll(['group_id' => AdminGroup::GROUP_BUSH_CHEF_FLORIST]), 'id', 'name_full'), + 'options' => [ + 'placeholder' => 'Кустовой шеф-флорист', + 'class' => 'form-select', + 'id' => 'bush_chef_florist', + ], + 'pluginOptions' => [ + 'allowClear' => true, + ], + ]); ?>
-
-
-
-
-
+
+ session->hasFlash($flash)): ?> + session->getFlash($flash), [ + 'class' => 'alert text-center flash-message mb-1 py-1 alert-' . Html::encode($flash), + ]) ?> + +
'btn btn-primary w-100', 'id' => 'apply-button']); ?> @@ -119,11 +175,6 @@ $this->registerJsFile('/js/city-store-params/city-store-params.js', ['position' 'btn btn-primary w-100 mt-2 py-1', 'id' => 'edit-button']); ?>
- session->hasFlash($flash)): ?> - session->getFlash($flash), [ - 'class' => 'alert text-center flash-message alert-' . Html::encode($flash), - ]) ?> -
@@ -134,7 +185,19 @@ $this->registerJsFile('/js/city-store-params/city-store-params.js', ['position'
- 'Тип магазина', 'class' => 'form-select', 'id' => 'store-type']); ?> + 'CityStoreParams[store_type]', + 'value' => null, + 'data' => [], + 'options' => [ + 'placeholder' => 'Тип магазина', + 'class' => 'form-select', + 'id' => 'store-type' + ], + 'pluginOptions' => [ + 'allowClear' => true, + ], + ]); ?> 'd-block mt-2 text-decoration-none']); ?>
@@ -144,15 +207,51 @@ $this->registerJsFile('/js/city-store-params/city-store-params.js', ['position'
- 'Регион', 'class' => 'form-select', 'id' => 'region']); ?> + 'CityStoreParams[address_region]', + 'value' => null, + 'data' => [], + 'options' => [ + 'placeholder' => 'Регион', + 'class' => 'form-select', + 'id' => 'region', + ], + 'pluginOptions' => [ + 'allowClear' => true, + ], + ]); ?>
- 'Город', 'class' => 'form-select', 'id' => 'city']); ?> + 'CityStoreParams[address_city]', + 'value' => null, + 'data' => [], + 'options' => [ + 'placeholder' => 'Город', + 'class' => 'form-select', + 'id' => 'city', + ], + 'pluginOptions' => [ + 'allowClear' => true, + ], + ]); ?>
- 'Район', 'class' => 'form-select', 'id' => 'district']); ?> + 'CityStoreParams[address_district]', + 'value' => null, + 'data' => [], + 'options' => [ + 'placeholder' => 'Район', + 'class' => 'form-select', + 'id' => 'district', + ], + 'pluginOptions' => [ + 'allowClear' => true, + ], + ]); ?>
@@ -161,7 +260,19 @@ $this->registerJsFile('/js/city-store-params/city-store-params.js', ['position' 'd-block mb-5 text-decoration-none']); ?>
- 'Территориально управляющий', 'class' => 'form-select', 'id' => 'territorial-manager']); ?> + 'CityStoreParams[territorial_manager]', + 'value' => null, + 'data' => [], + 'options' => [ + 'placeholder' => 'Территориально управляющий', + 'class' => 'form-select', + 'id' => 'territorial-manager', + ], + 'pluginOptions' => [ + 'allowClear' => true, + ], + ]); ?>
@@ -169,7 +280,19 @@ $this->registerJsFile('/js/city-store-params/city-store-params.js', ['position'
- 'Кустовой шеф-флорист', 'class' => 'form-select', 'id' => 'bush-chef-florist']); ?> + 'CityStoreParams[bush_chef_florist]', + 'value' => null, + 'data' => ArrayHelper::map(Admin::findAll(['group_id' => AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), + 'options' => [ + 'placeholder' => 'Кустовой шеф-флорист', + 'class' => 'form-select', + 'id' => 'bush-chef-florist', + ], + 'pluginOptions' => [ + 'allowClear' => true, + ], + ]); ?>
diff --git a/erp24/web/js/city-store-params/city-store-params.js b/erp24/web/js/city-store-params/city-store-params.js index 8e156545..ac65c58a 100644 --- a/erp24/web/js/city-store-params/city-store-params.js +++ b/erp24/web/js/city-store-params/city-store-params.js @@ -128,24 +128,16 @@ function validateDecimal(input) { input.value = value; } - $(document).ready(function () { - if ($('.flash-message').length) { - sessionStorage.setItem('flashMessage', $('.flash-message').html()); - } - - if ($('#selected-store').val()?.length > 0) { + if ($('#selected-store').val().length > 0) { $('#edit-button').click(); } - if (sessionStorage.getItem('flashMessage')) { - $('body').prepend('
' + sessionStorage.getItem('flashMessage') + '
'); - sessionStorage.removeItem('flashMessage'); + if ($('.flash-message').hasClass('alert-info') || $('.flash-message').hasClass('alert-success')) { + setTimeout(function () { + $('.flash-message').fadeOut(2000, function() { + $(this).remove(); + }); + }, 5000); } -}); - - - - - - +}); \ No newline at end of file