Update biz_v.html
Browse files- biz_v.html +27 -43
biz_v.html
CHANGED
|
@@ -24,35 +24,27 @@
|
|
| 24 |
justify-content: center;
|
| 25 |
gap: 10px;
|
| 26 |
margin-top: 20px;
|
| 27 |
-
flex-wrap: wrap;
|
| 28 |
}
|
| 29 |
-
.input-row input, .input-row select {
|
| 30 |
padding: 10px;
|
| 31 |
font-size: 16px;
|
| 32 |
border: 1px solid #ccc;
|
| 33 |
border-radius: 5px;
|
| 34 |
-
margin: 5px;
|
| 35 |
}
|
| 36 |
-
|
| 37 |
-
width: 100px;
|
| 38 |
-
}
|
| 39 |
-
#sendRequestButton, #sendGetRequestButton {
|
| 40 |
color: white;
|
| 41 |
background-color: #4CAF50;
|
| 42 |
border: none;
|
| 43 |
cursor: pointer;
|
| 44 |
-
padding: 10px 20px;
|
| 45 |
-
font-size: 16px;
|
| 46 |
-
border-radius: 5px;
|
| 47 |
-
margin-top: 20px;
|
| 48 |
}
|
| 49 |
-
#sendRequestButton:hover
|
| 50 |
background-color: #388E3C;
|
| 51 |
}
|
| 52 |
textarea {
|
| 53 |
width: 80%;
|
| 54 |
-
margin: 20px
|
| 55 |
padding: 10px;
|
|
|
|
| 56 |
border: 1px solid #ccc;
|
| 57 |
border-radius: 5px;
|
| 58 |
}
|
|
@@ -67,17 +59,15 @@
|
|
| 67 |
</div>
|
| 68 |
|
| 69 |
<div class="input-row">
|
| 70 |
-
<label for="
|
| 71 |
-
<input type="date" id="
|
| 72 |
-
|
| 73 |
-
<
|
| 74 |
-
<input type="date" id="maxDateSelect">
|
| 75 |
</div>
|
| 76 |
|
| 77 |
<div class="input-row">
|
| 78 |
<label for="limitInput">Limit:</label>
|
| 79 |
-
<input type="number" id="limitInput" placeholder="20"
|
| 80 |
-
|
| 81 |
<label for="typeSelect">Type:</label>
|
| 82 |
<select id="typeSelect">
|
| 83 |
<option value="LiveWebinars">Live Webinars</option>
|
|
@@ -87,40 +77,38 @@
|
|
| 87 |
|
| 88 |
<button id="sendRequestButton">Send Request</button>
|
| 89 |
|
| 90 |
-
<textarea id="responseArea" rows="10" readonly></textarea>
|
| 91 |
|
| 92 |
<div id="dropdown-container"></div>
|
| 93 |
|
| 94 |
<button id="sendGetRequestButton">Send GET Request</button>
|
| 95 |
|
| 96 |
-
<textarea id="secondResponseArea" rows="10" readonly></textarea>
|
| 97 |
|
| 98 |
<script>
|
| 99 |
document.getElementById('sendRequestButton').addEventListener('click', function() {
|
| 100 |
const token = document.getElementById('tokenInput').value;
|
| 101 |
-
const minDate = document.getElementById('
|
| 102 |
-
const maxDate = document.getElementById('
|
| 103 |
const limit = document.getElementById('limitInput').value;
|
| 104 |
const type = document.getElementById('typeSelect').value;
|
| 105 |
-
|
| 106 |
-
const params = new URLSearchParams(
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
fetch('/send_request', {
|
| 115 |
method: 'POST',
|
| 116 |
headers: {
|
| 117 |
'Content-Type': 'application/x-www-form-urlencoded'
|
| 118 |
},
|
| 119 |
-
body: params
|
| 120 |
})
|
| 121 |
.then(response => response.json())
|
| 122 |
.then(data => {
|
| 123 |
-
console.log('Response
|
| 124 |
document.getElementById('responseArea').value = JSON.stringify(data, null, 2);
|
| 125 |
createDropdown(data);
|
| 126 |
})
|
|
@@ -133,16 +121,12 @@
|
|
| 133 |
function createDropdown(data) {
|
| 134 |
const container = document.getElementById('dropdown-container');
|
| 135 |
container.innerHTML = ''; // Очистить контейнер перед добавлением нового списка
|
| 136 |
-
if (!Array.isArray(data)) {
|
| 137 |
-
console.error('Expected array, but got:', data);
|
| 138 |
-
return;
|
| 139 |
-
}
|
| 140 |
const select = document.createElement('select');
|
| 141 |
select.id = 'dropdown';
|
| 142 |
data.forEach(item => {
|
| 143 |
const option = document.createElement('option');
|
| 144 |
-
option.value = item;
|
| 145 |
-
option.text = item;
|
| 146 |
select.appendChild(option);
|
| 147 |
});
|
| 148 |
container.appendChild(select);
|
|
@@ -152,7 +136,6 @@
|
|
| 152 |
const selectedValue = document.getElementById('dropdown').value;
|
| 153 |
const token = document.getElementById('tokenInput').value;
|
| 154 |
const getUrl = '/send_get_request?token=' + encodeURIComponent(token) + '&webinarId=' + encodeURIComponent(selectedValue);
|
| 155 |
-
|
| 156 |
fetch(getUrl, {
|
| 157 |
method: 'GET'
|
| 158 |
})
|
|
@@ -169,3 +152,4 @@
|
|
| 169 |
</script>
|
| 170 |
</body>
|
| 171 |
</html>
|
|
|
|
|
|
| 24 |
justify-content: center;
|
| 25 |
gap: 10px;
|
| 26 |
margin-top: 20px;
|
|
|
|
| 27 |
}
|
| 28 |
+
.input-row input, .input-row select, .input-row button {
|
| 29 |
padding: 10px;
|
| 30 |
font-size: 16px;
|
| 31 |
border: 1px solid #ccc;
|
| 32 |
border-radius: 5px;
|
|
|
|
| 33 |
}
|
| 34 |
+
#sendRequestButton {
|
|
|
|
|
|
|
|
|
|
| 35 |
color: white;
|
| 36 |
background-color: #4CAF50;
|
| 37 |
border: none;
|
| 38 |
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
}
|
| 40 |
+
#sendRequestButton:hover {
|
| 41 |
background-color: #388E3C;
|
| 42 |
}
|
| 43 |
textarea {
|
| 44 |
width: 80%;
|
| 45 |
+
margin-top: 20px;
|
| 46 |
padding: 10px;
|
| 47 |
+
font-size: 16px;
|
| 48 |
border: 1px solid #ccc;
|
| 49 |
border-radius: 5px;
|
| 50 |
}
|
|
|
|
| 59 |
</div>
|
| 60 |
|
| 61 |
<div class="input-row">
|
| 62 |
+
<label for="minDate">Select Min Date:</label>
|
| 63 |
+
<input type="date" id="minDate">
|
| 64 |
+
<label for="maxDate">Select Max Date:</label>
|
| 65 |
+
<input type="date" id="maxDate">
|
|
|
|
| 66 |
</div>
|
| 67 |
|
| 68 |
<div class="input-row">
|
| 69 |
<label for="limitInput">Limit:</label>
|
| 70 |
+
<input type="number" id="limitInput" placeholder="20" max="100">
|
|
|
|
| 71 |
<label for="typeSelect">Type:</label>
|
| 72 |
<select id="typeSelect">
|
| 73 |
<option value="LiveWebinars">Live Webinars</option>
|
|
|
|
| 77 |
|
| 78 |
<button id="sendRequestButton">Send Request</button>
|
| 79 |
|
| 80 |
+
<textarea id="responseArea" rows="10" cols="50" readonly></textarea>
|
| 81 |
|
| 82 |
<div id="dropdown-container"></div>
|
| 83 |
|
| 84 |
<button id="sendGetRequestButton">Send GET Request</button>
|
| 85 |
|
| 86 |
+
<textarea id="secondResponseArea" rows="10" cols="50" readonly></textarea>
|
| 87 |
|
| 88 |
<script>
|
| 89 |
document.getElementById('sendRequestButton').addEventListener('click', function() {
|
| 90 |
const token = document.getElementById('tokenInput').value;
|
| 91 |
+
const minDate = document.getElementById('minDate').value;
|
| 92 |
+
const maxDate = document.getElementById('maxDate').value;
|
| 93 |
const limit = document.getElementById('limitInput').value;
|
| 94 |
const type = document.getElementById('typeSelect').value;
|
| 95 |
+
const url = '/send_request';
|
| 96 |
+
const params = new URLSearchParams();
|
| 97 |
+
params.append('token', token);
|
| 98 |
+
params.append('minDate', minDate);
|
| 99 |
+
params.append('maxDate', maxDate);
|
| 100 |
+
params.append('limit', limit);
|
| 101 |
+
params.append('type', type);
|
| 102 |
+
fetch(url, {
|
|
|
|
|
|
|
| 103 |
method: 'POST',
|
| 104 |
headers: {
|
| 105 |
'Content-Type': 'application/x-www-form-urlencoded'
|
| 106 |
},
|
| 107 |
+
body: params.toString()
|
| 108 |
})
|
| 109 |
.then(response => response.json())
|
| 110 |
.then(data => {
|
| 111 |
+
console.log('JSON Response:', data);
|
| 112 |
document.getElementById('responseArea').value = JSON.stringify(data, null, 2);
|
| 113 |
createDropdown(data);
|
| 114 |
})
|
|
|
|
| 121 |
function createDropdown(data) {
|
| 122 |
const container = document.getElementById('dropdown-container');
|
| 123 |
container.innerHTML = ''; // Очистить контейнер перед добавлением нового списка
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
const select = document.createElement('select');
|
| 125 |
select.id = 'dropdown';
|
| 126 |
data.forEach(item => {
|
| 127 |
const option = document.createElement('option');
|
| 128 |
+
option.value = item.id;
|
| 129 |
+
option.text = item.name;
|
| 130 |
select.appendChild(option);
|
| 131 |
});
|
| 132 |
container.appendChild(select);
|
|
|
|
| 136 |
const selectedValue = document.getElementById('dropdown').value;
|
| 137 |
const token = document.getElementById('tokenInput').value;
|
| 138 |
const getUrl = '/send_get_request?token=' + encodeURIComponent(token) + '&webinarId=' + encodeURIComponent(selectedValue);
|
|
|
|
| 139 |
fetch(getUrl, {
|
| 140 |
method: 'GET'
|
| 141 |
})
|
|
|
|
| 152 |
</script>
|
| 153 |
</body>
|
| 154 |
</html>
|
| 155 |
+
|