]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-360 Сборка страницы автопм
authormarina <m.zozirova@gmail.com>
Tue, 17 Jun 2025 08:16:01 +0000 (11:16 +0300)
committermarina <m.zozirova@gmail.com>
Tue, 17 Jun 2025 08:16:01 +0000 (11:16 +0300)
erp24/web/js/autoplannogramma/autoplannogramma.js

index 3fb0411a490bb41152f9dfcbab3ae34afa5dab9b..f137d00f84e87c921aa2bfe717111f76255eaacb 100644 (file)
@@ -72,7 +72,6 @@ $('.subcategory .list-group-item').on('click', function (e) {
         method: 'GET',
         data: filters,
         success: function (response) {
-            // Remove existing inserted rows
             $row.nextAll('tr.inserted-row').remove();
 
             if (!response || !Array.isArray(response) || response.length === 0) {
@@ -80,6 +79,28 @@ $('.subcategory .list-group-item').on('click', function (e) {
                 return;
             }
 
+            // Updated generateTitleString function
+            const generateTitleString = (titleObj) => {
+                if (!titleObj || typeof titleObj !== 'object') return '';
+
+                const typeTitles = {
+                    offline: '📦 Оффлайн',
+                    online: '🌐 Онлайн',
+                    marketplace: '🛒 Маркетплейс'
+                };
+
+                const parts = Object.entries(titleObj)
+                    .map(([typeKey, typeValue]) => {
+                        if (!typeValue || typeof typeValue !== 'object') return '';
+                        const lines = Object.entries(typeValue)
+                            .map(([key, val]) => `- ${key.replace(/_/g, ' ')}: ${parseFloat(val).toFixed(2)}`);
+                        return `${typeTitles[typeKey] || typeKey}:\n${lines.join('\n')}`;
+                    })
+                    .filter(Boolean);
+
+                return parts.join('\n\n');
+            };
+
             const fragment = document.createDocumentFragment();
 
             response.forEach(item => {
@@ -149,7 +170,10 @@ $('.subcategory .list-group-item').on('click', function (e) {
 
             $row.after(fragment);
 
-            $('[data-bs-toggle="tooltip"]').tooltip();
+            // Initialize Bootstrap tooltips
+            $('[data-bs-toggle="tooltip"]').tooltip({
+                customClass: 'custom-tooltip'
+            });
         },
         error: function (xhr) {
             alert('Ошибка: ' + (xhr.responseText || 'Неизвестная ошибка сервера'));