fixed form issue where the basic bin height was not being updated when advanced was being edited
This commit is contained in:
parent
7537c120b4
commit
cd2a0258bc
1 changed files with 45 additions and 18 deletions
|
|
@ -532,8 +532,7 @@ export default function BinSettings(props: Props) {
|
|||
let specs = form.specs;
|
||||
let specsValid =
|
||||
specs && Number(inputCapacity) > 0 && specs.diameterCm > 0 && specs.heightCm > 0;
|
||||
let tempsValid = +formExtension.highTemp > +formExtension.lowTemp;
|
||||
return specsValid && tempsValid;
|
||||
return specsValid
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1366,20 +1365,6 @@ export default function BinSettings(props: Props) {
|
|||
let angle = RadiansToDegrees(Math.atan((coneCM ?? 0) / (dCm / 2))); //('arcTan(opposite / adjacent))' and convert to degrees
|
||||
angle = Math.round(angle * 100) / 100; // round to 2 digits
|
||||
|
||||
//update the form with the new specs
|
||||
updateForm(
|
||||
"specs",
|
||||
pond.BinSpecs.create({
|
||||
...form.specs,
|
||||
modelId: 0,
|
||||
advancedDimensions: pond.BinAdvancedDimensions.create({
|
||||
...form.specs?.advancedDimensions,
|
||||
topConeHeight: coneCM,
|
||||
roofAngle: angle
|
||||
})
|
||||
})
|
||||
);
|
||||
|
||||
let ext = cloneDeep(formExtension);
|
||||
//calculate the total height from the parts
|
||||
let s = isNaN(parseFloat(sidewallHeight)) ? 0 : parseFloat(sidewallHeight);
|
||||
|
|
@ -1399,6 +1384,29 @@ export default function BinSettings(props: Props) {
|
|||
|
||||
//update the extensions with the new values
|
||||
setFormExtension({ ...ext });
|
||||
|
||||
//need to get the total height in cm
|
||||
let totalHeightCM = s + t + h; //the total height in the users units
|
||||
if(getDistanceUnit() === pond.DistanceUnit.DISTANCE_UNIT_FEET){
|
||||
totalHeightCM = totalHeightCM * 30.48 //convert from feet to cm
|
||||
}else{
|
||||
totalHeightCM = totalHeightCM * 100 //convert from m to cm
|
||||
}
|
||||
|
||||
//update the form with the new specs
|
||||
updateForm(
|
||||
"specs",
|
||||
pond.BinSpecs.create({
|
||||
...form.specs,
|
||||
modelId: 0,
|
||||
heightCm: Math.round(totalHeightCM),
|
||||
advancedDimensions: pond.BinAdvancedDimensions.create({
|
||||
...form.specs?.advancedDimensions,
|
||||
topConeHeight: coneCM,
|
||||
roofAngle: angle
|
||||
})
|
||||
})
|
||||
);
|
||||
}}
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
|
|
@ -1448,9 +1456,17 @@ export default function BinSettings(props: Props) {
|
|||
setInputCapacity(bushelCap.toFixed(0));
|
||||
ext.capacity = bushelCap.toFixed(0);
|
||||
ext.topConeHeight = newConeHeight;
|
||||
ext.height = (s + t + h).toFixed(2);
|
||||
|
||||
ext.height = (s + t + h).toFixed(2)
|
||||
|
||||
setFormExtension(ext);
|
||||
|
||||
//need to get the total height in cm
|
||||
let totalHeightCM = s + t + h; //the total height in the users units
|
||||
if(getDistanceUnit() === pond.DistanceUnit.DISTANCE_UNIT_FEET){
|
||||
totalHeightCM = totalHeightCM * 30.48 //convert from feet to cm
|
||||
}else{
|
||||
totalHeightCM = totalHeightCM * 100 //convert from m to cm
|
||||
}
|
||||
|
||||
setModelID(0);
|
||||
//update the form with the new specs
|
||||
|
|
@ -1459,6 +1475,7 @@ export default function BinSettings(props: Props) {
|
|||
pond.BinSpecs.create({
|
||||
...form.specs,
|
||||
modelId: 0,
|
||||
heightCm: Math.round(totalHeightCM),
|
||||
advancedDimensions: pond.BinAdvancedDimensions.create({
|
||||
...form.specs?.advancedDimensions,
|
||||
roofAngle: angle ?? 0,
|
||||
|
|
@ -1504,11 +1521,21 @@ export default function BinSettings(props: Props) {
|
|||
setFormExtension({ ...ext });
|
||||
|
||||
setModelID(0);
|
||||
|
||||
//need to get the total height in cm
|
||||
let totalHeightCM = s + t + h; //the total height in the users units
|
||||
if(getDistanceUnit() === pond.DistanceUnit.DISTANCE_UNIT_FEET){
|
||||
totalHeightCM = totalHeightCM * 30.48 //convert from feet to cm
|
||||
}else{
|
||||
totalHeightCM = totalHeightCM * 100 //convert from m to cm
|
||||
}
|
||||
|
||||
updateForm(
|
||||
"specs",
|
||||
pond.BinSpecs.create({
|
||||
...form.specs,
|
||||
modelId: 0,
|
||||
heightCm: Math.round(totalHeightCM),
|
||||
advancedDimensions: pond.BinAdvancedDimensions.create({
|
||||
...form.specs?.advancedDimensions,
|
||||
sidewallHeight:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue