From c61477111b95d83a9b862f242923b911364f3612 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 19 Oct 2024 11:49:38 +0700 Subject: fix section pengiriman --- src/lib/pengajuan-tempo/component/Referensi.jsx | 365 ++++++++++++++++++++++++ 1 file changed, 365 insertions(+) create mode 100644 src/lib/pengajuan-tempo/component/Referensi.jsx (limited to 'src/lib/pengajuan-tempo/component/Referensi.jsx') diff --git a/src/lib/pengajuan-tempo/component/Referensi.jsx b/src/lib/pengajuan-tempo/component/Referensi.jsx new file mode 100644 index 00000000..cb0bb5fe --- /dev/null +++ b/src/lib/pengajuan-tempo/component/Referensi.jsx @@ -0,0 +1,365 @@ +import React, { useState, useEffect, useMemo, useRef } from 'react'; +import { Controller, set, useForm } from 'react-hook-form'; +import HookFormSelect from '@/core/components/elements/Select/HookFormSelect'; +import odooApi from '~/libs/odooApi'; +import stateApi from '@/lib/address/api/stateApi.js'; +import cityApi from '@/lib/address/api/cityApi'; +import { Radio, RadioGroup, Stack, Checkbox } from '@chakra-ui/react'; +import { usePengajuanTempoStoreKontakPerson } from '../../../../src-migrate/modules/register/stores/usePengajuanTempoStore'; +const Referensi = ({ chekValid, buttonSubmitClick }) => { + const { control, watch } = useForm(); + const { + formKontakPerson, + errorsKontakPerson, + validateKontakPerson, + updateFormKontakPerson, + } = usePengajuanTempoStoreKontakPerson(); + + const handleInputChange = (event) => { + const { name, value } = event.target; + updateFormKontakPerson(name, value); + validateKontakPerson(); + }; + + const isFormValid = useMemo( + () => Object.keys(errorsKontakPerson).length === 0, + [errorsKontakPerson] + ); + + const direkturNameRef = useRef(null); + const direkturMobileRef = useRef(null); + const direkturEmailRef = useRef(null); + const purchasingNameRef = useRef(null); + const purchasingEmailRef = useRef(null); + const purchasingMobileRef = useRef(null); + const financeNameRef = useRef(null); + const financeMobileRef = useRef(null); + const financeEmailRef = useRef(null); + + useEffect(() => { + const loadIndustries = async () => { + if (!isFormValid) { + const options = { + behavior: 'smooth', + block: 'center', + }; + if (errorsKontakPerson.direkturName && direkturNameRef.current) { + direkturNameRef.current.scrollIntoView(options); + return; + } + if (errorsKontakPerson.direkturMobile && direkturMobileRef.current) { + direkturMobileRef.current.scrollIntoView(options); + return; + } + if (errorsKontakPerson.direkturEmail && direkturEmailRef.current) { + direkturEmailRef.current.scrollIntoView(options); + return; + } + if (errorsKontakPerson.purchasingName && purchasingNameRef.current) { + purchasingNameRef.current.scrollIntoView(options); + return; + } + if ( + errorsKontakPerson.purchasingMobile && + purchasingMobileRef.current + ) { + purchasingMobileRef.current.scrollIntoView(options); + return; + } + if (errorsKontakPerson.purchasingEmail && purchasingEmailRef.current) { + purchasingEmailRef.current.scrollIntoView(options); + return; + } + if (errorsKontakPerson.financeName && financeNameRef.current) { + financeNameRef.current.scrollIntoView(options); + return; + } + if (errorsKontakPerson.financeMobile && financeMobileRef.current) { + financeMobileRef.current.scrollIntoView(options); + return; + } + if (errorsKontakPerson.financeEmail && financeEmailRef.current) { + financeEmailRef.current.scrollIntoView(options); + return; + } + } + }; + loadIndustries(); + }, [buttonSubmitClick, chekValid]); + + useEffect(() => { + validateKontakPerson(); + }, [buttonSubmitClick]); + return ( + <> +
+

+ Referensi Supplier / Rekanan Bisnis Perusahaan{' '} + (Opsional) +

+
+
+
+
+
+ +
+
+ + {chekValid && ( +
+ {errorsKontakPerson.direkturName} +
+ )} +
+
+ +
+
+ + + isi nomor telpon direktur di perusahaan kamu + +
+
+ + {chekValid && ( +
+ {errorsKontakPerson.direkturMobile} +
+ )} +
+
+ +
+
+ + + isi email Direktur yang sesuai + +
+
+ + {chekValid && ( +
+ {errorsKontakPerson.direkturEmail} +
+ )} +
+
+ +
+
+ + + isi nama purchasing yang bertanggung jawab di perusahaan anda + +
+
+ + {chekValid && ( +
+ {errorsKontakPerson.purchasingName} +
+ )} +
+
+ +
+
+ + + isi nomor purchasing yang bertanggung jawab di perusahaan anda + +
+
+ + {chekValid && ( +
+ {errorsKontakPerson.purchasingMobile} +
+ )} +
+
+ +
+
+ + + isi email purchasing benar + +
+
+ + {chekValid && ( +
+ {errorsKontakPerson.purchasingEmail} +
+ )} +
+
+ +
+
+ + + isi nama finance yang bertanggung jawab di perusahaan anda + +
+
+ + {chekValid && ( +
+ {errorsKontakPerson.financeName} +
+ )} +
+
+
+
+ + + isi nomor finance yang bertanggung jawab di perusahaan anda + +
+
+ + {chekValid && ( +
+ {errorsKontakPerson.financeMobile} +
+ )} +
+
+ +
+
+ + + isi email finance dengan benar + +
+
+ + {chekValid && ( +
+ {errorsKontakPerson.financeEmail} +
+ )} +
+
+
+
+ + ); +}; + +export default Referensi; -- cgit v1.2.3