summaryrefslogtreecommitdiff
path: root/src/lib/checkout/components/Checkout.jsx
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-06-11 13:55:31 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-06-11 13:55:31 +0700
commit54636b53685422d495adce95b491f7b10585cb5c (patch)
tree99b60e655d2796ed3eb051fa029d88ccd79a51dd /src/lib/checkout/components/Checkout.jsx
parent907deb7ca6589b83203b2352a3dd02b631696848 (diff)
parentc644e559eff7320dfe7e08004aba040f9f11cad6 (diff)
Merge branch 'feature/integrasi-biteship' of https://bitbucket.org/altafixco/next-indoteknik into biteship-merge
# Conflicts: # src/lib/checkout/components/Checkout.jsx
Diffstat (limited to 'src/lib/checkout/components/Checkout.jsx')
-rw-r--r--src/lib/checkout/components/Checkout.jsx89
1 files changed, 46 insertions, 43 deletions
diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index 77053d1c..0dc025f5 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -253,6 +253,7 @@ const Checkout = () => {
return;
}
+
dataVoucher.forEach((addNewLine) => {
if (addNewLine.applyType !== 'shipping') {
// Mencari voucher dalam listVouchers
@@ -362,38 +363,38 @@ const Checkout = () => {
};
}, []);
- const hitungDiscountVoucher = (code, source) => {
- let countDiscount = 0;
- if (source === 'voucher') {
- let dataVoucherIndex = listVouchers.findIndex(
- (voucher) => voucher.code == code
- );
- let dataActiveVoucher = listVouchers[dataVoucherIndex];
-
- countDiscount = dataActiveVoucher.discountVoucher;
- } else {
- let dataVoucherIndex = listVoucherShippings.findIndex(
- (voucher) => voucher.code == code
- );
- let dataActiveVoucher = listVoucherShippings[dataVoucherIndex];
-
- countDiscount = dataActiveVoucher.discountVoucher;
- }
-
- /*if (dataActiveVoucher.discountType === 'percentage') {
- countDiscount = cartCheckout?.subtotal * (dataActiveVoucher.discountAmount / 100)
- if (
- dataActiveVoucher.maxDiscountAmount > 0 &&
- countDiscount > dataActiveVoucher.maxDiscountAmount
- ) {
- countDiscount = dataActiveVoucher.maxDiscountAmount
- }
- } else {
- countDiscount = dataActiveVoucher.discountAmount
- }*/
-
- return countDiscount;
- };
+ // const hitungDiscountVoucher = (code, source) => {
+ // let countDiscount = 0;
+ // if (source === 'voucher') {
+ // let dataVoucherIndex = listVouchers.findIndex(
+ // (voucher) => voucher.code == code
+ // );
+ // let dataActiveVoucher = listVouchers[dataVoucherIndex];
+ //
+ // countDiscount = dataActiveVoucher.discountVoucher;
+ // } else {
+ // let dataVoucherIndex = listVoucherShippings.findIndex(
+ // (voucher) => voucher.code == code
+ // );
+ // let dataActiveVoucher = listVoucherShippings[dataVoucherIndex];
+ //
+ // countDiscount = dataActiveVoucher.discountVoucher;
+ // }
+ //
+ // /*if (dataActiveVoucher.discountType === 'percentage') {
+ // countDiscount = cartCheckout?.subtotal * (dataActiveVoucher.discountAmount / 100)
+ // if (
+ // dataActiveVoucher.maxDiscountAmount > 0 &&
+ // countDiscount > dataActiveVoucher.maxDiscountAmount
+ // ) {
+ // countDiscount = dataActiveVoucher.maxDiscountAmount
+ // }
+ // } else {
+ // countDiscount = dataActiveVoucher.discountAmount
+ // }*/
+ //
+ // return countDiscount;
+ // };
// useEffect(() => {
// if (!listVouchers) return;
@@ -535,7 +536,11 @@ const Checkout = () => {
return;
}
//new release
- // if (selectedCarrier != 1 && biayaKirim == 0) {
+ // if (!selectedService) {
+ toast.error('Harap pilih tipe layanan pengiriman');
+ return;
+ }
+ if (selectedCourier != 1 && biayaKirim == 0) {
// toast.error('Maaf, layanan tidak tersedia. Mohon pilih expedisi lain.');
// return;
// }
@@ -577,15 +582,15 @@ const Checkout = () => {
delivery_service_type: selectedService?.service_type,
// New release
- // carrier_id: selectedCarrierId,
- // estimated_arrival_days: splitDuration(etd),
- // delivery_service_type: selectedExpedisiService,
+ // carrier_id: selectedCourierId,
+ estimated_arrival_days_start : parseInt(eta_courier_start) + parseInt(productSla),
+ // estimated_arrival_days: parseInt(eta_courier) + parseInt(productSla),
+ // delivery_service_type: selectedService?.service_type,
flash_sale: hasFlashSale, // dibuat negasi untuk ngetest kebalikan nilai false
voucher: activeVoucher,
voucher_shipping: activeVoucherShipping,
type: 'sale_order',
};
-
if (query) {
data.source = 'buy';
}
@@ -1235,7 +1240,7 @@ const Checkout = () => {
</Skeleton>
)}
<Divider />
- <SectionValidation address={selectedAddress.shipping} />
+ <SectionValidation address={selectedAddress.invoicing} />
{/*new-relase*/}
{/*<SectionExpedisi*/}
{/* address={selectedAddress.shipping}*/}
@@ -1250,7 +1255,7 @@ const Checkout = () => {
{/* <SectionListService*/}
{/* listserviceExpedisi={listserviceExpedisi}*/}
{/* setSelectedServiceType={setSelectedServiceType}*/}
- {/* />*/}
+ {/* /> */}
<div className='p-4 flex flex-col gap-y-4'>
{!!products &&
@@ -1541,7 +1546,7 @@ const Checkout = () => {
)}
{products && <SectionExpedition products={products} />}
<Divider />
- <SectionValidation address={selectedAddress.shipping} />
+ <SectionValidation address={selectedAddress.invoicing} />
{/* <SectionExpedisi
address={selectedAddress.shipping}
listExpedisi={listExpedisi}
@@ -1864,9 +1869,7 @@ const SectionValidation = ({ address }) =>
</Link>
</div>
</BottomPopup>
- )
-// )
-;
+ );
const SectionExpedisi = ({
address,