summaryrefslogtreecommitdiff
path: root/src/lib/checkout/components
diff options
context:
space:
mode:
authortrisusilo48 <tri.susilo@altama.co.id>2024-09-06 16:30:09 +0700
committertrisusilo48 <tri.susilo@altama.co.id>2024-09-06 16:30:09 +0700
commite0cb6bc2d391288462f7f3600cc74a603d9323df (patch)
tree13a32ce0e78edf2fb5134b926a91dfb79e15172f /src/lib/checkout/components
parent277f7eea312492c66ec8d942199dba65593e78b8 (diff)
parent969ca83a9adce96b3b58973654b29d3c2dd47a88 (diff)
Merge branch 'release' into CR/search_enggine
Diffstat (limited to 'src/lib/checkout/components')
-rw-r--r--src/lib/checkout/components/Checkout.jsx29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index 54acdf7c..f63ef457 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -174,7 +174,6 @@ const Checkout = () => {
}
return; // Hentikan eksekusi lebih lanjut pada iterasi ini
}
-
// Memeriksa apakah subtotal memenuhi syarat minimal pembelian
if (cartCheckout?.subtotal < addNewLine.minPurchaseAmount) {
SetSelisihHargaCode(
@@ -191,7 +190,9 @@ const Checkout = () => {
// Tambahkan voucher ke list dan set voucher aktif
SetListVoucher((prevList) => [addNewLine, ...prevList]);
- SetActiveVoucher(addNewLine.code);
+ if (addNewLine.canApply) {
+ SetActiveVoucher(addNewLine.code);
+ }
} else {
// Mencari voucher dalam listVoucherShippings
let checkList = listVoucherShippings?.findIndex(
@@ -227,7 +228,9 @@ const Checkout = () => {
// Tambahkan voucher ke list pengiriman dan set voucher aktif pengiriman
SetListVoucherShipping((prevList) => [addNewLine, ...prevList]);
- setActiveVoucherShipping(addNewLine.code);
+ if (addNewLine.canApply) {
+ setActiveVoucherShipping(addNewLine.code);
+ }
}
});
@@ -407,7 +410,7 @@ const Checkout = () => {
Math.round(parseInt(finalShippingAmt * 1.1) / 1000) * 1000;
const finalGT = GT < 0 ? 0 : GT;
setGrandTotal(finalGT);
- }, [biayaKirim, cartCheckout?.grandTotal, activeVoucher]);
+ }, [biayaKirim, cartCheckout?.grandTotal, activeVoucher, activeVoucherShipping]);
const checkout = async () => {
const file = poFile.current.files[0];
@@ -494,7 +497,7 @@ const Checkout = () => {
}
}
- const midtrans = async () => {
+ /* const midtrans = async () => {
for (const product of products) deleteItemCart({ productId: product.id });
if (grandTotal > 0) {
const payment = await axios.post(
@@ -510,7 +513,7 @@ const Checkout = () => {
'-'
)}`;
}
- };
+ };*/
};
const handlingActivateCode = async () => {
@@ -701,7 +704,9 @@ const Checkout = () => {
{listVoucherShippings && listVoucherShippings?.length > 0 && (
<div>
- <h3 className='font-semibold mb-4'>Promo Extra Potongan Ongkir</h3>
+ <h3 className='font-semibold mb-4'>
+ Promo Extra Potongan Ongkir
+ </h3>
{listVoucherShippings?.map((item) => (
<div key={item.id} className='relative'>
<div
@@ -1028,7 +1033,7 @@ const Checkout = () => {
</div>
<span className='leading-5'>
Jika mengalami kesulitan dalam melakukan pembelian di website
- Indoteknik. Hubungi kami disini
+ Indoteknik. <a href={whatsappUrl()}>Hubungi kami disini</a>
</span>
</Alert>
</div>
@@ -1184,7 +1189,7 @@ const Checkout = () => {
<div className='text-gray_r-11'>
Biaya Kirim <p className='text-xs mt-1'>{etdFix}</p>
</div>
- <div>{currencyFormat(biayaKirim)}</div>
+ <div>{currencyFormat(Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000)}</div>
</div>
{activeVoucherShipping && voucherShippingAmt && (
<div className='flex gap-x-2 justify-between'>
@@ -1236,10 +1241,10 @@ const Checkout = () => {
className='object-contain object-center h-6 rounded-md'
/>
</span>
- {activeVoucher ? (
+ {activeVoucher || activeVoucherShipping ? (
<div className=''>
<div className='text-left text-sm text-black font-semibold'>
- Potongan Senilai {currencyFormat(discountVoucher)}
+ Potongan Senilai {currencyFormat(totalDiscountVoucher)}
</div>
<div className='text-left mt-1 text-green-600 text-xs'>
Voucher berhasil digunakan
@@ -1485,7 +1490,7 @@ const Checkout = () => {
Biaya Kirim
<p className='text-xs mt-1'>{etdFix}</p>
</div>
- <div>{currencyFormat(biayaKirim)}</div>
+ <div>{currencyFormat(Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000) }</div>
</div>
{activeVoucherShipping && voucherShippingAmt && (
<div className='flex gap-x-2 justify-between'>