From: Alexander Smirnov Date: Tue, 28 Jan 2025 13:33:43 +0000 (+0300) Subject: добавки к фильтрам X-Git-Tag: 1.7~29^2~2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=7030147502522d4d8e66bd582eafb6b48b6e39e1;p=erp24_rep%2Fyii-erp24%2F.git добавки к фильтрам --- diff --git a/docker-compose.yml b/docker-compose.yml index 38d9ac34..bb516052 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: '2' services: nginx-yii_erp24: build: ./docker/nginx diff --git a/erp24/controllers/CategoryPlanController.php b/erp24/controllers/CategoryPlanController.php index 012410c3..29f3705d 100644 --- a/erp24/controllers/CategoryPlanController.php +++ b/erp24/controllers/CategoryPlanController.php @@ -6,6 +6,7 @@ use Yii; use yii\base\DynamicModel; use yii\helpers\ArrayHelper; use yii\web\Controller; +use yii\web\Response; use yii_app\records\CityStore; use yii_app\records\ExportImportTable; use yii_app\records\Sales; @@ -138,4 +139,30 @@ class CategoryPlanController extends Controller { return $this->render('index', compact('model', 'years', 'stores', 'table', 'tableOnline', 'tableWriteOffs', 'types', 'salesWriteOffsPlan')); } + + public function actionGetStores() { + Yii::$app->response->format = Response::FORMAT_JSON; + $cityId = Yii::$app->request->post('city_id'); + $regionId = Yii::$app->request->post('region_id'); + $raionId = Yii::$app->request->post('raion_id'); + $storeTypeId = Yii::$app->request->post('store_type_id'); +// $territoryManagerId = Yii::$app->request->post('territory_manager_id'); +// $kshfId = Yii::$app->request->post('kshf_id'); + + $stores = CityStore::find() + ->andFilterWhere([ + 'visible' => 1, + 'city' => $cityId, + 'region' => $regionId, + 'district' => $raionId, + 'type' => $storeTypeId, + ]) +// ->andFilterWhere(['in', 'id', $bushChefFloristStoreIds]) +// ->andFilterWhere(['in', 'id', $territorialManagerStoreIds]) + ->orderBy('id') + ->all(); + + + return ArrayHelper::map($stores, 'id', 'name'); + } } diff --git a/erp24/views/category-plan/index.php b/erp24/views/category-plan/index.php index cc702415..40ee2c64 100644 --- a/erp24/views/category-plan/index.php +++ b/erp24/views/category-plan/index.php @@ -3,10 +3,12 @@ use yii\helpers\Html; use yii\base\DynamicModel; use yii\widgets\ActiveForm; +use yii\helpers\ArrayHelper; use kartik\select2\Select2; use yii_app\helpers\HtmlHelper; use yii_app\records\SalesWriteOffsPlan; +use yii_app\records\StoreCityList; /* @var $model DynamicModel */ /* @var $years array */ @@ -37,7 +39,7 @@ $this->registerJsFile('/js/category-plan/index.js', ['position' => \yii\web\View
field($model, 'city_id')->widget(Select2::class, [ - 'data' => [0 => 'Москва', 1 => 'Нижний Новгород'], + 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_CITY]), 'id', 'name'), 'language' => 'ru', 'options' => ['placeholder' => 'Города...'], 'pluginOptions' => [ @@ -77,7 +79,7 @@ $this->registerJsFile('/js/category-plan/index.js', ['position' => \yii\web\View
field($model, 'region_id')->widget(Select2::class, [ - 'data' => [0 => 'Московская обл.', 1 => 'Нижегородская обл.'], + 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_REGION]), 'id', 'name'), 'language' => 'ru', 'options' => ['placeholder' => 'Регион...'], 'pluginOptions' => [ @@ -102,7 +104,7 @@ $this->registerJsFile('/js/category-plan/index.js', ['position' => \yii\web\View
field($model, 'raion_id')->widget(Select2::class, [ - 'data' => [0 => 'Автозаводский', 1 => 'Канавинский'], + 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_DISTRICT]), 'id', 'name'), 'language' => 'ru', 'options' => ['placeholder' => 'Район...'], 'pluginOptions' => [ @@ -127,7 +129,7 @@ $this->registerJsFile('/js/category-plan/index.js', ['position' => \yii\web\View
-