import { useEffect, useMemo, useState } from 'react'; import FormBisnis from './FormBisnis'; import Form from './Form'; import { Radio, RadioGroup, Stack, Divider, Button } from '@chakra-ui/react'; import React from 'react'; import { ChevronDownIcon, ChevronRightIcon } from '@heroicons/react/24/outline'; import { useRegisterStore } from '../stores/useRegisterStore'; interface FormProps { chekValid: boolean; buttonSubmitClick: boolean; } const RegistrasiBisnis: React.FC = ({ chekValid, buttonSubmitClick, }) => { const [isPKP, setIsPKP] = useState(false); const [isTerdaftar, setIsTerdaftar] = useState(false); const [isDropIndividu, setIsDropIndividu] = useState(true); const [isBisnisClicked, setisBisnisClicked] = useState(true); const [selectedValue, setSelectedValue] = useState('Non-PKP'); const [selectedValueBisnis, setSelectedValueBisnis] = useState('false'); const { validate, updateForm } = useRegisterStore(); useEffect(() => { if (selectedValue === 'PKP') { updateForm('is_pkp', 'true'); validate(); } else { updateForm('is_pkp', 'false'); validate(); } }, [selectedValue]); useEffect(() => { if (isTerdaftar) { updateForm('is_terdaftar', 'true'); validate(); } else { updateForm('is_terdaftar', 'false'); validate(); } }, [isTerdaftar]); const handleChange = (value: string) => { setSelectedValue(value); if (value === 'PKP') { validate(); setIsPKP(true); } else { validate(); setIsPKP(false); setIsPKP(false); } }; const handleChangeBisnis = (value: string) => { setSelectedValueBisnis(value); if (value === 'true') { validate(); setIsTerdaftar(true); } else { validate(); setIsTerdaftar(false); } }; const handleClick = () => { setIsDropIndividu(!isDropIndividu); }; const handleClickBisnis = () => { setisBisnisClicked(!isBisnisClicked); }; return ( <>

Data Akun

{isDropIndividu ? (
) : ( )}
{isDropIndividu && (
)}

Data Bisnis

{isBisnisClicked ? (
) : ( )}
{isBisnisClicked && (

Bisnis Terdaftar di Indoteknik?

Sudah Terdaftar Belum Terdaftar
{!isTerdaftar && (

Tipe Bisnis

PKP Non-PKP
)}
)}

); }; export default RegistrasiBisnis;