diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-12-16 17:42:31 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-12-16 17:42:31 +0700 |
| commit | 0178a1f88d7d34824562e1413be073c0795a47cf (patch) | |
| tree | 20a26bd36d2c8e0c3e09681836eea9f403519f70 /src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | |
| parent | 4711fff3bf3b07c50f353a7c5956055a37a5e4d2 (diff) | |
<iman> update code
Diffstat (limited to 'src/lib/pengajuan-tempo/component/PengajuanTempo.jsx')
| -rw-r--r-- | src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 95 |
1 files changed, 73 insertions, 22 deletions
diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx index b4f4ac9b..f5cad812 100644 --- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx +++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx @@ -253,6 +253,29 @@ const PengajuanTempo = () => { setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev + 1)); }; + const goPrevStep = () => { + // if (!isFormValid) { + // setNotValid(true); + // setButtonSubmitClick(!buttonSubmitClick); + // return; + // } else { + // // saveToLocalStorage(stepLabels[currentStep], stepDivsForm[currentStep]); + // if (currentStep == 3) { + // handleDaftarTempoSupplier(); + // } else if (currentStep == 4) { + // handleDaftarTempoDokumen(); + // } else { + // handleDaftarTempoPerPage( + // stepLabels[currentStep], + // stepDivsForm[currentStep] + // ); + // } + // setButtonSubmitClick(!buttonSubmitClick); + // setNotValid(false); + // } + setCurrentStep((prev) => (prev === NUMBER_OF_STEPS - 1 ? prev : prev - 1)); + }; + const handleDaftarTempoPerPage = async ( label, formData, @@ -558,30 +581,57 @@ const PengajuanTempo = () => { <span className='text-xs opacity-60'> *Pastikan data yang anda masukan sudah benar dan sesuai </span> - {currentStep < 5 && ( - <> - <Tooltip - label={clsxm({ - 'Klik simpan data terlebih dahulu': - currentStep === 3 && !hasSavedata, - })} + <div + className={` flex flex-row ${ + currentStep > 0 && currentStep < 5 + ? 'justify-between' + : 'justify-end' + } items-center w-full ${isMobile ? 'gap-x-4 ' : ''}`} + > + {currentStep < 5 && currentStep > 0 && ( + <Button + colorScheme='yellow' + w={`${isMobile ? 'full' : 'fit'}`} + onClick={goPrevStep} > - <Button - colorScheme='red' - w={`${isMobile ? 'full' : 'fit'}`} - isDisabled={ - (currentStep === 3 && !hasSavedata) || - currentStep === NUMBER_OF_STEPS - 1 - } - onClick={goToNextStep} + {<ChevronLeftIcon className='w-5' />} + <span className={`${isMobile ? 'text-xs' : ''} `}> + Langkah Sebelumnya + </span> + </Button> + )} + {currentStep < 5 && ( + <> + <Tooltip + label={clsxm({ + 'Klik simpan data terlebih dahulu': + currentStep === 3 && !hasSavedata, + })} > - Langkah Selanjutnya {<ChevronRightIcon className='w-5' />} - </Button> - </Tooltip> - </> - )} + <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> + </> + )} + </div> {currentStep == 5 && ( - <div className='flex flex-col items-end justify-start gap-4'> + <div + className={`flex flex-col ${ + isMobile ? 'items-start' : 'items-end' + } w-full justify-start gap-4`} + > <TempoTermCondition onCheckChange={handleCheckChange} /> <Button colorScheme='red' @@ -601,6 +651,7 @@ const PengajuanTempo = () => { const TempoTermCondition = ({ onCheckChange }) => { const [isCheckedTNC, SetIsCheckedTNC] = useState(false); const [openTNC, SetOpenTNC] = useState(false); + const { isDesktop, isMobile } = useDevice(); const openTNCHandle = () => { SetOpenTNC(!openTNC); @@ -623,7 +674,7 @@ const TempoTermCondition = ({ onCheckChange }) => { isChecked={isCheckedTNC} onChange={toggleCheckTNC} /> - <div> + <div className={`text-center ${isMobile ? 'text-sm' : ''}`}> <label htmlFor='tnc' className='cursor-pointer'> Dengan ini saya menyetujui </label>{' '} |
