diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/checkout/components/Checkout.jsx | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index eb31b9dc..85eda80b 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -10,7 +10,7 @@ import { ClockIcon, ExclamationCircleIcon, } from '@heroicons/react/24/outline'; -import React, { useEffect, useRef, useState } from 'react'; +import React, { useEffect, useMemo, useRef, useState } from 'react'; import _ from 'lodash'; import { deleteItemCart } from '@/core/utils/cart'; import currencyFormat from '@/core/utils/currencyFormat'; @@ -411,6 +411,14 @@ const Checkout = () => { }; // const taxTotal = (totalAmount - totalDiscountAmount - discountVoucher) * 0.11 + const hasNoPrice = useMemo(() => { + if (!products) return false; + for (const item of products) { + if (item.price.priceDiscount == 0) return true; + } + return false; + }, [products]); + return ( <> <BottomPopup @@ -995,7 +1003,11 @@ const Checkout = () => { className='flex-1 btn-yellow' onClick={checkout} disabled={ - isLoading || !products || products?.length == 0 || priceCheck + isLoading || + !products || + products?.length == 0 || + priceCheck || + hasNoPrice } > {isLoading ? 'Loading...' : 'Lanjut Pembayaran'} @@ -1090,8 +1102,7 @@ const Checkout = () => { <div className='flex justify-between items-center'> <div className='font-medium'>Ringkasan Pesanan</div> <div className='text-gray_r-11 text-caption-1'> - {cartCheckout?.totalWeight.kg}{' '} - Kg + {cartCheckout?.totalWeight.kg} Kg </div> </div> @@ -1283,7 +1294,8 @@ const Checkout = () => { isLoading || !products || products?.length == 0 || - priceCheck + priceCheck || + hasNoPrice } > {isLoading ? 'Loading...' : 'Lanjut Pembayaran'} |
