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