DmitrMakeev commited on
Commit
ee33f8e
·
verified ·
1 Parent(s): f9bb068

Update biz_v.html

Browse files
Files changed (1) hide show
  1. biz_v.html +30 -51
biz_v.html CHANGED
@@ -4,7 +4,6 @@
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Комменты Бизон 365</title>
7
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.8.0/css/pikaday.min.css">
8
  <style>
9
  body {
10
  font-family: Arial, sans-serif;
@@ -27,18 +26,15 @@
27
  margin-top: 20px;
28
  flex-wrap: wrap;
29
  }
30
- .input-row input, .input-row select, .input-row textarea {
31
  padding: 10px;
32
  font-size: 16px;
33
  border: 1px solid #ccc;
34
  border-radius: 5px;
35
- }
36
- #dateSelect, #maxDateSelect {
37
- width: 200px;
38
  margin: 5px;
39
  }
40
- #limitInput {
41
- width: 80px;
42
  }
43
  #sendRequestButton, #sendGetRequestButton {
44
  color: white;
@@ -53,12 +49,12 @@
53
  #sendRequestButton:hover, #sendGetRequestButton:hover {
54
  background-color: #388E3C;
55
  }
56
- #dropdown-container {
57
- margin-top: 20px;
58
- }
59
  textarea {
60
  width: 80%;
61
- margin-top: 20px;
 
 
 
62
  }
63
  </style>
64
  </head>
@@ -72,20 +68,16 @@
72
 
73
  <div class="input-row">
74
  <label for="dateSelect">Select Min Date:</label>
75
- <input type="text" id="dateSelect" placeholder="Select Min Date">
76
- </div>
77
-
78
- <div class="input-row">
79
  <label for="maxDateSelect">Select Max Date:</label>
80
- <input type="text" id="maxDateSelect" placeholder="Select Max Date">
81
  </div>
82
 
83
  <div class="input-row">
84
  <label for="limitInput">Limit:</label>
85
- <input type="number" id="limitInput" placeholder="20">
86
- </div>
87
-
88
- <div class="input-row">
89
  <label for="typeSelect">Type:</label>
90
  <select id="typeSelect">
91
  <option value="LiveWebinars">Live Webinars</option>
@@ -103,50 +95,32 @@
103
 
104
  <textarea id="secondResponseArea" rows="10" readonly></textarea>
105
 
106
- <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
107
- <script src="https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.8.0/pikaday.min.js"></script>
108
  <script>
109
- document.addEventListener('DOMContentLoaded', function() {
110
- const minDatePicker = new Pikaday({
111
- field: document.getElementById('dateSelect'),
112
- format: 'YYYY-MM-DD',
113
- onSelect: function(date) {
114
- console.log('Min Date Selected:', date.toISOString());
115
- }
116
- });
117
-
118
- const maxDatePicker = new Pikaday({
119
- field: document.getElementById('maxDateSelect'),
120
- format: 'YYYY-MM-DD',
121
- onSelect: function(date) {
122
- console.log('Max Date Selected:', date.toISOString());
123
- }
124
- });
125
- });
126
-
127
  document.getElementById('sendRequestButton').addEventListener('click', function() {
128
  const token = document.getElementById('tokenInput').value;
129
  const minDate = document.getElementById('dateSelect').value;
130
  const maxDate = document.getElementById('maxDateSelect').value;
131
  const limit = document.getElementById('limitInput').value;
132
  const type = document.getElementById('typeSelect').value;
133
- const url = '/send_request';
134
- const params = new URLSearchParams();
135
- params.append('token', token);
136
- params.append('minDate', minDate);
137
- params.append('maxDate', maxDate);
138
- params.append('limit', limit);
139
- params.append('type', type);
140
- fetch(url, {
 
 
141
  method: 'POST',
142
  headers: {
143
  'Content-Type': 'application/x-www-form-urlencoded'
144
  },
145
- body: params.toString()
146
  })
147
  .then(response => response.json())
148
  .then(data => {
149
- console.log('JSON Response:', data);
150
  document.getElementById('responseArea').value = JSON.stringify(data, null, 2);
151
  createDropdown(data);
152
  })
@@ -159,6 +133,10 @@
159
  function createDropdown(data) {
160
  const container = document.getElementById('dropdown-container');
161
  container.innerHTML = ''; // Очистить контейнер перед добавлением нового списка
 
 
 
 
162
  const select = document.createElement('select');
163
  select.id = 'dropdown';
164
  data.forEach(item => {
@@ -174,6 +152,7 @@
174
  const selectedValue = document.getElementById('dropdown').value;
175
  const token = document.getElementById('tokenInput').value;
176
  const getUrl = '/send_get_request?token=' + encodeURIComponent(token) + '&webinarId=' + encodeURIComponent(selectedValue);
 
177
  fetch(getUrl, {
178
  method: 'GET'
179
  })
@@ -189,4 +168,4 @@
189
  });
190
  </script>
191
  </body>
192
-
 
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>Комменты Бизон 365</title>
 
7
  <style>
8
  body {
9
  font-family: Arial, sans-serif;
 
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
+ .input-row input[type="number"] {
37
+ width: 100px;
38
  }
39
  #sendRequestButton, #sendGetRequestButton {
40
  color: white;
 
49
  #sendRequestButton:hover, #sendGetRequestButton:hover {
50
  background-color: #388E3C;
51
  }
 
 
 
52
  textarea {
53
  width: 80%;
54
+ margin: 20px auto;
55
+ padding: 10px;
56
+ border: 1px solid #ccc;
57
+ border-radius: 5px;
58
  }
59
  </style>
60
  </head>
 
68
 
69
  <div class="input-row">
70
  <label for="dateSelect">Select Min Date:</label>
71
+ <input type="date" id="dateSelect">
72
+
 
 
73
  <label for="maxDateSelect">Select Max Date:</label>
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" min="1" max="100">
80
+
 
 
81
  <label for="typeSelect">Type:</label>
82
  <select id="typeSelect">
83
  <option value="LiveWebinars">Live Webinars</option>
 
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('dateSelect').value;
102
  const maxDate = document.getElementById('maxDateSelect').value;
103
  const limit = document.getElementById('limitInput').value;
104
  const type = document.getElementById('typeSelect').value;
105
+
106
+ const params = new URLSearchParams({
107
+ token: token,
108
+ minDate: minDate,
109
+ maxDate: maxDate,
110
+ limit: limit,
111
+ type: type
112
+ }).toString();
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 Data:', data);
124
  document.getElementById('responseArea').value = JSON.stringify(data, null, 2);
125
  createDropdown(data);
126
  })
 
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 => {
 
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
  })
 
168
  });
169
  </script>
170
  </body>
171
+ </html>