From: marina Date: Mon, 9 Jun 2025 21:17:23 +0000 (+0300) Subject: ERP-360 Сборка страницы автопм X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=75646e94508a0bbf6342e76fcfb9eabd74039a95;p=erp24_rep%2Fyii-erp24%2F.git ERP-360 Сборка страницы автопм --- diff --git a/erp24/controllers/AutoPlannogrammaController.php b/erp24/controllers/AutoPlannogrammaController.php index 3c6b29ee..af22e135 100644 --- a/erp24/controllers/AutoPlannogrammaController.php +++ b/erp24/controllers/AutoPlannogrammaController.php @@ -190,37 +190,36 @@ class AutoPlannogrammaController extends BaseController public function actionGetVisibleStores() { Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; - $f = Yii::$app->request->get(); + $filters = Yii::$app->request->get(); - $q = CityStoreParams::find() + $query = CityStoreParams::find() ->alias('p') ->joinWith(['store s']) ->select('p.store_id') ->where(['s.visible' => CityStore::IS_VISIBLE]); - foreach ([ - 'city' => 'p.address_city', - 'storeType' => 'p.store_type', - 'region' => 'p.address_region', - 'district' => 'p.address_district' - ] as $param => $col) { - if (!empty($f[$param])) $q->andWhere([$col => $f[$param]]); + $query->andFilterWhere(['=', 'p.address_city', $filters['city']]); + $query->andFilterWhere(['=', 'p.store_type', $filters['store_type']]); + $query->andFilterWhere(['=', 'p.address_region', $filters['region']]); + $query->andFilterWhere(['=', 'p.address_district', $filters['district']]); + + if (!empty($filters['territorial_manager'])) { + $territorialManagerStoreIds = StoreDynamic::find() + ->select('store_id') + ->where(['category' => 3, 'active' => 1, 'value_int' => $filters['territorial_manager']]) + ->column(); + $query->andWhere(['in', 'a.store_id', $territorialManagerStoreIds ?: [-1]]); } - foreach ([ - 'territorialManager' => 3, - 'bushChefFlorist' => 2 - ] as $param => $cat) { - if (!empty($f[$param])) { - $ids = StoreDynamic::find() - ->select('store_id') - ->where(['category' => $cat, 'active' => 1, 'value_int' => $f[$param]]) - ->column(); - $q->andWhere(['p.store_id' => $ids ?: [-1]]); - } + if (!empty($filters['bush_chef_florist'])) { + $bushChefFloristStoreIds = StoreDynamic::find() + ->select('store_id') + ->where(['category' => 2, 'active' => 1, 'value_int' => $filters['bush_chef_florist']]) + ->column(); + $query->andWhere(['in', 'a.store_id', $bushChefFloristStoreIds ?: [-1]]); } - return array_values($q->column()); + return array_values($query->column()); } public function action1() diff --git a/erp24/views/auto-plannogramma/index.php b/erp24/views/auto-plannogramma/index.php index d2ce7e78..5e992d71 100644 --- a/erp24/views/auto-plannogramma/index.php +++ b/erp24/views/auto-plannogramma/index.php @@ -123,7 +123,7 @@ $this->registerJsFile('/js/autoplannogramma/autoplannogramma.js', ['position' =>
- 'month-label']) ?> + 'month-label ms-4']) ?>
registerJsFile('/js/autoplannogramma/autoplannogramma.js', ['position' =>
-
+
+
Для редактирования планограммы необходимо выбрать неделю и год!
+
+
diff --git a/erp24/web/js/autoplannogramma/autoplannogramma.js b/erp24/web/js/autoplannogramma/autoplannogramma.js index 439556d6..bbd0512d 100644 --- a/erp24/web/js/autoplannogramma/autoplannogramma.js +++ b/erp24/web/js/autoplannogramma/autoplannogramma.js @@ -273,7 +273,15 @@ function resetStoreFilter() { $('.btn-apply').on('click', function () { applyStoreFilter(); - console.log($('#week').val(),$('#year').val(), getMonthByWeek($('#week').val(), $('#year').val())) + if ($('#week').val() && $('#year').val()) { + $('.table-wrapper').css({ + 'pointer-events': 'auto', + 'opacity': '1' + }); + $('.flash-message').css({ + 'display': 'none' + }); + } $('tr.inserted-row').remove(); }); $('.btn-reset').on('click', resetStoreFilter); @@ -291,3 +299,16 @@ function getMonthByWeek(week, year) { return startMonth === endMonth ? startMonth : `${startMonth} - ${endMonth}`; } + +$(document).ready(function () { + if ($('#week').val().length > 0) { + $('#edit-button').click(); + } + + const flashMessage = $('.flash-message'); + + if (flashMessage.length) { + const delayTime = flashMessage.hasClass('alert-success') ? 5000 : 15000; + setTimeout(() => flashMessage.fadeOut(2000, () => flashMessage.remove()), delayTime); + } +}); \ No newline at end of file