DmitrMakeev commited on
Commit
383a97d
·
verified ·
1 Parent(s): 3b74e2e

Update nutri_call.html

Browse files
Files changed (1) hide show
  1. nutri_call.html +62 -127
nutri_call.html CHANGED
@@ -508,7 +508,29 @@ legend {
508
 
509
 
510
 
511
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
513
  <script>
514
  let call_data;
@@ -722,141 +744,54 @@ function data_out(response) {
722
  function showCalculationStatus(response) {
723
  // Настройки по умолчанию
724
  const defaults = {
725
- duration: 5000,
726
- gravity: "top",
727
- position: "right",
728
- stopOnFocus: true
 
 
 
729
  };
730
-
731
- // Проверяем дефициты
732
  if (Object.keys(response.deficits || {}).length === 0) {
733
- // Успешный расчёт (зелёный)
734
- Toastify({
735
  ...defaults,
736
- text: "✓ Расчёт успешен! Все элементы сбалансированы",
737
- backgroundColor: "#4CAF50",
738
- className: "toast-success"
739
- }).showToast();
740
- } else {
741
- // Есть дефициты (красный)
742
- const deficitText = Object.entries(response.deficits)
743
- .map(([el, val]) => `${el}: ${val.toFixed(2)} ppm`)
744
- .join(', ');
745
-
746
- Toastify({
 
 
 
 
747
  ...defaults,
748
- text: `⚠ Ошибка баланса: ${deficitText}`,
749
- backgroundColor: "#F44336",
750
- className: "toast-error",
751
- duration: 7000 // Даём больше времени на чтение ошибок
752
- }).showToast();
 
 
 
 
 
 
 
 
 
753
  }
754
  }
755
 
756
 
757
-
758
-
759
-
760
-
761
-
762
-
763
- <style>
764
- .pnotify-card {
765
- font-family: 'Segoe UI', sans-serif;
766
- border-radius: 8px;
767
- overflow: hidden;
768
- box-shadow: 0 4px 12px rgba(0,0,0,0.15);
769
- }
770
-
771
- .card-header {
772
- padding: 16px;
773
- display: flex;
774
- align-items: center;
775
- color: white;
776
- }
777
-
778
- .card-header.success {
779
- background: linear-gradient(135deg, #4CAF50, #2E7D32);
780
- }
781
-
782
- .card-header.error {
783
- background: linear-gradient(135deg, #F44336, #C62828);
784
- }
785
-
786
- .card-header h3 {
787
- margin: 0 0 0 12px;
788
- font-size: 1.2rem;
789
- }
790
-
791
- .card-header .icon {
792
- width: 24px;
793
- height: 24px;
794
- }
795
-
796
- .card-body {
797
- padding: 16px;
798
- background: white;
799
- }
800
-
801
- .card-body ul {
802
- margin: 0;
803
- padding-left: 20px;
804
- }
805
-
806
- .card-body p {
807
- margin: 0 0 8px 0;
808
- }
809
-
810
- .card-body small {
811
- color: #666;
812
- font-size: 0.8rem;
813
- }
814
- </style>
815
- <script type="module">
816
- import PNotify from 'https://cdn.jsdelivr.net/npm/@pnotify/core@5/dist/PNotify.js';
817
- import PNotifyMobile from 'https://cdn.jsdelivr.net/npm/@pnotify/mobile@5/dist/PNotifyMobile.js';
818
- import PNotifyBootstrap4 from 'https://cdn.jsdelivr.net/npm/@pnotify/bootstrap4@5/dist/PNotifyBootstrap4.js';
819
-
820
- PNotify.defaultModules.set(PNotifyMobile);
821
- PNotify.defaultModules.set(PNotifyBootstrap4);
822
-
823
- window.showCalculationStatus = function(response) {
824
- const defaults = {
825
- modules: {
826
- Mobile: {
827
- swipeDismiss: true
828
- }
829
- }
830
- };
831
-
832
- if (Object.keys(response.deficits || {}).length === 0) {
833
- new PNotify({
834
- ...defaults,
835
- title: 'Успешный расчёт',
836
- text: 'Все элементы сбалансированы!',
837
- type: 'success',
838
- icon: 'fas fa-check-circle',
839
- delay: 3000,
840
- width: '300px'
841
- });
842
- } else {
843
- new PNotify({
844
- ...defaults,
845
- title: 'Обнаружены отклонения',
846
- text: Object.entries(response.deficits)
847
- .map(([el, val]) => `${el}: ${val.toFixed(2)} ppm`)
848
- .join('<br>'),
849
- type: 'error',
850
- icon: 'fas fa-exclamation-triangle',
851
- delay: 5000,
852
- width: '300px'
853
- });
854
- }
855
- };
856
  </script>
857
-
858
-
859
-
860
 
861
  </body>
862
  </html>
 
508
 
509
 
510
 
511
+ <!-- Кастомные стили -->
512
+ <style>
513
+ .pnotify-success {
514
+ background: linear-gradient(135deg, #4CAF50, #2E7D32) !important;
515
+ border-left: 5px solid #1B5E20 !important;
516
+ }
517
+
518
+ .pnotify-error {
519
+ background: linear-gradient(135deg, #F44336, #C62828) !important;
520
+ border-left: 5px solid #B71C1C !important;
521
+ }
522
+
523
+ .deficit-item {
524
+ margin: 8px 0;
525
+ display: flex;
526
+ align-items: center;
527
+ }
528
+
529
+ .deficit-item i {
530
+ margin-right: 10px;
531
+ font-size: 1.2em;
532
+ }
533
+ </style>
534
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
535
  <script>
536
  let call_data;
 
744
  function showCalculationStatus(response) {
745
  // Настройки по умолчанию
746
  const defaults = {
747
+ modules: {
748
+ Mobile: {
749
+ swipeDismiss: true
750
+ }
751
+ },
752
+ delay: 4000,
753
+ width: '320px'
754
  };
755
+
756
+ // Успешный расчёт
757
  if (Object.keys(response.deficits || {}).length === 0) {
758
+ new PNotify({
 
759
  ...defaults,
760
+ title: 'Успешный расчёт',
761
+ text: 'Все элементы идеально сбалансированы',
762
+ type: 'success',
763
+ icon: 'fas fa-check-circle',
764
+ styling: 'bootstrap4',
765
+ addclass: 'pnotify-success',
766
+ buttons: {
767
+ closer: true,
768
+ sticker: false
769
+ }
770
+ });
771
+ }
772
+ // Ошибки баланса
773
+ else {
774
+ new PNotify({
775
  ...defaults,
776
+ title: 'Обнаружены дефициты',
777
+ text: Object.entries(response.deficits)
778
+ .map(([el, val]) => `<div class="deficit-item"><i class="fas fa-exclamation-circle"></i> ${el}: <strong>${val.toFixed(2)} ppm</strong></div>`)
779
+ .join(''),
780
+ type: 'error',
781
+ icon: 'fas fa-exclamation-triangle',
782
+ delay: 7000,
783
+ styling: 'bootstrap4',
784
+ addclass: 'pnotify-error',
785
+ buttons: {
786
+ closer: true,
787
+ sticker: false
788
+ }
789
+ });
790
  }
791
  }
792
 
793
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
794
  </script>
 
 
 
795
 
796
  </body>
797
  </html>