DmitrMakeev
commited on
Commit
•
d387255
1
Parent(s):
3e50d38
Update bas_vk_tab.html
Browse files- bas_vk_tab.html +52 -114
bas_vk_tab.html
CHANGED
@@ -220,16 +220,11 @@ button:hover, #filter-clear:hover, #download-json:hover, #take-for-yourself:hove
|
|
220 |
</select>
|
221 |
|
222 |
<input id="filter-value" type="text" placeholder="Значение фильтра">
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
<button id="filter-clear">Очистить фильтр</button>
|
229 |
<button id="download-xlsx">Скачать в XLSX</button>
|
230 |
<button id="download-json">Download JSON</button>
|
231 |
<button id="download-rass">Рассылка по выбранным</button>
|
232 |
-
<button id="take-for-yourself">Взять себе</button>
|
233 |
</div>
|
234 |
<div id="example-table"></div>
|
235 |
|
@@ -240,13 +235,14 @@ button:hover, #filter-clear:hover, #download-json:hover, #take-for-yourself:hove
|
|
240 |
.then(response => response.json())
|
241 |
.then(data => {
|
242 |
console.log('Data received:', data); // Логирование данных
|
243 |
-
// Переворачиваем массив данных
|
244 |
-
|
245 |
var linkFormatter = function(cell, formatterParams, onRendered) {
|
246 |
var curator = cell.getValue();
|
247 |
var curatorLink = cell.getData().curator_link;
|
248 |
return `<a href="${curatorLink}" target="_blank">${curator}</a>`;
|
249 |
};
|
|
|
250 |
var table = new Tabulator("#example-table", {
|
251 |
data: data, // set table data
|
252 |
layout: "fitColumns", // fit columns to width of table
|
@@ -256,41 +252,27 @@ button:hover, #filter-clear:hover, #download-json:hover, #take-for-yourself:hove
|
|
256 |
columns: [
|
257 |
{title:"Номер в списке", field:"id"},
|
258 |
{title:"Имя", field:"name", width:100},
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
Имя: ${data.name}\n
|
281 |
-
WhatsApp: ${data.phone}\n
|
282 |
-
Реплики: ${data.b_mess}
|
283 |
-
`;
|
284 |
-
|
285 |
-
// Показываем уведомление
|
286 |
-
notyf.open({
|
287 |
-
type: 'info',
|
288 |
-
message: message,
|
289 |
-
});
|
290 |
-
}},
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
{title:"Куратор", field:"curator", formatter: linkFormatter},
|
295 |
{title:"Статус покупки", field:"shop_st", formatter: function(cell, formatterParams, onRendered) {
|
296 |
var status = cell.getValue();
|
@@ -314,27 +296,24 @@ button:hover, #filter-clear:hover, #download-json:hover, #take-for-yourself:hove
|
|
314 |
var ad_url = cell.getValue();
|
315 |
return `<a href="${ad_url}" target="_blank">${ad_url}</a>`;
|
316 |
}},
|
317 |
-
|
318 |
{title:"Ссылка на Tg", field:"chat_id", formatter: function(cell, formatterParams, onRendered) {
|
319 |
var chatId = cell.getValue();
|
320 |
if (chatId.startsWith('@')) {
|
321 |
-
chatId = chatId.substring(1);
|
322 |
}
|
323 |
return `<a href="https://t.me/${chatId}" target="_blank">${chatId}</a>`;
|
324 |
}},
|
325 |
-
|
326 |
{title:"Вебинары-присутствовал", field:"web_st", formatter:"star", formatterParams:{stars:7}, hozAlign:"center", width:90},
|
327 |
{title:"Вебинары-досмотрел до конца", field:"b_fin", formatter:function(cell, formatterParams, onRendered){
|
328 |
var value = cell.getValue();
|
329 |
-
|
330 |
if (value === 'True') {
|
331 |
-
|
332 |
} else {
|
333 |
-
|
334 |
}
|
335 |
-
|
336 |
-
}},
|
337 |
-
|
338 |
{title:"Прогрес по воронке", field:"fin_prog", formatter:"progress", formatterParams:{color:["#ff0000", "orange", "#00dd00"]}, sorter:"number", width:100},
|
339 |
{title:"pr1", field:"pr1"},
|
340 |
{title:"pr2", field:"pr2"},
|
@@ -347,90 +326,49 @@ button:hover, #filter-clear:hover, #download-json:hover, #take-for-yourself:hove
|
|
347 |
],
|
348 |
});
|
349 |
|
350 |
-
|
351 |
var fieldEl = document.getElementById("filter-field");
|
352 |
var typeEl = document.getElementById("filter-type");
|
353 |
var valueEl = document.getElementById("filter-value");
|
354 |
-
var fieldEl2 = document.getElementById("filter-field2");
|
355 |
-
|
356 |
|
357 |
function updateFilter() {
|
358 |
-
var
|
359 |
-
var
|
360 |
-
var
|
361 |
-
|
362 |
-
|
363 |
-
var valueVal2 = valueEl2.value;
|
364 |
-
|
365 |
-
if (filterVal1 && filterVal2) {
|
366 |
-
table.setFilter([
|
367 |
-
{ field: filterVal1, type: typeVal1, value: valueVal1 },
|
368 |
-
{ field: filterVal2, type: "=", value: valueVal2 }
|
369 |
-
]);
|
370 |
}
|
371 |
}
|
372 |
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
document.getElementById('filter-value').addEventListener('input', function() {
|
378 |
-
var field = document.getElementById('filter-field').value;
|
379 |
-
var value = document.getElementById('filter-value').value;
|
380 |
-
table.setFilter(field, "like", value);
|
381 |
-
});
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
//trigger download of data.json file
|
387 |
-
document.getElementById("download-json").addEventListener("click", function(){
|
388 |
-
table.download("json", "data.json");
|
389 |
-
});
|
390 |
-
|
391 |
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
//trigger download of data.xlsx file
|
400 |
-
document.getElementById("download-xlsx").addEventListener("click", function(){
|
401 |
-
table.download("xlsx", "data.xlsx", {sheetName:"My Data"});
|
402 |
-
});
|
403 |
-
document.getElementById("filter-clear").addEventListener("click", function() {
|
404 |
fieldEl.value = "";
|
405 |
typeEl.value = "=";
|
406 |
valueEl.value = "";
|
407 |
-
fieldEl2.value = "";
|
408 |
-
valueEl2.value = "";
|
409 |
table.clearFilter();
|
410 |
});
|
411 |
|
412 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
var tableData = table.getData("active");
|
414 |
var jsonData = JSON.stringify(tableData, null, 2);
|
415 |
console.log("Данные для рассылки:", jsonData);
|
416 |
-
}
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
|
425 |
-
|
426 |
-
function handleTakeForYourself() {
|
427 |
var tableData = table.getData("active");
|
428 |
var jsonData = JSON.stringify(tableData, null, 2);
|
429 |
console.log("Данные для себя:", jsonData);
|
430 |
-
}
|
431 |
-
|
432 |
-
document.getElementById("download-rass").addEventListener("click", handleDownloadRass);
|
433 |
-
document.getElementById("take-for-yourself").addEventListener("click", handleTakeForYourself);
|
434 |
})
|
435 |
.catch(error => console.error('Error fetching data:', error));
|
436 |
});
|
|
|
220 |
</select>
|
221 |
|
222 |
<input id="filter-value" type="text" placeholder="Значение фильтра">
|
|
|
|
|
|
|
|
|
|
|
223 |
<button id="filter-clear">Очистить фильтр</button>
|
224 |
<button id="download-xlsx">Скачать в XLSX</button>
|
225 |
<button id="download-json">Download JSON</button>
|
226 |
<button id="download-rass">Рассылка по выбранным</button>
|
227 |
+
<button id="take-for-yourself">Взять себе</button>
|
228 |
</div>
|
229 |
<div id="example-table"></div>
|
230 |
|
|
|
235 |
.then(response => response.json())
|
236 |
.then(data => {
|
237 |
console.log('Data received:', data); // Логирование данных
|
238 |
+
data.reverse(); // Переворачиваем массив данных
|
239 |
+
|
240 |
var linkFormatter = function(cell, formatterParams, onRendered) {
|
241 |
var curator = cell.getValue();
|
242 |
var curatorLink = cell.getData().curator_link;
|
243 |
return `<a href="${curatorLink}" target="_blank">${curator}</a>`;
|
244 |
};
|
245 |
+
|
246 |
var table = new Tabulator("#example-table", {
|
247 |
data: data, // set table data
|
248 |
layout: "fitColumns", // fit columns to width of table
|
|
|
252 |
columns: [
|
253 |
{title:"Номер в списке", field:"id"},
|
254 |
{title:"Имя", field:"name", width:100},
|
255 |
+
{title:"Город", field:"b_city", width:95},
|
256 |
+
{title:"Email", field:"email", width:95},
|
257 |
+
{title:"Реплики", field:"b_mess", width:95, cellClick:function(e, cell){
|
258 |
+
var data = cell.getData();
|
259 |
+
const notyf = new Notyf({
|
260 |
+
duration: 5000,
|
261 |
+
position: {
|
262 |
+
x: 'right',
|
263 |
+
y: 'top',
|
264 |
+
},
|
265 |
+
});
|
266 |
+
const message = `
|
267 |
+
Имя: ${data.name}\n
|
268 |
+
WhatsApp: ${data.phone}\n
|
269 |
+
Реплики: ${data.b_mess}
|
270 |
+
`;
|
271 |
+
notyf.open({
|
272 |
+
type: 'info',
|
273 |
+
message: message,
|
274 |
+
});
|
275 |
+
}},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
{title:"Куратор", field:"curator", formatter: linkFormatter},
|
277 |
{title:"Статус покупки", field:"shop_st", formatter: function(cell, formatterParams, onRendered) {
|
278 |
var status = cell.getValue();
|
|
|
296 |
var ad_url = cell.getValue();
|
297 |
return `<a href="${ad_url}" target="_blank">${ad_url}</a>`;
|
298 |
}},
|
|
|
299 |
{title:"Ссылка на Tg", field:"chat_id", formatter: function(cell, formatterParams, onRendered) {
|
300 |
var chatId = cell.getValue();
|
301 |
if (chatId.startsWith('@')) {
|
302 |
+
chatId = chatId.substring(1);
|
303 |
}
|
304 |
return `<a href="https://t.me/${chatId}" target="_blank">${chatId}</a>`;
|
305 |
}},
|
|
|
306 |
{title:"Вебинары-присутствовал", field:"web_st", formatter:"star", formatterParams:{stars:7}, hozAlign:"center", width:90},
|
307 |
{title:"Вебинары-досмотрел до конца", field:"b_fin", formatter:function(cell, formatterParams, onRendered){
|
308 |
var value = cell.getValue();
|
309 |
+
var icon;
|
310 |
if (value === 'True') {
|
311 |
+
icon = ' <img src="https://i.ibb.co/9sqNhYz/4-2.png" width="98" height="14" />';
|
312 |
} else {
|
313 |
+
icon = '';
|
314 |
}
|
315 |
+
return icon;
|
316 |
+
}},
|
|
|
317 |
{title:"Прогрес по воронке", field:"fin_prog", formatter:"progress", formatterParams:{color:["#ff0000", "orange", "#00dd00"]}, sorter:"number", width:100},
|
318 |
{title:"pr1", field:"pr1"},
|
319 |
{title:"pr2", field:"pr2"},
|
|
|
326 |
],
|
327 |
});
|
328 |
|
|
|
329 |
var fieldEl = document.getElementById("filter-field");
|
330 |
var typeEl = document.getElementById("filter-type");
|
331 |
var valueEl = document.getElementById("filter-value");
|
|
|
|
|
332 |
|
333 |
function updateFilter() {
|
334 |
+
var filterVal = fieldEl.value;
|
335 |
+
var typeVal = typeEl.value;
|
336 |
+
var valueVal = valueEl.value;
|
337 |
+
if (filterVal) {
|
338 |
+
table.setFilter(filterVal, typeVal, valueVal);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
}
|
340 |
}
|
341 |
|
342 |
+
fieldEl.addEventListener("change", updateFilter);
|
343 |
+
typeEl.addEventListener("change", updateFilter);
|
344 |
+
valueEl.addEventListener("keyup", updateFilter);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
|
346 |
+
document.getElementById('filter-clear').addEventListener('click', function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
fieldEl.value = "";
|
348 |
typeEl.value = "=";
|
349 |
valueEl.value = "";
|
|
|
|
|
350 |
table.clearFilter();
|
351 |
});
|
352 |
|
353 |
+
document.getElementById("download-json").addEventListener("click", function() {
|
354 |
+
table.download("json", "data.json");
|
355 |
+
});
|
356 |
+
|
357 |
+
document.getElementById("download-xlsx").addEventListener("click", function() {
|
358 |
+
table.download("xlsx", "data.xlsx", {sheetName:"My Data"});
|
359 |
+
});
|
360 |
+
|
361 |
+
document.getElementById("download-rass").addEventListener("click", function() {
|
362 |
var tableData = table.getData("active");
|
363 |
var jsonData = JSON.stringify(tableData, null, 2);
|
364 |
console.log("Данные для рассылки:", jsonData);
|
365 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
|
367 |
+
document.getElementById("take-for-yourself").addEventListener("click", function() {
|
|
|
368 |
var tableData = table.getData("active");
|
369 |
var jsonData = JSON.stringify(tableData, null, 2);
|
370 |
console.log("Данные для себя:", jsonData);
|
371 |
+
});
|
|
|
|
|
|
|
372 |
})
|
373 |
.catch(error => console.error('Error fetching data:', error));
|
374 |
});
|