Compare commits
No commits in common. "b4b3d2512958d90066bace72e8af1cbc235f4112" and "19ebfc7b0c01c1fcba7b674019784f8dd5563471" have entirely different histories.
b4b3d25129
...
19ebfc7b0c
@ -138,27 +138,7 @@ export default function Estimate({}) {
|
|||||||
updatedRes = [...res]
|
updatedRes = [...res]
|
||||||
}
|
}
|
||||||
|
|
||||||
const groupByItemGroup = (items) => {
|
setOriginDisplayItemList(res)
|
||||||
const grouped = items.reduce((acc, item) => {
|
|
||||||
const group = item.itemGroup || '기타';
|
|
||||||
if (!acc[group]) {
|
|
||||||
acc[group] = {
|
|
||||||
label: group,
|
|
||||||
options: []
|
|
||||||
};
|
|
||||||
}
|
|
||||||
acc[group].options.push({
|
|
||||||
value: item.itemId,
|
|
||||||
label: `${item.itemNo} - ${item.itemName}`,
|
|
||||||
...item
|
|
||||||
});
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
return Object.values(grouped);
|
|
||||||
};
|
|
||||||
const groupedItems = groupByItemGroup(res);
|
|
||||||
setOriginDisplayItemList(groupedItems)
|
|
||||||
setDisplayItemList(updatedRes)
|
setDisplayItemList(updatedRes)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -173,19 +153,6 @@ export default function Estimate({}) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const groupStyles = {
|
|
||||||
groupHeading: (provided) => ({
|
|
||||||
...provided,
|
|
||||||
fontSize: '14px',
|
|
||||||
fontWeight: 'bold',
|
|
||||||
color: '#333',
|
|
||||||
backgroundColor: '#f5f5f5',
|
|
||||||
padding: '8px 12px',
|
|
||||||
marginBottom: '4px',
|
|
||||||
borderBottom: '2px solid #ddd'
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.log('🚀 ~ Estimate ~ selectedPlan:', selectedPlan)
|
// console.log('🚀 ~ Estimate ~ selectedPlan:', selectedPlan)
|
||||||
if (selectedPlan) initEstimate(selectedPlan?.planNo?? currentPid)
|
if (selectedPlan) initEstimate(selectedPlan?.planNo?? currentPid)
|
||||||
@ -2031,7 +1998,6 @@ export default function Estimate({}) {
|
|||||||
classNamePrefix="custom"
|
classNamePrefix="custom"
|
||||||
placeholder="Select"
|
placeholder="Select"
|
||||||
options={originDisplayItemList}
|
options={originDisplayItemList}
|
||||||
styles={groupStyles}
|
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
if (isObjectNotEmpty(e)) {
|
if (isObjectNotEmpty(e)) {
|
||||||
onChangeDisplayItem(e.itemId, item.dispOrder, index, false)
|
onChangeDisplayItem(e.itemId, item.dispOrder, index, false)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user