From: marina Date: Fri, 24 Jan 2025 09:08:54 +0000 (+0300) Subject: ERP-282 Нужно сделать интерфейс настройки магазина X-Git-Tag: 1.7~35^2~19 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=c6874f02e544041de37b336b8533adf306f751b9;p=erp24_rep%2Fyii-erp24%2F.git ERP-282 Нужно сделать интерфейс настройки магазина --- diff --git a/erp24/controllers/CityStoreParamsController.php b/erp24/controllers/CityStoreParamsController.php index e8995e5c..51050cd9 100644 --- a/erp24/controllers/CityStoreParamsController.php +++ b/erp24/controllers/CityStoreParamsController.php @@ -138,12 +138,13 @@ class CityStoreParamsController extends Controller ->andFilterWhere([ 'visible' => CityStore::IS_VISIBLE, 'city' => $addressCity, - 'district' => $addressRegion, - 'type' => $addressDistrict, + 'region' => $addressRegion, + 'district' => $addressDistrict, 'type' => $storeType, ]) ->andFilterWhere(['in', 'id', $bushChefFloristStoreIds]) ->andFilterWhere(['in', 'id', $territorialManagerStoreIds]) + ->orderBy('id') ->all(); return [ diff --git a/erp24/views/city-store-params/index.php b/erp24/views/city-store-params/index.php index 03379c6d..b923ae26 100644 --- a/erp24/views/city-store-params/index.php +++ b/erp24/views/city-store-params/index.php @@ -6,6 +6,7 @@ use yii\helpers\Html; use yii\helpers\Url; use yii_app\records\Admin; use yii_app\records\AdminGroup; +use yii_app\records\CityStore; use yii_app\records\StoreCityList; use yii_app\records\StoreType; @@ -95,12 +96,15 @@ $this->registerJsFile('/js/city-store-params/city-store-params.js', ['position'
all(), 'id', 'name'), [ - 'multiple' => true, - 'size' => 16, - 'class' => 'form-control', - 'id' => 'selected-store', - ]) ?> + ArrayHelper::map(CityStore::find()->where(['visible' => CityStore::IS_VISIBLE])->orderBy('id')->all(), 'id', function ($store) { + return $store->id . ' ' . $store->name; + }), + [ + 'multiple' => true, + 'size' => 16, + 'class' => 'form-control', + 'id' => 'selected-store', + ]) ?> 'btn btn-primary w-100 mt-2 py-1', 'id' => 'edit-button']); ?>
@@ -164,6 +168,7 @@ $this->registerJsFile('/js/city-store-params/city-store-params.js', ['position' 'placeholder' => 'Введите число', 'oninput' => 'validateDecimal(this)' ]); ?> + 'form-label']); ?> 'showcase-volume', @@ -171,6 +176,7 @@ $this->registerJsFile('/js/city-store-params/city-store-params.js', ['position' 'placeholder' => 'Введите число', 'oninput' => 'validateDecimal(this)' ]); ?> + 'form-label']); ?> 'freeze-area', @@ -178,6 +184,7 @@ $this->registerJsFile('/js/city-store-params/city-store-params.js', ['position' 'placeholder' => 'Введите число', 'oninput' => 'validateDecimal(this)' ]); ?> + 'form-label']); ?> 'freeze-volume', @@ -188,14 +195,14 @@ $this->registerJsFile('/js/city-store-params/city-store-params.js', ['position'
- + 'd-block mb-5 text-decoration-none']); ?> 'CityStoreParams[matrix_type]', 'data' => [], 'language' => 'ru-RU', 'options' => [ - 'id' => 'matrix-type', + 'id' => 'matrix-type', 'placeholder' => 'Выберите тип матрицы', 'multiple' => true, ], @@ -203,7 +210,7 @@ $this->registerJsFile('/js/city-store-params/city-store-params.js', ['position'
- 'btn btn-success']) ?> + 'btn btn-success']) ?>
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 f68a1a79..158c8014 100644 --- a/erp24/web/js/city-store-params/city-store-params.js +++ b/erp24/web/js/city-store-params/city-store-params.js @@ -138,6 +138,15 @@ function populateDualListbox(matrixTypeArray, matrixType) { select.val(matrixType).trigger('change'); } +function validateDecimal(input) { + let value = input.value; + value = value.replace(/[^0-9.]/g, ''); + if (value.indexOf('.') !== -1) { + value = value.replace(/(\.\d{2})\d+$/, '$1'); + } + input.value = value; +} +