DmitrMakeev commited on
Commit
558d642
·
verified ·
1 Parent(s): bc0912b

Update nutri_call.html

Browse files
Files changed (1) hide show
  1. 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
- // Инициализация PNotify с настройками
683
- PNotify.defaults.styling = 'bootstrap4';
684
- PNotify.defaults.icons = 'fontawesome5';
685
- PNotify.defaults.delay = 5000;
686
- PNotify.defaults.width = '300px';
 
 
687
 
 
688
  if (Object.keys(response.deficits || {}).length === 0) {
689
- new PNotify({
690
- title: 'Расчёт успешен!',
691
- text: 'Все элементы сбалансированы',
692
- type: 'success',
693
- addclass: 'custom-success',
694
- icon: 'fa fa-check-circle',
695
- cornerclass: 'ui-pnotify-sharp',
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('<br>');
702
 
703
- new PNotify({
704
- title: 'Обнаружены дефициты',
705
- text: deficitText,
706
- type: 'error',
707
- addclass: 'custom-error',
708
- icon: 'fa fa-exclamation-triangle',
709
- cornerclass: 'ui-pnotify-sharp',
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