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

