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