DmitrMakeev
commited on
Commit
•
5a9a48f
1
Parent(s):
e8d1bf2
Update bas_vk_tab.html
Browse files- bas_vk_tab.html +327 -334
bas_vk_tab.html
CHANGED
@@ -37,355 +37,348 @@
|
|
37 |
|
38 |
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
39 |
<style>
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
151 |
.notyf__toast {
|
152 |
-
background-color: #4CAF50 !important;
|
153 |
-
color: #ffffff !important;
|
154 |
font-size: 16px;
|
155 |
}
|
156 |
.notyf__toast--success {
|
157 |
-
background-color: #4CAF50 !important;
|
158 |
}
|
159 |
.notyf__toast--error {
|
160 |
-
background-color: #d9534f !important;
|
161 |
-
}
|
162 |
-
|
163 |
</head>
|
164 |
|
165 |
|
166 |
<body>
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
<
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
<option value="<="><=</option>
|
194 |
-
<option value=">">></option>
|
195 |
-
<option value=">=">>=</option>
|
196 |
-
<option value="!=">!=</option>
|
197 |
-
<option value="like">like</option>
|
198 |
-
</select>
|
199 |
-
<input id="filter-value" type="text" placeholder="Значение фильтра">
|
200 |
-
<button id="filter-clear">Очистить фильтр</button>
|
201 |
-
<button id="download-xlsx">Скачать в XLSX</button>
|
202 |
-
<button id="download-json">Рассылка по выбранным</button>
|
203 |
-
<button id="take-for-yourself">Взять себе</button>
|
204 |
-
<button id="download-json-new">Скачать JSON</button>
|
205 |
-
</div>
|
206 |
-
<div id="example-table"></div>
|
207 |
-
|
208 |
-
<script>
|
209 |
-
vkBridge.send('VKWebAppInit');
|
210 |
-
document.addEventListener('DOMContentLoaded', function() {
|
211 |
-
fetch('https://dmtuit-psy2.hf.space/data_gc_tab_out?api_sys=fasSd345D')
|
212 |
-
.then(response => response.json())
|
213 |
-
.then(data => {
|
214 |
-
console.log('Data received:', data);
|
215 |
-
data.reverse();
|
216 |
-
|
217 |
-
var linkFormatter = function(cell, formatterParams, onRendered) {
|
218 |
-
var curator = cell.getValue();
|
219 |
-
var curatorLink = cell.getData().curator_link;
|
220 |
-
return `<a href="${curatorLink}" target="_blank">${curator}</a>`;
|
221 |
-
};
|
222 |
-
var table = new Tabulator("#example-table", {
|
223 |
-
data: data,
|
224 |
-
layout: "fitColumns",
|
225 |
-
pagination: "local",
|
226 |
-
paginationSize: 50,
|
227 |
-
selectable: true,
|
228 |
-
columns: [
|
229 |
-
{title:"Номер в списке", field:"id"},
|
230 |
-
{title:"Имя", field:"name", width:100},
|
231 |
-
{title:"WhatsApp", field:"phone", formatter: function(cell, formatterParams, onRendered) {
|
232 |
-
var phone = cell.getValue();
|
233 |
-
var ws_stop = cell.getData().ws_stop;
|
234 |
-
var ws_st = cell.getData().ws_st;
|
235 |
-
var imageUrl1 = "https://i.ibb.co/YBvwFR6/whatsapp-2.png";
|
236 |
-
var imageUrl2 = "https://i.ibb.co/LZx71cM/1.png";
|
237 |
-
var imageUrl3 = "https://i.ibb.co/Cvn3QsK/whatsapp-3.png";
|
238 |
-
var link = `<a href="https://web.whatsapp.com/send?phone=${phone}" target="_blank">`;
|
239 |
-
if (ws_stop !== "1" && ws_st === "1") {
|
240 |
-
return link + `<img src="${imageUrl2}" alt="WhatsApp" style="width: 98px; height: 14px;">`;
|
241 |
-
} else if (ws_stop === "1" && ws_st === "1") {
|
242 |
-
return link + `<img src="${imageUrl3}" alt="WhatsApp" style="width: 98px; height: 14px;">`;
|
243 |
-
} else {
|
244 |
-
return link + `<img src="${imageUrl1}" alt="WhatsApp" style="width: 98px; height: 14px;">`;
|
245 |
-
}
|
246 |
-
}},
|
247 |
-
{title:"ВКонтакте", field:"vk_id", formatter: function(cell, formatterParams, onRendered) {
|
248 |
-
var vk_id = cell.getValue();
|
249 |
-
var imageUrlvk1 = "https://i.ibb.co/BKB8R4C/2-2.png";
|
250 |
-
var imageUrlvk2 = "https://i.ibb.co/MPCGvQX/2-1.png";
|
251 |
-
var link1 = `<a href="https://vk.com" target="_blank">`;
|
252 |
-
var link2 = `<a href="https://vk.com/id${vk_id}" target="_blank">`;
|
253 |
-
if (vk_id === "0" || vk_id === "") {
|
254 |
-
return link1 + `<img src="${imageUrlvk1}" alt="Image" style="width: 98px; height: 14px;">`;
|
255 |
-
} else {
|
256 |
-
return link2 + `<img src="${imageUrlvk2}" alt="Image" style="width: 98px; height: 14px;">`;
|
257 |
-
}
|
258 |
-
}},
|
259 |
-
{title:"Телеграм", field:"chat_id", formatter: function(cell, formatterParams, onRendered) {
|
260 |
-
var chat_id = cell.getValue();
|
261 |
-
var imageUrltg1 = "https://i.ibb.co/3S4Wt7m/3-2.png";
|
262 |
-
var imageUrlntg2 = "https://i.ibb.co/rZrzQhb/3-1.png";
|
263 |
-
var linktg1 = `<a href="https://t.me" target="_blank">`;
|
264 |
-
var linktg2 = `<a href="https://t.me/${chat_id}" target="_blank">`;
|
265 |
-
if (chat_id === "0" || chat_id === "") {
|
266 |
-
return linktg1 + `<img src="${imageUrltg1}" alt="Image" style="width: 98px; height: 14px;">`;
|
267 |
-
} else {
|
268 |
-
return linktg2 + `<img src="${imageUrlntg2}" alt="Image" style="width: 98px; height: 14px;">`;
|
269 |
-
}
|
270 |
-
}},
|
271 |
-
{title:"GetCurse", field:"gc_url", formatter: function(cell, formatterParams, onRendered) {
|
272 |
-
var gc_url = cell.getValue();
|
273 |
-
var imageUrlvkgc1 = "https://i.ibb.co/F8825KY/1-2.png";
|
274 |
-
var imageUrlvkgc2 = "https://i.ibb.co/S3qwFKM/1-1.png";
|
275 |
-
var linkgc1 = `<a href="https://vk.com/getcourseru" target="_blank">`;
|
276 |
-
var linkgc2 = `<a href="${gc_url}" target="_blank">`;
|
277 |
-
if (gc_url === "0" || gc_url === "") {
|
278 |
-
return linkgc1 + `<img src="${imageUrlvkgc1}" alt="Image" style="width: 98px; height: 14px;">`;
|
279 |
-
} else {
|
280 |
-
return linkgc2 + `<img src="${imageUrlvkgc2}" alt="Image" style="width: 98px; height: 14px;">`;
|
281 |
-
}
|
282 |
-
}},
|
283 |
-
{title:"Город", field:"b_city", width:95},
|
284 |
-
{title:"Email", field:"email", width:95},
|
285 |
-
{title:"Реплики", field:"b_mess", width:95, cellClick:function(e, cell){
|
286 |
-
var data = cell.getData();
|
287 |
-
const notyf = new Notyf({
|
288 |
-
duration: 5000,
|
289 |
-
position: {
|
290 |
-
x: 'right',
|
291 |
-
y: 'top',
|
292 |
-
},
|
293 |
-
});
|
294 |
-
const message = `
|
295 |
-
Имя: ${data.name}\n
|
296 |
-
WhatsApp: ${data.phone}\n
|
297 |
-
Реплики: ${data.b_mess}
|
298 |
-
`;
|
299 |
-
notyf.open({
|
300 |
-
type: 'info',
|
301 |
-
message: message,
|
302 |
-
});
|
303 |
-
}},
|
304 |
-
{title:"Куратор", field:"curator", formatter: linkFormatter},
|
305 |
-
{title:"Статус покупки", field:"shop_st", formatter: function(cell, formatterParams, onRendered) {
|
306 |
-
var status = cell.getValue();
|
307 |
-
var color;
|
308 |
-
switch (status) {
|
309 |
-
case 'green':
|
310 |
-
color = 'green';
|
311 |
-
break;
|
312 |
-
case 'red':
|
313 |
-
color = 'red';
|
314 |
-
break;
|
315 |
-
case 'yellow':
|
316 |
-
color = 'yellow';
|
317 |
-
break;
|
318 |
-
default:
|
319 |
-
color = 'gray';
|
320 |
-
}
|
321 |
-
return `<div style="width: 20px; height: 20px; background-color: ${color}; border-radius: 50%;"></div>`;
|
322 |
-
}},
|
323 |
-
{title:"Канал трафика", field:"pr4", width:95},
|
324 |
-
{title:"Дата", field:"pr5", width:95},
|
325 |
-
{title:"Ключ PR", field:"key_pr", width:95},
|
326 |
-
{title:"Канал", field:"canal", width:95},
|
327 |
-
{title:"Дата", field:"data_t", width:95},
|
328 |
-
],
|
329 |
-
});
|
330 |
-
|
331 |
-
// Clear filter
|
332 |
-
document.getElementById('filter-clear').addEventListener('click', function() {
|
333 |
-
table.clearFilter(true);
|
334 |
-
});
|
335 |
-
|
336 |
-
// Download XLSX functionality
|
337 |
-
document.getElementById('download-xlsx').addEventListener('click', function() {
|
338 |
-
table.download("xlsx", "data.xlsx");
|
339 |
-
});
|
340 |
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
document.body.appendChild(a);
|
351 |
-
a.click();
|
352 |
-
URL.revokeObjectURL(url);
|
353 |
-
});
|
354 |
|
355 |
-
|
356 |
-
document.getElementById('download-json-new').addEventListener('click', function() {
|
357 |
-
var jsonData = JSON.stringify(data);
|
358 |
-
var blob = new Blob([jsonData], { type: 'application/json' });
|
359 |
-
var url = URL.createObjectURL(blob);
|
360 |
-
var a = document.createElement('a');
|
361 |
-
a.href = url;
|
362 |
-
a.download = 'data.json';
|
363 |
-
document.body.appendChild(a);
|
364 |
-
a.click();
|
365 |
-
URL.revokeObjectURL(url);
|
366 |
-
});
|
367 |
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
|
|
|
|
373 |
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
});
|
383 |
-
|
384 |
-
|
385 |
-
console.error('Ошибка при загрузке JSON:', error);
|
386 |
-
});
|
387 |
-
});
|
388 |
-
</script>
|
389 |
</body>
|
390 |
|
391 |
|
|
|
37 |
|
38 |
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
39 |
<style>
|
40 |
+
body {
|
41 |
+
font-family: Arial, sans-serif;
|
42 |
+
text-align: center;
|
43 |
+
background-color: #f0f0f0;
|
44 |
+
margin: 0;
|
45 |
+
padding: 0;
|
46 |
+
}
|
47 |
+
h1 {
|
48 |
+
background-color: #4CAF50;
|
49 |
+
color: white;
|
50 |
+
padding: 20px;
|
51 |
+
margin: 0;
|
52 |
+
border-bottom: 2px solid #388E3C;
|
53 |
+
font-size: 28px;
|
54 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
55 |
+
}
|
56 |
+
button, #filter-clear, #download-json, #take-for-yourself {
|
57 |
+
color: white;
|
58 |
+
background-color: #4CAF50;
|
59 |
+
border: none;
|
60 |
+
cursor: pointer;
|
61 |
+
padding: 10px 20px;
|
62 |
+
font-size: 16px;
|
63 |
+
border-radius: 5px;
|
64 |
+
margin: 5px;
|
65 |
+
transition: background-color 0.3s ease;
|
66 |
+
}
|
67 |
+
button:hover, #filter-clear:hover, #download-json:hover, #take-for-yourself:hover {
|
68 |
+
background-color: #388E3C;
|
69 |
+
}
|
70 |
+
#filter-field, #filter-type, #filter-value, #filter-field2, #filter-value2 {
|
71 |
+
padding: 10px;
|
72 |
+
font-size: 16px;
|
73 |
+
margin: 5px;
|
74 |
+
border-radius: 5px;
|
75 |
+
border: 1px solid #ccc;
|
76 |
+
background-color: #f0f0f0;
|
77 |
+
transition: border-color 0.3s ease, box-shadow 0.3s ease;
|
78 |
+
}
|
79 |
+
#filter-field:focus, #filter-type:focus, #filter-value:focus, #filter-field2:focus, #filter-value2:focus {
|
80 |
+
border-color: #4CAF50;
|
81 |
+
box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
|
82 |
+
}
|
83 |
+
#filter-field option, #filter-type option, #filter-field2 option {
|
84 |
+
background-color: #f0f0f0;
|
85 |
+
color: #333;
|
86 |
+
}
|
87 |
+
#filter-field:hover, #filter-type:hover, #filter-value:hover, #filter-field2:hover, #filter-value2:hover {
|
88 |
+
border-color: #4CAF50;
|
89 |
+
}
|
90 |
+
#mediaContainer {
|
91 |
+
margin-top: 20px;
|
92 |
+
display: flex;
|
93 |
+
justify-content: center;
|
94 |
+
align-items: center;
|
95 |
+
flex-direction: column;
|
96 |
+
max-width: 100%;
|
97 |
+
height: auto;
|
98 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
99 |
+
border-radius: 10px;
|
100 |
+
padding: 20px;
|
101 |
+
background-color: white;
|
102 |
+
}
|
103 |
+
#mediaContainer img, #mediaContainer video {
|
104 |
+
max-width: 100%;
|
105 |
+
height: auto;
|
106 |
+
object-fit: contain;
|
107 |
+
border-radius: 10px;
|
108 |
+
}
|
109 |
+
#imageUrl {
|
110 |
+
margin-top: 20px;
|
111 |
+
font-size: 16px;
|
112 |
+
color: #333;
|
113 |
+
cursor: pointer;
|
114 |
+
text-decoration: underline;
|
115 |
+
transition: color 0.3s ease;
|
116 |
+
}
|
117 |
+
#imageUrl:hover {
|
118 |
+
color: #4CAF50;
|
119 |
+
}
|
120 |
+
#progressBarContainer {
|
121 |
+
width: 80%;
|
122 |
+
margin: 20px auto;
|
123 |
+
background-color: #ddd;
|
124 |
+
border-radius: 13px;
|
125 |
+
padding: 3px;
|
126 |
+
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
|
127 |
+
}
|
128 |
+
#progressBar {
|
129 |
+
width: 0%;
|
130 |
+
height: 20px;
|
131 |
+
background-color: #4CAF50;
|
132 |
+
border-radius: 10px;
|
133 |
+
text-align: center;
|
134 |
+
line-height: 20px;
|
135 |
+
color: white;
|
136 |
+
transition: width 0.3s ease;
|
137 |
+
}
|
138 |
+
.swal-button-custom {
|
139 |
+
background-color: #4CAF50;
|
140 |
+
font-size: 16px;
|
141 |
+
padding: 10px 20px;
|
142 |
+
}
|
143 |
+
.swal-title-custom {
|
144 |
+
font-size: 24px;
|
145 |
+
color: #333;
|
146 |
+
}
|
147 |
+
.swal-content-custom {
|
148 |
+
font-size: 16px;
|
149 |
+
color: #666;
|
150 |
+
}
|
151 |
+
/* Переопределение стилей Notyf */
|
152 |
.notyf__toast {
|
153 |
+
background-color: #4CAF50 !important; /* Зеленый фон */
|
154 |
+
color: #ffffff !important; /* Белый текст */
|
155 |
font-size: 16px;
|
156 |
}
|
157 |
.notyf__toast--success {
|
158 |
+
background-color: #4CAF50 !important; /* Зеленый фон для успешного уведомления */
|
159 |
}
|
160 |
.notyf__toast--error {
|
161 |
+
background-color: #d9534f !important; /* Красный фон для ошибок (по желанию) */
|
162 |
+
}
|
163 |
+
</style>
|
164 |
</head>
|
165 |
|
166 |
|
167 |
<body>
|
168 |
+
<div id="header">
|
169 |
+
<h1>WhatsMasterCRM</h1>
|
170 |
+
</div>
|
171 |
+
<div>
|
172 |
+
<select id="filter-field">
|
173 |
+
<option></option>
|
174 |
+
<option value="id">Номер в списке</option>
|
175 |
+
<option value="name">Имя</option>
|
176 |
+
<option value="phone">WhatsApp</option>
|
177 |
+
<option value="vk_id">Ссылка на VK</option>
|
178 |
+
<option value="chat_id">Ссылка на Tg</option>
|
179 |
+
<option value="gc_url">Ссылка на пользователя в GC</option>
|
180 |
+
<option value="b_city">Город</option>
|
181 |
+
<option value="email">Email</option>
|
182 |
+
<option value="b_mess">Реплики</option>
|
183 |
+
<option value="curator">Куратор</option>
|
184 |
+
<option value="shop_st">Статус покупки</option>
|
185 |
+
<option value="ws_stop">Стутус подписки</option>
|
186 |
+
<option value="web_st">Вебинары</option>
|
187 |
+
<option value="fin_prog">Прогрес по воронке</option>
|
188 |
+
<option value="pr4">Канал трафика</option>
|
189 |
+
<option value="pr5">Дата</option>
|
190 |
+
<option value="key_pr">Ключ PR</option>
|
191 |
+
<option value="canal">Канал</option>
|
192 |
+
<option value="data_t">Дата</option>
|
193 |
+
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
|
195 |
+
<select id="filter-type">
|
196 |
+
<option value="=">=</option>
|
197 |
+
<option value="<"><</option>
|
198 |
+
<option value="<="><=</option>
|
199 |
+
<option value=">">></option>
|
200 |
+
<option value=">=">>=</option>
|
201 |
+
<option value="!=">!=</option>
|
202 |
+
<option value="like">like</option>
|
203 |
+
</select>
|
|
|
|
|
|
|
|
|
204 |
|
205 |
+
<input id="filter-value" type="text" placeholder="Значение фильтра">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
|
207 |
+
<button id="filter-clear">Очистить фильтр</button>
|
208 |
+
<button id="download-xlsx">Скачать в XLSX</button>
|
209 |
+
<button id="download-json">Рассылка по выбранным</button>
|
210 |
+
<button id="take-for-yourself">Взять себе</button>
|
211 |
+
<button id="download-json-new">Скачать JSON</button> <!-- Новая кнопка для скачивания JSON -->
|
212 |
+
</div>
|
213 |
+
<div id="example-table"></div>
|
214 |
|
215 |
+
<script>
|
216 |
+
vkBridge.send('VKWebAppInit');
|
217 |
+
document.addEventListener('DOMContentLoaded', function() {
|
218 |
+
fetch('https://dmtuit-psy.hf.space/data_gc_tab_out?api_sys=fasSd345D')
|
219 |
+
.then(response => response.json())
|
220 |
+
.then(data => {
|
221 |
+
console.log('Data received:', data);
|
222 |
+
data.reverse();
|
223 |
+
|
224 |
+
var linkFormatter = function(cell, formatterParams, onRendered) {
|
225 |
+
var curator = cell.getValue();
|
226 |
+
var curatorLink = cell.getData().curator_link;
|
227 |
+
return `<a href="${curatorLink}" target="_blank">${curator}</a>`;
|
228 |
+
};
|
229 |
+
var table = new Tabulator("#example-table", {
|
230 |
+
data: data,
|
231 |
+
layout: "fitColumns",
|
232 |
+
pagination: "local",
|
233 |
+
paginationSize: 50,
|
234 |
+
selectable: true,
|
235 |
+
columns: [
|
236 |
+
{title:"Номер в списке", field:"id"},
|
237 |
+
{title:"Имя", field:"name", width:100},
|
238 |
+
{title:"WhatsApp", field:"phone", formatter: function(cell, formatterParams, onRendered) {
|
239 |
+
var phone = cell.getValue();
|
240 |
+
var ws_stop = cell.getData().ws_stop;
|
241 |
+
var ws_st = cell.getData().ws_st;
|
242 |
+
var imageUrl1 = "https://i.ibb.co/YBvwFR6/whatsapp-2.png";
|
243 |
+
var imageUrl2 = "https://i.ibb.co/LZx71cM/1.png";
|
244 |
+
var imageUrl3 = "https://i.ibb.co/Cvn3QsK/whatsapp-3.png";
|
245 |
+
var link = `<a href="https://web.whatsapp.com/send?phone=${phone}" target="_blank">`;
|
246 |
+
if (ws_stop !== "1" && ws_st === "1") {
|
247 |
+
return link + `<img src="${imageUrl2}" alt="WhatsApp" style="width: 98px; height: 14px;">`;
|
248 |
+
} else if (ws_stop === "1" && ws_st === "1") {
|
249 |
+
return link + `<img src="${imageUrl3}" alt="WhatsApp" style="width: 98px; height: 14px;">`;
|
250 |
+
} else {
|
251 |
+
return link + `<img src="${imageUrl1}" alt="WhatsApp" style="width: 98px; height: 14px;">`;
|
252 |
+
}
|
253 |
+
}},
|
254 |
+
{title:"ВКонтакте", field:"vk_id", formatter: function(cell, formatterParams, onRendered) {
|
255 |
+
var vk_id = cell.getValue();
|
256 |
+
var imageUrlvk1 = "https://i.ibb.co/BKB8R4C/2-2.png";
|
257 |
+
var imageUrlvk2 = "https://i.ibb.co/MPCGvQX/2-1.png";
|
258 |
+
var link1 = `<a href="https://vk.com" target="_blank">`;
|
259 |
+
var link2 = `<a href="https://vk.com/id${vk_id}" target="_blank">`;
|
260 |
+
if (vk_id === "0" || vk_id === "") {
|
261 |
+
return link1 + `<img src="${imageUrlvk1}" alt="Image" style="width: 98px; height: 14px;">`;
|
262 |
+
} else {
|
263 |
+
return link2 + `<img src="${imageUrlvk2}" alt="Image" style="width: 98px; height: 14px;">`;
|
264 |
+
}
|
265 |
+
}},
|
266 |
+
{title:"Телеграм", field:"chat_id", formatter: function(cell, formatterParams, onRendered) {
|
267 |
+
var chat_id = cell.getValue();
|
268 |
+
var imageUrltg1 = "https://i.ibb.co/3S4Wt7m/3-2.png";
|
269 |
+
var imageUrlntg2 = "https://i.ibb.co/rZrzQhb/3-1.png";
|
270 |
+
var linktg1 = `<a href="https://t.me" target="_blank">`;
|
271 |
+
var linktg2 = `<a href="https://t.me/${chat_id}" target="_blank">`;
|
272 |
+
if (chat_id === "0" || chat_id === "") {
|
273 |
+
return linktg1 + `<img src="${imageUrltg1}" alt="Image" style="width: 98px; height: 14px;">`;
|
274 |
+
} else {
|
275 |
+
return linktg2 + `<img src="${imageUrlntg2}" alt="Image" style="width: 98px; height: 14px;">`;
|
276 |
+
}
|
277 |
+
}},
|
278 |
+
{title:"GetCurse", field:"gc_url", formatter: function(cell, formatterParams, onRendered) {
|
279 |
+
var gc_url = cell.getValue();
|
280 |
+
var imageUrlvkgc1 = "https://i.ibb.co/F8825KY/1-2.png";
|
281 |
+
var imageUrlvkgc2 = "https://i.ibb.co/S3qwFKM/1-1.png";
|
282 |
+
var linkgc1 = `<a href="https://vk.com/getcourseru" target="_blank">`;
|
283 |
+
var linkgc2 = `<a href="${gc_url}" target="_blank">`;
|
284 |
+
if (gc_url === "0" || gc_url === "") {
|
285 |
+
return linkgc1 + `<img src="${imageUrlvkgc1}" alt="Image" style="width: 98px; height: 14px;">`;
|
286 |
+
} else {
|
287 |
+
return linkgc2 + `<img src="${imageUrlvkgc2}" alt="Image" style="width: 98px; height: 14px;">`;
|
288 |
+
}
|
289 |
+
}},
|
290 |
+
{title:"Город", field:"b_city", width:95},
|
291 |
+
{title:"Email", field:"email", width:95},
|
292 |
+
{title:"Реплики", field:"b_mess", width:95, cellClick:function(e, cell){
|
293 |
+
var data = cell.getData();
|
294 |
+
const notyf = new Notyf({
|
295 |
+
duration: 5000,
|
296 |
+
position: {
|
297 |
+
x: 'right',
|
298 |
+
y: 'top',
|
299 |
+
},
|
300 |
+
});
|
301 |
+
const message = `
|
302 |
+
Имя: ${data.name}\n
|
303 |
+
WhatsApp: ${data.phone}\n
|
304 |
+
Реплики: ${data.b_mess}
|
305 |
+
`;
|
306 |
+
notyf.open({
|
307 |
+
type: 'info',
|
308 |
+
message: message,
|
309 |
+
});
|
310 |
+
}},
|
311 |
+
{title:"Куратор", field:"curator", formatter: linkFormatter},
|
312 |
+
{title:"Статус покупки", field:"shop_st", formatter: function(cell, formatterParams, onRendered) {
|
313 |
+
var status = cell.getValue();
|
314 |
+
var color;
|
315 |
+
switch (status) {
|
316 |
+
case 'green':
|
317 |
+
color = 'green';
|
318 |
+
break;
|
319 |
+
case 'red':
|
320 |
+
color = 'red';
|
321 |
+
break;
|
322 |
+
case 'yellow':
|
323 |
+
color = 'yellow';
|
324 |
+
break;
|
325 |
+
default:
|
326 |
+
color = 'gray';
|
327 |
+
}
|
328 |
+
return `<div style="width: 20px; height: 20px; background-color: ${color}; border-radius: 50%;"></div>`;
|
329 |
+
}},
|
330 |
+
{title:"Канал трафика", field:"pr4", width:95},
|
331 |
+
{title:"Дата", field:"pr5", width:95},
|
332 |
+
{title:"Ключ PR", field:"key_pr", width:95},
|
333 |
+
{title:"Канал", field:"canal", width:95},
|
334 |
+
{title:"Дата", field:"data_t", width:95},
|
335 |
+
],
|
336 |
+
});
|
337 |
+
// Clear filter
|
338 |
+
document.getElementById('filter-clear').addEventListener('click', function() {
|
339 |
+
table.clearFilter(true);
|
340 |
+
});
|
341 |
+
// Download XLSX functionality
|
342 |
+
document.getElementById('download-xlsx').addEventListener('click', function() {
|
343 |
+
table.download("xlsx", "data.xlsx");
|
344 |
+
});
|
345 |
+
// Download JSON functionality
|
346 |
+
document.getElementById('download-json').addEventListener('click', function() {
|
347 |
+
var selectedRows = table.getSelectedData();
|
348 |
+
var jsonData = JSON.stringify(selectedRows);
|
349 |
+
var blob = new Blob([jsonData], { type: 'application/json' });
|
350 |
+
var url = URL.createObjectURL(blob);
|
351 |
+
var a = document.createElement('a');
|
352 |
+
a.href = url;
|
353 |
+
a.download = 'data.json';
|
354 |
+
document.body.appendChild(a);
|
355 |
+
a.click();
|
356 |
+
URL.revokeObjectURL(url);
|
357 |
+
});
|
358 |
+
// New Download JSON functionality
|
359 |
+
document.getElementById('download-json-new').addEventListener('click', function() {
|
360 |
+
var jsonData = JSON.stringify(data);
|
361 |
+
var blob = new Blob([jsonData], { type: 'application/json' });
|
362 |
+
var url = URL.createObjectURL(blob);
|
363 |
+
var a = document.createElement('a');
|
364 |
+
a.href = url;
|
365 |
+
a.download = 'data.json';
|
366 |
+
document.body.appendChild(a);
|
367 |
+
a.click();
|
368 |
+
URL.revokeObjectURL(url);
|
369 |
+
});
|
370 |
+
// Take for yourself functionality
|
371 |
+
document.getElementById('take-for-yourself').addEventListener('click', function() {
|
372 |
+
var selectedRows = table.getSelectedData();
|
373 |
+
// Your logic to handle selected rows
|
374 |
+
console.log('Selected rows:', selectedRows);
|
375 |
+
});
|
376 |
+
})
|
377 |
+
.catch(error => {
|
378 |
+
console.error('Ошибка при загрузке JSON:', error);
|
379 |
});
|
380 |
+
});
|
381 |
+
</script>
|
|
|
|
|
|
|
|
|
382 |
</body>
|
383 |
|
384 |
|