Spaces:
Running
Running
Update nutri_call.html
Browse files- nutri_call.html +30 -17
nutri_call.html
CHANGED
@@ -1510,7 +1510,7 @@ function showCalculationStatus(response) {
|
|
1510 |
|
1511 |
|
1512 |
<script>
|
1513 |
-
|
1514 |
const predefinedProfiles = {
|
1515 |
"profiles": [
|
1516 |
{
|
@@ -1525,6 +1525,19 @@ const predefinedProfiles = {
|
|
1525 |
"profile_n": 125,
|
1526 |
"liters": 100
|
1527 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1528 |
}
|
1529 |
]
|
1530 |
};
|
@@ -1576,14 +1589,14 @@ document.getElementById("profile-selector").addEventListener("change", function
|
|
1576 |
const selectedProfile = allProfiles.find(profile => profile.name === selectedProfileName);
|
1577 |
|
1578 |
if (selectedProfile) {
|
1579 |
-
document.getElementById("profile_p").value = selectedProfile.values.profile_p;
|
1580 |
-
document.getElementById("profile_k").value = selectedProfile.values.profile_k;
|
1581 |
-
document.getElementById("profile_mg").value = selectedProfile.values.profile_mg;
|
1582 |
-
document.getElementById("profile_ca").value = selectedProfile.values.profile_ca;
|
1583 |
-
document.getElementById("profile_s").value = selectedProfile.values.profile_s;
|
1584 |
-
document.getElementById("profile_no3").value = selectedProfile.values.profile_no3;
|
1585 |
-
document.getElementById("profile_n").value = selectedProfile.values.profile_n;
|
1586 |
-
document.getElementById("liters-input").value = selectedProfile.values.liters;
|
1587 |
}
|
1588 |
});
|
1589 |
|
@@ -1595,14 +1608,14 @@ document.getElementById("save-profile").addEventListener("click", function () {
|
|
1595 |
const newProfile = {
|
1596 |
name: profileName,
|
1597 |
values: {
|
1598 |
-
profile_p: parseFloat(document.getElementById("profile_p").value),
|
1599 |
-
profile_k: parseFloat(document.getElementById("profile_k").value),
|
1600 |
-
profile_mg: parseFloat(document.getElementById("profile_mg").value),
|
1601 |
-
profile_ca: parseFloat(document.getElementById("profile_ca").value),
|
1602 |
-
profile_s: parseFloat(document.getElementById("profile_s").value),
|
1603 |
-
profile_no3: parseFloat(document.getElementById("profile_no3").value),
|
1604 |
-
profile_n: parseFloat(document.getElementById("profile_n").value),
|
1605 |
-
liters: parseFloat(document.getElementById("liters-input").value)
|
1606 |
}
|
1607 |
};
|
1608 |
|
|
|
1510 |
|
1511 |
|
1512 |
<script>
|
1513 |
+
// Предустановленные профили (JSON)
|
1514 |
const predefinedProfiles = {
|
1515 |
"profiles": [
|
1516 |
{
|
|
|
1525 |
"profile_n": 125,
|
1526 |
"liters": 100
|
1527 |
}
|
1528 |
+
},
|
1529 |
+
{
|
1530 |
+
"name": "Профиль 2",
|
1531 |
+
"values": {
|
1532 |
+
"profile_p": 40,
|
1533 |
+
"profile_k": 250,
|
1534 |
+
"profile_mg": 30,
|
1535 |
+
"profile_ca": 90,
|
1536 |
+
"profile_s": 60,
|
1537 |
+
"profile_no3": 10,
|
1538 |
+
"profile_n": 150,
|
1539 |
+
"liters": 150
|
1540 |
+
}
|
1541 |
}
|
1542 |
]
|
1543 |
};
|
|
|
1589 |
const selectedProfile = allProfiles.find(profile => profile.name === selectedProfileName);
|
1590 |
|
1591 |
if (selectedProfile) {
|
1592 |
+
document.getElementById("profile_p").value = selectedProfile.values.profile_p || 0;
|
1593 |
+
document.getElementById("profile_k").value = selectedProfile.values.profile_k || 0;
|
1594 |
+
document.getElementById("profile_mg").value = selectedProfile.values.profile_mg || 0;
|
1595 |
+
document.getElementById("profile_ca").value = selectedProfile.values.profile_ca || 0;
|
1596 |
+
document.getElementById("profile_s").value = selectedProfile.values.profile_s || 0;
|
1597 |
+
document.getElementById("profile_no3").value = selectedProfile.values.profile_no3 || 0;
|
1598 |
+
document.getElementById("profile_n").value = selectedProfile.values.profile_n || 0;
|
1599 |
+
document.getElementById("liters-input").value = selectedProfile.values.liters || 0;
|
1600 |
}
|
1601 |
});
|
1602 |
|
|
|
1608 |
const newProfile = {
|
1609 |
name: profileName,
|
1610 |
values: {
|
1611 |
+
profile_p: parseFloat(document.getElementById("profile_p").value) || 0,
|
1612 |
+
profile_k: parseFloat(document.getElementById("profile_k").value) || 0,
|
1613 |
+
profile_mg: parseFloat(document.getElementById("profile_mg").value) || 0,
|
1614 |
+
profile_ca: parseFloat(document.getElementById("profile_ca").value) || 0,
|
1615 |
+
profile_s: parseFloat(document.getElementById("profile_s").value) || 0,
|
1616 |
+
profile_no3: parseFloat(document.getElementById("profile_no3").value) || 0,
|
1617 |
+
profile_n: parseFloat(document.getElementById("profile_n").value) || 0,
|
1618 |
+
liters: parseFloat(document.getElementById("liters-input").value) || 0
|
1619 |
}
|
1620 |
};
|
1621 |
|