diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2024-09-09 13:37:36 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2024-09-09 13:37:36 +0700 |
| commit | 914729a0d6ba9a9dd32d308954642439fa88c1d2 (patch) | |
| tree | 9a59a88b52c0baaf52dcef3ea0aa4882e9ec90ba /src-migrate/modules | |
| parent | afd84f86d2f26a3e0347dab7552060717030df19 (diff) | |
add manufacture logd
Diffstat (limited to 'src-migrate/modules')
| -rw-r--r-- | src-migrate/modules/product-detail/components/Information.tsx | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src-migrate/modules/product-detail/components/Information.tsx b/src-migrate/modules/product-detail/components/Information.tsx index c7f21d62..5df81dae 100644 --- a/src-migrate/modules/product-detail/components/Information.tsx +++ b/src-migrate/modules/product-detail/components/Information.tsx @@ -24,6 +24,7 @@ import { FingerPrintIcon, } from '@heroicons/react/24/outline'; import { useProductDetail } from '../stores/useProductDetail'; +import Image from 'next/image'; const Skeleton = dynamic(() => import('@chakra-ui/react').then((mod) => mod.Skeleton) @@ -34,20 +35,24 @@ type Props = { }; const Information = ({ product }: Props) => { - const { selectedVariant, setSelectedVariant, setSla, setActive } = + const { selectedVariant, setSelectedVariant, setSla, setActive, sla } = useProductDetail(); const variantOptions = product?.variants; - const querySLA = useQuery<IProductVariantSLA>({ - queryKey: ['variant-sla', selectedVariant?.id], - queryFn: () => getVariantSLA(selectedVariant?.id), - refetchOnWindowFocus: false, - }); - const sla = querySLA?.data; - console.log('sla', querySLA, selectedVariant); + // const querySLA = useQuery<IProductVariantSLA>({ + // queryKey: ['variant-sla', selectedVariant?.id], + // queryFn: () => getVariantSLA(selectedVariant?.id), + // enabled: !!selectedVariant?.id, + // }); + // const sla = querySLA?.data; + + const getsla = async () => { + const querySLA = await getVariantSLA(selectedVariant?.id); + setSla(querySLA); + }; useEffect(() => { - setSla(querySLA?.data); + getsla(); }, [selectedVariant]); const handleOnChange = (vals: any) => { @@ -71,15 +76,17 @@ const Information = ({ product }: Props) => { onChange={(vals) => handleOnChange(vals)} > <InputGroup> - <AutoCompleteInput placeholder={ + <AutoCompleteInput + placeholder={ selectedVariant?.code + ' - ' + selectedVariant?.attributes[0] - }/> + } + /> <InputRightElement> <ChevronDownIcon className='h-6 w-6 text-gray-500' /> </InputRightElement> </InputGroup> - <AutoCompleteList > + <AutoCompleteList> {variantOptions.map((option, cid) => ( <AutoCompleteItem key={`option-${cid}`} @@ -107,6 +114,7 @@ const Information = ({ product }: Props) => { </AutoCompleteList> </AutoComplete> </div> + <div className={style['row']}> <div className={style['label']}>Item Code</div> <div className={style['value']}>{selectedVariant?.code}</div> @@ -121,9 +129,13 @@ const Information = ({ product }: Props) => { product.manufacture.name, product.manufacture.id.toString() )} - className='text-danger-500 hover:underline' > - {product.manufacture.name} + <Image + height={50} + width={100} + src={product.manufacture.logo} + alt='' + /> </Link> ) : ( '-' |
