From da44e90efe705239ac7419da1874161acb88299a Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 15 Oct 2024 15:23:29 +0700
Subject: <iman> add feature pengajuan tempo

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 60 ++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
new file mode 100644
index 00000000..d7b45fda
--- /dev/null
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -0,0 +1,60 @@
+import React from 'react';
+import Stepper from './Stepper';
+
+const PengajuanTempo = () => {
+  const [currentStep, setCurrentStep] = React.useState(0);
+  const NUMBER_OF_STEPS = 6;
+  const stepDivs = [
+    <div>Informasi Perusahaan</div>,
+    <div>Kontak Person</div>,
+    <div>Pengiriman</div>,
+    <div>Referensi</div>,
+    <div>Dokumen</div>,
+    <div>Konfirmasi</div>,
+  ];
+
+  const goToNextStep = () =>
+    setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev + 1));
+
+  const goToPreviousStep = () =>
+    setCurrentStep((prev) => (prev <= 0 ? prev : prev - 1));
+
+  return (
+    <>
+      <div className='container flex flex-col items-center '>
+        <h1 className='text-h-sm md:text-title-sm font-semibold text-center mb-6'>
+          Form Pengajuan Tempo
+        </h1>
+        <p className='text-center mb-4'>
+          Lorem ipsum dolor sit amet consectetur. Commodo suspendisse at enim
+          magnis ut quisque rhoncus. Felis volutpat fringilla sollicitudin
+          ultricies. Enim non eget in lorem netus. Nisl pharetra accumsan diam
+          suspendisse.
+        </p>
+      </div>
+      <div className='h-[2px] w-full mb-20 bg-gray_r-3' />
+      <div className='container mt-10 flex flex-col items-center '>
+        <Stepper currentStep={currentStep} numberOfSteps={NUMBER_OF_STEPS} />
+        <div>{stepDivs[currentStep]}</div>
+        <section className='flex gap-10 mt-10'>
+          <button
+            onClick={goToPreviousStep}
+            className='bg-blue-600 text-white p-2 rounded-md'
+            disabled={currentStep === 0} // Disable if on the first step
+          >
+            Previous step
+          </button>
+          <button
+            onClick={goToNextStep}
+            className='bg-blue-600 text-white p-2 rounded-md'
+            disabled={currentStep === NUMBER_OF_STEPS - 1} // Disable if on the last step
+          >
+            Next step
+          </button>
+        </section>
+      </div>
+    </>
+  );
+};
+
+export default PengajuanTempo;
-- 
cgit v1.2.3


From 7868be545edebd0b54e0ed0b59bc80361bbf36d6 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 15 Oct 2024 17:01:36 +0700
Subject: <iman> update informasi perusahaan

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index d7b45fda..5ef5374e 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -1,11 +1,14 @@
 import React from 'react';
 import Stepper from './Stepper';
