DmitrMakeev commited on
Commit
5a9a48f
1 Parent(s): e8d1bf2

Update bas_vk_tab.html

Browse files
Files changed (1) hide show
  1. 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
- 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__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
- </style>
163
  </head>
164
 
165
 
166
  <body>
167
- <div>
168
- <select id="filter-field">
169
- <option></option>
170
- <option value="id">Номер в списке</option>
171
- <option value="name">Имя</option>
172
- <option value="phone">WhatsApp</option>
173
- <option value="vk_id">Ссылка на VK</option>
174
- <option value="chat_id">Ссылка на Tg</option>
175
- <option value="gc_url">Ссылка на пользователя в GC</option>
176
- <option value="b_city">Город</option>
177
- <option value="email">Email</option>
178
- <option value="b_mess">Реплики</option>
179
- <option value="curator">Куратор</option>
180
- <option value="shop_st">Статус покупки</option>
181
- <option value="ws_stop">Стутус подписки</option>
182
- <option value="web_st">Вебинары</option>
183
- <option value="fin_prog">Прогрес по воронке</option>
184
- <option value="pr4">Канал трафика</option>
185
- <option value="pr5">Дата</option>
186
- <option value="key_pr">Ключ PR</option>
187
- <option value="canal">Канал</option>
188
- <option value="data_t">Дата</option>
189
- </select>
190
- <select id="filter-type">
191
- <option value="=">=</option>
192
- <option value="<"><</option>
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
- // Download JSON functionality
342
- document.getElementById('download-json').addEventListener('click', function() {
343
- var selectedRows = table.getSelectedData();
344
- var jsonData = JSON.stringify(selectedRows);
345
- var blob = new Blob([jsonData], { type: 'application/json' });
346
- var url = URL.createObjectURL(blob);
347
- var a = document.createElement('a');
348
- a.href = url;
349
- a.download = 'data.json';
350
- document.body.appendChild(a);
351
- a.click();
352
- URL.revokeObjectURL(url);
353
- });
354
 
355
- // New Download JSON functionality
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
- // Take for yourself functionality
369
- document.getElementById('take-for-yourself').addEventListener('click', function() {
370
- var selectedRows = table.getSelectedData();
371
- console.log('Selected rows:', selectedRows);
372
- });
 
 
373
 
374
- // Filter functionality
375
- document.getElementById('filter-value').addEventListener('input', function() {
376
- var field = document.getElementById('filter-field').value;
377
- var type = document.getElementById('filter-type').value;
378
- var value = document.getElementById('filter-value').value;
379
- if (field && type && value) {
380
- table.setFilter(field, type, value);
381
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
  });
383
- })
384
- .catch(error => {
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