DmitrMakeev commited on
Commit
6b23076
1 Parent(s): a939a4d

Update biz_v.html

Browse files
Files changed (1) hide show
  1. biz_v.html +61 -26
biz_v.html CHANGED
@@ -38,40 +38,71 @@
38
  }
39
  </style>
40
  </head>
 
 
 
 
 
 
 
41
  <body>
42
  <h1>Комменты Бизон 365</h1>
 
43
  <label for="tokenInput">Enter Token:</label>
44
  <input type="text" id="tokenInput" placeholder="Your Token">
45
- <label for="dateSelect">Select Date:</label>
46
- <select id="dateSelect">
47
- <option value="2021-01-01T00:00:00">2021-01-01</option>
48
- <option value="2022-01-01T00:00:00">2022-01-01</option>
49
- <option value="2023-01-01T00:00:00">2023-01-01</option>
50
- <option value="2024-01-01T00:00:00">2024-01-01</option>
 
 
 
 
 
 
 
 
51
  </select>
 
52
  <button id="sendRequestButton">Send Request</button>
 
53
  <textarea id="responseArea" rows="10" cols="50" readonly></textarea>
 
54
  <div id="dropdown-container"></div>
 
55
  <button id="sendGetRequestButton">Send GET Request</button>
 
56
  <textarea id="secondResponseArea" rows="10" cols="50" readonly></textarea>
57
 
58
  <script>
59
  document.getElementById('sendRequestButton').addEventListener('click', function() {
60
  const token = document.getElementById('tokenInput').value;
61
  const minDate = document.getElementById('dateSelect').value;
 
 
 
 
62
  const url = '/send_request';
 
 
 
 
 
 
 
63
  fetch(url, {
64
  method: 'POST',
65
  headers: {
66
  'Content-Type': 'application/x-www-form-urlencoded'
67
  },
68
- body: 'token=' + encodeURIComponent(token) + '&minDate=' + encodeURIComponent(minDate)
69
  })
70
  .then(response => response.json())
71
  .then(data => {
72
  console.log('JSON Response:', data);
73
  document.getElementById('responseArea').value = JSON.stringify(data, null, 2);
74
- // Создание выпадающего списка
75
  createDropdown(data);
76
  })
77
  .catch(error => {
@@ -79,8 +110,10 @@
79
  document.getElementById('responseArea').value = 'Error: ' + error.message;
80
  });
81
  });
 
82
  function createDropdown(data) {
83
  const container = document.getElementById('dropdown-container');
 
84
  const select = document.createElement('select');
85
  select.id = 'dropdown';
86
  data.forEach(item => {
@@ -90,25 +123,27 @@
90
  select.appendChild(option);
91
  });
92
  container.appendChild(select);
93
- // Добавление обработчика для кнопки отправки GET-запроса
94
- document.getElementById('sendGetRequestButton').addEventListener('click', function() {
95
- const selectedValue = document.getElementById('dropdown').value;
96
- const token = document.getElementById('tokenInput').value;
97
- const getUrl = '/send_get_request?token=' + encodeURIComponent(token) + '&webinarId=' + encodeURIComponent(selectedValue);
98
- fetch(getUrl, {
99
- method: 'GET'
100
- })
101
- .then(response => response.json())
102
- .then(data => {
103
- console.log('GET Response:', data);
104
- document.getElementById('secondResponseArea').value = JSON.stringify(data, null, 2);
105
- })
106
- .catch(error => {
107
- console.error('Error:', error);
108
- document.getElementById('secondResponseArea').value = 'Error: ' + error.message;
109
- });
110
- });
111
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  </script>
113
  </body>
 
 
114
  </html>
 
38
  }
39
  </style>
40
  </head>
41
+ <!DOCTYPE html>
42
+ <html lang="en">
43
+ <head>
44
+ <meta charset="UTF-8">
45
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
46
+ <title>Комменты Бизон 365</title>
47
+ </head>
48
  <body>
49
  <h1>Комменты Бизон 365</h1>
50
+
51
  <label for="tokenInput">Enter Token:</label>
52
  <input type="text" id="tokenInput" placeholder="Your Token">
53
+
54
+ <label for="dateSelect">Select Min Date:</label>
55
+ <input type="datetime-local" id="dateSelect">
56
+
57
+ <label for="maxDateSelect">Select Max Date:</label>
58
+ <input type="datetime-local" id="maxDateSelect">
59
+
60
+ <label for="limitInput">Limit:</label>
61
+ <input type="number" id="limitInput" placeholder="20">
62
+
63
+ <label for="typeSelect">Type:</label>
64
+ <select id="typeSelect">
65
+ <option value="LiveWebinars">Live Webinars</option>
66
+ <option value="AutoWebinars">Auto Webinars</option>
67
  </select>
68
+
69
  <button id="sendRequestButton">Send Request</button>
70
+
71
  <textarea id="responseArea" rows="10" cols="50" readonly></textarea>
72
+
73
  <div id="dropdown-container"></div>
74
+
75
  <button id="sendGetRequestButton">Send GET Request</button>
76
+
77
  <textarea id="secondResponseArea" rows="10" cols="50" readonly></textarea>
78
 
79
  <script>
80
  document.getElementById('sendRequestButton').addEventListener('click', function() {
81
  const token = document.getElementById('tokenInput').value;
82
  const minDate = document.getElementById('dateSelect').value;
83
+ const maxDate = document.getElementById('maxDateSelect').value;
84
+ const limit = document.getElementById('limitInput').value;
85
+ const type = document.getElementById('typeSelect').value;
86
+
87
  const url = '/send_request';
88
+ const params = new URLSearchParams();
89
+ params.append('token', token);
90
+ params.append('minDate', minDate);
91
+ params.append('maxDate', maxDate);
92
+ params.append('limit', limit);
93
+ params.append('type', type);
94
+
95
  fetch(url, {
96
  method: 'POST',
97
  headers: {
98
  'Content-Type': 'application/x-www-form-urlencoded'
99
  },
100
+ body: params.toString()
101
  })
102
  .then(response => response.json())
103
  .then(data => {
104
  console.log('JSON Response:', data);
105
  document.getElementById('responseArea').value = JSON.stringify(data, null, 2);
 
106
  createDropdown(data);
107
  })
108
  .catch(error => {
 
110
  document.getElementById('responseArea').value = 'Error: ' + error.message;
111
  });
112
  });
113
+
114
  function createDropdown(data) {
115
  const container = document.getElementById('dropdown-container');
116
+ container.innerHTML = ''; // Очистить контейнер перед добавлением нового списка
117
  const select = document.createElement('select');
118
  select.id = 'dropdown';
119
  data.forEach(item => {
 
123
  select.appendChild(option);
124
  });
125
  container.appendChild(select);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
+
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
+ document.getElementById('secondResponseArea').value = JSON.stringify(data, null, 2);
139
+ })
140
+ .catch(error => {
141
+ console.error('Error:', error);
142
+ document.getElementById('secondResponseArea').value = 'Error: ' + error.message;
143
+ });
144
+ });
145
  </script>
146
  </body>
147
+ </html>
148
+
149
  </html>