DmitrMakeev
commited on
Commit
•
90eb70e
1
Parent(s):
d481e21
Update biz_v.html
Browse files- biz_v.html +33 -88
biz_v.html
CHANGED
@@ -72,22 +72,8 @@
|
|
72 |
</style>
|
73 |
|
74 |
|
|
|
75 |
|
76 |
-
<style>
|
77 |
-
body {
|
78 |
-
font-family: Arial, sans-serif;
|
79 |
-
text-align: center;
|
80 |
-
background-color: #f0f0f0;
|
81 |
-
margin: 0;
|
82 |
-
padding: 0;
|
83 |
-
}
|
84 |
-
h1 {
|
85 |
-
background-color: #4CAF50;
|
86 |
-
color: white;
|
87 |
-
padding: 20px;
|
88 |
-
margin: 0;
|
89 |
-
border-bottom: 2px solid #388E3C;
|
90 |
-
}
|
91 |
.input-row {
|
92 |
display: flex;
|
93 |
justify-content: center;
|
@@ -122,31 +108,6 @@
|
|
122 |
#uploadButton:hover {
|
123 |
background-color: #388E3C;
|
124 |
}
|
125 |
-
.loader {
|
126 |
-
border: 16px solid #f3f3f3;
|
127 |
-
border-radius: 50%;
|
128 |
-
border-top: 16px solid #4CAF50; /* Зелёный цвет */
|
129 |
-
width: 120px;
|
130 |
-
height: 120px;
|
131 |
-
-webkit-animation: spin 2s linear infinite; /* Safari */
|
132 |
-
animation: spin 2s linear infinite;
|
133 |
-
display: none; /* Изначально скрыт */
|
134 |
-
position: fixed; /* Фиксированное положение */
|
135 |
-
top: 50%; /* По центру по вертикали */
|
136 |
-
left: 50%; /* По центру по горизонтали */
|
137 |
-
transform: translate(-50%, -50%); /* Центрирование */
|
138 |
-
}
|
139 |
-
|
140 |
-
/* Safari */
|
141 |
-
@-webkit-keyframes spin {
|
142 |
-
0% { -webkit-transform: rotate(0deg); }
|
143 |
-
100% { -webkit-transform: rotate(360deg); }
|
144 |
-
}
|
145 |
-
|
146 |
-
@keyframes spin {
|
147 |
-
0% { transform: rotate(0deg); }
|
148 |
-
100% { transform: rotate(360deg); }
|
149 |
-
}
|
150 |
</style>
|
151 |
|
152 |
|
@@ -158,7 +119,6 @@
|
|
158 |
|
159 |
|
160 |
|
161 |
-
|
162 |
|
163 |
</head>
|
164 |
<body>
|
@@ -204,7 +164,7 @@
|
|
204 |
|
205 |
|
206 |
|
207 |
-
|
208 |
<form id="uploadForm" enctype="multipart/form-data" method="post">
|
209 |
<div class="input-row">
|
210 |
<input type="file" name="file" accept=".csv">
|
@@ -220,66 +180,53 @@
|
|
220 |
<input id="uploadButton" type="submit" value="Upload">
|
221 |
</form>
|
222 |
<div id="result"></div>
|
223 |
-
<div class="loader"></div>
|
224 |
|
225 |
-
|
226 |
-
|
227 |
<script>
|
228 |
document.getElementById('uploadForm').addEventListener('submit', function(event) {
|
229 |
event.preventDefault();
|
230 |
const form = new FormData(this);
|
231 |
-
|
232 |
-
|
233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
fetch('/upload_csv', {
|
235 |
method: 'POST',
|
236 |
body: form
|
237 |
})
|
238 |
.then(response => response.json())
|
239 |
.then(data => {
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
position: {
|
244 |
-
x: 'right',
|
245 |
-
y: 'bottom'
|
246 |
-
},
|
247 |
-
types: [
|
248 |
-
{
|
249 |
-
type: 'success',
|
250 |
-
background: 'green',
|
251 |
-
icon: {
|
252 |
-
className: 'notyf__icon--success',
|
253 |
-
tagName: 'span',
|
254 |
-
text: ''
|
255 |
-
}
|
256 |
-
}
|
257 |
-
]
|
258 |
});
|
259 |
-
notyf.success(data.message); // Показываем уведомление с сообщением от сервера
|
260 |
})
|
261 |
.catch(error => {
|
262 |
console.error('Error:', error);
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
position: {
|
267 |
-
x: 'right',
|
268 |
-
y: 'bottom'
|
269 |
-
},
|
270 |
-
types: [
|
271 |
-
{
|
272 |
-
type: 'error',
|
273 |
-
background: 'red',
|
274 |
-
icon: {
|
275 |
-
className: 'notyf__icon--error',
|
276 |
-
tagName: 'span',
|
277 |
-
text: ''
|
278 |
-
}
|
279 |
-
}
|
280 |
-
]
|
281 |
});
|
282 |
-
notyf.error('An error occurred while uploading the file.'); // Показываем уведомление об ошибке
|
283 |
});
|
284 |
});
|
285 |
</script>
|
@@ -307,8 +254,6 @@
|
|
307 |
|
308 |
|
309 |
|
310 |
-
|
311 |
-
|
312 |
|
313 |
|
314 |
|
|
|
72 |
</style>
|
73 |
|
74 |
|
75 |
+
<style>
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
.input-row {
|
78 |
display: flex;
|
79 |
justify-content: center;
|
|
|
108 |
#uploadButton:hover {
|
109 |
background-color: #388E3C;
|
110 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
</style>
|
112 |
|
113 |
|
|
|
119 |
|
120 |
|
121 |
|
|
|
122 |
|
123 |
</head>
|
124 |
<body>
|
|
|
164 |
|
165 |
|
166 |
|
167 |
+
<h1>Upload CSV File</h1>
|
168 |
<form id="uploadForm" enctype="multipart/form-data" method="post">
|
169 |
<div class="input-row">
|
170 |
<input type="file" name="file" accept=".csv">
|
|
|
180 |
<input id="uploadButton" type="submit" value="Upload">
|
181 |
</form>
|
182 |
<div id="result"></div>
|
|
|
183 |
|
184 |
+
<!-- Подключение скрипта Notyf -->
|
185 |
+
<script src="https://cdn.jsdelivr.net/npm/notyf/notyf.min.js"></script>
|
186 |
<script>
|
187 |
document.getElementById('uploadForm').addEventListener('submit', function(event) {
|
188 |
event.preventDefault();
|
189 |
const form = new FormData(this);
|
190 |
+
// Показываем сообщение "Загрузка началась, пожалуйста, подождите"
|
191 |
+
const notyf = new Notyf({
|
192 |
+
duration: 5000, // Длительность показа уведомления
|
193 |
+
position: {
|
194 |
+
x: 'right',
|
195 |
+
y: 'top'
|
196 |
+
},
|
197 |
+
types: [
|
198 |
+
{
|
199 |
+
type: 'info',
|
200 |
+
background: 'green',
|
201 |
+
icon: {
|
202 |
+
className: 'notyf__icon--info',
|
203 |
+
tagName: 'span',
|
204 |
+
text: ''
|
205 |
+
}
|
206 |
+
}
|
207 |
+
]
|
208 |
+
});
|
209 |
+
notyf.open({
|
210 |
+
type: 'info',
|
211 |
+
message: 'Загрузка началась, пожалуйста, подождите'
|
212 |
+
});
|
213 |
fetch('/upload_csv', {
|
214 |
method: 'POST',
|
215 |
body: form
|
216 |
})
|
217 |
.then(response => response.json())
|
218 |
.then(data => {
|
219 |
+
notyf.open({
|
220 |
+
type: 'success',
|
221 |
+
message: data.message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
});
|
|
|
223 |
})
|
224 |
.catch(error => {
|
225 |
console.error('Error:', error);
|
226 |
+
notyf.open({
|
227 |
+
type: 'error',
|
228 |
+
message: 'An error occurred while uploading the file.'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
});
|
|
|
230 |
});
|
231 |
});
|
232 |
</script>
|
|
|
254 |
|
255 |
|
256 |
|
|
|
|
|
257 |
|
258 |
|
259 |
|