summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-12-30 15:49:18 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-12-30 15:49:18 +0700
commit7f92d22feb841e1405e56505c742f90cbd365ffc (patch)
tree10f11ceff97188e3f6d4e73ad850f9d60d487358 /src
parentdaa0b872601789815513508d48a14cbd8e1f6518 (diff)
<iman> update pengajuan tempo
Diffstat (limited to 'src')
-rw-r--r--src/lib/pengajuan-tempo/component/PengajuanTempo.jsx40
-rw-r--r--src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx34
2 files changed, 41 insertions, 33 deletions
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>
diff --git a/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx b/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx
index fc0f1c28..d385bc3b 100644
--- a/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx
+++ b/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx
@@ -73,9 +73,6 @@ const InformasiPerusahaan = ({
const watchState = watch('state');
useEffect(() => {
- // setValue('city', '');
- // setValue('district', '');
- // setValue('subDistrict', '');
if (watchState) {
updateForm('state', `${watchState}`);
validate();
@@ -93,6 +90,15 @@ const InformasiPerusahaan = ({
const watchCity = watch('city');
+ // Untuk memperbarui form.city
+ useEffect(() => {
+ if (watchCity && form.city !== `${watchCity}`) {
+ updateForm('city', `${watchCity}`);
+ validate();
+ }
+ }, [watchCity]);
+
+ // Untuk memuat distrik
useEffect(() => {
if (watchCity) {
const loadDistricts = async () => {
@@ -103,10 +109,6 @@ const InformasiPerusahaan = ({
}));
setDistricts(dataDistricts);
};
- if (form.city !== `${watchCity}`) {
- updateForm('city', `${watchCity}`);
- }
- validate();
loadDistricts();
}
}, [watchCity]);
@@ -429,9 +431,7 @@ const InformasiPerusahaan = ({
if (form.state) {
setValue('state', parseInt(form.state));
}
- if (form.city) {
- setValue('city', parseInt(form.city));
- }
+
if (form.district) {
setValue('district', parseInt(form.district));
}
@@ -463,12 +463,20 @@ const InformasiPerusahaan = ({
}
}, [form]);
useEffect(() => {
+ if (form.city) {
+ setValue('city', parseInt(form.city));
+ }
+ }, [form.city]);
+ useEffect(() => {
const loadProfile = async () => {
try {
const dataProfile = await addressApi({ id: auth.parentId });
if (dataProfile.name) {
updateForm('name', dataProfile.name);
}
+ if (dataProfile.street) {
+ updateForm('street', dataProfile.street);
+ }
if (dataProfile.stateId.id) {
updateForm('state', `${dataProfile.stateId.id}`);
}
@@ -481,9 +489,6 @@ const InformasiPerusahaan = ({
if (dataProfile.subDistrict.id) {
updateForm('subDistrict', `${dataProfile.subDistrict.id}`);
}
- if (dataProfile.alamatBisnis) {
- updateForm('street', dataProfile.alamatBisnis);
- }
if (dataProfile.zip) {
updateForm('zip', dataProfile.zip);
}
@@ -509,7 +514,7 @@ const InformasiPerusahaan = ({
useEffect(() => {
const loadProfile = async () => {
try {
- const dataProfile = await addressApi({ id: auth.partnerId });
+ const dataProfile = await addressApi({ id: auth.parentId });
setValue('industryId', parseInt(dataProfile.industryId));
setValue('state', parseInt(dataProfile.stateId.id));
setValue('city', parseInt(dataProfile.city.id));
@@ -528,7 +533,6 @@ const InformasiPerusahaan = ({
const handleLengkapiData = () => {
router.push('/my/profile');
};
-
return (
<>
<BottomPopup