From 914729a0d6ba9a9dd32d308954642439fa88c1d2 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Mon, 9 Sep 2024 13:37:36 +0700 Subject: add manufacture logd --- .../product-detail/components/Information.tsx | 40 ++++++++++++++-------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'src-migrate/modules') 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({ - queryKey: ['variant-sla', selectedVariant?.id], - queryFn: () => getVariantSLA(selectedVariant?.id), - refetchOnWindowFocus: false, - }); - const sla = querySLA?.data; - console.log('sla', querySLA, selectedVariant); + // const querySLA = useQuery({ + // 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)} > - + } + /> - + {variantOptions.map((option, cid) => ( { +
Item Code
{selectedVariant?.code}
@@ -121,9 +129,13 @@ const Information = ({ product }: Props) => { product.manufacture.name, product.manufacture.id.toString() )} - className='text-danger-500 hover:underline' > - {product.manufacture.name} + ) : ( '-' -- cgit v1.2.3