From 58601bc17b6f0516eee9c36aa36e39f1dea3ad77 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Wed, 26 Feb 2025 10:47:58 +0700 Subject: bitehsip --- src/lib/checkout/components/Checkout.jsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/lib/checkout/components/Checkout.jsx') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 3ad833ec..1a7fdc03 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -165,6 +165,7 @@ const Checkout = () => { etd, unit, selectedCourier, + selectedCourierId, selectedService, listExpedisi, setExpedisi, @@ -447,6 +448,10 @@ const Checkout = () => { quantity: product.quantity, available_quantity: product?.availableQuantity, })); + let estimated_courier = etd.split('-').map(Number); + let eta_courier = Math.max(...estimated_courier); + let eta_courier_start = Math.min(...estimated_courier); + let data = { // partner_shipping_id: auth.partnerId,, // partner_invoice_id: auth.partnerId, @@ -455,8 +460,9 @@ const Checkout = () => { user_id: auth.id, order_line: JSON.stringify(productOrder), delivery_amount: biayaKirim, - carrier_id: selectedCourier, - estimated_arrival_days: getToDate(etd, unit), + 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, @@ -469,6 +475,8 @@ const Checkout = () => { if (poNumber.current.value) data.po_number = poNumber.current.value; if (typeof file !== 'undefined') data.po_file = await getFileBase64(file); + console.log('ini data', data); + const isCheckouted = await checkoutApi({ data }); if (!isCheckouted?.id) { @@ -1297,7 +1305,6 @@ const Checkout = () => { className='flex-1 btn-yellow' onClick={checkout} disabled={ - isLoading || !products || products?.length == 0 || priceCheck || @@ -1603,7 +1610,6 @@ const Checkout = () => { className='w-full btn-yellow mt-4' onClick={checkout} disabled={ - isLoading || !products || products?.length == 0 || priceCheck || -- cgit v1.2.3