DmitrMakeev
commited on
Commit
•
e0b0269
1
Parent(s):
a5d5813
Update data_gc_tab.html
Browse files- data_gc_tab.html +135 -112
data_gc_tab.html
CHANGED
@@ -208,119 +208,142 @@
|
|
208 |
</div>
|
209 |
<div id="example-table"></div>
|
210 |
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
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 |
-
console.log("Данные для себя:", jsonData);
|
317 |
}
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
.
|
322 |
-
|
323 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
</body>
|
325 |
|
326 |
</html>
|
|
|
208 |
</div>
|
209 |
<div id="example-table"></div>
|
210 |
|
211 |
+
|
212 |
+
|
213 |
+
|
214 |
+
|
215 |
+
<script>
|
216 |
+
// Функция для создания всплывающего окна с деталями строки
|
217 |
+
var rowPopupFormatter = function(e, row, onRendered){
|
218 |
+
var data = row.getData(),
|
219 |
+
container = document.createElement("div"),
|
220 |
+
contents = "<strong style='font-size:1.2em;'>Детали пользователя</strong><br/><ul style='padding:0; margin-top:10px; margin-bottom:0;'>";
|
221 |
+
contents += "<li><strong>Имя:</strong> " + data.name + "</li>";
|
222 |
+
contents += "<li><strong>Реплики:</strong> " + data.b_mess + "</li>";
|
223 |
+
contents += "</ul>";
|
224 |
+
|
225 |
+
container.innerHTML = contents;
|
226 |
+
|
227 |
+
return container;
|
228 |
+
};
|
229 |
+
|
230 |
+
// Инициализация таблицы с использованием rowClickPopup
|
231 |
+
document.addEventListener('DOMContentLoaded', function() {
|
232 |
+
fetch('https://dmtuit-gcapirabiz.hf.space/data_gc_tab_out?api_sys=fasSd345D')
|
233 |
+
.then(response => response.json())
|
234 |
+
.then(data => {
|
235 |
+
console.log('Data received:', data); // Логирование данных
|
236 |
+
// Переворачиваем массив данных
|
237 |
+
data.reverse();
|
238 |
+
var linkFormatter = function(cell, formatterParams, onRendered) {
|
239 |
+
var curator = cell.getValue();
|
240 |
+
var curatorLink = cell.getData().curator_link;
|
241 |
+
return `<a href="${curatorLink}" target="_blank">${curator}</a>`;
|
242 |
+
};
|
243 |
+
var table = new Tabulator("#example-table", {
|
244 |
+
data: data, // set table data
|
245 |
+
layout: "fitColumns", // fit columns to width of table
|
246 |
+
pagination: "local", // enable local pagination
|
247 |
+
paginationSize: 50, // number of rows per page
|
248 |
+
selectable: true, // enable row selection
|
249 |
+
rowClickPopup: rowPopupFormatter, // добавляем всплывающее окно при клике на строку
|
250 |
+
columns: [
|
251 |
+
{title:"Номер в списке", field:"id"},
|
252 |
+
{title:"Имя", field:"name", width:100},
|
253 |
+
{title:"WhatsApp", field:"phone", formatter: function(cell, formatterParams, onRendered) {
|
254 |
+
var phone = cell.getValue();
|
255 |
+
return `<a href="https://web.whatsapp.com/send?phone=${phone}" target="_blank">${phone}</a>`;
|
256 |
+
}, width:120},
|
257 |
+
{title:"Город", field:"b_city", width:110},
|
258 |
+
{title:"Email", field:"email", width:110},
|
259 |
+
{title:"Реплики", field:"b_mess", width:95},
|
260 |
+
{title:"Куратор", field:"curator", formatter: linkFormatter},
|
261 |
+
{title:"Статус покупки", field:"shop_st", formatter: function(cell, formatterParams, onRendered) {
|
262 |
+
var status = cell.getValue();
|
263 |
+
var color;
|
264 |
+
switch (status) {
|
265 |
+
case 'green':
|
266 |
+
color = 'green';
|
267 |
+
break;
|
268 |
+
case 'red':
|
269 |
+
color = 'red';
|
270 |
+
break;
|
271 |
+
case 'yellow':
|
272 |
+
color = 'yellow';
|
273 |
+
break;
|
274 |
+
default:
|
275 |
+
color = 'gray';
|
276 |
+
}
|
277 |
+
return `<div style="width: 20px; height: 20px; background-color: ${color};"></div>`;
|
278 |
+
}},
|
279 |
+
{title:"Ссылка на пользователя в GC", field:"ad_url", formatter: function(cell, formatterParams, onRendered) {
|
280 |
+
var ad_url = cell.getValue();
|
281 |
+
return `<a href="${ad_url}" target="_blank">${ad_url}</a>`;
|
282 |
+
}},
|
283 |
+
{title:"Ссылка на VK", field:"vk_id", formatter: function(cell, formatterParams, onRendered) {
|
284 |
+
var vk_id = cell.getValue();
|
285 |
+
return `<a href="https://vk.com/id${vk_id}" target="_blank">${vk_id}</a>`;
|
286 |
+
}},
|
287 |
+
{title:"Ссылка на Tg", field:"chat_id", formatter: function(cell, formatterParams, onRendered) {
|
288 |
+
var chatId = cell.getValue();
|
289 |
+
if (chatId.startsWith('@')) {
|
290 |
+
chatId = chatId.substring(1); // Удаление символа @ в начале
|
291 |
+
}
|
292 |
+
return `<a href="https://t.me/${chatId}" target="_blank">${chatId}</a>`;
|
293 |
+
}},
|
294 |
+
{title:"Статус WhatsApp", field:"ws_st"},
|
295 |
+
{title:"Стутус подписки", field:"ws_stop"},
|
296 |
+
{title:"Вебинары", field:"web_st", formatter:"star", formatterParams:{stars:7}, hozAlign:"center", width:120},
|
297 |
+
{title:"Прогрес по воронке", field:"fin_prog", formatter:"progress", formatterParams:{color:["#00dd00", "orange", "rgb(255,0,0)"]}, sorter:"number", width:100},
|
298 |
+
{title:"pr1", field:"pr1"},
|
299 |
+
{title:"pr2", field:"pr2"},
|
300 |
+
{title:"pr3", field:"pr3"},
|
301 |
+
{title:"Канал трафика", field:"pr4"},
|
302 |
+
{title:"Дата", field:"pr5"},
|
303 |
+
{title:"Ключ PR", field:"key_pr"},
|
304 |
+
{title:"Канал", field:"canal"},
|
305 |
+
{title:"Дата", field:"data_t"}
|
306 |
+
],
|
307 |
+
});
|
308 |
+
var fieldEl = document.getElementById("filter-field");
|
309 |
+
var typeEl = document.getElementById("filter-type");
|
310 |
+
var valueEl = document.getElementById("filter-value");
|
311 |
+
function updateFilter() {
|
312 |
+
var filterVal = fieldEl.options[fieldEl.selectedIndex].value;
|
313 |
+
var typeVal = typeEl.options[typeEl.selectedIndex].value;
|
314 |
+
if (filterVal) {
|
315 |
+
table.setFilter(filterVal, typeVal, valueEl.value);
|
|
|
316 |
}
|
317 |
+
}
|
318 |
+
document.getElementById("filter-field").addEventListener("change", updateFilter);
|
319 |
+
document.getElementById("filter-type").addEventListener("change", updateFilter);
|
320 |
+
document.getElementById("filter-value").addEventListener("keyup", updateFilter);
|
321 |
+
document.getElementById("filter-clear").addEventListener("click", function() {
|
322 |
+
fieldEl.value = "";
|
323 |
+
typeEl.value = "=";
|
324 |
+
valueEl.value = "";
|
325 |
+
table.clearFilter();
|
326 |
+
});
|
327 |
+
function handleDownloadJson() {
|
328 |
+
var tableData = table.getData("active");
|
329 |
+
var jsonData = JSON.stringify(tableData, null, 2);
|
330 |
+
console.log("Данные для рассылки:", jsonData);
|
331 |
+
}
|
332 |
+
function handleTakeForYourself() {
|
333 |
+
var tableData = table.getData("active");
|
334 |
+
var jsonData = JSON.stringify(tableData, null, 2);
|
335 |
+
console.log("Данные для себя:", jsonData);
|
336 |
+
}
|
337 |
+
document.getElementById("download-json").addEventListener("click", handleDownloadJson);
|
338 |
+
document.getElementById("take-for-yourself").addEventListener("click", handleTakeForYourself);
|
339 |
+
})
|
340 |
+
.catch(error => console.error('Error fetching data:', error));
|
341 |
+
});
|
342 |
+
</script>
|
343 |
+
|
344 |
+
|
345 |
+
|
346 |
+
|
347 |
</body>
|
348 |
|
349 |
</html>
|