[1222]견적의 제품 정보 화면에 대해서 - 그룹별 추가 #375
@ -138,7 +138,27 @@ export default function Estimate({}) {
|
|||||||
updatedRes = [...res]
|
updatedRes = [...res]
|
||||||
}
|
}
|
||||||
|
|
||||||
setOriginDisplayItemList(res)
|
const groupByItemGroup = (items) => {
|
||||||
|
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)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -153,6 +173,19 @@ 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)
|
||||||
@ -1998,6 +2031,7 @@ 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