DmitrMakeev
commited on
Commit
•
f9dec90
1
Parent(s):
b3ae86d
Update biz_v.html
Browse files- biz_v.html +68 -334
biz_v.html
CHANGED
@@ -1,263 +1,11 @@
|
|
1 |
-
|
2 |
-
<html lang="
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
-
<title>
|
7 |
-
<link rel="stylesheet" href="
|
8 |
-
<
|
9 |
-
body {
|
10 |
-
font-family: Arial, sans-serif;
|
11 |
-
text-align: center;
|
12 |
-
background-color: #f0f0f0;
|
13 |
-
margin: 0;
|
14 |
-
padding: 0;
|
15 |
-
}
|
16 |
-
|
17 |
-
h1, h2 {
|
18 |
-
color: black;
|
19 |
-
text-align: center;
|
20 |
-
}
|
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 |
-
|
32 |
-
.container {
|
33 |
-
display: flex;
|
34 |
-
justify-content: space-around;
|
35 |
-
margin-top: 20px;
|
36 |
-
}
|
37 |
-
|
38 |
-
.block {
|
39 |
-
width: 45%;
|
40 |
-
text-align: left;
|
41 |
-
background-color: white;
|
42 |
-
padding: 20px;
|
43 |
-
border-radius: 10px;
|
44 |
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
45 |
-
}
|
46 |
-
|
47 |
-
.form-group {
|
48 |
-
margin: 20px 0;
|
49 |
-
}
|
50 |
-
|
51 |
-
.form-group label {
|
52 |
-
display: block;
|
53 |
-
margin-bottom: 8px;
|
54 |
-
font-size: 16px;
|
55 |
-
}
|
56 |
-
|
57 |
-
.form-group input,
|
58 |
-
.form-group select {
|
59 |
-
width: 100%;
|
60 |
-
padding: 12px;
|
61 |
-
font-size: 16px;
|
62 |
-
border: 1px solid #ccc;
|
63 |
-
border-radius: 5px;
|
64 |
-
box-sizing: border-box;
|
65 |
-
}
|
66 |
-
|
67 |
-
button {
|
68 |
-
color: white;
|
69 |
-
background-color: #4CAF50;
|
70 |
-
border: none;
|
71 |
-
cursor: pointer;
|
72 |
-
padding: 12px 24px;
|
73 |
-
font-size: 16px;
|
74 |
-
border-radius: 5px;
|
75 |
-
transition: background-color 0.3s ease;
|
76 |
-
}
|
77 |
-
|
78 |
-
button:hover {
|
79 |
-
background-color: #388E3C;
|
80 |
-
}
|
81 |
-
|
82 |
-
.input-row {
|
83 |
-
display: flex;
|
84 |
-
justify-content: center;
|
85 |
-
gap: 10px;
|
86 |
-
margin-top: 20px;
|
87 |
-
}
|
88 |
-
|
89 |
-
.input-row input[type="file"] {
|
90 |
-
padding: 10px;
|
91 |
-
font-size: 16px;
|
92 |
-
border: 1px solid #ccc;
|
93 |
-
border-radius: 5px;
|
94 |
-
}
|
95 |
-
|
96 |
-
.input-row input[type="checkbox"] {
|
97 |
-
margin-top: 5px;
|
98 |
-
}
|
99 |
-
|
100 |
-
.input-row label {
|
101 |
-
display: flex;
|
102 |
-
align-items: center;
|
103 |
-
color: black;
|
104 |
-
font-size: 16px;
|
105 |
-
}
|
106 |
-
|
107 |
-
#uploadButton {
|
108 |
-
color: white;
|
109 |
-
background-color: #4CAF50;
|
110 |
-
border: none;
|
111 |
-
cursor: pointer;
|
112 |
-
padding: 10px 20px;
|
113 |
-
font-size: 16px;
|
114 |
-
border-radius: 5px;
|
115 |
-
margin-top: 20px;
|
116 |
-
display: block;
|
117 |
-
margin-left: auto;
|
118 |
-
margin-right: auto;
|
119 |
-
}
|
120 |
-
|
121 |
-
#uploadButton:hover {
|
122 |
-
background-color: #388E3C;
|
123 |
-
}
|
124 |
-
|
125 |
-
#uploadButtonJson {
|
126 |
-
color: white;
|
127 |
-
background-color: #4CAF50;
|
128 |
-
border: none;
|
129 |
-
cursor: pointer;
|
130 |
-
padding: 10px 20px;
|
131 |
-
font-size: 16px;
|
132 |
-
border-radius: 5px;
|
133 |
-
display: block;
|
134 |
-
margin: 20px auto;
|
135 |
-
transition: background-color 0.3s ease;
|
136 |
-
}
|
137 |
-
|
138 |
-
#uploadButtonJson:hover {
|
139 |
-
background-color: #388E3C;
|
140 |
-
}
|
141 |
-
|
142 |
-
/* Custom Checkbox Styles */
|
143 |
-
.container-checkbox {
|
144 |
-
color: black;
|
145 |
-
display: block;
|
146 |
-
position: relative;
|
147 |
-
padding-left: 35px;
|
148 |
-
margin-bottom: 12px;
|
149 |
-
cursor: pointer;
|
150 |
-
font-size: 16px;
|
151 |
-
-webkit-user-select: none;
|
152 |
-
-moz-user-select: none;
|
153 |
-
-ms-user-select: none;
|
154 |
-
user-select: none;
|
155 |
-
}
|
156 |
-
|
157 |
-
.container-checkbox input {
|
158 |
-
position: absolute;
|
159 |
-
opacity: 0;
|
160 |
-
cursor: pointer;
|
161 |
-
height: 0;
|
162 |
-
width: 0;
|
163 |
-
}
|
164 |
-
|
165 |
-
.checkmark {
|
166 |
-
position: absolute;
|
167 |
-
top: 0;
|
168 |
-
left: 0;
|
169 |
-
height: 25px;
|
170 |
-
width: 25px;
|
171 |
-
background-color: #eee;
|
172 |
-
}
|
173 |
-
|
174 |
-
.container-checkbox:hover input ~ .checkmark {
|
175 |
-
background-color: #ccc;
|
176 |
-
}
|
177 |
-
|
178 |
-
.container-checkbox input:checked ~ .checkmark {
|
179 |
-
background-color: #4CAF50;
|
180 |
-
}
|
181 |
-
|
182 |
-
.checkmark:after {
|
183 |
-
content: "";
|
184 |
-
position: absolute;
|
185 |
-
display: none;
|
186 |
-
}
|
187 |
-
|
188 |
-
.container-checkbox input:checked ~ .checkmark:after {
|
189 |
-
display: block;
|
190 |
-
}
|
191 |
-
|
192 |
-
.container-checkbox .checkmark:after {
|
193 |
-
left: 9px;
|
194 |
-
top: 5px;
|
195 |
-
width: 5px;
|
196 |
-
height: 10px;
|
197 |
-
border: solid white;
|
198 |
-
border-width: 0 3px 3px 0;
|
199 |
-
-webkit-transform: rotate(45deg);
|
200 |
-
-ms-transform: rotate(45deg);
|
201 |
-
transform: rotate(45deg);
|
202 |
-
}
|
203 |
-
|
204 |
-
/* Стили для input[type="date"] */
|
205 |
-
input[type="date"] {
|
206 |
-
background-color: #4CAF50;
|
207 |
-
color: white;
|
208 |
-
padding: 12px;
|
209 |
-
font-size: 16px;
|
210 |
-
border: none;
|
211 |
-
border-radius: 5px;
|
212 |
-
width: 100%;
|
213 |
-
box-sizing: border-box;
|
214 |
-
}
|
215 |
-
|
216 |
-
::-webkit-calendar-picker-indicator {
|
217 |
-
background-color: white;
|
218 |
-
padding: 5px;
|
219 |
-
cursor: pointer;
|
220 |
-
border-radius: 3px;
|
221 |
-
}
|
222 |
-
|
223 |
-
/* Стили для выпадающего списка */
|
224 |
-
#dropdown {
|
225 |
-
width: 100%;
|
226 |
-
padding: 12px;
|
227 |
-
font-size: 16px;
|
228 |
-
border: 1px solid #ccc;
|
229 |
-
border-radius: 5px;
|
230 |
-
box-sizing: border-box;
|
231 |
-
margin-bottom: 20px;
|
232 |
-
}
|
233 |
-
|
234 |
-
/* Стили для формы загрузки JSON */
|
235 |
-
.block form#uploadFormJson {
|
236 |
-
display: flex;
|
237 |
-
flex-direction: column;
|
238 |
-
align-items: center;
|
239 |
-
margin-top: 20px;
|
240 |
-
}
|
241 |
-
|
242 |
-
.block form#uploadFormJson input[type="file"] {
|
243 |
-
padding: 10px;
|
244 |
-
font-size: 16px;
|
245 |
-
border: 1px solid #ccc;
|
246 |
-
border-radius: 5px;
|
247 |
-
}
|
248 |
-
|
249 |
-
#message {
|
250 |
-
margin-top: 20px;
|
251 |
-
padding: 10px;
|
252 |
-
border: 1px solid #ccc;
|
253 |
-
border-radius: 5px;
|
254 |
-
background-color: #fff;
|
255 |
-
color: #4CAF50;
|
256 |
-
text-align: center;
|
257 |
-
}
|
258 |
-
|
259 |
-
|
260 |
-
</style>
|
261 |
</head>
|
262 |
<body>
|
263 |
<h1>WhatsMasterGRM - Принудительное обновление базы</h1>
|
@@ -318,67 +66,41 @@ input[type="date"] {
|
|
318 |
</div>
|
319 |
</div>
|
320 |
|
321 |
-
<!-- Подключение скрипта Notyf -->
|
322 |
-
<script src="https://cdn.jsdelivr.net/npm/notyf/notyf.min.js"></script>
|
323 |
<script>
|
324 |
document.getElementById('uploadForm').addEventListener('submit', function(event) {
|
325 |
event.preventDefault();
|
326 |
const form = new FormData(this);
|
327 |
-
const notyf = new Notyf({
|
328 |
-
duration: 5000,
|
329 |
-
position: {
|
330 |
-
x: 'right',
|
331 |
-
y: 'top'
|
332 |
-
},
|
333 |
-
types: [
|
334 |
-
{
|
335 |
-
type: 'info',
|
336 |
-
background: 'green',
|
337 |
-
icon: {
|
338 |
-
className: 'notyf__icon--info',
|
339 |
-
tagName: 'span',
|
340 |
-
text: ''
|
341 |
-
}
|
342 |
-
}
|
343 |
-
]
|
344 |
-
});
|
345 |
-
notyf.open({
|
346 |
-
type: 'info',
|
347 |
-
message: 'Загрузка началась, пожалуйста, подождите'
|
348 |
-
});
|
349 |
fetch('/upload_csv', {
|
350 |
method: 'POST',
|
351 |
body: form
|
352 |
})
|
353 |
.then(response => response.json())
|
354 |
.then(data => {
|
355 |
-
|
356 |
-
type: 'success',
|
357 |
-
message: data.message
|
358 |
-
});
|
359 |
})
|
360 |
.catch(error => {
|
361 |
console.error('Error:', error);
|
362 |
-
|
363 |
-
type: 'error',
|
364 |
-
message: 'An error occurred while uploading the file.'
|
365 |
-
});
|
366 |
});
|
367 |
});
|
368 |
-
</script>
|
369 |
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
});
|
378 |
-
|
379 |
document.getElementById('sendRequestButton').addEventListener('click', function() {
|
380 |
-
if (requestButtonClicked) return;
|
381 |
-
requestButtonClicked = true;
|
382 |
const token = document.getElementById('tokenInput').value;
|
383 |
const minDate = document.getElementById('dateInput').value;
|
384 |
const type = document.getElementById('typeSelect').value;
|
@@ -392,17 +114,15 @@ input[type="date"] {
|
|
392 |
})
|
393 |
.then(response => response.json())
|
394 |
.then(data => {
|
395 |
-
console.log('JSON Response:', data);
|
396 |
createDropdown(data);
|
|
|
397 |
})
|
398 |
.catch(error => {
|
399 |
console.error('Error:', error);
|
400 |
-
|
401 |
-
})
|
402 |
-
.finally(() => {
|
403 |
-
requestButtonClicked = false;
|
404 |
});
|
405 |
});
|
|
|
406 |
function createDropdown(data) {
|
407 |
const container = document.getElementById('dropdown-container');
|
408 |
container.innerHTML = '';
|
@@ -417,9 +137,11 @@ input[type="date"] {
|
|
417 |
});
|
418 |
container.appendChild(select);
|
419 |
const sendGetRequestButton = document.getElementById('sendGetRequestButton');
|
|
|
420 |
sendGetRequestButton.removeEventListener('click', handleGetRequest);
|
421 |
sendGetRequestButton.addEventListener('click', handleGetRequest);
|
422 |
}
|
|
|
423 |
function handleGetRequest() {
|
424 |
const selectedValue = document.getElementById('dropdown').value;
|
425 |
const token = document.getElementById('tokenInput').value;
|
@@ -429,42 +151,54 @@ input[type="date"] {
|
|
429 |
})
|
430 |
.then(response => response.json())
|
431 |
.then(data => {
|
432 |
-
|
433 |
-
notyf.success('Пользователи добавлены в базу данных WhatsGRM');
|
434 |
})
|
435 |
.catch(error => {
|
436 |
console.error('Error:', error);
|
437 |
-
|
438 |
});
|
439 |
}
|
440 |
-
</script>
|
441 |
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
|
|
|
|
|
|
|
|
465 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
}
|
467 |
</script>
|
468 |
</body>
|
469 |
-
|
470 |
-
</html>
|
|
|
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 |
+
<script src="https://cdn.jsdelivr.net/npm/notyf/notyf.min.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
</head>
|
10 |
<body>
|
11 |
<h1>WhatsMasterGRM - Принудительное обновление базы</h1>
|
|
|
66 |
</div>
|
67 |
</div>
|
68 |
|
|
|
|
|
69 |
<script>
|
70 |
document.getElementById('uploadForm').addEventListener('submit', function(event) {
|
71 |
event.preventDefault();
|
72 |
const form = new FormData(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
fetch('/upload_csv', {
|
74 |
method: 'POST',
|
75 |
body: form
|
76 |
})
|
77 |
.then(response => response.json())
|
78 |
.then(data => {
|
79 |
+
showNotification('Загрузка завершена');
|
|
|
|
|
|
|
80 |
})
|
81 |
.catch(error => {
|
82 |
console.error('Error:', error);
|
83 |
+
showNotification('Произошла ошибка при загрузке файла.', true);
|
|
|
|
|
|
|
84 |
});
|
85 |
});
|
|
|
86 |
|
87 |
+
document.getElementById('uploadFormJson').addEventListener('submit', function(event) {
|
88 |
+
event.preventDefault();
|
89 |
+
var formData = new FormData(event.target);
|
90 |
+
fetch('/upload_json', {
|
91 |
+
method: 'POST',
|
92 |
+
body: formData
|
93 |
+
})
|
94 |
+
.then(response => response.json())
|
95 |
+
.then(data => {
|
96 |
+
showNotification(data.message || 'Файл успешно загружен');
|
97 |
+
})
|
98 |
+
.catch(error => {
|
99 |
+
showNotification("Произошла ошибка: " + error, true);
|
100 |
+
});
|
101 |
});
|
102 |
+
|
103 |
document.getElementById('sendRequestButton').addEventListener('click', function() {
|
|
|
|
|
104 |
const token = document.getElementById('tokenInput').value;
|
105 |
const minDate = document.getElementById('dateInput').value;
|
106 |
const type = document.getElementById('typeSelect').value;
|
|
|
114 |
})
|
115 |
.then(response => response.json())
|
116 |
.then(data => {
|
|
|
117 |
createDropdown(data);
|
118 |
+
showNotification('Список комнат успешно получен');
|
119 |
})
|
120 |
.catch(error => {
|
121 |
console.error('Error:', error);
|
122 |
+
showNotification('Произошла ошибка при получении списка комнат.', true);
|
|
|
|
|
|
|
123 |
});
|
124 |
});
|
125 |
+
|
126 |
function createDropdown(data) {
|
127 |
const container = document.getElementById('dropdown-container');
|
128 |
container.innerHTML = '';
|
|
|
137 |
});
|
138 |
container.appendChild(select);
|
139 |
const sendGetRequestButton = document.getElementById('sendGetRequestButton');
|
140 |
+
|
141 |
sendGetRequestButton.removeEventListener('click', handleGetRequest);
|
142 |
sendGetRequestButton.addEventListener('click', handleGetRequest);
|
143 |
}
|
144 |
+
|
145 |
function handleGetRequest() {
|
146 |
const selectedValue = document.getElementById('dropdown').value;
|
147 |
const token = document.getElementById('tokenInput').value;
|
|
|
151 |
})
|
152 |
.then(response => response.json())
|
153 |
.then(data => {
|
154 |
+
showNotification('Пользователи добавлены в базу данных WhatsGRM');
|
|
|
155 |
})
|
156 |
.catch(error => {
|
157 |
console.error('Error:', error);
|
158 |
+
showNotification('Произошла ошибка при обновлении базы.', true);
|
159 |
});
|
160 |
}
|
|
|
161 |
|
162 |
+
function showNotification(message, isError = false) {
|
163 |
+
const notyf = new Notyf({
|
164 |
+
duration: 5000,
|
165 |
+
position: {
|
166 |
+
x: 'right',
|
167 |
+
y: 'top',
|
168 |
+
},
|
169 |
+
types: [
|
170 |
+
{
|
171 |
+
type: 'success',
|
172 |
+
background: 'green',
|
173 |
+
icon: {
|
174 |
+
className: 'notyf__icon--success',
|
175 |
+
tagName: 'span',
|
176 |
+
text: ''
|
177 |
+
}
|
178 |
+
},
|
179 |
+
{
|
180 |
+
type: 'error',
|
181 |
+
background: 'red',
|
182 |
+
icon: {
|
183 |
+
className: 'notyf__icon--error',
|
184 |
+
tagName: 'span',
|
185 |
+
text: ''
|
186 |
+
}
|
187 |
+
}
|
188 |
+
]
|
189 |
});
|
190 |
+
if (isError) {
|
191 |
+
notyf.open({
|
192 |
+
type: 'error',
|
193 |
+
message: message
|
194 |
+
});
|
195 |
+
} else {
|
196 |
+
notyf.open({
|
197 |
+
type: 'success',
|
198 |
+
message: message
|
199 |
+
});
|
200 |
+
}
|
201 |
}
|
202 |
</script>
|
203 |
</body>
|
204 |
+
</html>
|
|