DmitrMakeev
commited on
Commit
•
bcd40b3
1
Parent(s):
41159f1
Update biz_v.html
Browse files- biz_v.html +62 -64
biz_v.html
CHANGED
@@ -71,79 +71,77 @@
|
|
71 |
|
72 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
|
73 |
<script>
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
};
|
92 |
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
const token = document.getElementById('tokenInput').value;
|
95 |
-
const
|
96 |
-
|
97 |
-
|
98 |
-
fetch(url, {
|
99 |
-
method: 'POST',
|
100 |
-
headers: {
|
101 |
-
'Content-Type': 'application/x-www-form-urlencoded'
|
102 |
-
},
|
103 |
-
body: 'token=' + encodeURIComponent(token) + '&minDate=' + encodeURIComponent(minDate) + '&type=' + encodeURIComponent(type)
|
104 |
})
|
105 |
.then(response => response.json())
|
106 |
.then(data => {
|
107 |
-
console.log('
|
108 |
-
|
109 |
})
|
110 |
.catch(error => {
|
111 |
console.error('Error:', error);
|
112 |
-
toastr.error('Error: ' + error.message);
|
113 |
});
|
114 |
});
|
115 |
-
|
116 |
-
function createDropdown(data) {
|
117 |
-
const container = document.getElementById('dropdown-container');
|
118 |
-
container.innerHTML = ''; // Очистить контейнер перед добавлением нового списка
|
119 |
-
const select = document.createElement('select');
|
120 |
-
select.id = 'dropdown';
|
121 |
-
data.forEach(item => {
|
122 |
-
const option = document.createElement('option');
|
123 |
-
option.value = item;
|
124 |
-
option.text = item;
|
125 |
-
select.appendChild(option);
|
126 |
-
});
|
127 |
-
container.appendChild(select);
|
128 |
-
document.getElementById('sendGetRequestButton').addEventListener('click', function() {
|
129 |
-
const selectedValue = document.getElementById('dropdown').value;
|
130 |
-
const token = document.getElementById('tokenInput').value;
|
131 |
-
const getUrl = '/send_get_request?token=' + encodeURIComponent(token) + '&webinarId=' + encodeURIComponent(selectedValue);
|
132 |
-
fetch(getUrl, {
|
133 |
-
method: 'GET'
|
134 |
-
})
|
135 |
-
.then(response => response.json())
|
136 |
-
.then(data => {
|
137 |
-
console.log('GET Response:', data);
|
138 |
-
toastr.success('User data saved successfully'); // Здесь показываем уведомление о том, что данные успешно сохранены
|
139 |
-
})
|
140 |
-
.catch(error => {
|
141 |
-
console.error('Error:', error);
|
142 |
-
toastr.error('Error: ' + error.message); // Здесь показываем уведомление об ошибке
|
143 |
-
});
|
144 |
-
});
|
145 |
-
}
|
146 |
-
});
|
147 |
</script>
|
148 |
</body>
|
149 |
-
</html>
|
|
|
71 |
|
72 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
|
73 |
<script>
|
74 |
+
toastr.options = {
|
75 |
+
"closeButton": false,
|
76 |
+
"debug": false,
|
77 |
+
"newestOnTop": false,
|
78 |
+
"progressBar": false,
|
79 |
+
"positionClass": "toast-top-right",
|
80 |
+
"preventDuplicates": false,
|
81 |
+
"onclick": null,
|
82 |
+
"showDuration": "300",
|
83 |
+
"hideDuration": "1000",
|
84 |
+
"timeOut": "5000",
|
85 |
+
"extendedTimeOut": "1000",
|
86 |
+
"showEasing": "swing",
|
87 |
+
"hideEasing": "linear",
|
88 |
+
"showMethod": "fadeIn",
|
89 |
+
"hideMethod": "fadeOut"
|
90 |
+
};
|
|
|
91 |
|
92 |
+
document.getElementById('sendRequestButton').addEventListener('click', function() {
|
93 |
+
const token = document.getElementById('tokenInput').value;
|
94 |
+
const minDate = document.getElementById('dateSelect').value;
|
95 |
+
const type = document.getElementById('typeSelect').value;
|
96 |
+
const url = '/send_request';
|
97 |
+
fetch(url, {
|
98 |
+
method: 'POST',
|
99 |
+
headers: {
|
100 |
+
'Content-Type': 'application/x-www-form-urlencoded'
|
101 |
+
},
|
102 |
+
body: 'token=' + encodeURIComponent(token) + '&minDate=' + encodeURIComponent(minDate) + '&type=' + encodeURIComponent(type)
|
103 |
+
})
|
104 |
+
.then(response => response.json())
|
105 |
+
.then(data => {
|
106 |
+
console.log('JSON Response:', data);
|
107 |
+
createDropdown(data);
|
108 |
+
})
|
109 |
+
.catch(error => {
|
110 |
+
console.error('Error:', error);
|
111 |
+
toastr.error('Error: ' + error.message);
|
112 |
+
});
|
113 |
+
});
|
114 |
+
|
115 |
+
function createDropdown(data) {
|
116 |
+
const container = document.getElementById('dropdown-container');
|
117 |
+
container.innerHTML = ''; // Очистить контейнер перед добавлением нового списка
|
118 |
+
const select = document.createElement('select');
|
119 |
+
select.id = 'dropdown';
|
120 |
+
data.forEach(item => {
|
121 |
+
const option = document.createElement('option');
|
122 |
+
option.value = item;
|
123 |
+
option.text = item;
|
124 |
+
select.appendChild(option);
|
125 |
+
});
|
126 |
+
container.appendChild(select);
|
127 |
+
document.getElementById('sendGetRequestButton').addEventListener('click', function() {
|
128 |
+
const selectedValue = document.getElementById('dropdown').value;
|
129 |
const token = document.getElementById('tokenInput').value;
|
130 |
+
const getUrl = '/send_get_request?token=' + encodeURIComponent(token) + '&webinarId=' + encodeURIComponent(selectedValue);
|
131 |
+
fetch(getUrl, {
|
132 |
+
method: 'GET'
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
})
|
134 |
.then(response => response.json())
|
135 |
.then(data => {
|
136 |
+
console.log('GET Response:', data);
|
137 |
+
toastr.success('User data saved successfully'); // Уведомление об успешной загрузке пользователей
|
138 |
})
|
139 |
.catch(error => {
|
140 |
console.error('Error:', error);
|
141 |
+
toastr.error('Error: ' + error.message); // Уведомление об ошибке
|
142 |
});
|
143 |
});
|
144 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
</script>
|
146 |
</body>
|
147 |
+
</html>
|