Spaces:
Sleeping
Sleeping
Update nutri_call.html
Browse files- nutri_call.html +49 -79
nutri_call.html
CHANGED
@@ -1,75 +1,53 @@
|
|
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/mobile@5/dist/PNotifyMobile.css" rel="stylesheet">
|
|
|
|
|
8 |
|
9 |
<!-- Скрипты -->
|
10 |
-
<script
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
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 |
|
@@ -765,24 +743,16 @@ function data_out(response) {
|
|
765 |
|
766 |
|
767 |
|
|
|
|
|
768 |
<script>
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
total_ppm: 480.0
|
776 |
-
});
|
777 |
-
}, 2000);
|
778 |
-
} catch (error) {
|
779 |
-
console.error('Ошибка показа уведомлений:', error);
|
780 |
-
alert('Включите интернет для загрузки уведомлений');
|
781 |
-
}
|
782 |
-
});
|
783 |
</script>
|
784 |
-
|
785 |
-
<button id="testNotify">Проверить уведомления</button>
|
786 |
|
787 |
</body>
|
788 |
</html>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="ru">
|
3 |
<head>
|
4 |
+
<!-- Основные стили -->
|
5 |
+
<link href="https://cdn.jsdelivr.net/npm/@pnotify/core@5.2.0/dist/PNotify.css" rel="stylesheet">
|
6 |
+
<!-- Мобильная поддержка -->
|
7 |
+
<link href="https://cdn.jsdelivr.net/npm/@pnotify/mobile@5.2.0/dist/PNotifyMobile.css" rel="stylesheet">
|
8 |
+
<!-- Тема -->
|
9 |
+
<link href="https://cdn.jsdelivr.net/npm/@pnotify/core@5.2.0/dist/BrightTheme.css" rel="stylesheet">
|
10 |
|
11 |
<!-- Скрипты -->
|
12 |
+
<script type="module">
|
13 |
+
import { alert, defaultModules } from 'https://cdn.jsdelivr.net/npm/@pnotify/core@5.2.0/dist/PNotify.js';
|
14 |
+
import * as PNotifyMobile from 'https://cdn.jsdelivr.net/npm/@pnotify/mobile@5.2.0/dist/PNotifyMobile.js';
|
15 |
+
|
16 |
+
// Инициализация мобильного модуля
|
17 |
+
defaultModules.set(PNotifyMobile, {});
|
18 |
+
|
19 |
+
// Теперь функция showCalculationStatus будет доступна глобально
|
20 |
+
window.showCalculationStatus = function(response) {
|
21 |
+
if (Object.keys(response.deficits || {}).length === 0) {
|
22 |
+
alert({
|
23 |
+
title: 'Успешный расчёт',
|
24 |
+
text: 'Все элементы сбалансированы!',
|
25 |
+
type: 'success',
|
26 |
+
delay: 3000,
|
27 |
+
modules: {
|
28 |
+
Mobile: {
|
29 |
+
swipeDismiss: true
|
30 |
+
}
|
31 |
+
}
|
32 |
+
});
|
33 |
+
} else {
|
34 |
+
alert({
|
35 |
+
title: 'Обнаружены отклонения',
|
36 |
+
text: 'Дефициты: ' + Object.entries(response.deficits)
|
37 |
+
.map(([el, val]) => `${el}: ${val.toFixed(2)}ppm`)
|
38 |
+
.join(', '),
|
39 |
+
type: 'error',
|
40 |
+
delay: 5000,
|
41 |
+
modules: {
|
42 |
+
Mobile: {
|
43 |
+
swipeDismiss: true
|
44 |
+
}
|
45 |
+
}
|
46 |
+
});
|
47 |
}
|
48 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
</script>
|
50 |
|
|
|
|
|
|
|
51 |
|
52 |
|
53 |
|
|
|
743 |
|
744 |
|
745 |
|
746 |
+
<button id="testNotify">Тест уведомлений</button>
|
747 |
+
|
748 |
<script>
|
749 |
+
document.getElementById('testNotify').addEventListener('click', () => {
|
750 |
+
showCalculationStatus({ deficits: {} }); // Тест успеха
|
751 |
+
setTimeout(() => {
|
752 |
+
showCalculationStatus({ deficits: { Ca: -5.2, Mg: -1.1 } }); // Тест ошибки
|
753 |
+
}, 3500);
|
754 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
755 |
</script>
|
|
|
|
|
756 |
|
757 |
</body>
|
758 |
</html>
|