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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="ru">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>WhatsMasterCRM</title>
7
+
8
+
9
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
10
+ <script src="https://unpkg.com/@vkontakte/vk-bridge/dist/browser.min.js"></script>
11
+ <script type="text/javascript" src="https://vk.com/js/api/openapi.js?169"></script>
12
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
13
+ <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
14
+ <script type="text/javascript" src="https://oss.sheetjs.com/sheetjs/xlsx.full.min.js"></script>
15
+
16
+
17
+
18
+ <!-- Подключение стилей Notyf -->
19
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/notyf/notyf.min.css">
20
+
21
+ <!-- Подключение скрипта Notyf -->
22
+ <script src="https://cdn.jsdelivr.net/npm/notyf/notyf.min.js"></script>
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+ <link href="https://unpkg.com/[email protected]/dist/css/tabulator.min.css" rel="stylesheet">
34
+ <script type="text/javascript" src="https://unpkg.com/[email protected]/dist/js/tabulator.min.js"></script>
35
+
36
+
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
+ <body>
167
+ <div id="header">
168
+ <h1>WhatsMasterCRM</h1>
169
+ </div>
170
+ <div>
171
+ <select id="filter-field">
172
+ <option></option>
173
+ <option value="id">Номер в списке</option>
174
+ <option value="name">Имя</option>
175
+ <option value="phone">WhatsApp</option>
176
+ <option value="email">Email</option>
177
+ <option value="b_mess">Реплики</option>
178
+ <option value="curator">Куратор</option>
179
+ <option value="shop_st">Статус покупки</option>
180
+ <option value="ad_url">Ссылка на пользователя в GC</option>
181
+ <option value="vk_id">Ссылка на VK</option>
182
+ <option value="chat_id">Ссылка на Tg</option>
183
+ <option value="ws_stop">Стутус подписки</option>
184
+ <option value="web_st">Вебинары</option>
185
+ <option value="fin_prog">Прогрес по воронке</option>
186
+ <option value="pr1">pr1</option>
187
+ <option value="pr2">pr2</option>
188
+ <option value="pr3">pr3</option>
189
+ <option value="pr4">Канал трафика</option>
190
+ <option value="pr5">Дата</option>
191
+ <option value="key_pr">Ключ PR</option>
192
+ <option value="canal">Канал</option>
193
+ <option value="data_t">Дата</option>
194
+ </select>
195
+
196
+ <select id="filter-type">
197
+ <option value="=">=</option>
198
+ <option value="<"><</option>
199
+ <option value="<="><=</option>
200
+ <option value=">">></option>
201
+ <option value=">=">>=</option>
202
+ <option value="!=">!=</option>
203
+ <option value="like">like</option>
204
+ </select>
205
+
206
+ <input id="filter-value" type="text" placeholder="Значение фильтра">
207
+
208
+ <select id="filter-field2">
209
+ <option></option>
210
+ <option value="id">Номер в списке</option>
211
+ <option value="name">Имя</option>
212
+ <option value="phone">WhatsApp</option>
213
+ <option value="email">Email</option>
214
+ <option value="b_mess">Реплики</option>
215
+ <option value="curator">Куратор</option>
216
+ <option value="shop_st">Статус покупки</option>
217
+ <option value="ad_url">Ссылка на пользователя в GC</option>
218
+ <option value="vk_id">Ссылка на VK</option>
219
+ <option value="chat_id">Ссылка на Tg</option>
220
+ <option value="ws_stop">Стутус подписки</option>
221
+ <option value="web_st">Вебинары</option>
222
+ <option value="fin_prog">Прогрес по воронке</option>
223
+ <option value="pr1">pr1</option>
224
+ <option value="pr2">pr2</option>
225
+ <option value="pr3">pr3</option>
226
+ <option value="pr4">Канал трафика</option>
227
+ <option value="pr5">Дата</option>
228
+ <option value="key_pr">Ключ PR</option>
229
+ <option value="canal">Канал</option>
230
+ <option value="data_t">Дата</option>
231
+ </select>
232
+
233
+ <input id="filter-value2" type="text" placeholder="Значение фильтра 2">
234
+
235
+ <button id="filter-clear">Очистить фильтр</button>
236
+ <button id="download-xlsx">Скачать в XLSX</button>
237
+ <button id="download-json">Download JSON</button>
238
+ <button id="download-rass">Рассылка по выбранным</button>
239
+ <button id="take-for-yourself">Взять себе</button> <!-- Добавлена вторая кнопка -->
240
+ </div>
241
+ <div id="example-table"></div>
242
+
243
+ <script>
244
+ vkBridge.send('VKWebAppInit');
245
+ document.addEventListener('DOMContentLoaded', function() {
246
+ fetch('https://dmtuit-psy2.hf.space/data_gc_tab_out?api_sys=fasSd345D')
247
+ .then(response => response.json())
248
+ .then(data => {
249
+ console.log('Data received:', data); // Логирование данных
250
+ // Переворачиваем массив данных
251
+ data.reverse();
252
+ var linkFormatter = function(cell, formatterParams, onRendered) {
253
+ var curator = cell.getValue();
254
+ var curatorLink = cell.getData().curator_link;
255
+ return `<a href="${curatorLink}" target="_blank">${curator}</a>`;
256
+ };
257
+ var table = new Tabulator("#example-table", {
258
+ data: data, // set table data
259
+ layout: "fitColumns", // fit columns to width of table
260
+ pagination: "local", // enable local pagination
261
+ paginationSize: 50, // number of rows per page
262
+ selectable: true, // enable row selection
263
+ columns: [
264
+ {title:"Номер в списке", field:"id"},
265
+ {title:"Имя", field:"name", width:100},
266
+
267
+
268
+ {title:"WhatsApp", field:"phone", formatter: function(cell, formatterParams, onRendered) {
269
+ var phone = cell.getValue();
270
+ var ws_stop = cell.getData().ws_stop;
271
+ var ws_st = cell.getData().ws_st;
272
+ var imageUrl1 = "https://i.ibb.co/YBvwFR6/whatsapp-2.png"; // Замените на URL первой картинки
273
+ var imageUrl2 = "https://i.ibb.co/LZx71cM/1.png"; // Замените на URL второй картинки
274
+ var imageUrl3 = "https://i.ibb.co/Cvn3QsK/whatsapp-3.png"; // Замените на URL второй картинки
275
+ var link = `<a href="https://web.whatsapp.com/send?phone=${phone}" target="_blank">`;
276
+ // Проверка условий
277
+ if (ws_stop !== "1" && ws_st === "1") {
278
+ console.log("Первая переменная не равна единице, вторая равна единице");
279
+ return link + `<img src="${imageUrl2}" alt="WhatsApp" style="width: 98px; height: 14px;">`;
280
+
281
+ } else if (ws_stop === "1" && ws_st === "1") {
282
+ console.log("Обе переменные равны единице");
283
+ return link + `<img src="${imageUrl3}" alt="WhatsApp" style="width: 98px; height: 14px;">`;
284
+ } else {
285
+ console.log("Остальные случаи");
286
+ return link + `<img src="${imageUrl1}" alt="WhatsApp" style="width: 98px; height: 14px;">`;
287
+ }
288
+ }},
289
+ {title:"ВКонтакте", field:"vk_id", formatter: function(cell, formatterParams, onRendered) {
290
+ var vk_id = cell.getValue();
291
+ var imageUrlvk1 = "https://i.ibb.co/BKB8R4C/2-2.png"; // Замените на URL первой картинки
292
+ var imageUrlvk2 = "https://i.ibb.co/MPCGvQX/2-1.png"; // Замените на URL второй картинки
293
+ var link1 = `<a href="https://vk.com" target="_blank">`;
294
+ var link2 = `<a href="https://vk.com/id${vk_id}" target="_blank">`;
295
+ // Проверка условий
296
+ if (vk_id === "0" || vk_id === "") {
297
+ // Если vk_id равен "0" или пуст
298
+ return link1 + `<img src="${imageUrlvk1}" alt="Image" style="width: 98px; height: 14px;">`;
299
+ } else {
300
+ // Если vk_id не пуст и не равен "0"
301
+ return link2 + `<img src="${imageUrlvk2}" alt="Image" style="width: 98px; height: 14px;">`;
302
+ }
303
+ }},
304
+ {title:"Телеграм", field:"chat_id", formatter: function(cell, formatterParams, onRendered) {
305
+ var chat_id = cell.getValue();
306
+ var imageUrltg1 = "https://i.ibb.co/3S4Wt7m/3-2.png";
307
+ var imageUrlntg2 = "https://i.ibb.co/rZrzQhb/3-1.png";
308
+ var linktg1 = `<a href="https://t.me" target="_blank">`;
309
+ var linktg2 = `<a href="https://t.me/${chat_id}" target="_blank">`;
310
+ if (chat_id === "0" || chat_id === "") {
311
+ return linktg1 + `<img src="${imageUrltg1}" alt="Image" style="width: 98px; height: 14px;">`;
312
+ } else {
313
+ return linktg2 + `<img src="${imageUrlntg2}" alt="Image" style="width: 98px; height: 14px;">`;
314
+ }
315
+ }},
316
+ {title:"GetCurse", field:"gc_url", formatter: function(cell, formatterParams, onRendered) {
317
+ var gc_url = cell.getValue();
318
+ var imageUrlvkgc1 = "https://i.ibb.co/F8825KY/1-2.png";
319
+ var imageUrlvkgc2 = "https://i.ibb.co/S3qwFKM/1-1.png";
320
+ var linkgc1 = `<a href="https://vk.com/getcourseru" target="_blank">`;
321
+ var linkgc2 = `<a href="${gc_url}" target="_blank">`;
322
+ if (gc_url === "0" || gc_url === "") {
323
+ return linkgc1 + `<img src="${imageUrlvkgc1}" alt="Image" style="width: 98px; height: 14px;">`;
324
+ } else {
325
+ return linkgc2 + `<img src="${imageUrlvkgc2}" alt="Image" style="width: 98px; height: 14px;">`;
326
+ }
327
+ }},
328
+
329
+
330
+ {title:"Город", field:"b_city", width:95},
331
+ {title:"Email", field:"email", width:95},
332
+ {title:"Реплики", field:"b_mess", width:95, cellClick:function(e, cell){
333
+ var data = cell.getData();
334
+ const notyf = new Notyf({
335
+ duration: 5000,
336
+ position: {
337
+ x: 'right',
338
+ y: 'top',
339
+ },
340
+ });
341
+ // Формируем текст для уведомления
342
+ const message = `
343
+ Имя: ${data.name}\n
344
+ WhatsApp: ${data.phone}\n
345
+ Реплики: ${data.b_mess}
346
+ `;
347
+ // Показываем уведомление
348
+ notyf.open({
349
+ type: 'info',
350
+ message: message,
351
+ });
352
+ }},
353
+
354
+
355
+
356
+ {title:"Куратор", field:"curator", formatter: linkFormatter},
357
+ {title:"Статус покупки", field:"shop_st", formatter: function(cell, formatterParams, onRendered) {
358
+ var status = cell.getValue();
359
+ var color;
360
+ switch (status) {
361
+ case 'green':
362
+ color = 'green';
363
+ break;
364
+ case 'red':
365
+ color = 'red';
366
+ break;
367
+ case 'yellow':
368
+ color = 'yellow';
369
+ break;
370
+ default:
371
+ color = 'gray';
372
+ }
373
+ return `<div style="width: 20px; height: 20px; background-color: ${color};"></div>`;
374
+ }},
375
+ {title:"Ссылка на пользователя в GC", field:"ad_url", formatter: function(cell, formatterParams, onRendered) {
376
+ var ad_url = cell.getValue();
377
+ return `<a href="${ad_url}" target="_blank">${ad_url}</a>`;
378
+ }},
379
+ {title:"Ссылка на Tg", field:"chat_id", formatter: function(cell, formatterParams, onRendered) {
380
+ var chatId = cell.getValue();
381
+ if (chatId.startsWith('@')) {
382
+ chatId = chatId.substring(1); // Удаление символа @ в начале
383
+ }
384
+ return `<a href="https://t.me/${chatId}" target="_blank">${chatId}</a>`;
385
+ }},
386
+ {title:"Вебинары-присутствовал", field:"web_st", formatter:"star", formatterParams:{stars:7}, hozAlign:"center", width:90},
387
+ {title:"Вебинары-досмотрел до конца", field:"b_fin", formatter:function(cell, formatterParams, onRendered){
388
+ var value = cell.getValue();
389
+ var icon;
390
+ if (value === 'True') {
391
+ icon = ' <img src="https://i.ibb.co/9sqNhYz/4-2.png" width="98" height="14" />'; // Иконка для активного статуса
392
+ } else {
393
+ icon = ''; // Пустая строка для неактивного статуса или если значение не определено
394
+ }
395
+ return icon;
396
+ }},
397
+
398
+ {title:"Прогрес по воронке", field:"fin_prog", formatter:"progress", formatterParams:{color:["#ff0000", "orange", "#00dd00"]}, sorter:"number", width:100},
399
+ {title:"pr1", field:"pr1"},
400
+ {title:"pr2", field:"pr2"},
401
+ {title:"pr3", field:"pr3"},
402
+ {title:"Канал трафика", field:"pr4"},
403
+ {title:"Дата", field:"pr5"},
404
+ {title:"Ключ PR", field:"key_pr"},
405
+ {title:"Канал", field:"canal"},
406
+ {title:"Дата", field:"data_t", width:150}
407
+ ],
408
+ });
409
+
410
+ var fieldEl = document.getElementById("filter-field");
411
+ var typeEl = document.getElementById("filter-type");
412
+ var valueEl = document.getElementById("filter-value");
413
+ var fieldEl2 = document.getElementById("filter-field2");
414
+ var valueEl2 = document.getElementById("filter-value2");
415
+ function updateFilter() {
416
+ var filterVal1 = fieldEl.value;
417
+ var typeVal1 = typeEl.value;
418
+ var valueVal1 = valueEl.value;
419
+ var filterVal2 = fieldEl2.value;
420
+ var valueVal2 = valueEl2.value;
421
+ if (filterVal1 && filterVal2) {
422
+ table.setFilter([
423
+ { field: filterVal1, type: typeVal1, value: valueVal1 },
424
+ { field: filterVal2, type: "=", value: valueVal2 }
425
+ ]);
426
+ }
427
+ }
428
+ document.getElementById("filter-field").addEventListener("change", updateFilter);
429
+ document.getElementById("filter-type").addEventListener("change", updateFilter);
430
+ document.getElementById("filter-value").addEventListener("keyup", updateFilter);
431
+ document.getElementById("filter-field2").addEventListener("change", updateFilter);
432
+ document.getElementById("filter-value2").addEventListener("keyup", updateFilter);
433
+ //trigger download of data.json file
434
+ document.getElementById("download-json").addEventListener("click", function(){
435
+ table.download("json", "data.json");
436
+ });
437
+
438
+
439
+ //trigger download of data.xlsx file
440
+ document.getElementById("download-xlsx").addEventListener("click", function(){
441
+ table.download("xlsx", "data.xlsx", {sheetName:"My Data"});
442
+ });
443
+ document.getElementById("filter-clear").addEventListener("click", function() {
444
+ fieldEl.value = "";
445
+ typeEl.value = "=";
446
+ valueEl.value = "";
447
+ fieldEl2.value = "";
448
+ valueEl2.value = "";
449
+ table.clearFilter();
450
+ });
451
+ function handleDownloadRass() {
452
+ var tableData = table.getData("active");
453
+ var jsonData = JSON.stringify(tableData, null, 2);
454
+ console.log("Данные для рассылки:", jsonData);
455
+ }
456
+
457
+ function handleTakeForYourself() {
458
+ var tableData = table.getData("active");
459
+ var jsonData = JSON.stringify(tableData, null, 2);
460
+ console.log("Данные для себя:", jsonData);
461
+ }
462
+ document.getElementById("download-rass").addEventListener("click", handleDownloadRass);
463
+ document.getElementById("take-for-yourself").addEventListener("click", handleTakeForYourself);
464
+ })
465
+ .catch(error => console.error('Error fetching data:', error));
466
+ });
467
+ </script>
468
+ </body>
469
+
470
+ </html>