summaryrefslogtreecommitdiff
path: root/src/lib/merchant/components/Merchant.jsx
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2025-01-10 13:33:16 +0700
committerit-fixcomart <it@fixcomart.co.id>2025-01-10 13:33:16 +0700
commitc42e3256fa8f059a937629b1e44a2dc50d736928 (patch)
tree8c7fe1d9296bd1eb2337613e3754c60c02321cf8 /src/lib/merchant/components/Merchant.jsx
parente1ecdbe5dd1857d1aa2f3317c0d763241ebaa6e5 (diff)
<iman> update code
Diffstat (limited to 'src/lib/merchant/components/Merchant.jsx')
-rw-r--r--src/lib/merchant/components/Merchant.jsx57
1 files changed, 31 insertions, 26 deletions
diff --git a/src/lib/merchant/components/Merchant.jsx b/src/lib/merchant/components/Merchant.jsx
index 30ad0130..c4661d46 100644
--- a/src/lib/merchant/components/Merchant.jsx
+++ b/src/lib/merchant/components/Merchant.jsx
@@ -4,6 +4,7 @@ import Image from '~/components/ui/image';
import InformasiPerusahaan from './InformasiPerusahaan';
import InformasiVendor from './InformasiVendor';
import SyaratDagang from './SyaratDagang';
+import Dokumen from './Dokumen';
import { getAuth } from '~/libs/auth';
import { setAuth } from '@/core/utils/auth';
import useAuth from '@/core/hooks/useAuth';
@@ -20,7 +21,7 @@ import PageContent from '@/lib/content/components/PageContent';
const Merchant = () => {
const { isDesktop, isMobile } = useDevice();
const [currentStep, setCurrentStep] = React.useState(0);
- const NUMBER_OF_STEPS = 6;
+ const NUMBER_OF_STEPS = 5;
const [isLoading, setIsLoading] = useState(false);
const [bigData, setBigData] = useState();
const [idTempo, setIdTempo] = useState(0);
@@ -30,10 +31,19 @@ const Merchant = () => {
const [BannerTempo, setBannerTempo] = useState();
const [notValid, setNotValid] = useState(false);
const [buttonSubmitClick, setButtonSubmitClick] = useState(false);
+
+ const [error, setError] = useState(false);
+
+ const handleIsError = (value) => {
+ console.log('value yang dihasilkan', value);
+ goToNextStep();
+ setError(value); // Memperbarui state berdasarkan isError
+ };
const stepDivs = [
- <InformasiPerusahaan />,
- <InformasiVendor />,
+ <InformasiVendor handleIsError={handleIsError} />,
+ <InformasiPerusahaan handleIsError={handleIsError} />,
<SyaratDagang />,
+ <Dokumen />,
];
const stepLabels = [
@@ -45,6 +55,13 @@ const Merchant = () => {
'Konfirmasi',
];
+ useEffect(() => {
+ window.scrollTo({
+ top: 0,
+ behavior: 'smooth',
+ });
+ }, [currentStep]);
+
// useEffect(() => {
// const loadBigData = async () => {
// const toCamelCase = (str) =>
@@ -170,9 +187,7 @@ const Merchant = () => {
className='w-full mt-6'
/>
)}
- <h1 className=' font-semibold text-center mb-6'>
- Form Pengajuan Tempo
- </h1>
+ <h1 className=' font-semibold text-center mb-6'>Form Merchant</h1>
<p
className={`text-center ${
isMobile ? 'w-full text-sm' : 'w-3/4 mb-4'
@@ -224,27 +239,17 @@ const Merchant = () => {
)}
{currentStep < 5 && (
<>
- <Tooltip
- label={clsxm({
- 'Klik simpan data terlebih dahulu':
- currentStep === 3 && !hasSavedata,
- })}
+ <Button
+ colorScheme='red'
+ w={`${isMobile ? 'full' : 'fit'}`}
+ isDisabled={currentStep === NUMBER_OF_STEPS - 1}
+ onClick={goToNextStep}
>
- <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>
+ <span className={`${isMobile ? 'text-xs' : ''} `}>
+ Langkah Selanjutnya
+ </span>
+ {<ChevronRightIcon className='w-5' />}
+ </Button>
</>
)}
</div>