+import InformasiPerusahaan from './informasiPerusahaan'; // Make sure this component exists
 
 const PengajuanTempo = () => {
   const [currentStep, setCurrentStep] = React.useState(0);
   const NUMBER_OF_STEPS = 6;
+
+  // Use the component directly in the array
   const stepDivs = [
-    <div>Informasi Perusahaan</div>,
+    <InformasiPerusahaan />, // Call the component correctly
     <div>Kontak Person</div>,
     <div>Pengiriman</div>,
     <div>Referensi</div>,
@@ -33,8 +36,10 @@ const PengajuanTempo = () => {
         </p>
       </div>
       <div className='h-[2px] w-full mb-20 bg-gray_r-3' />
-      <div className='container mt-10 flex flex-col items-center '>
-        <Stepper currentStep={currentStep} numberOfSteps={NUMBER_OF_STEPS} />
+      <div className='container mt-10 flex flex-col '>
+        <div className='flex items-center justify-center'>
+          <Stepper currentStep={currentStep} numberOfSteps={NUMBER_OF_STEPS} />
+        </div>
         <div>{stepDivs[currentStep]}</div>
         <section className='flex gap-10 mt-10'>
           <button
-- 
cgit v1.2.3


From f555e7bc9d070e7e0bd4900941592480d4ba6c6a Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 17 Oct 2024 14:39:17 +0700
Subject: <iman> update pengajuan tempo

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 56 +++++++++++++++++-----
 1 file changed, 45 insertions(+), 11 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 5ef5374e..bc7dcb69 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -1,14 +1,22 @@
 import React from 'react';
+import { useMemo, useState, useEffect, useRef } from 'react';
 import Stepper from './Stepper';
-import InformasiPerusahaan from './informasiPerusahaan'; // Make sure this component exists
-
+import InformasiPerusahaan from './informasiPerusahaan';
+import { Controller, useForm } from 'react-hook-form';
+import { usePengajuanTempoStore } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
+import { ChevronRightIcon } from '@heroicons/react/24/outline';
 const PengajuanTempo = () => {
   const [currentStep, setCurrentStep] = React.useState(0);
   const NUMBER_OF_STEPS = 6;
-
-  // Use the component directly in the array
+  const { form, errors, validate, updateForm } = usePengajuanTempoStore();
+  const [notValid, setNotValid] = useState(false);
+  const isFormValid = useMemo(() => Object.keys(errors).length === 0, [errors]);
+  const [buttonSubmitClick, setButtonSubmitClick] = useState(false);
   const stepDivs = [
-    <InformasiPerusahaan />, // Call the component correctly
+    <InformasiPerusahaan
+      chekValid={notValid}
+      buttonSubmitClick={buttonSubmitClick}
+    />,
     <div>Kontak Person</div>,
     <div>Pengiriman</div>,
     <div>Referensi</div>,
@@ -16,8 +24,22 @@ const PengajuanTempo = () => {
     <div>Konfirmasi</div>,
   ];
 
-  const goToNextStep = () =>
+  useEffect(() => {
+    validate();
+  }, []);
+
+  const goToNextStep = () => {
+    if (!isFormValid) {
+      setNotValid(true);
+      setButtonSubmitClick(!buttonSubmitClick);
+      console.log('form', form);
+      return;
+    } else {
+      setButtonSubmitClick(!buttonSubmitClick);
+      setNotValid(false);
+    }
     setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev + 1));
+  };
 
   const goToPreviousStep = () =>
     setCurrentStep((prev) => (prev <= 0 ? prev : prev - 1));
@@ -42,21 +64,33 @@ const PengajuanTempo = () => {
         </div>
         <div>{stepDivs[currentStep]}</div>
         <section className='flex gap-10 mt-10'>
-          <button
+          {/* <button
             onClick={goToPreviousStep}
             className='bg-blue-600 text-white p-2 rounded-md'
             disabled={currentStep === 0} // Disable if on the first step
           >
             Previous step
-          </button>
-          <button
+          </button> */}
+          {/* <button
             onClick={goToNextStep}
             className='bg-blue-600 text-white p-2 rounded-md'
             disabled={currentStep === NUMBER_OF_STEPS - 1} // Disable if on the last step
-          >
+            >
             Next step
-          </button>
+            </button> */}
         </section>
+        <div className='flex flex-row justify-end items-center gap-4 mb-8'>
+          <span className='text-xs opacity-60'>
+            *Pastikan data yang anda masukan sudah benar dan sesuai
+          </span>
+          <button
+            onClick={goToNextStep}
+            disabled={currentStep === NUMBER_OF_STEPS - 1}
+            className='bg-red-600 border border-red-600 rounded-md text-sm text-white p-2 h-11 mb-1 content-center flex flex-row justify-center items-center'
+          >
+            Langkah Selanjutnya {<ChevronRightIcon className='w-5' />}
+          </button>
+        </div>
       </div>
     </>
   );
-- 
cgit v1.2.3


From 0908fc0075f91844ffed4002165c638d02eb91be Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 17 Oct 2024 16:01:50 +0700
Subject: <iman> update pengajuan tempo

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index bc7dcb69..5f250438 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -33,8 +33,11 @@ const PengajuanTempo = () => {
       setNotValid(true);
       setButtonSubmitClick(!buttonSubmitClick);
       console.log('form', form);
+      console.log('error', errors);
       return;
     } else {
+      console.log('form', form);
+      console.log('error', errors);
       setButtonSubmitClick(!buttonSubmitClick);
       setNotValid(false);
     }
-- 
cgit v1.2.3


From ead46a6d760850530946926b390a8954ca64e1c2 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 17 Oct 2024 17:06:58 +0700
Subject: <iman> update pengajuan tempo

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 5f250438..c15189d1 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -2,6 +2,7 @@ import React from 'react';
 import { useMemo, useState, useEffect, useRef } from 'react';
 import Stepper from './Stepper';
 import InformasiPerusahaan from './informasiPerusahaan';
+import KontakPerusahaan from './KontakPerusahaan';
 import { Controller, useForm } from 'react-hook-form';
 import { usePengajuanTempoStore } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
 import { ChevronRightIcon } from '@heroicons/react/24/outline';
@@ -13,6 +14,10 @@ const PengajuanTempo = () => {
   const isFormValid = useMemo(() => Object.keys(errors).length === 0, [errors]);
   const [buttonSubmitClick, setButtonSubmitClick] = useState(false);
   const stepDivs = [
+    <KontakPerusahaan
+      chekValid={notValid}
+      buttonSubmitClick={buttonSubmitClick}
+    />,
     <InformasiPerusahaan
       chekValid={notValid}
       buttonSubmitClick={buttonSubmitClick}
-- 
cgit v1.2.3


From 661d742193b62aeb3d2a2350433bdd3714667625 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 18 Oct 2024 10:39:40 +0700
Subject: <iman> add kontak perusahaan

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 32 ++++++++++++++++++----
 1 file changed, 27 insertions(+), 5 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index c15189d1..b2e9832e 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -4,14 +4,22 @@ import Stepper from './Stepper';
 import InformasiPerusahaan from './informasiPerusahaan';
 import KontakPerusahaan from './KontakPerusahaan';
 import { Controller, useForm } from 'react-hook-form';
-import { usePengajuanTempoStore } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
+import {
+  usePengajuanTempoStore,
+  usePengajuanTempoStoreKontakPerson,
+} from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
 import { ChevronRightIcon } from '@heroicons/react/24/outline';
 const PengajuanTempo = () => {
   const [currentStep, setCurrentStep] = React.useState(0);
   const NUMBER_OF_STEPS = 6;
   const { form, errors, validate, updateForm } = usePengajuanTempoStore();
+  const {
+    formKontakPerson,
+    errorsKontakPerson,
+    validateKontakPerson,
+    updateFormKontakPerson,
+  } = usePengajuanTempoStoreKontakPerson();
   const [notValid, setNotValid] = useState(false);
-  const isFormValid = useMemo(() => Object.keys(errors).length === 0, [errors]);
   const [buttonSubmitClick, setButtonSubmitClick] = useState(false);
   const stepDivs = [
     <KontakPerusahaan
@@ -28,21 +36,35 @@ const PengajuanTempo = () => {
     <div>Dokumen</div>,
     <div>Konfirmasi</div>,
   ];
+  const stepDivsError = [
+    errorsKontakPerson,
+    errors,
+    <div>Kontak Person</div>,
+    <div>Pengiriman</div>,
+    <div>Referensi</div>,
+    <div>Dokumen</div>,
+    <div>Konfirmasi</div>,
+  ];
 
+  const isFormValid = useMemo(
+    () => Object.keys(stepDivsError[currentStep]).length === 0,
+    [stepDivsError[currentStep]]
+  );
   useEffect(() => {
     validate();
+    validateKontakPerson();
   }, []);
-
+  console.log('isFormValid', isFormValid);
   const goToNextStep = () => {
     if (!isFormValid) {
       setNotValid(true);
       setButtonSubmitClick(!buttonSubmitClick);
       console.log('form', form);
-      console.log('error', errors);
+      console.log('error', stepDivsError[currentStep]);
       return;
     } else {
       console.log('form', form);
-      console.log('error', errors);
+      console.log('error', stepDivsError[currentStep]);
       setButtonSubmitClick(!buttonSubmitClick);
       setNotValid(false);
     }
-- 
cgit v1.2.3


From b884ae8fb7b3d208912f75decfe941435c59d571 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 18 Oct 2024 11:25:02 +0700
Subject: <iman> save to local storage

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 72 +++++++++++++++++-----
 1 file changed, 57 insertions(+), 15 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index b2e9832e..bdd6e6ef 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -8,7 +8,8 @@ import {
   usePengajuanTempoStore,
   usePengajuanTempoStoreKontakPerson,
 } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
-import { ChevronRightIcon } from '@heroicons/react/24/outline';
+import { ChevronRightIcon, ChevronLeftIcon } from '@heroicons/react/24/outline';
+import { chakra } from '@chakra-ui/react';
 const PengajuanTempo = () => {
   const [currentStep, setCurrentStep] = React.useState(0);
   const NUMBER_OF_STEPS = 6;
@@ -22,11 +23,11 @@ const PengajuanTempo = () => {
   const [notValid, setNotValid] = useState(false);
   const [buttonSubmitClick, setButtonSubmitClick] = useState(false);
   const stepDivs = [
-    <KontakPerusahaan
+    <InformasiPerusahaan
       chekValid={notValid}
       buttonSubmitClick={buttonSubmitClick}
     />,
-    <InformasiPerusahaan
+    <KontakPerusahaan
       chekValid={notValid}
       buttonSubmitClick={buttonSubmitClick}
     />,
@@ -37,14 +38,31 @@ const PengajuanTempo = () => {
     <div>Konfirmasi</div>,
   ];
   const stepDivsError = [
-    errorsKontakPerson,
     errors,
+    errorsKontakPerson,
+    <div>Kontak Person</div>,
+    <div>Pengiriman</div>,
+    <div>Referensi</div>,
+    <div>Dokumen</div>,
+    <div>Konfirmasi</div>,
+  ];
+  const stepDivsForm = [
+    form,
+    formKontakPerson,
     <div>Kontak Person</div>,
     <div>Pengiriman</div>,
     <div>Referensi</div>,
     <div>Dokumen</div>,
     <div>Konfirmasi</div>,
   ];
+  const stepLabels = [
+    'informasi_perusahaan',
+    'kontak_person',
+    'Pengiriman',
+    'Referensi',
+    'Dokumen',
+    'Konfirmasi',
+  ];
 
   const isFormValid = useMemo(
     () => Object.keys(stepDivsError[currentStep]).length === 0,
@@ -54,16 +72,18 @@ const PengajuanTempo = () => {
     validate();
     validateKontakPerson();
   }, []);
-  console.log('isFormValid', isFormValid);
   const goToNextStep = () => {
     if (!isFormValid) {
       setNotValid(true);
       setButtonSubmitClick(!buttonSubmitClick);
-      console.log('form', form);
+      console.log('form', stepDivsForm[currentStep]);
       console.log('error', stepDivsError[currentStep]);
       return;
     } else {
-      console.log('form', form);
+      saveToLocalStorage(stepLabels[currentStep], stepDivsForm[currentStep]);
+      const cachedData = getFromLocalStorage(stepLabels[currentStep]);
+      console.log('cachedData', cachedData);
+      console.log('form', stepDivsForm[currentStep]);
       console.log('error', stepDivsError[currentStep]);
       setButtonSubmitClick(!buttonSubmitClick);
       setNotValid(false);
@@ -71,8 +91,29 @@ const PengajuanTempo = () => {
     setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev + 1));
   };
 
-  const goToPreviousStep = () =>
+  const goToPreviousStep = () => {
+    const cachedData = getFromLocalStorage(stepLabels[currentStep - 1]);
+    console.log('cachedData prev button', cachedData);
+    if (cachedData) {
+      // const formData = JSON.parse(cachedData);
+      Object.keys(cachedData).forEach((key) => {
+        updateForm(key, cachedData[key]);
+      });
+    }
     setCurrentStep((prev) => (prev <= 0 ? prev : prev - 1));
+  };
+
+  const saveToLocalStorage = (key, form) => {
+    localStorage.setItem(key, JSON.stringify(form));
+  };
+
+  const getFromLocalStorage = (key) => {
+    const itemStr = localStorage.getItem(key);
+    if (!itemStr) return null;
+
+    const item = JSON.parse(itemStr);
+    return item;
+  };
 
   return (
     <>
@@ -94,13 +135,6 @@ const PengajuanTempo = () => {
         </div>
         <div>{stepDivs[currentStep]}</div>
         <section className='flex gap-10 mt-10'>
-          {/* <button
-            onClick={goToPreviousStep}
-            className='bg-blue-600 text-white p-2 rounded-md'
-            disabled={currentStep === 0} // Disable if on the first step
-          >
-            Previous step
-          </button> */}
           {/* <button
             onClick={goToNextStep}
             className='bg-blue-600 text-white p-2 rounded-md'
@@ -113,6 +147,14 @@ const PengajuanTempo = () => {
           <span className='text-xs opacity-60'>
             *Pastikan data yang anda masukan sudah benar dan sesuai
           </span>
+          <button
+            onClick={goToPreviousStep}
+            className='bg-red-600 border border-red-600 rounded-md text-sm text-white p-2 h-11 mb-1 content-center flex flex-row justify-center items-center'
+            disabled={currentStep === 0} // Disable if on the first step
+          >
+            {<ChevronLeftIcon className='w-5' />}
+            Langkah Sebelumnya
+          </button>
           <button
             onClick={goToNextStep}
             disabled={currentStep === NUMBER_OF_STEPS - 1}
-- 
cgit v1.2.3


From ae0f75d48261ba2057dc0dd4492708f1e6e06522 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 18 Oct 2024 11:35:57 +0700
Subject: <iman> get data from local based use effect

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index bdd6e6ef..2c10b1d6 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -72,6 +72,16 @@ const PengajuanTempo = () => {
     validate();
     validateKontakPerson();
   }, []);
+  useEffect(() => {
+    const cachedData = getFromLocalStorage(stepLabels[currentStep]);
+    console.log('cachedData prev button', cachedData);
+    if (cachedData) {
+      // const formData = JSON.parse(cachedData);
+      Object.keys(cachedData).forEach((key) => {
+        updateForm(key, cachedData[key]);
+      });
+    }
+  }, [currentStep]);
   const goToNextStep = () => {
     if (!isFormValid) {
       setNotValid(true);
@@ -92,14 +102,6 @@ const PengajuanTempo = () => {
   };
 
   const goToPreviousStep = () => {
-    const cachedData = getFromLocalStorage(stepLabels[currentStep - 1]);
-    console.log('cachedData prev button', cachedData);
-    if (cachedData) {
-      // const formData = JSON.parse(cachedData);
-      Object.keys(cachedData).forEach((key) => {
-        updateForm(key, cachedData[key]);
-      });
-    }
     setCurrentStep((prev) => (prev <= 0 ? prev : prev - 1));
   };
 
-- 
cgit v1.2.3


From 87ffd2fa7edc240693ddd81401ef23c5cd1bbb3e Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 18 Oct 2024 16:11:17 +0700
Subject: <iman> update fix kontak person

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 29 ++++++++++++++--------
 1 file changed, 19 insertions(+), 10 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 2c10b1d6..14ea1805 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -9,11 +9,11 @@ import {
   usePengajuanTempoStoreKontakPerson,
 } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
 import { ChevronRightIcon, ChevronLeftIcon } from '@heroicons/react/24/outline';
-import { chakra } from '@chakra-ui/react';
 const PengajuanTempo = () => {
   const [currentStep, setCurrentStep] = React.useState(0);
   const NUMBER_OF_STEPS = 6;
   const { form, errors, validate, updateForm } = usePengajuanTempoStore();
+  const { control, watch, setValue } = useForm();
   const {
     formKontakPerson,
     errorsKontakPerson,
@@ -55,6 +55,15 @@ const PengajuanTempo = () => {
     <div>Dokumen</div>,
     <div>Konfirmasi</div>,
   ];
+  const stepDivsUpdateForm = [
+    updateForm,
+    updateFormKontakPerson,
+    <div>Kontak Person</div>,
+    <div>Pengiriman</div>,
+    <div>Referensi</div>,
+    <div>Dokumen</div>,
+    <div>Konfirmasi</div>,
+  ];
   const stepLabels = [
     'informasi_perusahaan',
     'kontak_person',
@@ -69,16 +78,21 @@ const PengajuanTempo = () => {
     [stepDivsError[currentStep]]
   );
   useEffect(() => {
-    validate();
     validateKontakPerson();
-  }, []);
+    validate();
+
+    window.scrollTo({
+      top: 0,
+      behavior: 'smooth',
+    });
+  }, [currentStep]);
+
   useEffect(() => {
     const cachedData = getFromLocalStorage(stepLabels[currentStep]);
-    console.log('cachedData prev button', cachedData);
     if (cachedData) {
       // const formData = JSON.parse(cachedData);
       Object.keys(cachedData).forEach((key) => {
-        updateForm(key, cachedData[key]);
+        stepDivsUpdateForm[currentStep](key, cachedData[key]);
       });
     }
   }, [currentStep]);
@@ -86,15 +100,10 @@ const PengajuanTempo = () => {
     if (!isFormValid) {
       setNotValid(true);
       setButtonSubmitClick(!buttonSubmitClick);
-      console.log('form', stepDivsForm[currentStep]);
-      console.log('error', stepDivsError[currentStep]);
       return;
     } else {
       saveToLocalStorage(stepLabels[currentStep], stepDivsForm[currentStep]);
       const cachedData = getFromLocalStorage(stepLabels[currentStep]);
-      console.log('cachedData', cachedData);
-      console.log('form', stepDivsForm[currentStep]);
-      console.log('error', stepDivsError[currentStep]);
       setButtonSubmitClick(!buttonSubmitClick);
       setNotValid(false);
     }
-- 
cgit v1.2.3


From 548e2b48b1c2f6521037765f96083a8d79f611d6 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 18 Oct 2024 17:08:55 +0700
Subject: <iman> add pengiriman section

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 14ea1805..257648ca 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -3,6 +3,7 @@ import { useMemo, useState, useEffect, useRef } from 'react';
 import Stepper from './Stepper';
 import InformasiPerusahaan from './informasiPerusahaan';
 import KontakPerusahaan from './KontakPerusahaan';
+import Pengiriman from './Pengiriman';
 import { Controller, useForm } from 'react-hook-form';
 import {
   usePengajuanTempoStore,
@@ -31,8 +32,7 @@ const PengajuanTempo = () => {
       chekValid={notValid}
       buttonSubmitClick={buttonSubmitClick}
     />,
-    <div>Kontak Person</div>,
-    <div>Pengiriman</div>,
+    <Pengiriman chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
     <div>Referensi</div>,
     <div>Dokumen</div>,
     <div>Konfirmasi</div>,
@@ -85,7 +85,7 @@ const PengajuanTempo = () => {
       top: 0,
       behavior: 'smooth',
     });
-  }, [currentStep]);
+  }, [currentStep, buttonSubmitClick]);
 
   useEffect(() => {
     const cachedData = getFromLocalStorage(stepLabels[currentStep]);
-- 
cgit v1.2.3


From c61477111b95d83a9b862f242923b911364f3612 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Sat, 19 Oct 2024 11:49:38 +0700
Subject: <iman> fix section pengiriman

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 257648ca..612b009a 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -8,6 +8,7 @@ import { Controller, useForm } from 'react-hook-form';
 import {
   usePengajuanTempoStore,
   usePengajuanTempoStoreKontakPerson,
+  usePengajuanTempoStorePengiriman,
 } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
 import { ChevronRightIcon, ChevronLeftIcon } from '@heroicons/react/24/outline';
 const PengajuanTempo = () => {
@@ -21,6 +22,12 @@ const PengajuanTempo = () => {
     validateKontakPerson,
     updateFormKontakPerson,
   } = usePengajuanTempoStoreKontakPerson();
+  const {
+    formPengiriman,
+    errorsPengiriman,
+    validatePengiriman,
+    updateFormPengiriman,
+  } = usePengajuanTempoStorePengiriman();
   const [notValid, setNotValid] = useState(false);
   const [buttonSubmitClick, setButtonSubmitClick] = useState(false);
   const stepDivs = [
@@ -40,8 +47,7 @@ const PengajuanTempo = () => {
   const stepDivsError = [
     errors,
     errorsKontakPerson,
-    <div>Kontak Person</div>,
-    <div>Pengiriman</div>,
+    errorsPengiriman,
     <div>Referensi</div>,
     <div>Dokumen</div>,
     <div>Konfirmasi</div>,
@@ -49,8 +55,7 @@ const PengajuanTempo = () => {
   const stepDivsForm = [
     form,
     formKontakPerson,
-    <div>Kontak Person</div>,
-    <div>Pengiriman</div>,
+    formPengiriman,
     <div>Referensi</div>,
     <div>Dokumen</div>,
     <div>Konfirmasi</div>,
@@ -58,8 +63,7 @@ const PengajuanTempo = () => {
   const stepDivsUpdateForm = [
     updateForm,
     updateFormKontakPerson,
-    <div>Kontak Person</div>,
-    <div>Pengiriman</div>,
+    updateFormPengiriman,
     <div>Referensi</div>,
     <div>Dokumen</div>,
     <div>Konfirmasi</div>,
@@ -78,8 +82,9 @@ const PengajuanTempo = () => {
     [stepDivsError[currentStep]]
   );
   useEffect(() => {
-    validateKontakPerson();
     validate();
+    validateKontakPerson();
+    validatePengiriman();
 
     window.scrollTo({
       top: 0,
@@ -103,7 +108,6 @@ const PengajuanTempo = () => {
       return;
     } else {
       saveToLocalStorage(stepLabels[currentStep], stepDivsForm[currentStep]);
-      const cachedData = getFromLocalStorage(stepLabels[currentStep]);
       setButtonSubmitClick(!buttonSubmitClick);
       setNotValid(false);
     }
-- 
cgit v1.2.3


From 3a0f3c6ed7ef886d3205d51937b1ecbb035b1a87 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 21 Oct 2024 16:16:34 +0700
Subject: <iman> update and fix section dokumen

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 612b009a..2ab7c21a 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -4,11 +4,13 @@ import Stepper from './Stepper';
 import InformasiPerusahaan from './informasiPerusahaan';
 import KontakPerusahaan from './KontakPerusahaan';
 import Pengiriman from './Pengiriman';
+import Referensi from './Referensi';
 import { Controller, useForm } from 'react-hook-form';
 import {
   usePengajuanTempoStore,
   usePengajuanTempoStoreKontakPerson,
   usePengajuanTempoStorePengiriman,
+  usePengajuanTempoStoreSupplier,
 } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
 import { ChevronRightIcon, ChevronLeftIcon } from '@heroicons/react/24/outline';
 const PengajuanTempo = () => {
@@ -22,6 +24,8 @@ const PengajuanTempo = () => {
     validateKontakPerson,
     updateFormKontakPerson,
   } = usePengajuanTempoStoreKontakPerson();
+  const { formSupplier, errorsSupplier, validateSupplier, updateFormSupplier } =
+    usePengajuanTempoStoreSupplier();
   const {
     formPengiriman,
     errorsPengiriman,
@@ -40,7 +44,7 @@ const PengajuanTempo = () => {
       buttonSubmitClick={buttonSubmitClick}
     />,
     <Pengiriman chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
-    <div>Referensi</div>,
+    <Referensi chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
     <div>Dokumen</div>,
     <div>Konfirmasi</div>,
   ];
@@ -48,7 +52,7 @@ const PengajuanTempo = () => {
     errors,
     errorsKontakPerson,
     errorsPengiriman,
-    <div>Referensi</div>,
+    errorsSupplier,
     <div>Dokumen</div>,
     <div>Konfirmasi</div>,
   ];
@@ -56,7 +60,7 @@ const PengajuanTempo = () => {
     form,
     formKontakPerson,
     formPengiriman,
-    <div>Referensi</div>,
+    formSupplier,
     <div>Dokumen</div>,
     <div>Konfirmasi</div>,
   ];
@@ -64,7 +68,7 @@ const PengajuanTempo = () => {
     updateForm,
     updateFormKontakPerson,
     updateFormPengiriman,
-    <div>Referensi</div>,
+    updateFormSupplier,
     <div>Dokumen</div>,
     <div>Konfirmasi</div>,
   ];
@@ -96,9 +100,13 @@ const PengajuanTempo = () => {
     const cachedData = getFromLocalStorage(stepLabels[currentStep]);
     if (cachedData) {
       // const formData = JSON.parse(cachedData);
-      Object.keys(cachedData).forEach((key) => {
-        stepDivsUpdateForm[currentStep](key, cachedData[key]);
-      });
+      if (currentStep == 3) {
+        stepDivsUpdateForm[currentStep](cachedData);
+      } else {
+        Object.keys(cachedData).forEach((key) => {
+          stepDivsUpdateForm[currentStep](key, cachedData[key]);
+        });
+      }
     }
   }, [currentStep]);
   const goToNextStep = () => {
-- 
cgit v1.2.3


From d6ede238658d90315a5dc5b864f20037e8a776f6 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 22 Oct 2024 11:24:43 +0700
Subject: <iman> update & add section dokumen

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 2ab7c21a..238c5e4e 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -5,12 +5,14 @@ import InformasiPerusahaan from './informasiPerusahaan';
 import KontakPerusahaan from './KontakPerusahaan';
 import Pengiriman from './Pengiriman';
 import Referensi from './Referensi';
+import Dokumen from './Dokumen';
 import { Controller, useForm } from 'react-hook-form';
 import {
   usePengajuanTempoStore,
   usePengajuanTempoStoreKontakPerson,
   usePengajuanTempoStorePengiriman,
   usePengajuanTempoStoreSupplier,
+  usePengajuanTempoStoreDokumen,
 } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
 import { ChevronRightIcon, ChevronLeftIcon } from '@heroicons/react/24/outline';
 const PengajuanTempo = () => {
@@ -18,6 +20,8 @@ const PengajuanTempo = () => {
   const NUMBER_OF_STEPS = 6;
   const { form, errors, validate, updateForm } = usePengajuanTempoStore();
   const { control, watch, setValue } = useForm();
+  const { formDokumen, errorsDokumen, validateDokumen, updateFormDokumen } =
+    usePengajuanTempoStoreDokumen();
   const {
     formKontakPerson,
     errorsKontakPerson,
@@ -45,6 +49,7 @@ const PengajuanTempo = () => {
     />,
     <Pengiriman chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
     <Referensi chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
+    <Dokumen chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
     <div>Dokumen</div>,
     <div>Konfirmasi</div>,
   ];
@@ -53,7 +58,7 @@ const PengajuanTempo = () => {
     errorsKontakPerson,
     errorsPengiriman,
     errorsSupplier,
-    <div>Dokumen</div>,
+    errorsDokumen,
     <div>Konfirmasi</div>,
   ];
   const stepDivsForm = [
@@ -61,7 +66,7 @@ const PengajuanTempo = () => {
     formKontakPerson,
     formPengiriman,
     formSupplier,
-    <div>Dokumen</div>,
+    formDokumen,
     <div>Konfirmasi</div>,
   ];
   const stepDivsUpdateForm = [
@@ -69,7 +74,7 @@ const PengajuanTempo = () => {
     updateFormKontakPerson,
     updateFormPengiriman,
     updateFormSupplier,
-    <div>Dokumen</div>,
+    updateFormDokumen,
     <div>Konfirmasi</div>,
   ];
   const stepLabels = [
@@ -89,6 +94,7 @@ const PengajuanTempo = () => {
     validate();
     validateKontakPerson();
     validatePengiriman();
+    validateDokumen();
 
     window.scrollTo({
       top: 0,
@@ -108,6 +114,8 @@ const PengajuanTempo = () => {
         });
       }
     }
+    if (formSupplier) {
+    }
   }, [currentStep]);
   const goToNextStep = () => {
     if (!isFormValid) {
-- 
cgit v1.2.3


From acee071ea98505b42918f4d7cdc15252ae78f705 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 22 Oct 2024 15:28:40 +0700
Subject: <iman> update fix dokumen

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 238c5e4e..e6424e51 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -50,7 +50,6 @@ const PengajuanTempo = () => {
     <Pengiriman chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
     <Referensi chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
     <Dokumen chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
-    <div>Dokumen</div>,
     <div>Konfirmasi</div>,
   ];
   const stepDivsError = [
@@ -108,6 +107,12 @@ const PengajuanTempo = () => {
       // const formData = JSON.parse(cachedData);
       if (currentStep == 3) {
         stepDivsUpdateForm[currentStep](cachedData);
+      } else if (currentStep == 4) {
+        // Memanggil updateFormDokumen dengan parameter yang benar
+        Object.keys(cachedData).forEach((key) => {
+          const { name, format, base64 } = cachedData[key];
+          stepDivsUpdateForm[currentStep](key, name, format, base64);
+        });
       } else {
         Object.keys(cachedData).forEach((key) => {
           stepDivsUpdateForm[currentStep](key, cachedData[key]);
-- 
cgit v1.2.3


From d44a64960c1bc5830121ead771646b30fd1841bb Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 23 Oct 2024 09:25:04 +0700
Subject: <iman> update section konfirmasi

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index e6424e51..030583aa 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -6,6 +6,7 @@ import KontakPerusahaan from './KontakPerusahaan';
 import Pengiriman from './Pengiriman';
 import Referensi from './Referensi';
 import Dokumen from './Dokumen';
+import Konfirmasi from './Konfirmasi';
 import { Controller, useForm } from 'react-hook-form';
 import {
   usePengajuanTempoStore,
@@ -50,7 +51,7 @@ const PengajuanTempo = () => {
     <Pengiriman chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
     <Referensi chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
     <Dokumen chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
-    <div>Konfirmasi</div>,
+    <Konfirmasi chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
   ];
   const stepDivsError = [
     errors,
-- 
cgit v1.2.3


From abcce110895d767a16fb961a65e7c78f9213ca0d Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 24 Oct 2024 17:11:32 +0700
Subject: <iman> update pengajuan tempo

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 54 ++++++++++++++++++----
 1 file changed, 45 insertions(+), 9 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 030583aa..66d5ea1c 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -7,6 +7,8 @@ import Pengiriman from './Pengiriman';
 import Referensi from './Referensi';
 import Dokumen from './Dokumen';
 import Konfirmasi from './Konfirmasi';
+import useAuth from '@/core/hooks/useAuth';
+import { useRouter } from 'next/router';
 import { Controller, useForm } from 'react-hook-form';
 import {
   usePengajuanTempoStore,
@@ -21,6 +23,8 @@ const PengajuanTempo = () => {
   const NUMBER_OF_STEPS = 6;
   const { form, errors, validate, updateForm } = usePengajuanTempoStore();
   const { control, watch, setValue } = useForm();
+  const auth = useAuth();
+  const router = useRouter();
   const { formDokumen, errorsDokumen, validateDokumen, updateFormDokumen } =
     usePengajuanTempoStoreDokumen();
   const {
@@ -86,6 +90,15 @@ const PengajuanTempo = () => {
     'Konfirmasi',
   ];
 
+  // const stepLabels = [
+  //   `${auth.partnerId}_informasi_perusahaan`,
+  //   `${auth.partnerId}_kontak_person`,
+  //   `${auth.partnerId}_Pengiriman`,
+  //   `${auth.partnerId}_Referensi`,
+  //   `${auth.partnerId}_Dokumen`,
+  //   `${auth.partnerId}_Konfirmasi`,
+  // ];
+
   const isFormValid = useMemo(
     () => Object.keys(stepDivsError[currentStep]).length === 0,
     [stepDivsError[currentStep]]
@@ -135,6 +148,19 @@ const PengajuanTempo = () => {
     }
     setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev + 1));
   };
+  const handleDaftarTempo = () => {
+    router.push('/pengajuan-tempo/finish?order_id=SO-2023-06480');
+    // if (!isFormValid) {
+    //   setNotValid(true);
+    //   setButtonSubmitClick(!buttonSubmitClick);
+    //   return;
+    // } else {
+    //   saveToLocalStorage(stepLabels[currentStep], stepDivsForm[currentStep]);
+    //   setButtonSubmitClick(!buttonSubmitClick);
+    //   setNotValid(false);
+    // }
+    // setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev + 1));
+  };
 
   const goToPreviousStep = () => {
     setCurrentStep((prev) => (prev <= 0 ? prev : prev - 1));
@@ -184,21 +210,31 @@ const PengajuanTempo = () => {
           <span className='text-xs opacity-60'>
             *Pastikan data yang anda masukan sudah benar dan sesuai
           </span>
-          <button
+          {/* <button
             onClick={goToPreviousStep}
             className='bg-red-600 border border-red-600 rounded-md text-sm text-white p-2 h-11 mb-1 content-center flex flex-row justify-center items-center'
             disabled={currentStep === 0} // Disable if on the first step
           >
             {<ChevronLeftIcon className='w-5' />}
             Langkah Sebelumnya
-          </button>
-          <button
-            onClick={goToNextStep}
-            disabled={currentStep === NUMBER_OF_STEPS - 1}
-            className='bg-red-600 border border-red-600 rounded-md text-sm text-white p-2 h-11 mb-1 content-center flex flex-row justify-center items-center'
-          >
-            Langkah Selanjutnya {<ChevronRightIcon className='w-5' />}
-          </button>
+          </button> */}
+          {currentStep < 5 && (
+            <button
+              onClick={goToNextStep}
+              disabled={currentStep === NUMBER_OF_STEPS - 1}
+              className='bg-red-600 border border-red-600 rounded-md text-sm text-white p-2 h-11 mb-1 content-center flex flex-row justify-center items-center'
+            >
+              Langkah Selanjutnya {<ChevronRightIcon className='w-5' />}
+            </button>
+          )}
+          {currentStep == 5 && (
+            <button
+              onClick={handleDaftarTempo}
+              className='bg-red-600 border border-red-600 rounded-md text-sm text-white p-2 h-11 mb-1 content-center flex flex-row justify-center items-center'
+            >
+              Daftar Tempo {<ChevronRightIcon className='w-5' />}
+            </button>
+          )}
         </div>
       </div>
     </>
-- 
cgit v1.2.3


From 9054afb2c842a1177dbcf0842aadf2ad14403cde Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 25 Oct 2024 09:04:25 +0700
Subject: <iman> update pengajuan tempo finsish

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 66d5ea1c..d44d44e6 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -149,7 +149,7 @@ const PengajuanTempo = () => {
     setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev + 1));
   };
   const handleDaftarTempo = () => {
-    router.push('/pengajuan-tempo/finish?order_id=SO-2023-06480');
+    router.push('/pengajuan-tempo/finish?tempo_id=SO-2023-06480');
     // if (!isFormValid) {
     //   setNotValid(true);
     //   setButtonSubmitClick(!buttonSubmitClick);
-- 
cgit v1.2.3


From daaf32f9dd3af860013b70d04c89f4cca84724b1 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 29 Oct 2024 16:22:33 +0700
Subject: <iman> updarte pengajuan tempo

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 50 ++++++++++++++++++++--
 1 file changed, 47 insertions(+), 3 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index d44d44e6..0efea807 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -18,6 +18,7 @@ import {
   usePengajuanTempoStoreDokumen,
 } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
 import { ChevronRightIcon, ChevronLeftIcon } from '@heroicons/react/24/outline';
+import createPengajuanTempoApi from '../api/createPengajuanTempoApi';
 const PengajuanTempo = () => {
   const [currentStep, setCurrentStep] = React.useState(0);
   const NUMBER_OF_STEPS = 6;
@@ -71,7 +72,7 @@ const PengajuanTempo = () => {
     formPengiriman,
     formSupplier,
     formDokumen,
-    <div>Konfirmasi</div>,
+    '',
   ];
   const stepDivsUpdateForm = [
     updateForm,
@@ -89,6 +90,21 @@ const PengajuanTempo = () => {
     'Dokumen',
     'Konfirmasi',
   ];
+  const combineForms = () => {
+    return stepDivsForm.reduce((accumulator, currentForm, index) => {
+      if (currentForm && typeof currentForm === 'object') {
+        if (index === 3) {
+          if (!accumulator.formSupplier) {
+            accumulator.formSupplier = [];
+          }
+          accumulator.formSupplier.push(...currentForm);
+        } else {
+          return { ...accumulator, ...currentForm };
+        }
+      }
+      return accumulator;
+    }, {});
+  };
 
   // const stepLabels = [
   //   `${auth.partnerId}_informasi_perusahaan`,
@@ -148,8 +164,36 @@ const PengajuanTempo = () => {
     }
     setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev + 1));
   };
-  const handleDaftarTempo = () => {
-    router.push('/pengajuan-tempo/finish?tempo_id=SO-2023-06480');
+  const handleDaftarTempo = async () => {
+    for (const error of stepDivsError) {
+      if (error.length > 0) {
+        console.log('ada yang salah');
+        return; // Keluar dari fungsi jika ada error
+      }
+    }
+    const combinedData = combineForms();
+    console.log('combinedData', combinedData);
+    const data = {
+      ...combinedData,
+      parent_id: auth.partnerId,
+    };
+
+    const productOrder = formSupplier.map((product) => ({
+      supplier: product.supplier,
+      pic: product.pic,
+      telepon: product.telepon,
+      quantitydurasiTempo: product.durasiTempo,
+      creditLimit: product.creditLimit,
+    }));
+    const data2 = {
+      form: JSON.stringify(productOrder),
+      parent_id: auth.partnerId,
+    };
+    const address = await createPengajuanTempoApi({ combinedData });
+
+    console.log('Sukses Daftar');
+    // router.push('/pengajuan-tempo/finish?tempo_id=SO-2023-06480');
+
     // if (!isFormValid) {
     //   setNotValid(true);
     //   setButtonSubmitClick(!buttonSubmitClick);
-- 
cgit v1.2.3


From b5701645ce23deed5e32afc4a0f98bd523c6c92c Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 31 Oct 2024 13:58:23 +0700
Subject: <iman> update pengajuan tempo

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 146 +++++++++------------
 1 file changed, 60 insertions(+), 86 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 0efea807..11079328 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -19,6 +19,9 @@ import {
 } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore';
 import { ChevronRightIcon, ChevronLeftIcon } from '@heroicons/react/24/outline';
 import createPengajuanTempoApi from '../api/createPengajuanTempoApi';
+import { Button, Checkbox, Spinner, Tooltip } from '@chakra-ui/react';
+import clsxm from '~/libs/clsxm';
+import { toast } from 'react-hot-toast';
 const PengajuanTempo = () => {
   const [currentStep, setCurrentStep] = React.useState(0);
   const NUMBER_OF_STEPS = 6;
@@ -34,8 +37,14 @@ const PengajuanTempo = () => {
     validateKontakPerson,
     updateFormKontakPerson,
   } = usePengajuanTempoStoreKontakPerson();
-  const { formSupplier, errorsSupplier, validateSupplier, updateFormSupplier } =
-    usePengajuanTempoStoreSupplier();
+  const {
+    formSupplier,
+    errorsSupplier,
+    validateSupplier,
+    updateFormSupplier,
+    hasSavedata,
+    updateHasSave,
+  } = usePengajuanTempoStoreSupplier();
   const {
     formPengiriman,
     errorsPengiriman,
@@ -90,31 +99,6 @@ const PengajuanTempo = () => {
     'Dokumen',
     'Konfirmasi',
   ];
-  const combineForms = () => {
-    return stepDivsForm.reduce((accumulator, currentForm, index) => {
-      if (currentForm && typeof currentForm === 'object') {
-        if (index === 3) {
-          if (!accumulator.formSupplier) {
-            accumulator.formSupplier = [];
-          }
-          accumulator.formSupplier.push(...currentForm);
-        } else {
-          return { ...accumulator, ...currentForm };
-        }
-      }
-      return accumulator;
-    }, {});
-  };
-
-  // const stepLabels = [
-  //   `${auth.partnerId}_informasi_perusahaan`,
-  //   `${auth.partnerId}_kontak_person`,
-  //   `${auth.partnerId}_Pengiriman`,
-  //   `${auth.partnerId}_Referensi`,
-  //   `${auth.partnerId}_Dokumen`,
-  //   `${auth.partnerId}_Konfirmasi`,
-  // ];
-
   const isFormValid = useMemo(
     () => Object.keys(stepDivsError[currentStep]).length === 0,
     [stepDivsError[currentStep]]
@@ -124,6 +108,7 @@ const PengajuanTempo = () => {
     validateKontakPerson();
     validatePengiriman();
     validateDokumen();
+    updateHasSave(false);
 
     window.scrollTo({
       top: 0,
@@ -134,11 +119,9 @@ const PengajuanTempo = () => {
   useEffect(() => {
     const cachedData = getFromLocalStorage(stepLabels[currentStep]);
     if (cachedData) {
-      // const formData = JSON.parse(cachedData);
       if (currentStep == 3) {
         stepDivsUpdateForm[currentStep](cachedData);
       } else if (currentStep == 4) {
-        // Memanggil updateFormDokumen dengan parameter yang benar
         Object.keys(cachedData).forEach((key) => {
           const { name, format, base64 } = cachedData[key];
           stepDivsUpdateForm[currentStep](key, name, format, base64);
@@ -149,8 +132,6 @@ const PengajuanTempo = () => {
         });
       }
     }
-    if (formSupplier) {
-    }
   }, [currentStep]);
   const goToNextStep = () => {
     if (!isFormValid) {
@@ -167,43 +148,39 @@ const PengajuanTempo = () => {
   const handleDaftarTempo = async () => {
     for (const error of stepDivsError) {
       if (error.length > 0) {
-        console.log('ada yang salah');
-        return; // Keluar dari fungsi jika ada error
+        return;
       }
     }
-    const combinedData = combineForms();
-    console.log('combinedData', combinedData);
-    const data = {
-      ...combinedData,
-      parent_id: auth.partnerId,
-    };
-
     const productOrder = formSupplier.map((product) => ({
       supplier: product.supplier,
       pic: product.pic,
       telepon: product.telepon,
-      quantitydurasiTempo: product.durasiTempo,
+      durasiTempo: product.durasiTempo,
       creditLimit: product.creditLimit,
     }));
+
+    const formattedDokumen = Object.entries(formDokumen).map(([key, doc]) => ({
+      documentName: key,
+      details: {
+        name: doc.name,
+        format: doc.format,
+        base64: doc.base64,
+      },
+    }));
     const data2 = {
-      form: JSON.stringify(productOrder),
-      parent_id: auth.partnerId,
+      ...form,
+      ...formKontakPerson,
+      ...formPengiriman,
+      formDocs: JSON.stringify(formattedDokumen),
+      formSupplier: JSON.stringify(productOrder),
+      user_id: auth.id,
     };
-    const address = await createPengajuanTempoApi({ combinedData });
-
-    console.log('Sukses Daftar');
-    // router.push('/pengajuan-tempo/finish?tempo_id=SO-2023-06480');
-
-    // if (!isFormValid) {
-    //   setNotValid(true);
-    //   setButtonSubmitClick(!buttonSubmitClick);
-    //   return;
-    // } else {
-    //   saveToLocalStorage(stepLabels[currentStep], stepDivsForm[currentStep]);
-    //   setButtonSubmitClick(!buttonSubmitClick);
-    //   setNotValid(false);
-    // }
-    // setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev + 1));
+    const address = await createPengajuanTempoApi(data2);
+    if (address) {
+      removeFromLocalStorage();
+      toast.success('Pengajuan tempo berhasil dilakukan', { duration: 4000 });
+      router.push('/pengajuan-tempo/finish?tempo_id=SO-2023-06480');
+    }
   };
 
   const goToPreviousStep = () => {
@@ -221,6 +198,11 @@ const PengajuanTempo = () => {
     const item = JSON.parse(itemStr);
     return item;
   };
+  const removeFromLocalStorage = () => {
+    for (const key of stepLabels) {
+      localStorage.removeItem(key);
+    }
+  };
 
   return (
     <>
@@ -241,43 +223,35 @@ const PengajuanTempo = () => {
           <Stepper currentStep={currentStep} numberOfSteps={NUMBER_OF_STEPS} />
         </div>
         <div>{stepDivs[currentStep]}</div>
-        <section className='flex gap-10 mt-10'>
-          {/* <button
-            onClick={goToNextStep}
-            className='bg-blue-600 text-white p-2 rounded-md'
-            disabled={currentStep === NUMBER_OF_STEPS - 1} // Disable if on the last step
-            >
-            Next step
-            </button> */}
-        </section>
+        <section className='flex gap-10 mt-10'></section>
         <div className='flex flex-row justify-end items-center gap-4 mb-8'>
           <span className='text-xs opacity-60'>
             *Pastikan data yang anda masukan sudah benar dan sesuai
           </span>
-          {/* <button
-            onClick={goToPreviousStep}
-            className='bg-red-600 border border-red-600 rounded-md text-sm text-white p-2 h-11 mb-1 content-center flex flex-row justify-center items-center'
-            disabled={currentStep === 0} // Disable if on the first step
-          >
-            {<ChevronLeftIcon className='w-5' />}
-            Langkah Sebelumnya
-          </button> */}
           {currentStep < 5 && (
-            <button
-              onClick={goToNextStep}
-              disabled={currentStep === NUMBER_OF_STEPS - 1}
-              className='bg-red-600 border border-red-600 rounded-md text-sm text-white p-2 h-11 mb-1 content-center flex flex-row justify-center items-center'
+            <Tooltip
+              label={clsxm({
+                'Klik simpan data terlebih dahulu':
+                  currentStep === 3 && !hasSavedata,
+              })}
             >
-              Langkah Selanjutnya {<ChevronRightIcon className='w-5' />}
-            </button>
+              <Button
+                colorScheme='red'
+                w='fit'
+                isDisabled={
+                  (currentStep === 3 && !hasSavedata) ||
+                  currentStep === NUMBER_OF_STEPS - 1
+                }
+                onClick={goToNextStep}
+              >
+                Langkah Selanjutnya {<ChevronRightIcon className='w-5' />}
+              </Button>
+            </Tooltip>
           )}
           {currentStep == 5 && (
-            <button
-              onClick={handleDaftarTempo}
-              className='bg-red-600 border border-red-600 rounded-md text-sm text-white p-2 h-11 mb-1 content-center flex flex-row justify-center items-center'
-            >
+            <Button colorScheme='red' w='fit' onClick={handleDaftarTempo}>
               Daftar Tempo {<ChevronRightIcon className='w-5' />}
-            </button>
+            </Button>
           )}
         </div>
       </div>
-- 
cgit v1.2.3


From 803d93cd36abdf5de5882ba9e9cda24e9a32ab80 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 31 Oct 2024 16:07:18 +0700
Subject: update pengajuan tempo fix suplier ids

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 11079328..b811e736 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -177,8 +177,8 @@ const PengajuanTempo = () => {
     };
     const address = await createPengajuanTempoApi(data2);
     if (address) {
-      removeFromLocalStorage();
-      toast.success('Pengajuan tempo berhasil dilakukan', { duration: 4000 });
+      toast.success('Pengajuan tempo berhasil dilakukan');
+      // removeFromLocalStorage();
       router.push('/pengajuan-tempo/finish?tempo_id=SO-2023-06480');
     }
   };
-- 
cgit v1.2.3


From 37ab7c5ac682e3a2ddb4153d4f7cb91593a77fe4 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 31 Oct 2024 16:39:11 +0700
Subject: <iman> update code

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 33 +++++++++++++++++-----
 1 file changed, 26 insertions(+), 7 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index b811e736..74dbedf3 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -1,7 +1,7 @@
 import React from 'react';
 import { useMemo, useState, useEffect, useRef } from 'react';
 import Stepper from './Stepper';
-import InformasiPerusahaan from './informasiPerusahaan';
+import InformasiPerusahaan from './InformasiPerusahaan';
 import KontakPerusahaan from './KontakPerusahaan';
 import Pengiriman from './Pengiriman';
 import Referensi from './Referensi';
@@ -55,25 +55,44 @@ const PengajuanTempo = () => {
   const [buttonSubmitClick, setButtonSubmitClick] = useState(false);
   const stepDivs = [
     <InformasiPerusahaan
+      key='informasi-perusahaan'
       chekValid={notValid}
       buttonSubmitClick={buttonSubmitClick}
     />,
     <KontakPerusahaan
+      key='kontak-perusahaan'
+      chekValid={notValid}
+      buttonSubmitClick={buttonSubmitClick}
+    />,
+    <Pengiriman
+      key='pengiriman'
+      chekValid={notValid}
+      buttonSubmitClick={buttonSubmitClick}
+    />,
+    <Referensi
+      key='referensi'
+      chekValid={notValid}
+      buttonSubmitClick={buttonSubmitClick}
+    />,
+    <Dokumen
+      key='dokumen'
+      chekValid={notValid}
+      buttonSubmitClick={buttonSubmitClick}
+    />,
+    <Konfirmasi
+      key='konfirmasi'
       chekValid={notValid}
       buttonSubmitClick={buttonSubmitClick}
     />,
-    <Pengiriman chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
-    <Referensi chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
-    <Dokumen chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
-    <Konfirmasi chekValid={notValid} buttonSubmitClick={buttonSubmitClick} />,
   ];
+
   const stepDivsError = [
     errors,
     errorsKontakPerson,
     errorsPengiriman,
     errorsSupplier,
     errorsDokumen,
-    <div>Konfirmasi</div>,
+    <div key='konfirmasi'>Konfirmasi</div>,
   ];
   const stepDivsForm = [
     form,
@@ -89,7 +108,7 @@ const PengajuanTempo = () => {
     updateFormPengiriman,
     updateFormSupplier,
     updateFormDokumen,
-    <div>Konfirmasi</div>,
+    <div key='konfirmasi'>Konfirmasi</div>,
   ];
   const stepLabels = [
     'informasi_perusahaan',
-- 
cgit v1.2.3


From 5e3b8914037fcd7b5153d94f289079ac4dd60235 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 1 Nov 2024 09:35:35 +0700
Subject: <iman> update pengajuan tempo

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 74dbedf3..a3c0236c 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -1,7 +1,7 @@
 import React from 'react';
 import { useMemo, useState, useEffect, useRef } from 'react';
 import Stepper from './Stepper';
-import InformasiPerusahaan from './InformasiPerusahaan';
+import InformasiPerusahaan from './informasiPerusahaan';
 import KontakPerusahaan from './KontakPerusahaan';
 import Pengiriman from './Pengiriman';
 import Referensi from './Referensi';
-- 
cgit v1.2.3


From 0cabc5303cbda27eeed3003ee3d4300291946f8d Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 1 Nov 2024 09:45:02 +0700
Subject: <iman> add validate

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index a3c0236c..7cc85b44 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -151,6 +151,11 @@ const PengajuanTempo = () => {
         });
       }
     }
+    validate();
+    validateKontakPerson();
+    validatePengiriman();
+    validateDokumen();
+    updateHasSave(false);
   }, [currentStep]);
   const goToNextStep = () => {
     if (!isFormValid) {
-- 
cgit v1.2.3


From ff388c53fcd23d108ae81b055caf59ec9e731617 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 1 Nov 2024 09:58:20 +0700
Subject: <iman> edit code

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 1 +
 1 file changed, 1 insertion(+)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 7cc85b44..5c88e9bf 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -172,6 +172,7 @@ const PengajuanTempo = () => {
   const handleDaftarTempo = async () => {
     for (const error of stepDivsError) {
       if (error.length > 0) {
+        console.log('error', error);
         return;
       }
     }
-- 
cgit v1.2.3


From cab54d311cd5e89bee34a1bbbfa46bca6b077882 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 1 Nov 2024 10:51:20 +0700
Subject: <iman> update error to large requesr

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 62 +++++++++++++++++++---
 1 file changed, 55 insertions(+), 7 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 5c88e9bf..772807a2 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -25,6 +25,7 @@ import { toast } from 'react-hot-toast';
 const PengajuanTempo = () => {
   const [currentStep, setCurrentStep] = React.useState(0);
   const NUMBER_OF_STEPS = 6;
+  const [isLoading, setIsLoading] = useState(false);
   const { form, errors, validate, updateForm } = usePengajuanTempoStore();
   const { control, watch, setValue } = useForm();
   const auth = useAuth();
@@ -169,10 +170,41 @@ const PengajuanTempo = () => {
     }
     setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev + 1));
   };
+
+  const splitDataAndSend = async (data, partSize = 50000) => {
+    const totalDataSize = JSON.stringify(data).length;
+
+    if (totalDataSize <= partSize) {
+      return await createPengajuanTempoApi(data);
+    }
+    const dataParts = [];
+    let currentIndex = 0;
+
+    while (currentIndex < totalDataSize) {
+      const part = JSON.stringify(data).slice(
+        currentIndex,
+        currentIndex + partSize
+      );
+      dataParts.push(part);
+      currentIndex += partSize;
+    }
+
+    const responses = [];
+    for (let i = 0; i < dataParts.length; i++) {
+      const partData = {
+        data: dataParts[i],
+        part: i + 1,
+        totalParts: dataParts.length,
+      };
+      responses.push(await createPengajuanTempoApi(partData));
+    }
+
+    return responses;
+  };
+
   const handleDaftarTempo = async () => {
     for (const error of stepDivsError) {
       if (error.length > 0) {
-        console.log('error', error);
         return;
       }
     }
@@ -200,11 +232,24 @@ const PengajuanTempo = () => {
       formSupplier: JSON.stringify(productOrder),
       user_id: auth.id,
     };
-    const address = await createPengajuanTempoApi(data2);
-    if (address) {
-      toast.success('Pengajuan tempo berhasil dilakukan');
-      // removeFromLocalStorage();
-      router.push('/pengajuan-tempo/finish?tempo_id=SO-2023-06480');
+    const toastId = toast.loading('Mengirimkan formulir pengajuan tempo...');
+    setIsLoading(true);
+    try {
+      const address = await splitDataAndSend(data2);
+      toast.dismiss(toastId);
+      setIsLoading(false);
+
+      if (address) {
+        toast.success('Pengajuan tempo berhasil dilakukan');
+        // removeFromLocalStorage();
+        router.push('/pengajuan-tempo/finish?tempo_id=SO-2023-06480');
+      }
+    } catch (error) {
+      toast.dismiss(toastId);
+      setIsLoading(false);
+
+      toast.error('Terjadi kesalahan dalam pengiriman formulir');
+      console.error(error);
     }
   };
 
@@ -243,7 +288,10 @@ const PengajuanTempo = () => {
         </p>
       </div>
       <div className='h-[2px] w-full mb-20 bg-gray_r-3' />
-      <div className='container mt-10 flex flex-col '>
+      {isLoading && (
+        <div className='fixed inset-0 bg-black bg-opacity-10 flex items-center justify-center z-[999] backdrop-blur-sm'></div>
+      )}
+      <div className='container mt-10 flex flex-col'>
         <div className='flex items-center justify-center'>
           <Stepper currentStep={currentStep} numberOfSteps={NUMBER_OF_STEPS} />
         </div>
-- 
cgit v1.2.3


From d1a5c71e886d2a4ac208eb49e12f269ef1b87c2a Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 1 Nov 2024 11:03:59 +0700
Subject: remove blur

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 772807a2..4d5207c2 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -288,9 +288,7 @@ const PengajuanTempo = () => {
         </p>
       </div>
       <div className='h-[2px] w-full mb-20 bg-gray_r-3' />
-      {isLoading && (
-        <div className='fixed inset-0 bg-black bg-opacity-10 flex items-center justify-center z-[999] backdrop-blur-sm'></div>
-      )}
+
       <div className='container mt-10 flex flex-col'>
         <div className='flex items-center justify-center'>
           <Stepper currentStep={currentStep} numberOfSteps={NUMBER_OF_STEPS} />
-- 
cgit v1.2.3


From 0c48c602edb0ffb33e6259a774a2aad0fff75713 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 1 Nov 2024 15:45:02 +0700
Subject: <iman> update pengajuan tempo

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 72 ++++++++++++----------
 1 file changed, 38 insertions(+), 34 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 4d5207c2..04797c5f 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -171,37 +171,6 @@ const PengajuanTempo = () => {
     setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev + 1));
   };
 
-  const splitDataAndSend = async (data, partSize = 50000) => {
-    const totalDataSize = JSON.stringify(data).length;
-
-    if (totalDataSize <= partSize) {
-      return await createPengajuanTempoApi(data);
-    }
-    const dataParts = [];
-    let currentIndex = 0;
-
-    while (currentIndex < totalDataSize) {
-      const part = JSON.stringify(data).slice(
-        currentIndex,
-        currentIndex + partSize
-      );
-      dataParts.push(part);
-      currentIndex += partSize;
-    }
-
-    const responses = [];
-    for (let i = 0; i < dataParts.length; i++) {
-      const partData = {
-        data: dataParts[i],
-        part: i + 1,
-        totalParts: dataParts.length,
-      };
-      responses.push(await createPengajuanTempoApi(partData));
-    }
-
-    return responses;
-  };
-
   const handleDaftarTempo = async () => {
     for (const error of stepDivsError) {
       if (error.length > 0) {
@@ -224,22 +193,57 @@ const PengajuanTempo = () => {
         base64: doc.base64,
       },
     }));
+
     const data2 = {
+      user_id: auth.id,
       ...form,
       ...formKontakPerson,
       ...formPengiriman,
       formDocs: JSON.stringify(formattedDokumen),
       formSupplier: JSON.stringify(productOrder),
-      user_id: auth.id,
     };
     const toastId = toast.loading('Mengirimkan formulir pengajuan tempo...');
     setIsLoading(true);
     try {
-      const address = await splitDataAndSend(data2);
+      let address5;
+      const address = await createPengajuanTempoApi({
+        id: '0',
+        user_id: auth.id,
+        ...form,
+      });
+      if (address.id) {
+        const address2 = await createPengajuanTempoApi({
+          id: address.id,
+          user_id: address.userId,
+          ...formKontakPerson,
+        });
+        if (address2.id) {
+          const address3 = await createPengajuanTempoApi({
+            id: address2.id,
+            user_id: address2.userId,
+            ...formPengiriman,
+          });
+          if (address3.id) {
+            const address4 = await createPengajuanTempoApi({
+              id: address3.id,
+              user_id: address3.userId,
+              formDocs: JSON.stringify(formattedDokumen),
+            });
+            if (address4.id) {
+              address5 = await createPengajuanTempoApi({
+                id: address4.id,
+                user_id: address4.userId,
+                tempo_request: true,
+                formSupplier: JSON.stringify(productOrder),
+              });
+            }
+          }
+        }
+      }
       toast.dismiss(toastId);
       setIsLoading(false);
 
-      if (address) {
+      if (address5.id) {
         toast.success('Pengajuan tempo berhasil dilakukan');
         // removeFromLocalStorage();
         router.push('/pengajuan-tempo/finish?tempo_id=SO-2023-06480');
-- 
cgit v1.2.3


From 3550c262e5eeb1b861ae100cd26ae853c7f153fe Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 4 Nov 2024 14:25:02 +0700
Subject: <iman> update pengajuan tempo mobile 80%

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 04797c5f..7ed208db 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -22,7 +22,9 @@ import createPengajuanTempoApi from '../api/createPengajuanTempoApi';
 import { Button, Checkbox, Spinner, Tooltip } from '@chakra-ui/react';
 import clsxm from '~/libs/clsxm';
 import { toast } from 'react-hot-toast';
+import useDevice from '@/core/hooks/useDevice';
 const PengajuanTempo = () => {
+  const { isDesktop, isMobile } = useDevice();
   const [currentStep, setCurrentStep] = React.useState(0);
   const NUMBER_OF_STEPS = 6;
   const [isLoading, setIsLoading] = useState(false);
@@ -298,8 +300,17 @@ const PengajuanTempo = () => {
           <Stepper currentStep={currentStep} numberOfSteps={NUMBER_OF_STEPS} />
         </div>
         <div>{stepDivs[currentStep]}</div>
-        <section className='flex gap-10 mt-10'></section>
-        <div className='flex flex-row justify-end items-center gap-4 mb-8'>
+        {isDesktop && <section className='flex gap-10 mt-10'></section>}
+        {isMobile && (
+          <div className='h-[2px] bg-gray-300 w-[120%] inset-0 mt-4 mb-4 relative transform -translate-x-5'></div>
+        )}
+        <div
+          className={`flex ${
+            isMobile
+              ? 'flex-col justify-start items-start'
+              : 'flex-row justify-end items-center'
+          }   gap-4 mb-8`}
+        >
           <span className='text-xs opacity-60'>
             *Pastikan data yang anda masukan sudah benar dan sesuai
           </span>
@@ -312,7 +323,7 @@ const PengajuanTempo = () => {
             >
               <Button
                 colorScheme='red'
-                w='fit'
+                w={`${isMobile ? 'full' : 'fit'}`}
                 isDisabled={
                   (currentStep === 3 && !hasSavedata) ||
                   currentStep === NUMBER_OF_STEPS - 1
-- 
cgit v1.2.3


From f751fa6d398a8aab96380c832da927c60c6ccbe4 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 4 Nov 2024 16:10:09 +0700
Subject: <iman> update pengajuan tempo mobile view fix

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 7ed208db..d0e1fcc6 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -335,7 +335,11 @@ const PengajuanTempo = () => {
             </Tooltip>
           )}
           {currentStep == 5 && (
-            <Button colorScheme='red' w='fit' onClick={handleDaftarTempo}>
+            <Button
+              colorScheme='red'
+              w={`${isMobile ? 'full' : 'fit'}`}
+              onClick={handleDaftarTempo}
+            >
               Daftar Tempo {<ChevronRightIcon className='w-5' />}
             </Button>
           )}
-- 
cgit v1.2.3


From 6bbf1dbd94355f34f58f4b72f134f3dbeac776aa Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Sat, 23 Nov 2024 11:55:59 +0700
Subject: <iman> update tempo

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 228 +++++++++++++++++++--
 1 file changed, 210 insertions(+), 18 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index d0e1fcc6..fc558b01 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -7,7 +7,7 @@ import Pengiriman from './Pengiriman';
 import Referensi from './Referensi';
 import Dokumen from './Dokumen';
 import Konfirmasi from './Konfirmasi';
-import useAuth from '@/core/hooks/useAuth';
+import { getAuth } from '~/libs/auth';
 import { useRouter } from 'next/router';
 import { Controller, useForm } from 'react-hook-form';
 import {
@@ -23,14 +23,17 @@ import { Button, Checkbox, Spinner, Tooltip } from '@chakra-ui/react';
 import clsxm from '~/libs/clsxm';
 import { toast } from 'react-hot-toast';
 import useDevice from '@/core/hooks/useDevice';
+import odooApi from '~/libs/odooApi';
 const PengajuanTempo = () => {
   const { isDesktop, isMobile } = useDevice();
   const [currentStep, setCurrentStep] = React.useState(0);
   const NUMBER_OF_STEPS = 6;
   const [isLoading, setIsLoading] = useState(false);
+  const [bigData, setBigData] = useState();
+  const [idTempo, setIdTempo] = useState(0);
   const { form, errors, validate, updateForm } = usePengajuanTempoStore();
   const { control, watch, setValue } = useForm();
-  const auth = useAuth();
+  const auth = getAuth();
   const router = useRouter();
   const { formDokumen, errorsDokumen, validateDokumen, updateFormDokumen } =
     usePengajuanTempoStoreDokumen();
@@ -131,48 +134,230 @@ const PengajuanTempo = () => {
     validatePengiriman();
     validateDokumen();
     updateHasSave(false);
-
+    if (isFormValid) {
+      window.scrollTo({
+        top: 0,
+        behavior: 'smooth',
+      });
+    }
+  }, [currentStep, buttonSubmitClick]);
+  useEffect(() => {
     window.scrollTo({
       top: 0,
       behavior: 'smooth',
     });
-  }, [currentStep, buttonSubmitClick]);
+  }, [currentStep]);
 
   useEffect(() => {
-    const cachedData = getFromLocalStorage(stepLabels[currentStep]);
+    const loadBigData = async () => {
+      const toCamelCase = (str) =>
+        str.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
+
+      const transformKeysToCamelCase = (data) => {
+        if (Array.isArray(data)) {
+          return data.map((item) => transformKeysToCamelCase(item));
+        } else if (data && typeof data === 'object') {
+          return Object.keys(data).reduce((acc, key) => {
+            const camelKey = toCamelCase(key); // Ubah kunci menjadi camelCase
+            acc[camelKey] = transformKeysToCamelCase(data[key]); // Rekursif untuk nested object atau array
+            return acc;
+          }, {});
+        }
+        return data; // Jika bukan object atau array, kembalikan nilai aslinya
+      };
+
+      try {
+        const dataPaymentTerm = await odooApi(
+          'GET',
+          `/api/v1/partner/detail-tempo/${auth.parentId}`
+        );
+
+        console.log('Original dataPaymentTerm', dataPaymentTerm);
+
+        const transformedData = transformKeysToCamelCase(dataPaymentTerm);
+
+        console.log('Transformed dataPaymentTerm', transformedData);
+
+        setBigData(transformedData);
+      } catch (error) {
+        console.error('Error loading dataPaymentTerm:', error);
+      }
+    };
+
+    loadBigData();
+  }, []);
+
+  console.log('bigData', bigData);
+
+  useEffect(() => {
+    const cachedData = bigData;
+    console.log('data_lama', getFromLocalStorage(stepLabels[currentStep]));
+    console.log('cachedData', cachedData);
+
     if (cachedData) {
-      if (currentStep == 3) {
+      // Ambil kunci-kunci yang relevan berdasarkan currentStep dari stepDivsForm
+      const formKeys = stepDivsForm[currentStep]
+        ? Object.keys(stepDivsForm[currentStep])
+        : [];
+      console.log('formKeys', formKeys);
+      if (currentStep === 3) {
         stepDivsUpdateForm[currentStep](cachedData);
-      } else if (currentStep == 4) {
-        Object.keys(cachedData).forEach((key) => {
-          const { name, format, base64 } = cachedData[key];
-          stepDivsUpdateForm[currentStep](key, name, format, base64);
+      } else if (currentStep === 4) {
+        formKeys.forEach((key) => {
+          if (cachedData[key]) {
+            // Proses hanya kunci yang ada di cachedData
+            const { name, format, base64 } = cachedData[key];
+            stepDivsUpdateForm[currentStep](key, name, format, base64);
+          }
         });
       } else {
-        Object.keys(cachedData).forEach((key) => {
-          stepDivsUpdateForm[currentStep](key, cachedData[key]);
+        formKeys.forEach((key) => {
+          if (cachedData[key]) {
+            // Ubah data menjadi string
+            const stringData =
+              typeof cachedData[key] === 'object'
+                ? JSON.stringify(cachedData[key]) // Untuk objek atau array
+                : String(cachedData[key]); // Untuk tipe primitif
+
+            // Kirim data yang sudah diubah ke string ke stepDivsUpdateForm
+            stepDivsUpdateForm[currentStep](key, stringData);
+          }
         });
       }
     }
+
     validate();
     validateKontakPerson();
     validatePengiriman();
     validateDokumen();
     updateHasSave(false);
-  }, [currentStep]);
+  }, [currentStep, bigData]);
+
   const goToNextStep = () => {
     if (!isFormValid) {
       setNotValid(true);
       setButtonSubmitClick(!buttonSubmitClick);
       return;
     } else {
-      saveToLocalStorage(stepLabels[currentStep], stepDivsForm[currentStep]);
+      // saveToLocalStorage(stepLabels[currentStep], stepDivsForm[currentStep]);
+      if (currentStep == 3) {
+        handleDaftarTempoSupplier();
+      } else if (currentStep == 4) {
+        handleDaftarTempoDokumen();
+      } else {
+        handleDaftarTempoPerPage(
+          stepLabels[currentStep],
+          stepDivsForm[currentStep]
+        );
+      }
       setButtonSubmitClick(!buttonSubmitClick);
       setNotValid(false);
     }
     setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev + 1));
   };
 
+  const handleDaftarTempoPerPage = async (
+    label,
+    formData,
+    tempoRequest = false
+  ) => {
+    for (const error of stepDivsError) {
+      if (error.length > 0) {
+        return;
+      }
+    }
+    const toastId = toast.loading('Mengirimkan formulir pengajuan tempo...');
+    setIsLoading(true);
+    try {
+      const address = await createPengajuanTempoApi({
+        id: idTempo,
+        user_id: auth.parentId,
+        section: label,
+        tempo_request: tempoRequest,
+        ...formData,
+      });
+      if (address.id) {
+        setIdTempo(address.id);
+      }
+      toast.dismiss(toastId);
+      setIsLoading(false);
+    } catch (error) {
+      toast.dismiss(toastId);
+      setIsLoading(false);
+
+      toast.error('Terjadi kesalahan dalam pengiriman formulir');
+      console.error(error);
+    }
+  };
+  const handleDaftarTempoDokumen = async () => {
+    for (const error of stepDivsError) {
+      if (error.length > 0) {
+        return;
+      }
+    }
+    const formattedDokumen = Object.entries(formDokumen).map(([key, doc]) => ({
+      documentName: key,
+      details: {
+        name: doc.name,
+        format: doc.format,
+        base64: doc.base64,
+      },
+    }));
+    const toastId = toast.loading('Mengirimkan formulir pengajuan tempo...');
+    setIsLoading(true);
+    try {
+      const address = await createPengajuanTempoApi({
+        id: idTempo,
+        user_id: auth.parentId,
+        formDocs: JSON.stringify(formattedDokumen),
+      });
+      if (address.id) {
+        setIdTempo(address.id);
+      }
+      toast.dismiss(toastId);
+      setIsLoading(false);
+    } catch (error) {
+      toast.dismiss(toastId);
+      setIsLoading(false);
+
+      toast.error('Terjadi kesalahan dalam pengiriman formulir');
+      console.error(error);
+    }
+  };
+  const handleDaftarTempoSupplier = async () => {
+    for (const error of stepDivsError) {
+      if (error.length > 0) {
+        return;
+      }
+    }
+    const productOrder = formSupplier.map((product) => ({
+      supplier: product.supplier,
+      pic: product.pic,
+      telepon: product.telepon,
+      durasiTempo: product.durasiTempo,
+      creditLimit: product.creditLimit,
+    }));
+    const toastId = toast.loading('Mengirimkan formulir pengajuan tempo...');
+    setIsLoading(true);
+    try {
+      const address = await createPengajuanTempoApi({
+        id: idTempo,
+        user_id: auth.parentId,
+        formDocs: JSON.stringify(productOrder),
+      });
+      if (address.id) {
+        setIdTempo(address.id);
+      }
+      toast.dismiss(toastId);
+      setIsLoading(false);
+    } catch (error) {
+      toast.dismiss(toastId);
+      setIsLoading(false);
+
+      toast.error('Terjadi kesalahan dalam pengiriman formulir');
+      console.error(error);
+    }
+  };
   const handleDaftarTempo = async () => {
     for (const error of stepDivsError) {
       if (error.length > 0) {
@@ -195,6 +380,11 @@ const PengajuanTempo = () => {
         base64: doc.base64,
       },
     }));
+    if (currentStep == 3) {
+      formData = JSON.stringify(productOrder);
+    } else if (currentStep == 4) {
+      formData = JSON.stringify(formattedDokumen);
+    }
 
     const data2 = {
       user_id: auth.id,
@@ -209,8 +399,10 @@ const PengajuanTempo = () => {
     try {
       let address5;
       const address = await createPengajuanTempoApi({
-        id: '0',
-        user_id: auth.id,
+        id: 0,
+        user_id: auth.parentId,
+        section: label,
+        tempo_request: tempoRequest,
         ...form,
       });
       if (address.id) {
@@ -247,7 +439,7 @@ const PengajuanTempo = () => {
 
       if (address5.id) {
         toast.success('Pengajuan tempo berhasil dilakukan');
-        // removeFromLocalStorage();
+        removeFromLocalStorage();
         router.push('/pengajuan-tempo/finish?tempo_id=SO-2023-06480');
       }
     } catch (error) {
@@ -338,7 +530,7 @@ const PengajuanTempo = () => {
             <Button
               colorScheme='red'
               w={`${isMobile ? 'full' : 'fit'}`}
-              onClick={handleDaftarTempo}
+              onClick={handleDaftarTempo()}
             >
               Daftar Tempo {<ChevronRightIcon className='w-5' />}
             </Button>
-- 
cgit v1.2.3


From 654fbb128ab331c3272d6e8733dda1b5b71f4253 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 25 Nov 2024 10:05:02 +0700
Subject: <iman> update pengajuan tempo

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index fc558b01..952c4244 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -343,7 +343,7 @@ const PengajuanTempo = () => {
       const address = await createPengajuanTempoApi({
         id: idTempo,
         user_id: auth.parentId,
-        formDocs: JSON.stringify(productOrder),
+        formSupplier: JSON.stringify(productOrder),
       });
       if (address.id) {
         setIdTempo(address.id);
@@ -530,7 +530,7 @@ const PengajuanTempo = () => {
             <Button
               colorScheme='red'
               w={`${isMobile ? 'full' : 'fit'}`}
-              onClick={handleDaftarTempo()}
+              onClick={handleDaftarTempo}
             >
               Daftar Tempo {<ChevronRightIcon className='w-5' />}
             </Button>
-- 
cgit v1.2.3


From 494909f40b918e4273d6258a74f12ac42253a4a7 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 25 Nov 2024 17:04:51 +0700
Subject: <iman> pengajuan tempo

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 952c4244..ab66f94f 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -79,6 +79,7 @@ const PengajuanTempo = () => {
       key='referensi'
       chekValid={notValid}
       buttonSubmitClick={buttonSubmitClick}
+      data={bigData?.supplierIds}
     />,
     <Dokumen
       key='dokumen'
@@ -192,7 +193,6 @@ const PengajuanTempo = () => {
   useEffect(() => {
     const cachedData = bigData;
     console.log('data_lama', getFromLocalStorage(stepLabels[currentStep]));
-    console.log('cachedData', cachedData);
 
     if (cachedData) {
       // Ambil kunci-kunci yang relevan berdasarkan currentStep dari stepDivsForm
@@ -201,7 +201,8 @@ const PengajuanTempo = () => {
         : [];
       console.log('formKeys', formKeys);
       if (currentStep === 3) {
-        stepDivsUpdateForm[currentStep](cachedData);
+        console.log('cachedData', cachedData.supplierIds[0]);
+        stepDivsUpdateForm[currentStep](cachedData.supplierIds);
       } else if (currentStep === 4) {
         formKeys.forEach((key) => {
           if (cachedData[key]) {
@@ -230,6 +231,7 @@ const PengajuanTempo = () => {
     validateKontakPerson();
     validatePengiriman();
     validateDokumen();
+    validateSupplier();
     updateHasSave(false);
   }, [currentStep, bigData]);
 
@@ -292,6 +294,7 @@ const PengajuanTempo = () => {
   const handleDaftarTempoDokumen = async () => {
     for (const error of stepDivsError) {
       if (error.length > 0) {
+        console.log('iman_erro', error);
         return;
       }
     }
@@ -337,6 +340,7 @@ const PengajuanTempo = () => {
       durasiTempo: product.durasiTempo,
       creditLimit: product.creditLimit,
     }));
+    console.log('productOrder', productOrder);
     const toastId = toast.loading('Mengirimkan formulir pengajuan tempo...');
     setIsLoading(true);
     try {
@@ -344,6 +348,7 @@ const PengajuanTempo = () => {
         id: idTempo,
         user_id: auth.parentId,
         formSupplier: JSON.stringify(productOrder),
+        section,
       });
       if (address.id) {
         setIdTempo(address.id);
@@ -380,11 +385,6 @@ const PengajuanTempo = () => {
         base64: doc.base64,
       },
     }));
-    if (currentStep == 3) {
-      formData = JSON.stringify(productOrder);
-    } else if (currentStep == 4) {
-      formData = JSON.stringify(formattedDokumen);
-    }
 
     const data2 = {
       user_id: auth.id,
@@ -401,10 +401,10 @@ const PengajuanTempo = () => {
       const address = await createPengajuanTempoApi({
         id: 0,
         user_id: auth.parentId,
-        section: label,
         tempo_request: tempoRequest,
         ...form,
       });
+      console.log('address', address);
       if (address.id) {
         const address2 = await createPengajuanTempoApi({
           id: address.id,
-- 
cgit v1.2.3


From 77f9843ad5072583cb1797d7ecf5ac80394bad3f Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 2 Dec 2024 09:31:44 +0700
Subject: <iman> pengajuan tempo

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 43 ++++++++++++++++------
 1 file changed, 31 insertions(+), 12 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index ab66f94f..97e64030 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -8,6 +8,8 @@ import Referensi from './Referensi';
 import Dokumen from './Dokumen';
 import Konfirmasi from './Konfirmasi';
 import { getAuth } from '~/libs/auth';
+import { setAuth } from '@/core/utils/auth';
+import useAuth from '@/core/hooks/useAuth';
 import { useRouter } from 'next/router';
 import { Controller, useForm } from 'react-hook-form';
 import {
@@ -24,6 +26,7 @@ import clsxm from '~/libs/clsxm';
 import { toast } from 'react-hot-toast';
 import useDevice from '@/core/hooks/useDevice';
 import odooApi from '~/libs/odooApi';
+import editAuthTempo from '../api/editAuthTempo';
 const PengajuanTempo = () => {
   const { isDesktop, isMobile } = useDevice();
   const [currentStep, setCurrentStep] = React.useState(0);
@@ -33,7 +36,7 @@ const PengajuanTempo = () => {
   const [idTempo, setIdTempo] = useState(0);
   const { form, errors, validate, updateForm } = usePengajuanTempoStore();
   const { control, watch, setValue } = useForm();
-  const auth = getAuth();
+  const auth = useAuth();
   const router = useRouter();
   const { formDokumen, errorsDokumen, validateDokumen, updateFormDokumen } =
     usePengajuanTempoStoreDokumen();
@@ -363,6 +366,7 @@ const PengajuanTempo = () => {
       console.error(error);
     }
   };
+
   const handleDaftarTempo = async () => {
     for (const error of stepDivsError) {
       if (error.length > 0) {
@@ -386,46 +390,55 @@ const PengajuanTempo = () => {
       },
     }));
 
-    const data2 = {
-      user_id: auth.id,
-      ...form,
-      ...formKontakPerson,
-      ...formPengiriman,
-      formDocs: JSON.stringify(formattedDokumen),
-      formSupplier: JSON.stringify(productOrder),
-    };
+    // const data2 = {
+    //   user_id: auth.id,
+    //   ...form,
+    //   ...formKontakPerson,
+    //   ...formPengiriman,
+    //   formDocs: JSON.stringify(formattedDokumen),
+    //   formSupplier: JSON.stringify(productOrder),
+    // };
     const toastId = toast.loading('Mengirimkan formulir pengajuan tempo...');
     setIsLoading(true);
     try {
       let address5;
+      console.log('MASUK SINI');
       const address = await createPengajuanTempoApi({
         id: 0,
+        partner_id: auth.partnerId,
         user_id: auth.parentId,
-        tempo_request: tempoRequest,
+        tempo_request: false,
         ...form,
       });
       console.log('address', address);
       if (address.id) {
         const address2 = await createPengajuanTempoApi({
           id: address.id,
+          partner_id: auth.partnerId,
           user_id: address.userId,
+          tempo_request: false,
           ...formKontakPerson,
         });
         if (address2.id) {
           const address3 = await createPengajuanTempoApi({
             id: address2.id,
+            partner_id: auth.partnerId,
             user_id: address2.userId,
+            tempo_request: false,
             ...formPengiriman,
           });
           if (address3.id) {
             const address4 = await createPengajuanTempoApi({
               id: address3.id,
+              partner_id: auth.partnerId,
               user_id: address3.userId,
+              tempo_request: false,
               formDocs: JSON.stringify(formattedDokumen),
             });
             if (address4.id) {
               address5 = await createPengajuanTempoApi({
                 id: address4.id,
+                partner_id: auth.partnerId,
                 user_id: address4.userId,
                 tempo_request: true,
                 formSupplier: JSON.stringify(productOrder),
@@ -439,8 +452,14 @@ const PengajuanTempo = () => {
 
       if (address5.id) {
         toast.success('Pengajuan tempo berhasil dilakukan');
-        removeFromLocalStorage();
-        router.push('/pengajuan-tempo/finish?tempo_id=SO-2023-06480');
+        const isUpdated = await editAuthTempo();
+        if (isUpdated?.user) {
+          setAuth(isUpdated.user);
+          toast.success('Berhasil mengubah status akun', { duration: 1000 });
+          removeFromLocalStorage();
+          router.push('/pengajuan-tempo/finish?tempo_id=SO-2023-06480');
+          return;
+        }
       }
     } catch (error) {
       toast.dismiss(toastId);
-- 
cgit v1.2.3


From 9a49b8d84761781531cb417731cb9ef802f63541 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 4 Dec 2024 10:59:21 +0700
Subject: <iman> update pengajuan tempo

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 90 ++++++++++------------
 1 file changed, 39 insertions(+), 51 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 97e64030..1704556e 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -176,12 +176,6 @@ const PengajuanTempo = () => {
           `/api/v1/partner/detail-tempo/${auth.parentId}`
         );
 
-        console.log('Original dataPaymentTerm', dataPaymentTerm);
-
-        const transformedData = transformKeysToCamelCase(dataPaymentTerm);
-
-        console.log('Transformed dataPaymentTerm', transformedData);
-
         setBigData(transformedData);
       } catch (error) {
         console.error('Error loading dataPaymentTerm:', error);
@@ -189,54 +183,50 @@ const PengajuanTempo = () => {
     };
 
     loadBigData();
-  }, []);
-
-  console.log('bigData', bigData);
+  }, [auth]);
 
   useEffect(() => {
     const cachedData = bigData;
-    console.log('data_lama', getFromLocalStorage(stepLabels[currentStep]));
-
-    if (cachedData) {
-      // Ambil kunci-kunci yang relevan berdasarkan currentStep dari stepDivsForm
-      const formKeys = stepDivsForm[currentStep]
-        ? Object.keys(stepDivsForm[currentStep])
-        : [];
-      console.log('formKeys', formKeys);
-      if (currentStep === 3) {
-        console.log('cachedData', cachedData.supplierIds[0]);
-        stepDivsUpdateForm[currentStep](cachedData.supplierIds);
-      } else if (currentStep === 4) {
-        formKeys.forEach((key) => {
-          if (cachedData[key]) {
-            // Proses hanya kunci yang ada di cachedData
-            const { name, format, base64 } = cachedData[key];
-            stepDivsUpdateForm[currentStep](key, name, format, base64);
-          }
-        });
-      } else {
-        formKeys.forEach((key) => {
-          if (cachedData[key]) {
-            // Ubah data menjadi string
-            const stringData =
-              typeof cachedData[key] === 'object'
-                ? JSON.stringify(cachedData[key]) // Untuk objek atau array
-                : String(cachedData[key]); // Untuk tipe primitif
 
-            // Kirim data yang sudah diubah ke string ke stepDivsUpdateForm
-            stepDivsUpdateForm[currentStep](key, stringData);
-          }
-        });
+    const loadBigData = async () => {
+      if (cachedData) {
+        // Ambil kunci-kunci yang relevan berdasarkan currentStep dari stepDivsForm
+        const formKeys = stepDivsForm[currentStep]
+          ? Object.keys(stepDivsForm[currentStep])
+          : [];
+        if (currentStep === 3) {
+          stepDivsUpdateForm[currentStep](cachedData.supplierIds);
+        } else if (currentStep === 4) {
+          formKeys.forEach((key) => {
+            if (cachedData[key]) {
+              // Proses hanya kunci yang ada di cachedData
+              const { name, format, base64 } = cachedData[key];
+              stepDivsUpdateForm[currentStep](key, name, format, base64);
+            }
+          });
+        } else {
+          formKeys.forEach((key) => {
+            if (bigData[key]) {
+              // Ubah data menjadi string
+              const stringData =
+                typeof bigData[key] === 'object'
+                  ? JSON.stringify(bigData[key]) // Untuk objek atau array
+                  : String(bigData[key]); // Untuk tipe primitif
+              // Kirim data yang sudah diubah ke string ke stepDivsUpdateForm
+              stepDivsUpdateForm[currentStep](key, stringData);
+            }
+          });
+        }
       }
-    }
-
+    };
+    loadBigData();
     validate();
     validateKontakPerson();
     validatePengiriman();
     validateDokumen();
     validateSupplier();
     updateHasSave(false);
-  }, [currentStep, bigData]);
+  }, [currentStep, bigData, auth]);
 
   const goToNextStep = () => {
     if (!isFormValid) {
@@ -277,6 +267,7 @@ const PengajuanTempo = () => {
       const address = await createPengajuanTempoApi({
         id: idTempo,
         user_id: auth.parentId,
+        partner_id: auth.partnerId,
         section: label,
         tempo_request: tempoRequest,
         ...formData,
@@ -297,7 +288,6 @@ const PengajuanTempo = () => {
   const handleDaftarTempoDokumen = async () => {
     for (const error of stepDivsError) {
       if (error.length > 0) {
-        console.log('iman_erro', error);
         return;
       }
     }
@@ -315,6 +305,7 @@ const PengajuanTempo = () => {
       const address = await createPengajuanTempoApi({
         id: idTempo,
         user_id: auth.parentId,
+        partner_id: auth.partnerId,
         formDocs: JSON.stringify(formattedDokumen),
       });
       if (address.id) {
@@ -343,15 +334,14 @@ const PengajuanTempo = () => {
       durasiTempo: product.durasiTempo,
       creditLimit: product.creditLimit,
     }));
-    console.log('productOrder', productOrder);
     const toastId = toast.loading('Mengirimkan formulir pengajuan tempo...');
     setIsLoading(true);
     try {
       const address = await createPengajuanTempoApi({
         id: idTempo,
         user_id: auth.parentId,
+        partner_id: auth.partnerId,
         formSupplier: JSON.stringify(productOrder),
-        section,
       });
       if (address.id) {
         setIdTempo(address.id);
@@ -402,7 +392,6 @@ const PengajuanTempo = () => {
     setIsLoading(true);
     try {
       let address5;
-      console.log('MASUK SINI');
       const address = await createPengajuanTempoApi({
         id: 0,
         partner_id: auth.partnerId,
@@ -410,7 +399,6 @@ const PengajuanTempo = () => {
         tempo_request: false,
         ...form,
       });
-      console.log('address', address);
       if (address.id) {
         const address2 = await createPengajuanTempoApi({
           id: address.id,
@@ -447,12 +435,12 @@ const PengajuanTempo = () => {
           }
         }
       }
-      toast.dismiss(toastId);
-      setIsLoading(false);
 
       if (address5.id) {
-        toast.success('Pengajuan tempo berhasil dilakukan');
         const isUpdated = await editAuthTempo();
+        toast.dismiss(toastId);
+        setIsLoading(false);
+        toast.success('Pengajuan tempo berhasil dilakukan');
         if (isUpdated?.user) {
           setAuth(isUpdated.user);
           toast.success('Berhasil mengubah status akun', { duration: 1000 });
-- 
cgit v1.2.3


From e9cd13307f0095dc4edc5048752675d80c551564 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 6 Dec 2024 17:06:26 +0700
Subject: <iman> pengajuan tempo

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 235 ++++++++++++++-------
 1 file changed, 159 insertions(+), 76 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 1704556e..82b64df7 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -27,6 +27,8 @@ import { toast } from 'react-hot-toast';
 import useDevice from '@/core/hooks/useDevice';
 import odooApi from '~/libs/odooApi';
 import editAuthTempo from '../api/editAuthTempo';
+import BottomPopup from '@/core/components/elements/Popup/BottomPopup';
+import PageContent from '@/lib/content/components/PageContent';
 const PengajuanTempo = () => {
   const { isDesktop, isMobile } = useDevice();
   const [currentStep, setCurrentStep] = React.useState(0);
@@ -137,7 +139,7 @@ const PengajuanTempo = () => {
     validateKontakPerson();
     validatePengiriman();
     validateDokumen();
-    updateHasSave(false);
+    updateHasSave(true);
     if (isFormValid) {
       window.scrollTo({
         top: 0,
@@ -175,7 +177,8 @@ const PengajuanTempo = () => {
           'GET',
           `/api/v1/partner/detail-tempo/${auth.parentId}`
         );
-
+        console.log('original data', dataPaymentTerm);
+        const transformedData = transformKeysToCamelCase(dataPaymentTerm);
         setBigData(transformedData);
       } catch (error) {
         console.error('Error loading dataPaymentTerm:', error);
@@ -213,6 +216,7 @@ const PengajuanTempo = () => {
                   ? JSON.stringify(bigData[key]) // Untuk objek atau array
                   : String(bigData[key]); // Untuk tipe primitif
               // Kirim data yang sudah diubah ke string ke stepDivsUpdateForm
+              console.log('key', key, stringData);
               stepDivsUpdateForm[currentStep](key, stringData);
             }
           });
@@ -225,7 +229,7 @@ const PengajuanTempo = () => {
     validatePengiriman();
     validateDokumen();
     validateSupplier();
-    updateHasSave(false);
+    updateHasSave(true);
   }, [currentStep, bigData, auth]);
 
   const goToNextStep = () => {
@@ -291,15 +295,25 @@ const PengajuanTempo = () => {
         return;
       }
     }
-    const formattedDokumen = Object.entries(formDokumen).map(([key, doc]) => ({
-      documentName: key,
-      details: {
-        name: doc.name,
-        format: doc.format,
-        base64: doc.base64,
-      },
-    }));
+
+    // Filter hanya dokumen dengan `format` yang tidak undefined
+    const formattedDokumen = Object.entries(formDokumen)
+      .filter(([_, doc]) => doc.format !== undefined) // Hanya dokumen dengan `format` tidak undefined
+      .map(([key, doc]) => ({
+        documentName: key,
+        details: {
+          name: doc.name,
+          format: doc.format,
+          base64: doc.base64,
+        },
+      }));
+
     const toastId = toast.loading('Mengirimkan formulir pengajuan tempo...');
+    if (formattedDokumen.length === 0) {
+      // toast.error('Tidak ada dokumen valid untuk dikirim.');
+      return;
+    }
+
     setIsLoading(true);
     try {
       const address = await createPengajuanTempoApi({
@@ -321,12 +335,30 @@ const PengajuanTempo = () => {
       console.error(error);
     }
   };
+
+  const isSupplierDataChanged = (formSupplier, supplierIds) => {
+    if (formSupplier.length !== supplierIds.length) {
+      return true;
+    }
+    return formSupplier.some((supplier, index) => {
+      const original = supplierIds[index];
+      return (
+        supplier.supplier !== original.supplier ||
+        supplier.pic !== original.pic ||
+        supplier.telepon !== original.telepon ||
+        supplier.durasiTempo !== original.durasiTempo ||
+        supplier.creditLimit !== original.creditLimit
+      );
+    });
+  };
+
   const handleDaftarTempoSupplier = async () => {
     for (const error of stepDivsError) {
       if (error.length > 0) {
         return;
       }
     }
+
     const productOrder = formSupplier.map((product) => ({
       supplier: product.supplier,
       pic: product.pic,
@@ -334,7 +366,13 @@ const PengajuanTempo = () => {
       durasiTempo: product.durasiTempo,
       creditLimit: product.creditLimit,
     }));
+
+    // Periksa perubahan
     const toastId = toast.loading('Mengirimkan formulir pengajuan tempo...');
+    if (!isSupplierDataChanged(productOrder, bigData.supplierIds)) {
+      return;
+    }
+
     setIsLoading(true);
     try {
       const address = await createPengajuanTempoApi({
@@ -363,35 +401,23 @@ const PengajuanTempo = () => {
         return;
       }
     }
-    const productOrder = formSupplier.map((product) => ({
-      supplier: product.supplier,
-      pic: product.pic,
-      telepon: product.telepon,
-      durasiTempo: product.durasiTempo,
-      creditLimit: product.creditLimit,
-    }));
 
-    const formattedDokumen = Object.entries(formDokumen).map(([key, doc]) => ({
-      documentName: key,
-      details: {
-        name: doc.name,
-        format: doc.format,
-        base64: doc.base64,
-      },
-    }));
+    // Filter hanya dokumen dengan `format` yang tidak undefined
+    const formattedDokumen = Object.entries(formDokumen)
+      .filter(([_, doc]) => doc.format !== undefined) // Hanya dokumen dengan `format` tidak undefined
+      .map(([key, doc]) => ({
+        documentName: key,
+        details: {
+          name: doc.name,
+          format: doc.format,
+          base64: doc.base64,
+        },
+      }));
 
-    // const data2 = {
-    //   user_id: auth.id,
-    //   ...form,
-    //   ...formKontakPerson,
-    //   ...formPengiriman,
-    //   formDocs: JSON.stringify(formattedDokumen),
-    //   formSupplier: JSON.stringify(productOrder),
-    // };
     const toastId = toast.loading('Mengirimkan formulir pengajuan tempo...');
     setIsLoading(true);
     try {
-      let address5;
+      let address4;
       const address = await createPengajuanTempoApi({
         id: 0,
         partner_id: auth.partnerId,
@@ -415,37 +441,29 @@ const PengajuanTempo = () => {
             tempo_request: false,
             ...formPengiriman,
           });
-          if (address3.id) {
-            const address4 = await createPengajuanTempoApi({
+          if (address3.id && formattedDokumen.length > 0) {
+            // Kirim dokumen yang sudah difilter
+            address4 = await createPengajuanTempoApi({
               id: address3.id,
               partner_id: auth.partnerId,
               user_id: address3.userId,
-              tempo_request: false,
+              tempo_request: true,
               formDocs: JSON.stringify(formattedDokumen),
             });
-            if (address4.id) {
-              address5 = await createPengajuanTempoApi({
-                id: address4.id,
-                partner_id: auth.partnerId,
-                user_id: address4.userId,
-                tempo_request: true,
-                formSupplier: JSON.stringify(productOrder),
-              });
-            }
           }
         }
       }
 
-      if (address5.id) {
+      if (address4?.id) {
         const isUpdated = await editAuthTempo();
         toast.dismiss(toastId);
-        setIsLoading(false);
-        toast.success('Pengajuan tempo berhasil dilakukan');
         if (isUpdated?.user) {
           setAuth(isUpdated.user);
+          setIsLoading(false);
+          toast.success('Pengajuan tempo berhasil dilakukan');
           toast.success('Berhasil mengubah status akun', { duration: 1000 });
           removeFromLocalStorage();
-          router.push('/pengajuan-tempo/finish?tempo_id=SO-2023-06480');
+          router.push('/pengajuan-tempo/finish');
           return;
         }
       }
@@ -479,6 +497,14 @@ const PengajuanTempo = () => {
     }
   };
 
+  const [isCheckedTNC, setIsCheckedTNC] = useState(false);
+
+  const handleCheckChange = (checked) => {
+    setIsCheckedTNC(checked);
+  };
+  console.log('formSupplier', formSupplier);
+  console.log('!hassavedata', hasSavedata);
+  console.log('isCheckedTNC', isCheckedTNC);
   return (
     <>
       <div className='container flex flex-col items-center '>
@@ -507,45 +533,102 @@ const PengajuanTempo = () => {
           className={`flex ${
             isMobile
               ? 'flex-col justify-start items-start'
-              : 'flex-row justify-end items-center'
-          }   gap-4 mb-8`}
+              : 'flex-col justify-end items-end'
+          }    mb-8 gap-2`}
         >
           <span className='text-xs opacity-60'>
             *Pastikan data yang anda masukan sudah benar dan sesuai
           </span>
           {currentStep < 5 && (
-            <Tooltip
-              label={clsxm({
-                'Klik simpan data terlebih dahulu':
-                  currentStep === 3 && !hasSavedata,
-              })}
-            >
+            <>
+              <Tooltip
+                label={clsxm({
+                  'Klik simpan data terlebih dahulu':
+                    currentStep === 3 && !hasSavedata,
+                })}
+              >
+                <Button
+                  colorScheme='red'
+                  w={`${isMobile ? 'full' : 'fit'}`}
+                  isDisabled={
+                    (currentStep === 3 && !hasSavedata) ||
+                    currentStep === NUMBER_OF_STEPS - 1
+                  }
+                  onClick={goToNextStep}
+                >
+                  Langkah Selanjutnya {<ChevronRightIcon className='w-5' />}
+                </Button>
+              </Tooltip>
+            </>
+          )}
+          {currentStep == 5 && (
+            <div className='flex flex-col items-end justify-start gap-4'>
+              <TempoTermCondition onCheckChange={handleCheckChange} />
               <Button
                 colorScheme='red'
-                w={`${isMobile ? 'full' : 'fit'}`}
-                isDisabled={
-                  (currentStep === 3 && !hasSavedata) ||
-                  currentStep === NUMBER_OF_STEPS - 1
-                }
-                onClick={goToNextStep}
+                w={`${isMobile ? 'full' : '36'}`}
+                isDisabled={!isCheckedTNC}
+                onClick={handleDaftarTempo}
               >
-                Langkah Selanjutnya {<ChevronRightIcon className='w-5' />}
+                Daftar Tempo {<ChevronRightIcon className='w-5' />}
               </Button>
-            </Tooltip>
-          )}
-          {currentStep == 5 && (
-            <Button
-              colorScheme='red'
-              w={`${isMobile ? 'full' : 'fit'}`}
-              onClick={handleDaftarTempo}
-            >
-              Daftar Tempo {<ChevronRightIcon className='w-5' />}
-            </Button>
+            </div>
           )}
         </div>
       </div>
     </>
   );
 };
+const TempoTermCondition = ({ onCheckChange }) => {
+  const [isCheckedTNC, SetIsCheckedTNC] = useState(false);
+  const [openTNC, SetOpenTNC] = useState(false);
+
+  const openTNCHandle = () => {
+    SetOpenTNC(!openTNC);
+  };
+
+  const toggleCheckTNC = () => {
+    const newValue = !isCheckedTNC;
+    SetIsCheckedTNC(newValue);
+    if (onCheckChange) {
+      onCheckChange(newValue);
+    }
+  };
+  return (
+    <>
+      <div className='flex items-center gap-x-2'>
+        <Checkbox
+          id='tnc'
+          name='tnc'
+          colorScheme='red'
+          isChecked={isCheckedTNC}
+          onChange={toggleCheckTNC}
+        />
+        <div>
+          <label htmlFor='tnc' className='cursor-pointer'>
+            Dengan ini saya menyetujui
+          </label>{' '}
+          <span
+            className='font-medium text-danger-500 cursor-pointer'
+            onClick={openTNCHandle}
+          >
+            syarat dan ketentuan
+          </span>
+          <label htmlFor='tnc' className='ml-2 cursor-pointer'>
+            yang berlaku
+          </label>
+        </div>
+      </div>
+
+      <BottomPopup
+        active={openTNC}
+        close={() => SetOpenTNC(false)}
+        title='Syarat & Ketentuan Pendaftaran Tempo'
+      >
+        <PageContent path='/tempoTnd' />
+      </BottomPopup>
+    </>
+  );
+};
 
 export default PengajuanTempo;
-- 
cgit v1.2.3


From f2451beed670dc697aa2026b2df6ad1ad1e90da2 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 9 Dec 2024 15:00:45 +0700
Subject: <iman> update pengajuan tempo

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 82b64df7..58794b31 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -177,7 +177,6 @@ const PengajuanTempo = () => {
           'GET',
           `/api/v1/partner/detail-tempo/${auth.parentId}`
         );
-        console.log('original data', dataPaymentTerm);
         const transformedData = transformKeysToCamelCase(dataPaymentTerm);
         setBigData(transformedData);
       } catch (error) {
@@ -216,7 +215,6 @@ const PengajuanTempo = () => {
                   ? JSON.stringify(bigData[key]) // Untuk objek atau array
                   : String(bigData[key]); // Untuk tipe primitif
               // Kirim data yang sudah diubah ke string ke stepDivsUpdateForm
-              console.log('key', key, stringData);
               stepDivsUpdateForm[currentStep](key, stringData);
             }
           });
@@ -369,8 +367,10 @@ const PengajuanTempo = () => {
 
     // Periksa perubahan
     const toastId = toast.loading('Mengirimkan formulir pengajuan tempo...');
-    if (!isSupplierDataChanged(productOrder, bigData.supplierIds)) {
-      return;
+    if (bigData.supplierIds) {
+      if (!isSupplierDataChanged(productOrder, bigData.supplierIds)) {
+        return;
+      }
     }
 
     setIsLoading(true);
@@ -456,9 +456,9 @@ const PengajuanTempo = () => {
 
       if (address4?.id) {
         const isUpdated = await editAuthTempo();
-        toast.dismiss(toastId);
         if (isUpdated?.user) {
           setAuth(isUpdated.user);
+          toast.dismiss(toastId);
           setIsLoading(false);
           toast.success('Pengajuan tempo berhasil dilakukan');
           toast.success('Berhasil mengubah status akun', { duration: 1000 });
@@ -502,9 +502,6 @@ const PengajuanTempo = () => {
   const handleCheckChange = (checked) => {
     setIsCheckedTNC(checked);
   };
-  console.log('formSupplier', formSupplier);
-  console.log('!hassavedata', hasSavedata);
-  console.log('isCheckedTNC', isCheckedTNC);
   return (
     <>
       <div className='container flex flex-col items-center '>
-- 
cgit v1.2.3


From 0f84963214ee6dc5b5a44d945540826a66bec9e0 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 11 Dec 2024 11:51:45 +0700
Subject: <iman> update pengajuan tempo

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 25 ++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 58794b31..aff49373 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -178,6 +178,7 @@ const PengajuanTempo = () => {
           `/api/v1/partner/detail-tempo/${auth.parentId}`
         );
         const transformedData = transformKeysToCamelCase(dataPaymentTerm);
+
         setBigData(transformedData);
       } catch (error) {
         console.error('Error loading dataPaymentTerm:', error);
@@ -454,16 +455,28 @@ const PengajuanTempo = () => {
         }
       }
 
+      toast.dismiss(toastId);
+      setIsLoading(false);
+      toast.success('Pengajuan tempo berhasil dilakukan');
       if (address4?.id) {
+        const toastId = toast.loading('Mengubah status akun...');
+        setIsLoading(true);
         const isUpdated = await editAuthTempo();
         if (isUpdated?.user) {
-          setAuth(isUpdated.user);
-          toast.dismiss(toastId);
-          setIsLoading(false);
-          toast.success('Pengajuan tempo berhasil dilakukan');
-          toast.success('Berhasil mengubah status akun', { duration: 1000 });
+          const update = await setAuth(isUpdated.user);
+          if (update) {
+            toast.dismiss(toastId);
+            setIsLoading(false);
+            toast.success('Berhasil mengubah status akun', { duration: 1000 });
+            router.push('/pengajuan-tempo/finish');
+          } else {
+            toast.dismiss(toastId);
+            setIsLoading(false);
+            toast.success('Pengajuan tempo berhasil dilakukan');
+            toast.error('Gagal mengubah status akun', { duration: 1000 });
+            router.push('/pengajuan-tempo');
+          }
           removeFromLocalStorage();
-          router.push('/pengajuan-tempo/finish');
           return;
         }
       }
-- 
cgit v1.2.3


From 915dc67e1ce31eab1f2415cc8df95cebb75a137d Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 13 Dec 2024 14:18:03 +0700
Subject: <iman>update pengajuan tempo request

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 23 +++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index aff49373..b4f4ac9b 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -178,7 +178,6 @@ const PengajuanTempo = () => {
           `/api/v1/partner/detail-tempo/${auth.parentId}`
         );
         const transformedData = transformKeysToCamelCase(dataPaymentTerm);
-
         setBigData(transformedData);
       } catch (error) {
         console.error('Error loading dataPaymentTerm:', error);
@@ -419,6 +418,7 @@ const PengajuanTempo = () => {
     setIsLoading(true);
     try {
       let address4;
+      let address3;
       const address = await createPengajuanTempoApi({
         id: 0,
         partner_id: auth.partnerId,
@@ -435,7 +435,7 @@ const PengajuanTempo = () => {
           ...formKontakPerson,
         });
         if (address2.id) {
-          const address3 = await createPengajuanTempoApi({
+          address3 = await createPengajuanTempoApi({
             id: address2.id,
             partner_id: auth.partnerId,
             user_id: address2.userId,
@@ -451,16 +451,20 @@ const PengajuanTempo = () => {
               tempo_request: true,
               formDocs: JSON.stringify(formattedDokumen),
             });
+          } else {
+            address4 = await createPengajuanTempoApi({
+              id: address3.id,
+              partner_id: auth.partnerId,
+              user_id: address3.userId,
+              tempo_request: true,
+            });
           }
         }
       }
 
-      toast.dismiss(toastId);
-      setIsLoading(false);
-      toast.success('Pengajuan tempo berhasil dilakukan');
       if (address4?.id) {
+        toast.success('Pengajuan tempo berhasil dilakukan');
         const toastId = toast.loading('Mengubah status akun...');
-        setIsLoading(true);
         const isUpdated = await editAuthTempo();
         if (isUpdated?.user) {
           const update = await setAuth(isUpdated.user);
@@ -479,6 +483,11 @@ const PengajuanTempo = () => {
           removeFromLocalStorage();
           return;
         }
+      } else {
+        toast.dismiss(toastId);
+        setIsLoading(false);
+
+        toast.error('Terjadi kesalahan dalam pengiriman formulir');
       }
     } catch (error) {
       toast.dismiss(toastId);
@@ -518,7 +527,7 @@ const PengajuanTempo = () => {
   return (
     <>
       <div className='container flex flex-col items-center '>
-        <h1 className='text-h-sm md:text-title-sm font-semibold text-center mb-6'>
+        <h1 className=' font-semibold text-center mb-6'>
           Form Pengajuan Tempo
         </h1>
         <p className='text-center mb-4'>
-- 
cgit v1.2.3


From 0178a1f88d7d34824562e1413be073c0795a47cf Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 16 Dec 2024 17:42:31 +0700
Subject: <iman> update code

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 95 +++++++++++++++++-----
 1 file changed, 73 insertions(+), 22 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index b4f4ac9b..f5cad812 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -253,6 +253,29 @@ const PengajuanTempo = () => {
     setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev + 1));
   };
 
+  const goPrevStep = () => {
+    // if (!isFormValid) {
+    //   setNotValid(true);
+    //   setButtonSubmitClick(!buttonSubmitClick);
+    //   return;
+    // } else {
+    //   // saveToLocalStorage(stepLabels[currentStep], stepDivsForm[currentStep]);
+    //   if (currentStep == 3) {
+    //     handleDaftarTempoSupplier();
+    //   } else if (currentStep == 4) {
+    //     handleDaftarTempoDokumen();
+    //   } else {
+    //     handleDaftarTempoPerPage(
+    //       stepLabels[currentStep],
+    //       stepDivsForm[currentStep]
+    //     );
+    //   }
+    //   setButtonSubmitClick(!buttonSubmitClick);
+    //   setNotValid(false);
+    // }
+    setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev - 1));
+  };
+
   const handleDaftarTempoPerPage = async (
     label,
     formData,
@@ -558,30 +581,57 @@ const PengajuanTempo = () => {
           <span className='text-xs opacity-60'>
             *Pastikan data yang anda masukan sudah benar dan sesuai
           </span>
-          {currentStep < 5 && (
-            <>
-              <Tooltip
-                label={clsxm({
-                  'Klik simpan data terlebih dahulu':
-                    currentStep === 3 && !hasSavedata,
-                })}
+          <div
+            className={` flex flex-row ${
+              currentStep > 0 && currentStep < 5
+                ? 'justify-between'
+                : 'justify-end'
+            } items-center w-full ${isMobile ? 'gap-x-4 ' : ''}`}
+          >
+            {currentStep < 5 && currentStep > 0 && (
+              <Button
+                colorScheme='yellow'
+                w={`${isMobile ? 'full' : 'fit'}`}
+                onClick={goPrevStep}
               >
-                <Button
-                  colorScheme='red'
-                  w={`${isMobile ? 'full' : 'fit'}`}
-                  isDisabled={
-                    (currentStep === 3 && !hasSavedata) ||
-                    currentStep === NUMBER_OF_STEPS - 1
-                  }
-                  onClick={goToNextStep}
+                {<ChevronLeftIcon className='w-5' />}
+                <span className={`${isMobile ? 'text-xs' : ''} `}>
+                  Langkah Sebelumnya
+                </span>
+              </Button>
+            )}
+            {currentStep < 5 && (
+              <>
+                <Tooltip
+                  label={clsxm({
+                    'Klik simpan data terlebih dahulu':
+                      currentStep === 3 && !hasSavedata,
+                  })}
                 >
-                  Langkah Selanjutnya {<ChevronRightIcon className='w-5' />}
-                </Button>
-              </Tooltip>
-            </>
-          )}
+                  <Button
+                    colorScheme='red'
+                    w={`${isMobile ? 'full' : 'fit'}`}
+                    isDisabled={
+                      (currentStep === 3 && !hasSavedata) ||
+                      currentStep === NUMBER_OF_STEPS - 1
+                    }
+                    onClick={goToNextStep}
+                  >
+                    <span className={`${isMobile ? 'text-xs' : ''} `}>
+                      Langkah Selanjutnya
+                    </span>
+                    {<ChevronRightIcon className='w-5' />}
+                  </Button>
+                </Tooltip>
+              </>
+            )}
+          </div>
           {currentStep == 5 && (
-            <div className='flex flex-col items-end justify-start gap-4'>
+            <div
+              className={`flex flex-col ${
+                isMobile ? 'items-start' : 'items-end'
+              } w-full justify-start gap-4`}
+            >
               <TempoTermCondition onCheckChange={handleCheckChange} />
               <Button
                 colorScheme='red'
@@ -601,6 +651,7 @@ const PengajuanTempo = () => {
 const TempoTermCondition = ({ onCheckChange }) => {
   const [isCheckedTNC, SetIsCheckedTNC] = useState(false);
   const [openTNC, SetOpenTNC] = useState(false);
+  const { isDesktop, isMobile } = useDevice();
 
   const openTNCHandle = () => {
     SetOpenTNC(!openTNC);
@@ -623,7 +674,7 @@ const TempoTermCondition = ({ onCheckChange }) => {
           isChecked={isCheckedTNC}
           onChange={toggleCheckTNC}
         />
-        <div>
+        <div className={`text-center ${isMobile ? 'text-sm' : ''}`}>
           <label htmlFor='tnc' className='cursor-pointer'>
             Dengan ini saya menyetujui
           </label>{' '}
-- 
cgit v1.2.3


From aea914d21c16f53a1c28122b9b9a135439443ba6 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 17 Dec 2024 11:38:03 +0700
Subject: <iman> update pengajuan tempo

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 29 ++++++++++++++--------
 1 file changed, 19 insertions(+), 10 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index f5cad812..ccd63856 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -33,7 +33,7 @@ const PengajuanTempo = () => {
   const { isDesktop, isMobile } = useDevice();
   const [currentStep, setCurrentStep] = React.useState(0);
   const NUMBER_OF_STEPS = 6;
-  const [isLoading, setIsLoading] = useState(false);
+  const [isLoading, setIsLoading] = useState(true);
   const [bigData, setBigData] = useState();
   const [idTempo, setIdTempo] = useState(0);
   const { form, errors, validate, updateForm } = usePengajuanTempoStore();
@@ -547,22 +547,31 @@ const PengajuanTempo = () => {
   const handleCheckChange = (checked) => {
     setIsCheckedTNC(checked);
   };
+  if (isLoading && !bigData) {
+    return;
+  }
+  console.log('bigData', bigData);
   return (
     <>
       <div className='container flex flex-col items-center '>
         <h1 className=' font-semibold text-center mb-6'>
           Form Pengajuan Tempo
         </h1>
-        <p className='text-center mb-4'>
-          Lorem ipsum dolor sit amet consectetur. Commodo suspendisse at enim
-          magnis ut quisque rhoncus. Felis volutpat fringilla sollicitudin
-          ultricies. Enim non eget in lorem netus. Nisl pharetra accumsan diam
-          suspendisse.
+        <p
+          className={`text-center  ${
+            isMobile ? 'w-full text-sm' : 'w-3/4 mb-4'
+          }`}
+        >
+          Pembayaran tempo adalah layanan pembayaran berjangka yang difasilitasi
+          indoteknik.com untuk konsumen akun bisnis yang terdaftar dengan waktu
+          pembayaran mulai dari 7, 14, 21 hingga 30 Hari.
         </p>
       </div>
-      <div className='h-[2px] w-full mb-20 bg-gray_r-3' />
+      <div
+        className={`h-[2px] w-full ${isMobile ? 'mt-4' : 'mb-20'}  bg-gray_r-3`}
+      />
 
-      <div className='container mt-10 flex flex-col'>
+      <div className={`container ${isMobile ? 'mt-4' : 'mt-10'} flex flex-col`}>
         <div className='flex items-center justify-center'>
           <Stepper currentStep={currentStep} numberOfSteps={NUMBER_OF_STEPS} />
         </div>
@@ -595,7 +604,7 @@ const PengajuanTempo = () => {
                 onClick={goPrevStep}
               >
                 {<ChevronLeftIcon className='w-5' />}
-                <span className={`${isMobile ? 'text-xs' : ''} `}>
+                <span className={`font-medium ${isMobile ? 'text-xs' : ''} `}>
                   Langkah Sebelumnya
                 </span>
               </Button>
@@ -674,7 +683,7 @@ const TempoTermCondition = ({ onCheckChange }) => {
           isChecked={isCheckedTNC}
           onChange={toggleCheckTNC}
         />
-        <div className={`text-center ${isMobile ? 'text-sm' : ''}`}>
+        <div className={`${isMobile ? 'text-xs' : ''}`}>
           <label htmlFor='tnc' className='cursor-pointer'>
             Dengan ini saya menyetujui
           </label>{' '}
-- 
cgit v1.2.3


From 92c6c99e3b65b1770b02c2fd63c9c943f99cfda2 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 17 Dec 2024 11:39:30 +0700
Subject: <iman> delete console log

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 1 -
 1 file changed, 1 deletion(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index ccd63856..d7c1dfac 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -550,7 +550,6 @@ const PengajuanTempo = () => {
   if (isLoading && !bigData) {
     return;
   }
-  console.log('bigData', bigData);
   return (
     <>
       <div className='container flex flex-col items-center '>
-- 
cgit v1.2.3


From dd8a56ad12d054e121965c41bcb077158690b208 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 17 Dec 2024 17:07:44 +0700
Subject: <iman> update code

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index d7c1dfac..22227624 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -33,7 +33,7 @@ const PengajuanTempo = () => {
   const { isDesktop, isMobile } = useDevice();
   const [currentStep, setCurrentStep] = React.useState(0);
   const NUMBER_OF_STEPS = 6;
-  const [isLoading, setIsLoading] = useState(true);
+  const [isLoading, setIsLoading] = useState(false);
   const [bigData, setBigData] = useState();
   const [idTempo, setIdTempo] = useState(0);
   const { form, errors, validate, updateForm } = usePengajuanTempoStore();
@@ -547,9 +547,10 @@ const PengajuanTempo = () => {
   const handleCheckChange = (checked) => {
     setIsCheckedTNC(checked);
   };
-  if (isLoading && !bigData) {
-    return;
-  }
+  // if (isLoading && !bigData) {
+  //   return;
+  // }
+  console.log('bigData', bigData);
   return (
     <>
       <div className='container flex flex-col items-center '>
-- 
cgit v1.2.3


From daa0b872601789815513508d48a14cbd8e1f6518 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 23 Dec 2024 13:39:47 +0700
Subject: <iman> update pengajuan tempo

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 1 -
 1 file changed, 1 deletion(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index 22227624..dbf2c606 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -550,7 +550,6 @@ const PengajuanTempo = () => {
   // if (isLoading && !bigData) {
   //   return;
   // }
-  console.log('bigData', bigData);
   return (
     <>
       <div className='container flex flex-col items-center '>
-- 
cgit v1.2.3


From 7f92d22feb841e1405e56505c742f90cbd365ffc Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 30 Dec 2024 15:49:18 +0700
Subject: <iman> update pengajuan tempo

---
 .../pengajuan-tempo/component/PengajuanTempo.jsx   | 40 ++++++++++++----------
 1 file changed, 22 insertions(+), 18 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index dbf2c606..be994171 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -1,5 +1,6 @@
 import React from 'react';
 import { useMemo, useState, useEffect, useRef } from 'react';
+import Image from '~/components/ui/image';
 import Stepper from './Stepper';
 import InformasiPerusahaan from './informasiPerusahaan';
 import KontakPerusahaan from './KontakPerusahaan';
@@ -40,6 +41,7 @@ const PengajuanTempo = () => {
   const { control, watch, setValue } = useForm();
   const auth = useAuth();
   const router = useRouter();
+  const [BannerTempo, setBannerTempo] = useState();
   const { formDokumen, errorsDokumen, validateDokumen, updateFormDokumen } =
     usePengajuanTempoStoreDokumen();
   const {
@@ -521,21 +523,6 @@ const PengajuanTempo = () => {
     }
   };
 
-  const goToPreviousStep = () => {
-    setCurrentStep((prev) => (prev <= 0 ? prev : prev - 1));
-  };
-
-  const saveToLocalStorage = (key, form) => {
-    localStorage.setItem(key, JSON.stringify(form));
-  };
-
-  const getFromLocalStorage = (key) => {
-    const itemStr = localStorage.getItem(key);
-    if (!itemStr) return null;
-
-    const item = JSON.parse(itemStr);
-    return item;
-  };
   const removeFromLocalStorage = () => {
     for (const key of stepLabels) {
       localStorage.removeItem(key);
@@ -547,12 +534,29 @@ const PengajuanTempo = () => {
   const handleCheckChange = (checked) => {
     setIsCheckedTNC(checked);
   };
-  // if (isLoading && !bigData) {
-  //   return;
-  // }
+
+  useEffect(() => {
+    const getBanner = async () => {
+      const get = await odooApi('GET', '/api/v1/banner?type=banner-form-tempo');
+      // setBannerTempo(get[0].image);
+      setBannerTempo(
+        'http://192.168.23.244:8069/api/image/x_banner.banner/x_banner_image/479'
+      );
+    };
+    getBanner();
+  }, []);
   return (
     <>
       <div className='container flex flex-col items-center '>
+        {BannerTempo && (
+          <Image
+            src={BannerTempo}
+            alt='FORM Tempo'
+            width={500}
+            height={160}
+            className='w-full mt-6'
+          />
+        )}
         <h1 className=' font-semibold text-center mb-6'>
           Form Pengajuan Tempo
         </h1>
-- 
cgit v1.2.3


From 51b7b4cd945f78ebeabdbfcd4842c9ea83cb3efc Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Tue, 31 Dec 2024 08:58:23 +0700
Subject: <iman> update

---
 src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
index be994171..97cf506e 100644
--- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx
@@ -540,7 +540,7 @@ const PengajuanTempo = () => {
       const get = await odooApi('GET', '/api/v1/banner?type=banner-form-tempo');
       // setBannerTempo(get[0].image);
       setBannerTempo(
-        'http://192.168.23.244:8069/api/image/x_banner.banner/x_banner_image/479'
+        'https://erp.indoteknik.com/api/image/x_banner.banner/x_banner_image/431'
       );
     };
     getBanner();
-- 
cgit v1.2.3

