DmitrMakeev
commited on
Update data_gc_tab.html
Browse files- data_gc_tab.html +83 -143
data_gc_tab.html
CHANGED
@@ -158,170 +158,110 @@
|
|
158 |
background-color: #388E3C;
|
159 |
}
|
160 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
</head>
|
162 |
|
163 |
<body>
|
164 |
<div id="header">
|
165 |
<h1>WhatsCRM - Автопилот + Tilda + Бизон 365 + GetCurse</h1>
|
166 |
</div>
|
167 |
-
<div>
|
168 |
<select id="filter-field">
|
169 |
-
|
170 |
-
<option value="id">Номер в списке</option>
|
171 |
-
<option value="name">Имя</option>
|
172 |
-
<option value="phone">WhatsApp</option>
|
173 |
-
<option value="email">Email</option>
|
174 |
-
<option value="b_mess">Реплики</option>
|
175 |
-
<option value="curator">Куратор</option>
|
176 |
-
<option value="shop_st">Статус покупки</option>
|
177 |
-
<option value="ad_url">Ссылка на пользователя в GC</option>
|
178 |
-
<option value="vk_id">Ссылка на VK</option>
|
179 |
-
<option value="chat_id">Ссылка на Tg</option>
|
180 |
-
<option value="ws_stop">Стутус подписки</option>
|
181 |
-
<option value="web_st">Вебинары</option>
|
182 |
-
<option value="fin_prog">Прогрес по воронке</option>
|
183 |
-
<option value="pr1">pr1</option>
|
184 |
-
<option value="pr2">pr2</option>
|
185 |
-
<option value="pr3">pr3</option>
|
186 |
-
<option value="pr4">Канал трафика</option>
|
187 |
-
<option value="pr5">Дата</option>
|
188 |
-
<option value="key_pr">Ключ PR</option>
|
189 |
-
<option value="canal">Канал</option>
|
190 |
-
<option value="data_t">Дата</option>
|
191 |
</select>
|
192 |
-
|
193 |
<select id="filter-type">
|
194 |
-
|
195 |
-
<option value="<"><</option>
|
196 |
-
<option value="<="><=</option>
|
197 |
-
<option value=">">></option>
|
198 |
-
<option value=">=">>=</option>
|
199 |
-
<option value="!=">!=</option>
|
200 |
-
<option value="like">like</option>
|
201 |
</select>
|
202 |
-
|
203 |
<input id="filter-value" type="text" placeholder="Значение фильтра">
|
204 |
-
|
205 |
<button id="filter-clear">Очистить фильтр</button>
|
206 |
-
|
207 |
<button id="download-json">Рассылка по выбранным</button>
|
208 |
-
<button id="take-for-yourself">Взять себе</button>
|
209 |
</div>
|
210 |
<div id="example-table"></div>
|
211 |
|
212 |
<script>
|
213 |
-
vkBridge.send('VKWebAppInit');
|
214 |
document.addEventListener('DOMContentLoaded', function() {
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
console.log('Data received:', data); // Логирование данных
|
219 |
|
220 |
-
|
221 |
-
|
|
|
|
|
222 |
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
break;
|
255 |
-
case 'yellow':
|
256 |
-
color = 'yellow';
|
257 |
-
break;
|
258 |
-
default:
|
259 |
-
color = 'gray';
|
260 |
-
}
|
261 |
-
return `<div style="width: 20px; height: 20px; background-color: ${color};"></div>`;
|
262 |
-
}},
|
263 |
-
{title:"Ссылка на пользователя в GC", field:"ad_url", formatter: function(cell, formatterParams, onRendered) {
|
264 |
-
var ad_url = cell.getValue();
|
265 |
-
return `<a href="${ad_url}" target="_blank">${ad_url}</a>`;
|
266 |
-
}},
|
267 |
-
{title:"Ссылка на VK", field:"vk_id", formatter: function(cell, formatterParams, onRendered) {
|
268 |
-
var vk_id = cell.getValue();
|
269 |
-
return `<a href="https://vk.com/id${vk_id}" target="_blank">${vk_id}</a>`;
|
270 |
-
}},
|
271 |
-
{title:"Ссылка на Tg", field:"chat_id", formatter: function(cell, formatterParams, onRendered) {
|
272 |
-
var chatId = cell.getValue();
|
273 |
-
if (chatId.startsWith('@')) {
|
274 |
-
chatId = chatId.substring(1); // Удаление символа @ в начале
|
275 |
}
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
{
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
document.getElementById("filter-value").addEventListener("keyup", updateFilter);
|
305 |
-
document.getElementById("filter-clear").addEventListener("click", function() {
|
306 |
-
fieldEl.value = "";
|
307 |
-
typeEl.value = "=";
|
308 |
-
valueEl.value = "";
|
309 |
-
table.clearFilter();
|
310 |
-
});
|
311 |
-
function handleDownloadJson() {
|
312 |
-
var tableData = table.getData("active");
|
313 |
-
var jsonData = JSON.stringify(tableData, null, 2);
|
314 |
-
console.log("Данные для рассылки:", jsonData);
|
315 |
-
}
|
316 |
-
function handleTakeForYourself() {
|
317 |
-
var tableData = table.getData("active");
|
318 |
-
var jsonData = JSON.stringify(tableData, null, 2);
|
319 |
-
console.log("Данные для себя:", jsonData);
|
320 |
-
}
|
321 |
-
document.getElementById("download-json").addEventListener("click", handleDownloadJson);
|
322 |
-
document.getElementById("take-for-yourself").addEventListener("click", handleTakeForYourself);
|
323 |
-
})
|
324 |
-
.catch(error => console.error('Error fetching data:', error));
|
325 |
});
|
326 |
</script>
|
327 |
</body>
|
|
|
158 |
background-color: #388E3C;
|
159 |
}
|
160 |
</style>
|
161 |
+
<style>
|
162 |
+
body {
|
163 |
+
font-family: Arial, sans-serif;
|
164 |
+
text-align: center;
|
165 |
+
background-color: #f0f0f0;
|
166 |
+
margin: 0;
|
167 |
+
padding: 0;
|
168 |
+
}
|
169 |
+
#content {
|
170 |
+
display: none; /* Скрыть содержимое до авторизации */
|
171 |
+
}
|
172 |
+
/* Ваш CSS код */
|
173 |
+
</style>
|
174 |
</head>
|
175 |
|
176 |
<body>
|
177 |
<div id="header">
|
178 |
<h1>WhatsCRM - Автопилот + Tilda + Бизон 365 + GetCurse</h1>
|
179 |
</div>
|
180 |
+
<div id="content">
|
181 |
<select id="filter-field">
|
182 |
+
<!-- Ваш код -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
</select>
|
|
|
184 |
<select id="filter-type">
|
185 |
+
<!-- Ваш код -->
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
</select>
|
|
|
187 |
<input id="filter-value" type="text" placeholder="Значение фильтра">
|
|
|
188 |
<button id="filter-clear">Очистить фильтр</button>
|
|
|
189 |
<button id="download-json">Рассылка по выбранным</button>
|
190 |
+
<button id="take-for-yourself">Взять себе</button>
|
191 |
</div>
|
192 |
<div id="example-table"></div>
|
193 |
|
194 |
<script>
|
|
|
195 |
document.addEventListener('DOMContentLoaded', function() {
|
196 |
+
VK.init({
|
197 |
+
apiId: 7715842
|
198 |
+
});
|
|
|
199 |
|
200 |
+
VK.Auth.login(function(response) {
|
201 |
+
if (response.session) {
|
202 |
+
console.log('User ID:', response.session.user.id);
|
203 |
+
console.log('Access Token:', response.session.sid);
|
204 |
|
205 |
+
document.getElementById('content').style.display = 'block'; // Показать содержимое после авторизации
|
206 |
+
|
207 |
+
fetch('https://dmtuit-gcapirabiz.hf.space/data_gc_tab_out?api_sys=fasSd345D')
|
208 |
+
.then(response => response.json())
|
209 |
+
.then(data => {
|
210 |
+
console.log('Data received:', data); // Логирование данных
|
211 |
+
// Переворачиваем массив данных
|
212 |
+
data.reverse();
|
213 |
+
var linkFormatter = function(cell, formatterParams, onRendered) {
|
214 |
+
var curator = cell.getValue();
|
215 |
+
var curatorLink = cell.getData().curator_link;
|
216 |
+
return `<a href="${curatorLink}" target="_blank">${curator}</a>`;
|
217 |
+
};
|
218 |
+
var table = new Tabulator("#example-table", {
|
219 |
+
data: data, // set table data
|
220 |
+
layout: "fitColumns", // fit columns to width of table
|
221 |
+
pagination: "local", // enable local pagination
|
222 |
+
paginationSize: 50, // number of rows per page
|
223 |
+
selectable: true, // enable row selection
|
224 |
+
columns: [
|
225 |
+
// Ваш код
|
226 |
+
],
|
227 |
+
});
|
228 |
+
var fieldEl = document.getElementById("filter-field");
|
229 |
+
var typeEl = document.getElementById("filter-type");
|
230 |
+
var valueEl = document.getElementById("filter-value");
|
231 |
+
function updateFilter() {
|
232 |
+
var filterVal = fieldEl.options[fieldEl.selectedIndex].value;
|
233 |
+
var typeVal = typeEl.options[typeEl.selectedIndex].value;
|
234 |
+
if (filterVal) {
|
235 |
+
table.setFilter(filterVal, typeVal, valueEl.value);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
}
|
237 |
+
}
|
238 |
+
document.getElementById("filter-field").addEventListener("change", updateFilter);
|
239 |
+
document.getElementById("filter-type").addEventListener("change", updateFilter);
|
240 |
+
document.getElementById("filter-value").addEventListener("keyup", updateFilter);
|
241 |
+
document.getElementById("filter-clear").addEventListener("click", function() {
|
242 |
+
fieldEl.value = "";
|
243 |
+
typeEl.value = "=";
|
244 |
+
valueEl.value = "";
|
245 |
+
table.clearFilter();
|
246 |
+
});
|
247 |
+
function handleDownloadJson() {
|
248 |
+
var tableData = table.getData("active");
|
249 |
+
var jsonData = JSON.stringify(tableData, null, 2);
|
250 |
+
console.log("Данные для рассылки:", jsonData);
|
251 |
+
}
|
252 |
+
function handleTakeForYourself() {
|
253 |
+
var tableData = table.getData("active");
|
254 |
+
var jsonData = JSON.stringify(tableData, null, 2);
|
255 |
+
console.log("Данные для себя:", jsonData);
|
256 |
+
}
|
257 |
+
document.getElementById("download-json").addEventListener("click", handleDownloadJson);
|
258 |
+
document.getElementById("take-for-yourself").addEventListener("click", handleTakeForYourself);
|
259 |
+
})
|
260 |
+
.catch(error => console.error('Error fetching data:', error));
|
261 |
+
} else {
|
262 |
+
console.error('Authorization failed');
|
263 |
+
}
|
264 |
+
}, 8192); // 8192 - права на доступ к фотографиям
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
});
|
266 |
</script>
|
267 |
</body>
|