From d078c6adfd896b59f14e2a5116ecb977256674fa Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Tue, 19 Nov 2024 16:51:54 +0700
Subject: biteships

---
 src/lib/checkout/components/Checkout.jsx | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 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 33cfaa87..92a94834 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -34,6 +34,7 @@ import ExpedisiList from '../api/ExpedisiList';
 import { getVoucher } from '../api/getVoucher';
 import { useAddress } from '../stores/useAdress';
 import SectionExpedition from './SectionExpedition';
+import { useCheckout } from '../stores/stateCheckout';
 
 const SELF_PICKUP_ID = 32;
 
@@ -125,7 +126,6 @@ const Checkout = () => {
     }
   }, [addresses]);
 
-  const [products, setProducts] = useState(null);
   const [totalWeight, setTotalWeight] = useState(0);
   const [priceCheck, setPriceCheck] = useState(false);
   const [listExpedisi, setExpedisi] = useState([]);
@@ -133,8 +133,6 @@ const Checkout = () => {
   const [selectedExpedisi, setSelectedExpedisi] = useState(0);
   const [selectedCarrierId, setselectedCarrierId] = useState(0);
   const [selectedCarrier, setselectedCarrier] = useState(0);
-  const [biayaKirim, setBiayaKirim] = useState(0);
-  const [checkWeigth, setCheckWeight] = useState(false);
   const [selectedServiceType, setSelectedServiceType] = useState(null);
   const [selectedExpedisiService, setselectedExpedisiService] = useState(null);
   const [etd, setEtd] = useState(null);
@@ -149,11 +147,11 @@ const Checkout = () => {
   const [findCodeVoucher, SetFindVoucher] = useState(null);
   const [selisihHargaCode, SetSelisihHargaCode] = useState(null);
   const [buttonTerapkan, SetButtonTerapkan] = useState(false);
-  const [checkoutValidation, setCheckoutValidation] = useState(false);
   const [loadingVoucher, setLoadingVoucher] = useState(true);
   const [loadingRajaOngkir, setLoadingRajaOngkir] = useState(false);
   const [grandTotal, setGrandTotal] = useState(0);
-  const [hasFlashSale, setHasFlashSale] = useState(false);
+
+  const {checkWeigth, setCheckWeight, hasFlashSale, setHasFlashSale, checkoutValidation, setCheckoutValidation, biayaKirim, setBiayaKirim, products, setProducts} = useCheckout();
 
   const expedisiValidation = useRef(null);
 
@@ -571,6 +569,9 @@ const Checkout = () => {
     cartCheckout?.discountVoucher +
     (cartCheckout?.discountVoucherShipping || 0);
 
+
+  console.log('etd', etd, calculateEstimatedArrival(etd), splitDuration(etd));
+
   return (
     <>
       <BottomPopup
-- 
cgit v1.2.3

