Spaces:
Sleeping
Sleeping
Update nutri_call.html
Browse files- nutri_call.html +58 -23
nutri_call.html
CHANGED
@@ -1,41 +1,76 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="ru">
|
3 |
<head>
|
4 |
-
<!--
|
5 |
<link href="https://cdn.jsdelivr.net/npm/@pnotify/core@5/dist/PNotify.css" rel="stylesheet">
|
6 |
-
<!-- Тема (обязательно!) -->
|
7 |
<link href="https://cdn.jsdelivr.net/npm/@pnotify/bootstrap4@5/dist/PNotifyBootstrap4.css" rel="stylesheet">
|
8 |
-
<!-- Мобильная поддержка -->
|
9 |
<link href="https://cdn.jsdelivr.net/npm/@pnotify/mobile@5/dist/PNotifyMobile.css" rel="stylesheet">
|
10 |
|
11 |
-
<!--
|
|
|
|
|
|
|
|
|
12 |
<script>
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
-
|
32 |
-
// Запускаем инициализацию при загрузке страницы
|
33 |
-
initPNotify();
|
34 |
</script>
|
35 |
|
|
|
|
|
36 |
|
37 |
|
38 |
-
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
|
39 |
|
40 |
|
41 |
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="ru">
|
3 |
<head>
|
4 |
+
<!-- Стили -->
|
5 |
<link href="https://cdn.jsdelivr.net/npm/@pnotify/core@5/dist/PNotify.css" rel="stylesheet">
|
|
|
6 |
<link href="https://cdn.jsdelivr.net/npm/@pnotify/bootstrap4@5/dist/PNotifyBootstrap4.css" rel="stylesheet">
|
|
|
7 |
<link href="https://cdn.jsdelivr.net/npm/@pnotify/mobile@5/dist/PNotifyMobile.css" rel="stylesheet">
|
8 |
|
9 |
+
<!-- Скрипты -->
|
10 |
+
<script src="https://cdn.jsdelivr.net/npm/@pnotify/core@5/dist/iife/PNotify.js"></script>
|
11 |
+
<script src="https://cdn.jsdelivr.net/npm/@pnotify/mobile@5/dist/iife/PNotifyMobile.js"></script>
|
12 |
+
<script src="https://cdn.jsdelivr.net/npm/@pnotify/bootstrap4@5/dist/iife/PNotifyBootstrap4.js"></script>
|
13 |
+
|
14 |
<script>
|
15 |
+
// Инициализация PNotify
|
16 |
+
function initPNotify() {
|
17 |
+
PNotify.defaultModules.set(PNotifyMobile);
|
18 |
+
PNotify.defaultModules.set(PNotifyBootstrap4);
|
19 |
+
PNotify.defaults.styling = 'bootstrap4';
|
20 |
+
PNotify.defaults.icons = 'fontawesome5';
|
21 |
+
window.PNotifyReady = true;
|
22 |
+
|
23 |
+
// Проверка инициализации
|
24 |
+
console.log('PNotify initialized successfully');
|
25 |
+
}
|
26 |
+
|
27 |
+
// Запускаем инициализацию при полной загрузке страницы
|
28 |
+
window.addEventListener('DOMContentLoaded', initPNotify);
|
29 |
+
|
30 |
+
// Функция для показа уведомлений
|
31 |
+
function showCalculationStatus(response) {
|
32 |
+
if (!window.PNotifyReady) {
|
33 |
+
console.error('PNotify not loaded yet');
|
34 |
+
return;
|
35 |
}
|
36 |
|
37 |
+
const options = {
|
38 |
+
width: '350px',
|
39 |
+
delay: 4000,
|
40 |
+
modules: {
|
41 |
+
Mobile: {
|
42 |
+
swipeDismiss: true
|
43 |
+
}
|
44 |
+
}
|
45 |
+
};
|
46 |
+
|
47 |
+
if (Object.keys(response.deficits || {}).length === 0) {
|
48 |
+
new PNotify({
|
49 |
+
...options,
|
50 |
+
title: 'Успешный расчёт',
|
51 |
+
text: 'Все элементы сбалансированы',
|
52 |
+
type: 'success',
|
53 |
+
icon: 'fas fa-check-circle'
|
54 |
+
});
|
55 |
+
} else {
|
56 |
+
new PNotify({
|
57 |
+
...options,
|
58 |
+
title: 'Обнаружены дефициты',
|
59 |
+
text: Object.entries(response.deficits)
|
60 |
+
.map(([el, val]) => `<b>${el}:</b> ${val.toFixed(2)} ppm`)
|
61 |
+
.join('<br>'),
|
62 |
+
type: 'error',
|
63 |
+
delay: 7000,
|
64 |
+
icon: 'fas fa-exclamation-triangle'
|
65 |
+
});
|
66 |
}
|
67 |
+
}
|
|
|
|
|
68 |
</script>
|
69 |
|
70 |
+
<!-- Font Awesome для иконок -->
|
71 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
|
72 |
|
73 |
|
|
|
74 |
|
75 |
|
76 |
|