From: Alexander Smirnov Date: Thu, 25 Jul 2024 12:58:22 +0000 (+0300) Subject: Фильтр показывает только доступные значения и для магазинов X-Git-Tag: 1.4~45^2~23 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=d5b9180f7dc8c15d60e23f1a4cfdccba3743cec9;p=erp24_rep%2Fyii-erp24%2F.git Фильтр показывает только доступные значения и для магазинов --- diff --git a/erp24/actions/motivation/IndexAction.php b/erp24/actions/motivation/IndexAction.php index 15aad57e..6c3c7ae4 100644 --- a/erp24/actions/motivation/IndexAction.php +++ b/erp24/actions/motivation/IndexAction.php @@ -38,9 +38,14 @@ class IndexAction extends Action ]); $model->load(Yii::$app->request->get()); + $motivations = Motivation::find()->all(); + $possibleStoreIds = ArrayHelper::getColumn($motivations, 'store_id'); + $stores = ArrayHelper::map(CityStore::find()->all(), 'id', 'name'); + $stores = array_filter($stores, function ($k, $v) use($possibleStoreIds) { + return in_array($v, $possibleStoreIds); + }, ARRAY_FILTER_USE_BOTH); - $motivations = Motivation::find()->all(); $possibleYears = ArrayHelper::getColumn($motivations, 'year'); $years = array_filter(range(2023, 20100), function ($k) use ($possibleYears) { return in_array($k, $possibleYears);