summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2025-01-11 09:27:46 +0700
committerit-fixcomart <it@fixcomart.co.id>2025-01-11 09:27:46 +0700
commit40f762589601de0fe1d5b06164b2553ebdbf5ecd (patch)
treeb5d341a472ef37a00e5a87e0877e9874b0ca5490
parentfedaceac3e41741c198c94fd20917c9572fa7ec1 (diff)
<iman> update code
-rw-r--r--src/lib/tempo/components/Tempo.jsx7
-rw-r--r--src/pages/pengajuan-tempo/[status].jsx9
-rw-r--r--src/pages/pengajuan-tempo/index.jsx5
3 files changed, 8 insertions, 13 deletions
diff --git a/src/lib/tempo/components/Tempo.jsx b/src/lib/tempo/components/Tempo.jsx
index 3af5b56c..c246f3d8 100644
--- a/src/lib/tempo/components/Tempo.jsx
+++ b/src/lib/tempo/components/Tempo.jsx
@@ -33,7 +33,7 @@ import { InfoIcon } from 'lucide-react';
const Tempo = () => {
const auth = getAuth();
const router = useRouter();
- const { q = '', page = 1, limit = 15, status = 0 } = router.query;
+ const { q = '', page = 1, limit = 15, status = '' } = router.query;
const { isDesktop, isMobile } = useDevice();
const [pageNew, setPageNew] = useState(page);
const [limitNew, setLimitNew] = useState(limit);
@@ -282,7 +282,7 @@ const Tempo = () => {
</select>
<select
id='statusSelect'
- value={statusNew}
+ value={statusNew ?? ''} // Gunakan nullish coalescing untuk default value
onChange={(e) => {
setStatusNew(Number(e.target.value));
if (e.target.value == 0) {
@@ -293,6 +293,9 @@ const Tempo = () => {
}}
className='border p-2'
>
+ <option value='' disabled hidden>
+ Status
+ </option>
<option value={0}>All</option>
<option value={1}>Jatuh Tempo</option>
<option value={2}>Belum Jatuh Tempo</option>
diff --git a/src/pages/pengajuan-tempo/[status].jsx b/src/pages/pengajuan-tempo/[status].jsx
index c97b5897..fa0a1749 100644
--- a/src/pages/pengajuan-tempo/[status].jsx
+++ b/src/pages/pengajuan-tempo/[status].jsx
@@ -8,9 +8,9 @@ import Seo from '@/core/components/Seo';
import { getAuth } from '~/libs/auth';
export async function getServerSideProps(context) {
- const { tempo_id } = context.query;
+ const { status } = context.query;
// await axios.post(
- // `${process.env.NEXT_PUBLIC_SELF_HOST}/api/pengajuan-tempo?formId=${tempo_id}`,
+ // `${process.env.NEXT_PUBLIC_SELF_HOST}/api/pengajuan-tempo/${status}`,
// {},
// { headers: context.req.headers }
// );
@@ -25,11 +25,6 @@ export default function Finish() {
if (!auth) {
const nextUrl = encodeURIComponent(router.asPath);
router.push(`/login?next=${nextUrl}`);
- } else if (
- (router.query.status == 'approve' || router.query.status == 'review') &&
- auth.tempoProgres === ''
- ) {
- router.push('/pengajuan-tempo');
} else {
setIsLoading(false);
}
diff --git a/src/pages/pengajuan-tempo/index.jsx b/src/pages/pengajuan-tempo/index.jsx
index d485c721..6987bd29 100644
--- a/src/pages/pengajuan-tempo/index.jsx
+++ b/src/pages/pengajuan-tempo/index.jsx
@@ -46,10 +46,7 @@ export default function TrackingOrder() {
if (!auth) {
const nextUrl = encodeURIComponent(router.asPath);
router.push(`/login?next=${nextUrl}`);
- } else if (
- auth.tempoProgres === 'approve' &&
- tempo?.paymentTerm?.toLowerCase().includes('tempo')
- ) {
+ } else if (auth.tempoProgres === 'approve' || auth?.partnerTempo) {
router.push('/pengajuan-tempo/approve');
} else if (!auth.parentId) {
router.push('/pengajuan-tempo/switch-account');