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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>WhatsMasterGRM - Принудительное обновление базы</title>
|
7 |
+
<link rel="stylesheet" href="styles.css">
|
8 |
+
<!-- Подключение стилей Notyf -->
|
9 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/notyf/notyf.min.css">
|
10 |
+
|
11 |
+
<!-- Подключение скрипта Notyf -->
|
12 |
+
<script src="https://cdn.jsdelivr.net/npm/notyf/notyf.min.js"></script>
|
13 |
+
</head>
|
14 |
+
<style>
|
15 |
+
body {
|
16 |
+
font-family: Arial, sans-serif;
|
17 |
+
text-align: center;
|
18 |
+
background-color: #f0f0f0;
|
19 |
+
margin: 0;
|
20 |
+
padding: 0;
|
21 |
+
}
|
22 |
+
h1 {
|
23 |
+
background-color: #4CAF50;
|
24 |
+
color: white;
|
25 |
+
padding: 20px;
|
26 |
+
margin: 0;
|
27 |
+
border-bottom: 2px solid #388E3C;
|
28 |
+
font-size: 28px;
|
29 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
30 |
+
}
|
31 |
+
.container {
|
32 |
+
display: flex;
|
33 |
+
justify-content: space-around;
|
34 |
+
margin-top: 20px;
|
35 |
+
}
|
36 |
+
.block {
|
37 |
+
width: 45%;
|
38 |
+
text-align: center;
|
39 |
+
background-color: white;
|
40 |
+
padding: 20px;
|
41 |
+
border-radius: 10px;
|
42 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
43 |
+
}
|
44 |
+
.form-group {
|
45 |
+
margin: 20px 0;
|
46 |
+
}
|
47 |
+
.form-group label {
|
48 |
+
display: block;
|
49 |
+
margin-bottom: 8px;
|
50 |
+
font-size: 16px;
|
51 |
+
}
|
52 |
+
.form-group input,
|
53 |
+
.form-group select {
|
54 |
+
width: 100%;
|
55 |
+
padding: 12px;
|
56 |
+
font-size: 16px;
|
57 |
+
border: 1px solid #ccc;
|
58 |
+
border-radius: 5px;
|
59 |
+
box-sizing: border-box;
|
60 |
+
}
|
61 |
+
button {
|
62 |
+
display: block;
|
63 |
+
margin: 20px auto;
|
64 |
+
color: white;
|
65 |
+
background-color: #4CAF50;
|
66 |
+
border: none;
|
67 |
+
cursor: pointer;
|
68 |
+
padding: 12px 24px;
|
69 |
+
font-size: 16px;
|
70 |
+
border-radius: 5px;
|
71 |
+
transition: background-color 0.3s ease;
|
72 |
+
}
|
73 |
+
button:hover {
|
74 |
+
background-color: #388E3C;
|
75 |
+
}
|
76 |
+
.input-row {
|
77 |
+
display: flex;
|
78 |
+
justify-content: center;
|
79 |
+
gap: 10px;
|
80 |
+
margin-top: 20px;
|
81 |
+
}
|
82 |
+
.input-row input[type="file"] {
|
83 |
+
padding: 10px;
|
84 |
+
font-size: 16px;
|
85 |
+
border: 1px solid #ccc;
|
86 |
+
border-radius: 5px;
|
87 |
+
}
|
88 |
+
.input-row input[type="checkbox"] {
|
89 |
+
margin-top: 5px;
|
90 |
+
}
|
91 |
+
.input-row label {
|
92 |
+
display: flex;
|
93 |
+
align-items: center;
|
94 |
+
color: #000000;
|
95 |
+
font-size: 16px;
|
96 |
+
}
|
97 |
+
#uploadButton {
|
98 |
+
color: white;
|
99 |
+
background-color: #4CAF50;
|
100 |
+
border: none;
|
101 |
+
cursor: pointer;
|
102 |
+
padding: 10px 20px;
|
103 |
+
font-size: 16px;
|
104 |
+
border-radius: 5px;
|
105 |
+
margin-top: 20px;
|
106 |
+
display: block;
|
107 |
+
margin-left: auto;
|
108 |
+
margin-right: auto;
|
109 |
+
}
|
110 |
+
#uploadButton:hover {
|
111 |
+
background-color: #388E3C;
|
112 |
+
}
|
113 |
+
.block h2 {
|
114 |
+
text-align: center;
|
115 |
+
}
|
116 |
+
/* Custom Checkbox Styles */
|
117 |
+
.container-checkbox {
|
118 |
+
color: #000000;
|
119 |
+
display: block;
|
120 |
+
position: relative;
|
121 |
+
padding-left: 35px;
|
122 |
+
margin-bottom: 12px;
|
123 |
+
cursor: pointer;
|
124 |
+
font-size: 16px;
|
125 |
+
-webkit-user-select: none;
|
126 |
+
-moz-user-select: none;
|
127 |
+
-ms-user-select: none;
|
128 |
+
user-select: none;
|
129 |
+
}
|
130 |
+
.container-checkbox input {
|
131 |
+
position: absolute;
|
132 |
+
opacity: 0;
|
133 |
+
cursor: pointer;
|
134 |
+
height: 0;
|
135 |
+
width: 0;
|
136 |
+
}
|
137 |
+
.checkmark {
|
138 |
+
position: absolute;
|
139 |
+
top: 0;
|
140 |
+
left: 0;
|
141 |
+
height: 25px;
|
142 |
+
width: 25px;
|
143 |
+
background-color: #eee;
|
144 |
+
}
|
145 |
+
.container-checkbox:hover input ~ .checkmark {
|
146 |
+
background-color: #ccc;
|
147 |
+
}
|
148 |
+
.container-checkbox input:checked ~ .checkmark {
|
149 |
+
background-color: #4CAF50;
|
150 |
+
}
|
151 |
+
.checkmark:after {
|
152 |
+
content: "";
|
153 |
+
position: absolute;
|
154 |
+
display: none;
|
155 |
+
}
|
156 |
+
.container-checkbox input:checked ~ .checkmark:after {
|
157 |
+
display: block;
|
158 |
+
}
|
159 |
+
.container-checkbox .checkmark:after {
|
160 |
+
left: 9px;
|
161 |
+
top: 5px;
|
162 |
+
width: 5px;
|
163 |
+
height: 10px;
|
164 |
+
border: solid white;
|
165 |
+
border-width: 0 3px 3px 0;
|
166 |
+
-webkit-transform: rotate(45deg);
|
167 |
+
-ms-transform: rotate(45deg);
|
168 |
+
transform: rotate(45deg);
|
169 |
+
}
|
170 |
+
input[type="date"] {
|
171 |
+
background-color: #4CAF50;
|
172 |
+
color: white;
|
173 |
+
padding: 12px;
|
174 |
+
font-size: 16px;
|
175 |
+
border: none;
|
176 |
+
border-radius: 5px;
|
177 |
+
width: 100%;
|
178 |
+
box-sizing: border-box;
|
179 |
+
}
|
180 |
+
::-webkit-calendar-picker-indicator {
|
181 |
+
background-color: white;
|
182 |
+
padding: 5px;
|
183 |
+
cursor: pointer;
|
184 |
+
border-radius: 3px;
|
185 |
+
}
|
186 |
+
#dropdown {
|
187 |
+
width: 100%;
|
188 |
+
padding: 12px;
|
189 |
+
font-size: 16px;
|
190 |
+
border: 1px solid #ccc;
|
191 |
+
border-radius: 5px;
|
192 |
+
box-sizing: border-box;
|
193 |
+
margin-bottom: 20px;
|
194 |
+
}
|
195 |
+
#uploadButtonJson {
|
196 |
+
color: white;
|
197 |
+
background-color: #4CAF50;
|
198 |
+
border: none;
|
199 |
+
cursor: pointer;
|
200 |
+
padding: 10px 20px;
|
201 |
+
font-size: 16px;
|
202 |
+
border-radius: 5px;
|
203 |
+
margin-top: 20px;
|
204 |
+
display: block;
|
205 |
+
margin-left: auto;
|
206 |
+
margin-right: auto;
|
207 |
+
}
|
208 |
+
#uploadButtonJson:hover {
|
209 |
+
background-color: #388E3C;
|
210 |
+
}
|
211 |
+
.block form#uploadFormJson {
|
212 |
+
margin-top: 20px;
|
213 |
+
}
|
214 |
+
.block form#uploadFormJson label {
|
215 |
+
display: flex;
|
216 |
+
align-items: center;
|
217 |
+
margin-bottom: 10px;
|
218 |
+
font-size: 16px;
|
219 |
+
color: #000000;
|
220 |
+
}
|
221 |
+
.block form#uploadFormJson input[type="file"] {
|
222 |
+
padding: 10px;
|
223 |
+
font-size: 16px;
|
224 |
+
border: 1px solid #ccc;
|
225 |
+
border-radius: 5px;
|
226 |
+
margin-right: 10px;
|
227 |
+
}
|
228 |
+
#message {
|
229 |
+
margin-top: 20px;
|
230 |
+
padding: 10px;
|
231 |
+
border: 1px solid #ccc;
|
232 |
+
border-radius: 5px;
|
233 |
+
background-color: #fff;
|
234 |
+
color: #4CAF50;
|
235 |
+
text-align: center;
|
236 |
+
}
|
237 |
+
</style>
|
238 |
+
<body>
|
239 |
+
<h1>WhatsMasterGRM - Принудительное обновление базы</h1>
|
240 |
+
|
241 |
+
<div class="container">
|
242 |
+
<div class="block">
|
243 |
+
<h2>Тильда - Таблица CSV</h2>
|
244 |
+
<form id="uploadForm" enctype="multipart/form-data" method="post">
|
245 |
+
<div class="input-row">
|
246 |
+
<input type="file" name="file" accept=".csv">
|
247 |
+
</div>
|
248 |
+
<div class="input-row">
|
249 |
+
<label class="container-checkbox">
|
250 |
+
Наличие WhatsApp
|
251 |
+
<input type="checkbox" name="verify_phone" value="1">
|
252 |
+
<span class="checkmark"></span>
|
253 |
+
</label>
|
254 |
+
<label class="container-checkbox">
|
255 |
+
Добавлять менеджера
|
256 |
+
<input type="checkbox" name="add_curator" value="1">
|
257 |
+
<span class="checkmark"></span>
|
258 |
+
</label>
|
259 |
+
</div>
|
260 |
+
<input id="uploadButton" type="submit" value="Загрузить пользователей">
|
261 |
+
</form>
|
262 |
+
<div id="result"></div>
|
263 |
+
|
264 |
+
<h2>WhatsMasterCRM - Файл JSON</h2>
|
265 |
+
<form id="uploadFormJson" onsubmit="handleFormSubmit(event)" enctype="multipart/form-data">
|
266 |
+
<div class="input-row">
|
267 |
+
<input type="file" id="fileJson" name="file" accept=".json" required>
|
268 |
+
</div>
|
269 |
+
<input id="uploadButtonJson" type="submit" value="Upload">
|
270 |
+
</form>
|
271 |
+
<div id="message" style="display:none; margin-top:20px;"></div>
|
272 |
+
</div>
|
273 |
+
|
274 |
+
<div class="block">
|
275 |
+
<h2>Бизон 365 - API</h2>
|
276 |
+
<div class="form-group">
|
277 |
+
<label for="tokenInput">API-токен администратора Бизон 365:</label>
|
278 |
+
<input type="text" id="tokenInput" placeholder="Введите токен">
|
279 |
+
</div>
|
280 |
+
<div class="form-group">
|
281 |
+
<label for="dateInput">Крайняя дата выборки комнат:</label>
|
282 |
+
<input type="date" id="dateInput">
|
283 |
+
</div>
|
284 |
+
<div class="form-group">
|
285 |
+
<label for="typeSelect">Выбор формата вебинара:</label>
|
286 |
+
<select id="typeSelect">
|
287 |
+
<option value="AutoWebinars">Автовебинарные комнаты</option>
|
288 |
+
<option value="LiveWebinars">Вебинарные комнаты</option>
|
289 |
+
</select>
|
290 |
+
</div>
|
291 |
+
<button id="sendRequestButton">Получить список комнат Бизон 365</button>
|
292 |
+
<div id="dropdown-container"></div>
|
293 |
+
<button id="sendGetRequestButton">Обновить базу WhatsMasterGRM</button>
|
294 |
+
</div>
|
295 |
+
</div>
|
296 |
+
|
297 |
+
<script>
|
298 |
+
document.getElementById('uploadForm').addEventListener('submit', function(event) {
|
299 |
+
event.preventDefault();
|
300 |
+
const form = new FormData(this);
|
301 |
+
fetch('/upload_csv', {
|
302 |
+
method: 'POST',
|
303 |
+
body: form
|
304 |
+
})
|
305 |
+
.then(response => response.json())
|
306 |
+
.then(data => {
|
307 |
+
showNotification('Загрузка завершена');
|
308 |
+
})
|
309 |
+
.catch(error => {
|
310 |
+
console.error('Error:', error);
|
311 |
+
showNotification('Произошла ошибка при загрузке файла.', true);
|
312 |
+
});
|
313 |
+
});
|
314 |
+
document.getElementById('uploadFormJson').addEventListener('submit', function(event) {
|
315 |
+
event.preventDefault();
|
316 |
+
var formData = new FormData(event.target);
|
317 |
+
fetch('/upload_json', {
|
318 |
+
method: 'POST',
|
319 |
+
body: formData
|
320 |
+
})
|
321 |
+
.then(response => response.json())
|
322 |
+
.then(data => {
|
323 |
+
showNotification(data.message || 'Файл успешно загружен');
|
324 |
+
})
|
325 |
+
.catch(error => {
|
326 |
+
showNotification("Произошла ошибка: " + error, true);
|
327 |
+
});
|
328 |
+
});
|
329 |
+
document.getElementById('sendRequestButton').addEventListener('click', function() {
|
330 |
+
const token = document.getElementById('tokenInput').value;
|
331 |
+
const minDate = document.getElementById('dateInput').value;
|
332 |
+
const type = document.getElementById('typeSelect').value;
|
333 |
+
const url = '/send_request';
|
334 |
+
fetch(url, {
|
335 |
+
method: 'POST',
|
336 |
+
headers: {
|
337 |
+
'Content-Type': 'application/x-www-form-urlencoded'
|
338 |
+
},
|
339 |
+
body: 'token=' + encodeURIComponent(token) + '&minDate=' + encodeURIComponent(minDate) + '&type=' + encodeURIComponent(type)
|
340 |
+
})
|
341 |
+
.then(response => response.json())
|
342 |
+
.then(data => {
|
343 |
+
createDropdown(data);
|
344 |
+
showNotification('Список комнат успешно получен');
|
345 |
+
})
|
346 |
+
.catch(error => {
|
347 |
+
console.error('Error:', error);
|
348 |
+
showNotification('Произошла ошибка при получении списка комнат.', true);
|
349 |
+
});
|
350 |
+
});
|
351 |
+
function createDropdown(data) {
|
352 |
+
const container = document.getElementById('dropdown-container');
|
353 |
+
container.innerHTML = '';
|
354 |
+
const select = document.createElement('select');
|
355 |
+
select.id = 'dropdown';
|
356 |
+
select.classList.add('form-group');
|
357 |
+
data.forEach(item => {
|
358 |
+
const option = document.createElement('option');
|
359 |
+
option.value = item;
|
360 |
+
option.text = item;
|
361 |
+
select.appendChild(option);
|
362 |
+
});
|
363 |
+
container.appendChild(select);
|
364 |
+
const sendGetRequestButton = document.getElementById('sendGetRequestButton');
|
365 |
+
|
366 |
+
sendGetRequestButton.removeEventListener('click', handleGetRequest);
|
367 |
+
sendGetRequestButton.addEventListener('click', handleGetRequest);
|
368 |
+
}
|
369 |
+
function handleGetRequest() {
|
370 |
+
const selectedValue = document.getElementById('dropdown').value;
|
371 |
+
const token = document.getElementById('tokenInput').value;
|
372 |
+
const getUrl = '/send_get_request?token=' + encodeURIComponent(token) + '&webinarId=' + encodeURIComponent(selectedValue);
|
373 |
+
fetch(getUrl, {
|
374 |
+
method: 'GET'
|
375 |
+
})
|
376 |
+
.then(response => response.json())
|
377 |
+
.then(data => {
|
378 |
+
showNotification('Пользователи добавлены в базу данных WhatsGRM');
|
379 |
+
})
|
380 |
+
.catch(error => {
|
381 |
+
console.error('Error:', error);
|
382 |
+
showNotification('Произошла ошибка при обновлении базы.', true);
|
383 |
+
});
|
384 |
+
}
|
385 |
+
function showNotification(message, isError = false) {
|
386 |
+
const notyf = new Notyf({
|
387 |
+
duration: 5000,
|
388 |
+
position: {
|
389 |
+
x: 'right',
|
390 |
+
y: 'top',
|
391 |
+
},
|
392 |
+
types: [
|
393 |
+
{
|
394 |
+
type: 'success',
|
395 |
+
background: 'green',
|
396 |
+
icon: {
|
397 |
+
className: 'notyf__icon--success',
|
398 |
+
tagName: 'span',
|
399 |
+
text: ''
|
400 |
+
}
|
401 |
+
},
|
402 |
+
{
|
403 |
+
type: 'error',
|
404 |
+
background: 'red',
|
405 |
+
icon: {
|
406 |
+
className: 'notyf__icon--error',
|
407 |
+
tagName: 'span',
|
408 |
+
text: ''
|
409 |
+
}
|
410 |
+
}
|
411 |
+
]
|
412 |
+
});
|
413 |
+
if (isError) {
|
414 |
+
notyf.open({
|
415 |
+
type: 'error',
|
416 |
+
message: message
|
417 |
+
});
|
418 |
+
} else {
|
419 |
+
notyf.open({
|
420 |
+
type: 'success',
|
421 |
+
message: message
|
422 |
+
});
|
423 |
+
}
|
424 |
+
}
|
425 |
+
</script>
|
426 |
+
</body>
|
427 |
+
</html>
|