견적서 아이템 자동완성

This commit is contained in:
basssy 2024-11-11 10:55:07 +09:00
parent 3b3eee6baa
commit 2d7f8c18e9

View File

@ -34,6 +34,9 @@ export default function Estimate({ params }) {
//
const [hidden, setHidden] = useState(false)
//
const [displayItemList, setDisplayItemList] = useState([])
//
const { findCommonCode } = useCommonCode()
const [honorificCodeList, setHonorificCodeList] = useState([]) //
@ -81,6 +84,17 @@ export default function Estimate({ params }) {
if (code1 != null) {
setHonorificCodeList(code1)
}
//
const param = {
saleStoreId: session.storeId,
}
const apiUrl = `/api/display-item/item-list?${queryStringFormatter(param)}`
get({ url: apiUrl }).then((res) => {
if (res.length > 0) {
setDisplayItemList(res)
}
})
}, [])
useEffect(() => {
@ -775,19 +789,19 @@ export default function Estimate({ params }) {
<div className="form-flex-wrap">
<div className="select-wrap mr5">
<Select
id=""
instanceId=""
id="long-value-select1"
instanceId="long-value-select1"
className="react-select-custom"
classNamePrefix="custom"
placeholder="Select"
options={[]}
// getOptionLabel={(x) => x.saleStoreName}
// getOptionValue={(x) => x.saleStoreId}
options={displayItemList}
getOptionLabel={(x) => x.itemName}
getOptionValue={(x) => x.itemId}
isClearable={true}
isDisabled={false}
// value={saleStoreList.filter(function (option) {
// return option.saleStoreId === selOptions
// })}
value={displayItemList.filter(function (option) {
return option.itemId === item.itemId
})}
/>
</div>
{item?.itemChangeFlg === '1' && (