견적서 수정

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 { state, setState, addItem } = useEstimateController(params.pid)
const [itemList, setItemList] = useState([]) //
// List // List
const [specialNoteList, setSpecialNoteList] = useState([]) const [specialNoteList, setSpecialNoteList] = useState([])
@ -183,11 +181,11 @@ export default function Estimate({ params }) {
} }
// //
useEffect(() => { // useEffect(() => {
if (isNotEmptyArray(state.itemList)) { // if (isNotEmptyArray(state.itemList)) {
setItemList(state.itemList) // setItemList(state.itemList)
} // }
}, [state?.itemList]) // }, [state?.itemList])
// option // option
useEffect(() => { useEffect(() => {
@ -207,12 +205,6 @@ export default function Estimate({ params }) {
} }
}, [state?.estimateType]) }, [state?.estimateType])
// useEffect(() => {
// if (state.priceCd) {
// setTempPriceCd(state.priceCd)
// }
// }, [state?.priceCd])
// option // option
useEffect(() => { useEffect(() => {
if (tempPriceCd !== '') { if (tempPriceCd !== '') {
@ -292,7 +284,24 @@ export default function Estimate({ params }) {
// //
const removeItem = () => { const removeItem = () => {
const array = [...selection] 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 ( return (
@ -809,7 +818,12 @@ export default function Estimate({ params }) {
<tr key={index}> <tr key={index}>
<td className="al-c"> <td className="al-c">
<div className="d-check-box light no-text"> <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> <label htmlFor={item?.dispOrder}></label>
</div> </div>
</td> </td>