DmitrMakeev
commited on
Commit
•
e882c31
1
Parent(s):
193a177
Update bas_vk_tab.html
Browse files- bas_vk_tab.html +167 -192
bas_vk_tab.html
CHANGED
@@ -225,202 +225,177 @@ button:hover, #filter-clear:hover, #download-json:hover, #take-for-yourself:hove
|
|
225 |
<button id="filter-clear">Очистить фильтр</button>
|
226 |
<button id="download-xlsx">Скачать в XLSX</button>
|
227 |
<button id="download-json">Рассылка по выбранным</button>
|
228 |
-
<button id="take-for-yourself">Взять себе</button>
|
|
|
229 |
</div>
|
230 |
<div id="example-table"></div>
|
231 |
|
232 |
-
<script>
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
});
|
384 |
-
|
385 |
-
|
386 |
-
var typeEl = document.getElementById("filter-type");
|
387 |
-
var valueEl = document.getElementById("filter-value");
|
388 |
-
function updateFilter() {
|
389 |
-
var filterVal1 = fieldEl.value;
|
390 |
-
var typeVal1 = typeEl.value;
|
391 |
-
var valueVal1 = valueEl.value;
|
392 |
-
table.setFilter([
|
393 |
-
{ field: filterVal1, type: typeVal1, value: valueVal1 }
|
394 |
-
]);
|
395 |
-
}
|
396 |
-
document.getElementById("filter-field").addEventListener("change", updateFilter);
|
397 |
-
document.getElementById("filter-type").addEventListener("change", updateFilter);
|
398 |
-
document.getElementById("filter-value").addEventListener("keyup", updateFilter);
|
399 |
-
document.getElementById("filter-clear").addEventListener("click", function() {
|
400 |
-
fieldEl.value = "";
|
401 |
-
typeEl.value = "=";
|
402 |
-
valueEl.value = "";
|
403 |
-
table.clearFilter();
|
404 |
-
});
|
405 |
-
document.getElementById("download-xlsx").addEventListener("click", function(){
|
406 |
-
table.download("xlsx", "data.xlsx", {sheetName:"My Data"});
|
407 |
-
});
|
408 |
-
function handleDownloadJson() {
|
409 |
-
var tableData = table.getData("active");
|
410 |
-
var jsonData = JSON.stringify(tableData, null, 2);
|
411 |
-
console.log("Данные для рассылки:", jsonData);
|
412 |
-
}
|
413 |
-
function handleTakeForYourself() {
|
414 |
-
var tableData = table.getData("active");
|
415 |
-
var jsonData = JSON.stringify(tableData, null, 2);
|
416 |
-
console.log("Данные для себя:", jsonData);
|
417 |
-
}
|
418 |
-
document.getElementById("download-json").addEventListener("click", handleDownloadJson);
|
419 |
-
document.getElementById("take-for-yourself").addEventListener("click", handleTakeForYourself);
|
420 |
-
})
|
421 |
-
.catch(error => console.error('Error fetching data:', error));
|
422 |
-
});
|
423 |
-
</script>
|
424 |
</body>
|
425 |
|
|
|
426 |
</html>
|
|
|
225 |
<button id="filter-clear">Очистить фильтр</button>
|
226 |
<button id="download-xlsx">Скачать в XLSX</button>
|
227 |
<button id="download-json">Рассылка по выбранным</button>
|
228 |
+
<button id="take-for-yourself">Взять себе</button>
|
229 |
+
<button id="download-csv">Скачать CSV</button> <!-- Добавлена кнопка для скачивания CSV -->
|
230 |
</div>
|
231 |
<div id="example-table"></div>
|
232 |
|
233 |
+
<script>
|
234 |
+
vkBridge.send('VKWebAppInit');
|
235 |
+
document.addEventListener('DOMContentLoaded', function() {
|
236 |
+
fetch('https://irdelsol-psy.hf.space/data_gc_tab_out?api_sys=fasSd345D')
|
237 |
+
.then(response => response.json())
|
238 |
+
.then(data => {
|
239 |
+
console.log('Data received:', data);
|
240 |
+
data.reverse();
|
241 |
+
|
242 |
+
var linkFormatter = function(cell, formatterParams, onRendered) {
|
243 |
+
var curator = cell.getValue();
|
244 |
+
var curatorLink = cell.getData().curator_link;
|
245 |
+
return `<a href="${curatorLink}" target="_blank">${curator}</a>`;
|
246 |
+
};
|
247 |
+
|
248 |
+
var table = new Tabulator("#example-table", {
|
249 |
+
data: data,
|
250 |
+
layout: "fitColumns",
|
251 |
+
pagination: "local",
|
252 |
+
paginationSize: 50,
|
253 |
+
selectable: true,
|
254 |
+
columns: [
|
255 |
+
{title:"Номер в списке", field:"id"},
|
256 |
+
{title:"Имя", field:"name", width:100},
|
257 |
+
{title:"WhatsApp", field:"phone", formatter: function(cell, formatterParams, onRendered) {
|
258 |
+
var phone = cell.getValue();
|
259 |
+
var ws_stop = cell.getData().ws_stop;
|
260 |
+
var ws_st = cell.getData().ws_st;
|
261 |
+
var imageUrl1 = "https://i.ibb.co/YBvwFR6/whatsapp-2.png";
|
262 |
+
var imageUrl2 = "https://i.ibb.co/LZx71cM/1.png";
|
263 |
+
var imageUrl3 = "https://i.ibb.co/Cvn3QsK/whatsapp-3.png";
|
264 |
+
var link = `<a href="https://web.whatsapp.com/send?phone=${phone}" target="_blank">`;
|
265 |
+
if (ws_stop !== "1" && ws_st === "1") {
|
266 |
+
return link + `<img src="${imageUrl2}" alt="WhatsApp" style="width: 98px; height: 14px;">`;
|
267 |
+
} else if (ws_stop === "1" && ws_st === "1") {
|
268 |
+
return link + `<img src="${imageUrl3}" alt="WhatsApp" style="width: 98px; height: 14px;">`;
|
269 |
+
} else {
|
270 |
+
return link + `<img src="${imageUrl1}" alt="WhatsApp" style="width: 98px; height: 14px;">`;
|
271 |
+
}
|
272 |
+
}},
|
273 |
+
{title:"ВКонтакте", field:"vk_id", formatter: function(cell, formatterParams, onRendered) {
|
274 |
+
var vk_id = cell.getValue();
|
275 |
+
var imageUrlvk1 = "https://i.ibb.co/BKB8R4C/2-2.png";
|
276 |
+
var imageUrlvk2 = "https://i.ibb.co/MPCGvQX/2-1.png";
|
277 |
+
var link1 = `<a href="https://vk.com" target="_blank">`;
|
278 |
+
var link2 = `<a href="https://vk.com/id${vk_id}" target="_blank">`;
|
279 |
+
if (vk_id === "0" || vk_id === "") {
|
280 |
+
return link1 + `<img src="${imageUrlvk1}" alt="Image" style="width: 98px; height: 14px;">`;
|
281 |
+
} else {
|
282 |
+
return link2 + `<img src="${imageUrlvk2}" alt="Image" style="width: 98px; height: 14px;">`;
|
283 |
+
}
|
284 |
+
}},
|
285 |
+
{title:"Телеграм", field:"chat_id", formatter: function(cell, formatterParams, onRendered) {
|
286 |
+
var chat_id = cell.getValue();
|
287 |
+
var imageUrltg1 = "https://i.ibb.co/3S4Wt7m/3-2.png";
|
288 |
+
var imageUrlntg2 = "https://i.ibb.co/rZrzQhb/3-1.png";
|
289 |
+
var linktg1 = `<a href="https://t.me" target="_blank">`;
|
290 |
+
var linktg2 = `<a href="https://t.me/${chat_id}" target="_blank">`;
|
291 |
+
if (chat_id === "0" || chat_id === "") {
|
292 |
+
return linktg1 + `<img src="${imageUrltg1}" alt="Image" style="width: 98px; height: 14px;">`;
|
293 |
+
} else {
|
294 |
+
return linktg2 + `<img src="${imageUrlntg2}" alt="Image" style="width: 98px; height: 14px;">`;
|
295 |
+
}
|
296 |
+
}},
|
297 |
+
{title:"GetCurse", field:"gc_url", formatter: function(cell, formatterParams, onRendered) {
|
298 |
+
var gc_url = cell.getValue();
|
299 |
+
var imageUrlvkgc1 = "https://i.ibb.co/F8825KY/1-2.png";
|
300 |
+
var imageUrlvkgc2 = "https://i.ibb.co/S3qwFKM/1-1.png";
|
301 |
+
var linkgc1 = `<a href="https://vk.com/getcourseru" target="_blank">`;
|
302 |
+
var linkgc2 = `<a href="${gc_url}" target="_blank">`;
|
303 |
+
if (gc_url === "0" || gc_url === "") {
|
304 |
+
return linkgc1 + `<img src="${imageUrlvkgc1}" alt="Image" style="width: 98px; height: 14px;">`;
|
305 |
+
} else {
|
306 |
+
return linkgc2 + `<img src="${imageUrlvkgc2}" alt="Image" style="width: 98px; height: 14px;">`;
|
307 |
+
}
|
308 |
+
}},
|
309 |
+
{title:"Город", field:"b_city", width:95},
|
310 |
+
{title:"Email", field:"email", width:95},
|
311 |
+
{title:"Реплики", field:"b_mess", width:95, cellClick:function(e, cell){
|
312 |
+
var data = cell.getData();
|
313 |
+
const notyf = new Notyf({
|
314 |
+
duration: 5000,
|
315 |
+
position: {
|
316 |
+
x: 'right',
|
317 |
+
y: 'top',
|
318 |
+
},
|
319 |
+
});
|
320 |
+
const message = `
|
321 |
+
Имя: ${data.name}\n
|
322 |
+
WhatsApp: ${data.phone}\n
|
323 |
+
Реплики: ${data.b_mess}
|
324 |
+
`;
|
325 |
+
notyf.open({
|
326 |
+
type: 'info',
|
327 |
+
message: message,
|
328 |
+
});
|
329 |
+
}},
|
330 |
+
{title:"Куратор", field:"curator", formatter: linkFormatter},
|
331 |
+
{title:"Статус покупки", field:"shop_st", formatter: function(cell, formatterParams, onRendered) {
|
332 |
+
var status = cell.getValue();
|
333 |
+
var color;
|
334 |
+
switch (status) {
|
335 |
+
case 'green':
|
336 |
+
color = 'green';
|
337 |
+
break;
|
338 |
+
case 'red':
|
339 |
+
color = 'red';
|
340 |
+
break;
|
341 |
+
case 'yellow':
|
342 |
+
color = 'yellow';
|
343 |
+
break;
|
344 |
+
default:
|
345 |
+
color = 'gray';
|
346 |
+
}
|
347 |
+
return `<div style="width: 20px; height: 20px; background-color: ${color}; border-radius: 50%;"></div>`;
|
348 |
+
}},
|
349 |
+
{title:"Канал трафика", field:"pr4", width:95},
|
350 |
+
{title:"Дата", field:"pr5", width:95},
|
351 |
+
{title:"Ключ PR", field:"key_pr", width:95},
|
352 |
+
{title:"Канал", field:"canal", width:95},
|
353 |
+
{title:"Дата", field:"data_t", width:95},
|
354 |
+
],
|
355 |
+
});
|
356 |
+
|
357 |
+
// Clear filter
|
358 |
+
document.getElementById('filter-clear').addEventListener('click', function() {
|
359 |
+
table.clearFilter(true);
|
360 |
+
});
|
361 |
+
|
362 |
+
// Download XLSX functionality
|
363 |
+
document.getElementById('download-xlsx').addEventListener('click', function() {
|
364 |
+
table.download("xlsx", "data.xlsx");
|
365 |
+
});
|
366 |
+
|
367 |
+
// Download JSON functionality
|
368 |
+
document.getElementById('download-json').addEventListener('click', function() {
|
369 |
+
var selectedRows = table.getSelectedData();
|
370 |
+
var jsonData = JSON.stringify(selectedRows);
|
371 |
+
var blob = new Blob([jsonData], { type: 'application/json' });
|
372 |
+
var url = URL.createObjectURL(blob);
|
373 |
+
var a = document.createElement('a');
|
374 |
+
a.href = url;
|
375 |
+
a.download = 'data.json';
|
376 |
+
document.body.appendChild(a);
|
377 |
+
a.click();
|
378 |
+
URL.revokeObjectURL(url);
|
379 |
+
});
|
380 |
+
|
381 |
+
// Download CSV functionality
|
382 |
+
document.getElementById('download-csv').addEventListener('click', function() {
|
383 |
+
table.download("csv", "data.csv");
|
384 |
+
});
|
385 |
+
|
386 |
+
// Take for yourself functionality
|
387 |
+
document.getElementById('take-for-yourself').addEventListener('click', function() {
|
388 |
+
var selectedRows = table.getSelectedData();
|
389 |
+
// Your logic to handle selected rows
|
390 |
+
console.log('Selected rows:', selectedRows);
|
391 |
+
});
|
392 |
+
})
|
393 |
+
.catch(error => {
|
394 |
+
console.error('Ошибка при загрузке JSON:', error);
|
395 |
});
|
396 |
+
});
|
397 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
398 |
</body>
|
399 |
|
400 |
+
|
401 |
</html>
|