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) {
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 => {
$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 || 'Неизвестная ошибка сервера'));