diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/pengajuan-tempo/component/FinishTempo.jsx | 58 |
1 files changed, 39 insertions, 19 deletions
diff --git a/src/lib/pengajuan-tempo/component/FinishTempo.jsx b/src/lib/pengajuan-tempo/component/FinishTempo.jsx index 84c80e60..9d912b1a 100644 --- a/src/lib/pengajuan-tempo/component/FinishTempo.jsx +++ b/src/lib/pengajuan-tempo/component/FinishTempo.jsx @@ -8,6 +8,7 @@ import useAuth from '@/core/hooks/useAuth'; import axios from 'axios'; import { toast } from 'react-hot-toast'; import { ChevronRightIcon, ChevronLeftIcon } from '@heroicons/react/24/outline'; +import { useRouter } from 'next/router'; const FinishTempo = ({ query }) => { const [data, setData] = useState(); @@ -15,6 +16,8 @@ const FinishTempo = ({ query }) => { const { isDesktop, isMobile } = useDevice(); const auth = useAuth(); const so_order = query?.order_id?.replaceAll('-', '/'); + const router = useRouter(); + useEffect(() => { const fetchData = async () => { const fetchedData = await odooApi( @@ -26,6 +29,14 @@ const FinishTempo = ({ query }) => { fetchData(); }, [query]); + // Handler khusus untuk tombol Ubah Akun + const handleSwitchAccountClick = () => { + // Set flag di localStorage + localStorage.setItem('autoCheckProfile', 'true'); + // Navigate tanpa query param ke halaman profile + router.push('/my/profile'); + }; + return ( <div className='container flex flex-col items-center gap-4'> <div @@ -94,27 +105,36 @@ const FinishTempo = ({ query }) => { {query?.status == 'approve' && 'Proses pengajuan tempo anda sudah berhasil terdaftar di indoteknik.com. Nikmati pembelian anda di website indoteknik dengan menggunakan pembayaran tempo'} </div> - <Link - href={ - query?.status === 'switch-account' - ? '/my/profile' - : query?.status === 'approve' - ? '/my/tempo/' - : '/' - } - className='btn-solid-red rounded-md text-base flex flex-row items-center justify-center' - > - {query?.status === 'switch-account' - ? 'Ubah Akun' - : query?.status === 'approve' - ? 'Lihat Detail Tempo' - : 'Kembali Ke Beranda'} - <ChevronRightIcon className='w-5' /> - </Link> + + {/* Tombol dengan behavior berbeda jika status switch-account */} + {query?.status === 'switch-account' ? ( + <button + onClick={handleSwitchAccountClick} + className='btn-solid-red rounded-md text-base flex flex-row items-center justify-center' + > + Ubah Akun + <ChevronRightIcon className='w-5' /> + </button> + ) : ( + <Link + href={ + query?.status === 'approve' + ? '/my/tempo/' + : '/' + } + className='btn-solid-red rounded-md text-base flex flex-row items-center justify-center' + > + {query?.status === 'approve' + ? 'Lihat Detail Tempo' + : 'Kembali Ke Beranda'} + <ChevronRightIcon className='w-5' /> + </Link> + )} + {/* Video panduan khusus tampil saat status switch-account */} {query?.status === 'switch-account' && ( - <div className="mt-6 w-full max-w-3xl mx-auto px-4 text-center text-gray-700 mb-6 md:mb-20"> - <div className="mb-3 font-medium"> + <div className="w-full max-w-3xl mx-auto px-4 text-center text-gray-700 mb-6 md:mb-20"> + <div className="mb-3 font-medium opacity-75"> <p>Agar tidak bingung saat mengubah akun,</p> <p>Yuk pelajari dulu langkah-langkah pengajuan tempo lewat video berikut</p> </div> |
