summaryrefslogtreecommitdiff
path: root/src-migrate/modules/product-detail/components/PriceAction.tsx
diff options
context:
space:
mode:
authortrisusilo48 <tri.susilo@altama.co.id>2024-08-26 10:47:28 +0700
committertrisusilo48 <tri.susilo@altama.co.id>2024-08-26 10:47:28 +0700
commitf8133c76306d9f70e01ac510c74dcfabe7f79b37 (patch)
tree28a150a4af59c1bf902d838c90df5cfce94d7258 /src-migrate/modules/product-detail/components/PriceAction.tsx
parent948914e88fa6849ec3be1cd88113dc7febeda577 (diff)
new product template
Diffstat (limited to 'src-migrate/modules/product-detail/components/PriceAction.tsx')
-rw-r--r--src-migrate/modules/product-detail/components/PriceAction.tsx33
1 files changed, 25 insertions, 8 deletions
diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx
index 405eb12b..b46afac9 100644
--- a/src-migrate/modules/product-detail/components/PriceAction.tsx
+++ b/src-migrate/modules/product-detail/components/PriceAction.tsx
@@ -39,6 +39,18 @@ const PriceAction = ({ product }: Props) => {
}
}, [product, setActive, selectedVariant]);
+ let voucherPastiHemat = 0;
+
+ if (
+ product?.voucher_pasti_hemat
+ ? product?.voucher_pasti_hemat.length
+ : voucherPastiHemat > 0
+ ) {
+ const stringVoucher = product?.voucher_pasti_hemat[0];
+ const validJsonString = stringVoucher.replace(/'/g, '"');
+ voucherPastiHemat = JSON.parse(validJsonString);
+ }
+
return (
<div
className='block md:sticky top-[150px] bg-white py-0 md:py-6 z-10'
@@ -88,16 +100,21 @@ const PriceAction = ({ product }: Props) => {
<label htmlFor='quantity' className='hidden'>
Quantity
</label>
- <input
- type='number'
- id='quantity'
- value={quantityInput}
- onChange={(e) => setQuantityInput(e.target.value)}
- className={style['quantity-input']}
- />
+ <div className='flex items-center space-x-2'>
+ <input
+ type='number'
+ id='quantity'
+ value={quantityInput}
+ onChange={(e) => setQuantityInput(e.target.value)}
+ className={style['quantity-input']}
+ />
+ </div>
</div>
<div>
- <span className={sla?.qty < 10 ? 'text-red-600 font-medium' : ''} > Stock : {sla?.qty} </span>
+ <span className={sla?.qty < 10 ? 'text-red-600 font-medium' : ''}>
+ {' '}
+ Stock : {sla?.qty}{' '}
+ </span>
</div>
</div>
<div className='h-4' />