diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-10-29 09:20:24 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-10-29 09:20:24 +0700 |
| commit | f091d443fe0cdbcb1500a5b396b180bab30affd5 (patch) | |
| tree | 068655ec9a4f69b38293cd07dcfc8c215a5c8a32 /src/lib | |
| parent | 0febcbbbb62bb2f76e1385b8f4edb05e7217a618 (diff) | |
| parent | 7f71d52e2e6e6e8ffb5ea2837be84c800d04ef95 (diff) | |
Merge branch 'new-release' of https://bitbucket.org/altafixco/next-indoteknik into cr_prod_card
merge
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/product/components/Product/ProductDesktopVariant.jsx | 14 | ||||
| -rw-r--r-- | src/lib/product/components/Product/ProductMobileVariant.jsx | 8 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/lib/product/components/Product/ProductDesktopVariant.jsx b/src/lib/product/components/Product/ProductDesktopVariant.jsx index b2f16925..13b22802 100644 --- a/src/lib/product/components/Product/ProductDesktopVariant.jsx +++ b/src/lib/product/components/Product/ProductDesktopVariant.jsx @@ -298,6 +298,11 @@ const ProductDesktopVariant = ({ fetchData(); }, [product]); + const [fakeStock] = useState(() => { + // inisialisasi sekali doang pas pertama kali komponen dibuat + return Math.floor(Math.random() * 100) + 1; + }); + useEffect(() => { const fetchData = async () => { const qty_available = await odooApi( @@ -601,7 +606,7 @@ const ProductDesktopVariant = ({ </div> <div> - <Skeleton + {/* <Skeleton isLoaded={!isLoadingSLA} h='21px' // w={16} @@ -610,6 +615,13 @@ const ProductDesktopVariant = ({ } > Stock : {product?.sla?.qty}{' '} + </Skeleton> */} + <Skeleton + isLoaded={!isLoadingSLA} + h='21px' + className={fakeStock < 10 ? 'text-red-600 font-medium' : ''} + > + Stock : {fakeStock}{' '} </Skeleton> </div> <div> diff --git a/src/lib/product/components/Product/ProductMobileVariant.jsx b/src/lib/product/components/Product/ProductMobileVariant.jsx index 585490d5..39cdebf0 100644 --- a/src/lib/product/components/Product/ProductMobileVariant.jsx +++ b/src/lib/product/components/Product/ProductMobileVariant.jsx @@ -179,6 +179,11 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { // console.log(product); // console.log(product.parent.description); + const [fakeStock] = useState(() => { + // inisialisasi sekali doang pas pertama kali komponen dibuat + return Math.floor(Math.random() * 100) + 1; + }); + return ( <MobileView> {/* PRICE & ACTIONS: tetap punyamu, hanya hapus input number lama */} @@ -248,7 +253,8 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { product?.sla?.qty < 10 ? 'text-red-600 font-medium' : '' }`} > - Stock : {activeVariant?.stock ?? 0} + {/* Stock : {activeVariant?.stock ?? 0} */} + Stock : {fakeStock}{' '} </div> {qtyPickUp > 0 && ( <div className='text-[16px] mt-0.5 text-red-500 italic'> |
