Spaces:
Running
Running
Update nutri_call.html
Browse files- nutri_call.html +55 -1
nutri_call.html
CHANGED
@@ -1,7 +1,52 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="ru">
|
3 |
<head>
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
|
7 |
|
@@ -719,7 +764,16 @@ function showCalculationStatus(response) {
|
|
719 |
</script>
|
720 |
|
721 |
|
|
|
722 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
723 |
|
724 |
|
725 |
</body>
|
|
|
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 |
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
|
52 |
|
|
|
764 |
</script>
|
765 |
|
766 |
|
767 |
+
<button id="testNotify">Тест уведомлений</button>
|
768 |
|
769 |
+
<script>
|
770 |
+
document.getElementById('testNotify').addEventListener('click', () => {
|
771 |
+
showCalculationStatus({ deficits: {} }); // Тест успеха
|
772 |
+
setTimeout(() => {
|
773 |
+
showCalculationStatus({ deficits: { Ca: -5.2, Mg: -1.1 } }); // Тест ошибки
|
774 |
+
}, 3500);
|
775 |
+
});
|
776 |
+
</script>
|
777 |
|
778 |
|
779 |
</body>
|