Spaces:
Sleeping
Sleeping
Update nutri_call.html
Browse files- nutri_call.html +26 -30
nutri_call.html
CHANGED
@@ -3,11 +3,7 @@
|
|
3 |
<head>
|
4 |
|
5 |
|
6 |
-
|
7 |
-
<link href="https://cdn.jsdelivr.net/npm/@pnotify/core@5.2.0/dist/PNotify.css" rel="stylesheet">
|
8 |
-
<link href="https://cdn.jsdelivr.net/npm/@pnotify/bootstrap4@5.2.0/dist/PNotifyBootstrap4.css" rel="stylesheet">
|
9 |
-
<script src="https://cdn.jsdelivr.net/npm/@pnotify/core@5.2.0/dist/PNotify.js"></script>
|
10 |
-
<script src="https://cdn.jsdelivr.net/npm/@pnotify/bootstrap4@5.2.0/dist/PNotifyBootstrap4.js"></script>
|
11 |
|
12 |
|
13 |
|
@@ -468,7 +464,7 @@ legend {
|
|
468 |
|
469 |
|
470 |
|
471 |
-
|
472 |
<script>
|
473 |
let call_data;
|
474 |
|
@@ -679,36 +675,36 @@ function data_out(response) {
|
|
679 |
|
680 |
|
681 |
function showCalculationStatus(response) {
|
682 |
-
//
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
|
|
|
|
687 |
|
|
|
688 |
if (Object.keys(response.deficits || {}).length === 0) {
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
stack: {"dir1": "down", "dir2": "left", "push": "top"}
|
697 |
-
});
|
698 |
} else {
|
|
|
699 |
const deficitText = Object.entries(response.deficits)
|
700 |
.map(([el, val]) => `${el}: ${val.toFixed(2)} ppm`)
|
701 |
-
.join('
|
702 |
|
703 |
-
|
704 |
-
|
705 |
-
text: deficitText
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
stack: {"dir1": "down", "dir2": "left", "push": "top"}
|
711 |
-
});
|
712 |
}
|
713 |
}
|
714 |
|
|
|
3 |
<head>
|
4 |
|
5 |
|
6 |
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
|
|
|
|
|
|
|
|
|
7 |
|
8 |
|
9 |
|
|
|
464 |
|
465 |
|
466 |
|
467 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
|
468 |
<script>
|
469 |
let call_data;
|
470 |
|
|
|
675 |
|
676 |
|
677 |
function showCalculationStatus(response) {
|
678 |
+
// Настройки по умолчанию
|
679 |
+
const defaults = {
|
680 |
+
duration: 5000,
|
681 |
+
gravity: "top",
|
682 |
+
position: "right",
|
683 |
+
stopOnFocus: true
|
684 |
+
};
|
685 |
|
686 |
+
// Проверяем дефициты
|
687 |
if (Object.keys(response.deficits || {}).length === 0) {
|
688 |
+
// Успешный расчёт (зелёный)
|
689 |
+
Toastify({
|
690 |
+
...defaults,
|
691 |
+
text: "✓ Расчёт успешен! Все элементы сбалансированы",
|
692 |
+
backgroundColor: "#4CAF50",
|
693 |
+
className: "toast-success"
|
694 |
+
}).showToast();
|
|
|
|
|
695 |
} else {
|
696 |
+
// Есть дефициты (красный)
|
697 |
const deficitText = Object.entries(response.deficits)
|
698 |
.map(([el, val]) => `${el}: ${val.toFixed(2)} ppm`)
|
699 |
+
.join(', ');
|
700 |
|
701 |
+
Toastify({
|
702 |
+
...defaults,
|
703 |
+
text: `⚠ Ошибка баланса: ${deficitText}`,
|
704 |
+
backgroundColor: "#F44336",
|
705 |
+
className: "toast-error",
|
706 |
+
duration: 7000 // Даём больше времени на чтение ошибок
|
707 |
+
}).showToast();
|
|
|
|
|
708 |
}
|
709 |
}
|
710 |
|