feature/ysCha #23
@ -217,7 +217,7 @@ const Trestle = forwardRef((props, ref) => {
|
||||
}
|
||||
}
|
||||
|
||||
const isComplete = () => {
|
||||
const isComplete = async () => {
|
||||
const newAddedRoofs = roofs.map((roof, i) => {
|
||||
if (i === selectedRoof?.index) {
|
||||
return {
|
||||
@ -263,51 +263,60 @@ const Trestle = forwardRef((props, ref) => {
|
||||
console.log('newAddedRoofs', newAddedRoofs)
|
||||
|
||||
if (result) {
|
||||
setRoofs(newAddedRoofs)
|
||||
setModuleSelectionData({
|
||||
...moduleSelectionData,
|
||||
roofConstructions: newAddedRoofs.map((roof, index) => {
|
||||
return {
|
||||
roofIndex: roof.index,
|
||||
addRoof: {
|
||||
...moduleSelectionData.roofConstructions[index]?.addRoof,
|
||||
...roof.addRoof,
|
||||
},
|
||||
trestle: {
|
||||
...moduleSelectionData.roofConstructions[index]?.trestle,
|
||||
...roof.trestle,
|
||||
},
|
||||
construction: {
|
||||
...roof.construction,
|
||||
...moduleSelectionData.roofConstructions[index]?.construction,
|
||||
},
|
||||
trestleDetail: {
|
||||
...roof.trestleDetail,
|
||||
},
|
||||
}
|
||||
const updatePromises = [
|
||||
new Promise((resolve) => {
|
||||
setRoofs(newAddedRoofs)
|
||||
resolve()
|
||||
}),
|
||||
})
|
||||
trestleTrigger({
|
||||
roofConstruction: newAddedRoofs.map((roof) => {
|
||||
return {
|
||||
roofIndex: roof.index,
|
||||
addRoof: {
|
||||
...roof,
|
||||
},
|
||||
trestle: {
|
||||
...selectedTrestle,
|
||||
raftBaseCd: roof.raftBaseCd,
|
||||
},
|
||||
construction: {
|
||||
...constructionList.find((construction) => trestleState.constTp === construction.constTp),
|
||||
new Promise((resolve) => {
|
||||
setModuleSelectionData({
|
||||
...moduleSelectionData,
|
||||
roofConstructions: newAddedRoofs.map((roof, index) => ({
|
||||
roofIndex: roof.index,
|
||||
setupCover: roof.cvrYn === 'Y',
|
||||
setupSnowCover: roof.snowGdYn === 'Y',
|
||||
selectedIndex: roof.index,
|
||||
},
|
||||
}
|
||||
addRoof: {
|
||||
...moduleSelectionData.roofConstructions[index]?.addRoof,
|
||||
...roof.addRoof,
|
||||
},
|
||||
trestle: {
|
||||
...moduleSelectionData.roofConstructions[index]?.trestle,
|
||||
...roof.trestle,
|
||||
},
|
||||
construction: {
|
||||
...roof.construction,
|
||||
...moduleSelectionData.roofConstructions[index]?.construction,
|
||||
},
|
||||
trestleDetail: {
|
||||
...roof.trestleDetail,
|
||||
},
|
||||
})),
|
||||
})
|
||||
resolve()
|
||||
}),
|
||||
})
|
||||
new Promise((resolve) => {
|
||||
trestleTrigger({
|
||||
roofConstruction: newAddedRoofs.map((roof) => ({
|
||||
roofIndex: roof.index,
|
||||
addRoof: {
|
||||
...roof,
|
||||
},
|
||||
trestle: {
|
||||
...selectedTrestle,
|
||||
raftBaseCd: roof.raftBaseCd,
|
||||
},
|
||||
construction: {
|
||||
...constructionList.find((construction) => trestleState.constTp === construction.constTp),
|
||||
roofIndex: roof.index,
|
||||
setupCover: roof.cvrYn === 'Y',
|
||||
setupSnowCover: roof.snowGdYn === 'Y',
|
||||
selectedIndex: roof.index,
|
||||
},
|
||||
})),
|
||||
})
|
||||
resolve()
|
||||
}),
|
||||
]
|
||||
|
||||
await Promise.all(updatePromises)
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user