summaryrefslogtreecommitdiff
path: root/src/lib/checkout/components/Checkout.jsx
diff options
context:
space:
mode:
authortrisusilo48 <tri.susilo@altama.co.id>2025-02-26 10:47:58 +0700
committertrisusilo48 <tri.susilo@altama.co.id>2025-02-26 10:47:58 +0700
commit58601bc17b6f0516eee9c36aa36e39f1dea3ad77 (patch)
tree1223647d2e4c80603685fb97532b85649a8edc37 /src/lib/checkout/components/Checkout.jsx
parentfdb488651e864cf30f09fe2337187241ef649177 (diff)
bitehsip
Diffstat (limited to 'src/lib/checkout/components/Checkout.jsx')
-rw-r--r--src/lib/checkout/components/Checkout.jsx14
1 files changed, 10 insertions, 4 deletions
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 ||