]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-360 Сборка страницы автопм
authormarina <m.zozirova@gmail.com>
Fri, 6 Jun 2025 06:28:08 +0000 (09:28 +0300)
committermarina <m.zozirova@gmail.com>
Fri, 6 Jun 2025 06:28:08 +0000 (09:28 +0300)
erp24/controllers/AutoPlannogrammaController.php
erp24/views/auto-plannogramma/index.php
erp24/web/js/autoplannogramma/autoplannogramma.js

index eab7c55b863fb1bd7880ac9d4f1cd467430adc15..bfeea6e6e8469330a3dc7092bc0c367cde514c3c 100644 (file)
@@ -119,11 +119,11 @@ class AutoPlannogrammaController extends BaseController
             ->where(['s.visible' => CityStore::IS_VISIBLE]);
 
         $fields = [
-            'city' => 's.city_id',
-            'storeType' => 's.type_id',
+            'city' => 'p.address_city',
+            'store_type' => 'p.store_type',
             'territorialManager' => 's.territorial_manager_id',
-            'region' => 's.region_id',
-            'district' => 's.district_id',
+            'region' => 'p.address_region',
+            'district' => 'p.address_district',
             'bushChefFlorist' => 's.bush_chef_florist_id',
         ];
 
index daf2cd11df4d5627be4376bbd051466f404bc763..8039f1aeacc35b5f4c2fec3b8214a6b66a2a42f9 100644 (file)
@@ -171,12 +171,11 @@ $this->registerJsFile('/js/autoplannogramma/autoplannogramma.js', ['position' =>
                         <?= Html::a('Corrected', '#', ['class' => 'btn btn-success ms-1']) ?>
                     </div>
                 </th>
-
-                <?php foreach ($stores as $store): ?>
-                    <th scope="col" class="fixed-column">
-                        <?= Html::label($store, null, [
+                <?php foreach ($stores as $storeId => $storeName): ?>
+                    <th scope="col" class="fixed-column" data-store-id="<?= $storeId ?>">
+                        <?= Html::label($storeName, null, [
                             'style' => 'writing-mode: sideways-lr; text-align: center; white-space: nowrap; 
-                            font-weight: bold; transform-origin: left bottom; padding-right: 7%;'
+                        font-weight: bold; transform-origin: left bottom; padding-right: 7%;'
                         ]) ?>
                     </th>
                 <?php endforeach; ?>
index 530477c8fb9fba4877544c7192eba6ee5b6d01a9..39cadd73323db718cd2cc0ec93dd41bf1fdf357d 100644 (file)
@@ -155,6 +155,7 @@ $('#autoplannogramma').on('click', '.reject-btn', function () {
     }
 });
 
+// Получение значений фильтров
 function getFilterData() {
     return {
         year: $('#year').val(),
@@ -169,48 +170,31 @@ function getFilterData() {
     };
 }
 
-// Ð¡ÐºÑ\80Ñ\8bваем Ñ\8fÑ\87ейки Ð¼Ð°Ð³Ð°Ð·Ð¸Ð½Ð¾Ð², Ð½Ðµ Ð¿Ð¾Ð´Ñ\85одÑ\8fÑ\89иÑ\85 Ð¿Ð¾ Ñ\84илÑ\8cÑ\82Ñ\80Ñ\83
+// Ð\9fÑ\80именение Ñ\84илÑ\8cÑ\82Ñ\80а Ð¼Ð°Ð³Ð°Ð·Ð¸Ð½Ð¾Ð²
 function applyStoreFilter() {
-    const filterData = getFilterData();
+    $.get('/auto-plannogramma/get-visible-stores', getFilterData(), function (response) {
+        const allowedStoreIds = (response.store_ids || []).map(String);
 
-    $.ajax({
-        url: '/auto-plannogramma/get-visible-stores',
-        type: 'GET',
-        data: filterData,
-        success: function (response) {
-            const allowedStoreIds = response.store_ids.map(id => String(id));
-
-            $('td[data-store-id], th[data-store-id]').each(function () {
-                const storeId = $(this).data('store-id').toString();
-                if (!allowedStoreIds.includes(storeId)) {
-                    $(this).hide(); // скрываем
-                } else {
-                    $(this).show(); // показываем нужное
-                }
-            });
-        },
-        error: function (xhr) {
-            console.error('Ошибка при фильтрации магазинов:', xhr.responseText);
-        }
+        $('td[data-store-id], th[data-store-id]').each(function () {
+            const storeId = String($(this).data('store-id'));
+            $(this).toggle(allowedStoreIds.includes(storeId));
+        });
+    }).fail(function (xhr) {
+        console.error('Ошибка при фильтрации магазинов:', xhr.responseText);
     });
 }
 
-// Ð\9fоказÑ\8bваем Ð²Ñ\81Ñ\91 Ð¾Ð±Ñ\80аÑ\82но Ð¿Ñ\80и Ñ\81бÑ\80оÑ\81е
+// Ð¡Ð±Ñ\80оÑ\81 Ñ\84илÑ\8cÑ\82Ñ\80ов Ð¸ Ð¾Ñ\82обÑ\80ажение Ð²Ñ\81еÑ\85 Ñ\8fÑ\87еек
 function resetStoreFilter() {
-    $('td[data-store-id], th[data-store-id]').show(); // показываем все
-}
-
-// Вешаем события
-$('.btn-apply').on('click', function () {
-    applyStoreFilter();
-});
-
-$('.btn-reset').on('click', function () {
     // Сброс значений фильтров
     $('#year, #city, #store-type, #territorial-manger, #polnogramma-type, #week, #region, #bush_chef_florist, #district').val('');
+    // Показ всех ячеек
+    $('td[data-store-id], th[data-store-id]').show();
+}
 
-    resetStoreFilter();
-});
+// Обработчики событий
+$('.btn-apply').on('click', applyStoreFilter);
+$('.btn-reset').on('click', resetStoreFilter);