견적서 수정

This commit is contained in:
basssy 2024-11-13 15:18:03 +09:00
parent fbd023c0bd
commit fee77f8563

View File

@ -56,8 +56,6 @@ export default function Estimate({ params }) {
//
const { state, setState, addItem } = useEstimateController(params.pid)
const [itemList, setItemList] = useState([]) //
// List
const [specialNoteList, setSpecialNoteList] = useState([])
@ -183,11 +181,11 @@ export default function Estimate({ params }) {
}
//
useEffect(() => {
if (isNotEmptyArray(state.itemList)) {
setItemList(state.itemList)
}
}, [state?.itemList])
// useEffect(() => {
// if (isNotEmptyArray(state.itemList)) {
// setItemList(state.itemList)
// }
// }, [state?.itemList])
// option
useEffect(() => {
@ -207,12 +205,6 @@ export default function Estimate({ params }) {
}
}, [state?.estimateType])
// useEffect(() => {
// if (state.priceCd) {
// setTempPriceCd(state.priceCd)
// }
// }, [state?.priceCd])
// option
useEffect(() => {
if (tempPriceCd !== '') {
@ -292,7 +284,24 @@ export default function Estimate({ params }) {
//
const removeItem = () => {
const array = [...selection]
console.log(array)
let tempList = []
state.itemList.filter((row) => {
array.map((row2) => {
if (row2 === row.dispOrder) {
tempList.push({ ...row })
}
})
})
const result = state.itemList.filter((item) => {
return !tempList.some((other) => other.dispOrder === item.dispOrder)
})
setState({
itemList: result,
})
setSelection(new Set())
}
return (
@ -809,7 +818,12 @@ export default function Estimate({ params }) {
<tr key={index}>
<td className="al-c">
<div className="d-check-box light no-text">
<input type="checkbox" id={item?.dispOrder} onChange={() => onChangeSelect(item.dispOrder)} />
<input
type="checkbox"
id={item?.dispOrder}
onChange={() => onChangeSelect(item.dispOrder)}
checked={selection.has(item.dispOrder) ? true : false}
/>
<label htmlFor={item?.dispOrder}></label>
</div>
</td>