Spaces:
Sleeping
Sleeping
Update nutri_call.html
Browse files- nutri_call.html +16 -47
nutri_call.html
CHANGED
@@ -728,57 +728,26 @@ function data_out(response) {
|
|
728 |
|
729 |
|
730 |
|
731 |
-
function showCalculationStatus(response) {
|
732 |
-
// Настройки по умолчанию
|
733 |
-
const defaults = {
|
734 |
-
modules: {
|
735 |
-
Mobile: {
|
736 |
-
swipeDismiss: true
|
737 |
-
}
|
738 |
-
},
|
739 |
-
delay: 4000,
|
740 |
-
width: '320px'
|
741 |
-
};
|
742 |
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
addclass: 'pnotify-success',
|
753 |
-
buttons: {
|
754 |
-
closer: true,
|
755 |
-
sticker: false
|
756 |
-
}
|
757 |
-
});
|
758 |
-
}
|
759 |
-
// Ошибки баланса
|
760 |
-
else {
|
761 |
-
new PNotify({
|
762 |
-
...defaults,
|
763 |
-
title: 'Обнаружены дефициты',
|
764 |
-
text: Object.entries(response.deficits)
|
765 |
-
.map(([el, val]) => `<div class="deficit-item"><i class="fas fa-exclamation-circle"></i> ${el}: <strong>${val.toFixed(2)} ppm</strong></div>`)
|
766 |
-
.join(''),
|
767 |
-
type: 'error',
|
768 |
-
icon: 'fas fa-exclamation-triangle',
|
769 |
-
delay: 7000,
|
770 |
-
styling: 'bootstrap4',
|
771 |
-
addclass: 'pnotify-error',
|
772 |
-
buttons: {
|
773 |
-
closer: true,
|
774 |
-
sticker: false
|
775 |
-
}
|
776 |
});
|
|
|
|
|
|
|
|
|
777 |
}
|
778 |
-
}
|
779 |
-
|
780 |
-
|
781 |
</script>
|
|
|
|
|
782 |
|
783 |
</body>
|
784 |
</html>
|
|
|
728 |
|
729 |
|
730 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
731 |
|
732 |
+
|
733 |
+
<script>
|
734 |
+
document.getElementById('testNotify').addEventListener('click', async () => {
|
735 |
+
try {
|
736 |
+
await showCalculationStatus({ deficits: {} });
|
737 |
+
setTimeout(async () => {
|
738 |
+
await showCalculationStatus({
|
739 |
+
deficits: { Ca: -5.2, Mg: -1.1 },
|
740 |
+
total_ppm: 480.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
741 |
});
|
742 |
+
}, 2000);
|
743 |
+
} catch (error) {
|
744 |
+
console.error('Ошибка показа уведомлений:', error);
|
745 |
+
alert('Включите интернет для загрузки уведомлений');
|
746 |
}
|
747 |
+
});
|
|
|
|
|
748 |
</script>
|
749 |
+
|
750 |
+
<button id="testNotify">Проверить уведомления</button>
|
751 |
|
752 |
</body>
|
753 |
</html>
|