DmitrMakeev commited on
Commit
8bc3fd3
·
verified ·
1 Parent(s): 3f32a3c

Update bas_vk_tab.html

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