Spaces:
Sleeping
Sleeping
Update nutri_call.html
Browse files- nutri_call.html +106 -10
nutri_call.html
CHANGED
@@ -760,21 +760,117 @@ function showCalculationStatus(response) {
|
|
760 |
|
761 |
|
762 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
763 |
|
764 |
-
|
765 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
766 |
|
767 |
-
|
768 |
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
776 |
</script>
|
777 |
|
|
|
|
|
778 |
|
779 |
</body>
|
780 |
</html>
|
|
|
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 { alert, defaultModules } from 'https://cdn.jsdelivr.net/npm/@pnotify/core@5.2.0/dist/PNotify.js';
|
817 |
+
import * as PNotifyMobile from 'https://cdn.jsdelivr.net/npm/@pnotify/mobile@5.2.0/dist/PNotifyMobile.js';
|
818 |
+
import 'https://cdn.jsdelivr.net/npm/@pnotify/core@5.2.0/dist/BrightTheme.css';
|
819 |
+
import 'https://cdn.jsdelivr.net/npm/@pnotify/bootstrap4@5.2.0/dist/PNotifyBootstrap4.css';
|
820 |
|
821 |
+
defaultModules.set(PNotifyMobile, {});
|
822 |
|
823 |
+
window.showCalculationStatus = function(response) {
|
824 |
+
const successTemplate = `
|
825 |
+
<div class="pnotify-card">
|
826 |
+
<div class="card-header success">
|
827 |
+
<svg class="icon" viewBox="0 0 24 24"><path fill="currentColor" d="M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41 10.59L10 14.17L17.59 6.58L19 8L10 17Z"/></svg>
|
828 |
+
<h3>Расчёт успешен</h3>
|
829 |
+
</div>
|
830 |
+
<div class="card-body">
|
831 |
+
<p>Все элементы идеально сбалансированы</p>
|
832 |
+
<small>Общая концентрация: ${response.total_ppm.toFixed(2)} ppm</small>
|
833 |
+
</div>
|
834 |
+
</div>
|
835 |
+
`;
|
836 |
+
|
837 |
+
const errorTemplate = `
|
838 |
+
<div class="pnotify-card">
|
839 |
+
<div class="card-header error">
|
840 |
+
<svg class="icon" viewBox="0 0 24 24"><path fill="currentColor" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/></svg>
|
841 |
+
<h3>Обнаружены дефициты</h3>
|
842 |
+
</div>
|
843 |
+
<div class="card-body">
|
844 |
+
<ul>
|
845 |
+
${Object.entries(response.deficits).map(([el, val]) => `
|
846 |
+
<li><strong>${el}:</strong> ${val.toFixed(2)} ppm</li>
|
847 |
+
`).join('')}
|
848 |
+
</ul>
|
849 |
+
</div>
|
850 |
+
</div>
|
851 |
+
`;
|
852 |
+
|
853 |
+
alert({
|
854 |
+
type: Object.keys(response.deficits || {}).length === 0 ? 'success' : 'error',
|
855 |
+
text: Object.keys(response.deficits || {}).length === 0 ? successTemplate : errorTemplate,
|
856 |
+
delay: 4000,
|
857 |
+
width: '320px',
|
858 |
+
modules: {
|
859 |
+
Desktop: {
|
860 |
+
desktop: true
|
861 |
+
},
|
862 |
+
Animate: {
|
863 |
+
animate: true,
|
864 |
+
inClass: 'zoomIn',
|
865 |
+
outClass: 'zoomOut'
|
866 |
+
}
|
867 |
+
}
|
868 |
+
});
|
869 |
+
};
|
870 |
</script>
|
871 |
|
872 |
+
|
873 |
+
|
874 |
|
875 |
</body>
|
876 |
</html>
|