summaryrefslogtreecommitdiff
path: root/src/pages/my
diff options
context:
space:
mode:
authortrisusilo48 <tri.susilo@altama.co.id>2025-03-27 14:44:54 +0700
committertrisusilo48 <tri.susilo@altama.co.id>2025-03-27 14:44:54 +0700
commit969e193708e01ffb88c0d81d72d63dad200e0ef8 (patch)
tree59c44292727bdfecb2970cb1d8130c53c0075653 /src/pages/my
parentf88f457fd1b91298ea8a7f9f396e49660a81e276 (diff)
parentd64f70fbc89e2cea6cbd95f5c3e3af437a3c2810 (diff)
Merge branch 'new-release' into feature/integrasi_biteship
# Conflicts: # src/lib/address/components/EditAddress.jsx
Diffstat (limited to 'src/pages/my')
-rw-r--r--src/pages/my/profile.jsx54
-rw-r--r--src/pages/my/tempo/index.jsx54
2 files changed, 56 insertions, 52 deletions
diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx
index eaf3341c..859b6960 100644
--- a/src/pages/my/profile.jsx
+++ b/src/pages/my/profile.jsx
@@ -71,18 +71,19 @@ export default function Profile() {
<IsAuth>
<MobileView>
<AppLayout title='Akun Saya'>
- {!auth?.parentId && !ubahAkun && (
- <div className='text-sm p-4 flex items-center'>
- <Checkbox
- borderColor='gray.600'
- colorScheme='red'
- size='lg'
- isChecked={isChecked}
- onChange={handleChange}
- />
- <p className='ml-2'>Ubah ke akun bisnis</p>
- </div>
- )}
+ {auth?.company ||
+ (!ubahAkun && (
+ <div className='text-sm p-4 flex items-center'>
+ <Checkbox
+ borderColor='gray.600'
+ colorScheme='red'
+ size='lg'
+ isChecked={isChecked}
+ onChange={handleChange}
+ />
+ <p className='ml-2'>Ubah ke akun bisnis</p>
+ </div>
+ ))}
{isChecked && (
<div>
<SwitchAccount company_type='nonpkp' />
@@ -97,7 +98,7 @@ export default function Profile() {
)} */}
<PersonalProfile />
<Divider />
- {auth?.parentId && <CompanyProfile />}
+ {(auth?.parentId || auth?.company) && <CompanyProfile />}
</AppLayout>
</MobileView>
@@ -108,18 +109,19 @@ export default function Profile() {
<Menu />
</div>
<div className='w-9/12 bg-white border border-gray_r-6 rounded'>
- {!auth?.parentId && !ubahAkun && (
- <div className='text-sm p-4 flex items-center'>
- <Checkbox
- borderColor='gray.600'
- colorScheme='red'
- size='lg'
- isChecked={isChecked}
- onChange={handleChange}
- />
- <p className='ml-2'>Ubah ke akun bisnis</p>
- </div>
- )}
+ {auth?.company ||
+ (!ubahAkun && (
+ <div className='text-sm p-4 flex items-center'>
+ <Checkbox
+ borderColor='gray.600'
+ colorScheme='red'
+ size='lg'
+ isChecked={isChecked}
+ onChange={handleChange}
+ />
+ <p className='ml-2'>Ubah ke akun bisnis</p>
+ </div>
+ ))}
{isChecked && (
<div>
<SwitchAccount company_type='nonpkp' />
@@ -134,7 +136,7 @@ export default function Profile() {
)} */}
<PersonalProfile />
<Divider />
- {auth?.parentId && <CompanyProfile />}
+ {(auth?.parentId || auth?.company) && <CompanyProfile />}
</div>
</div>
</BasicLayout>
diff --git a/src/pages/my/tempo/index.jsx b/src/pages/my/tempo/index.jsx
index 5fb9deba..6ca5c718 100644
--- a/src/pages/my/tempo/index.jsx
+++ b/src/pages/my/tempo/index.jsx
@@ -13,39 +13,41 @@ export default function MyTempo() {
const router = useRouter();
const [isLoading, setIsLoading] = useState(true);
useEffect(() => {
+ setIsLoading(true);
if (!auth) {
const nextUrl = encodeURIComponent(router.asPath);
router.push(`/login?next=${nextUrl}`);
- }
- // else if (
- // (auth.tempoProgres === '' || auth.tempoProgres === 'rejected') &&
- // !auth.company
- // ) {
- // router.push('/pengajuan-tempo');
- // }
- else {
+ } else {
+ if (
+ !auth.partnerTempo &&
+ (!auth.partnerTempo || auth.tempoProgres === 'review')
+ ) {
+ setIsLoading(true);
+ router.push('/pengajuan-tempo');
+ }
setIsLoading(false);
}
}, [auth]);
- if (isLoading || !auth) {
- return null; // Tidak render apa pun selama loading atau auth/tempo belum tersedia
- }
- return (
- <IsAuth>
- <Seo title='Tempo - Indoteknik.com' />
+ if (isLoading && !auth) {
+ return null;
+ } else {
+ return (
+ <IsAuth>
+ <Seo title='Tempo - Indoteknik.com' />
- <MobileView>
- <AppLayout title='Pembayaran Tempo'>
- <InvoicesComponent />
- </AppLayout>
- </MobileView>
+ <MobileView>
+ <AppLayout title='Pembayaran Tempo'>
+ <InvoicesComponent />
+ </AppLayout>
+ </MobileView>
- <DesktopView>
- <BasicLayout>
- <InvoicesComponent />
- </BasicLayout>
- </DesktopView>
- </IsAuth>
- );
+ <DesktopView>
+ <BasicLayout>
+ <InvoicesComponent />
+ </BasicLayout>
+ </DesktopView>
+ </IsAuth>
+ );
+ }
}