From 930919a6f99626436bf2e24aa0ee2b0566808a88 Mon Sep 17 00:00:00 2001
From: "Indoteknik ." <andrifebriyadiputra@gmail.com>
Date: Mon, 11 Aug 2025 13:53:36 +0700
Subject: (andri) add iframe embed tutorial pengajuan tempo

---
 src/lib/pengajuan-tempo/component/FinishTempo.jsx | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

(limited to 'src/lib/pengajuan-tempo/component/FinishTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/FinishTempo.jsx b/src/lib/pengajuan-tempo/component/FinishTempo.jsx
index aacb9ef3..84c80e60 100644
--- a/src/lib/pengajuan-tempo/component/FinishTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/FinishTempo.jsx
@@ -111,6 +111,26 @@ const FinishTempo = ({ query }) => {
           : '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">
+            <p>Agar tidak bingung saat mengubah akun,</p>
+            <p>Yuk pelajari dulu langkah-langkah pengajuan tempo lewat video berikut</p>
+          </div>
+          <div className="relative" style={{ paddingTop: '56.25%' /* 16:9 aspect ratio */ }}>
+            <iframe
+              src="https://www.youtube.com/embed/m15f8-eLqUc?si=frNbGnJu1zjINnDT"
+              title="YouTube video player"
+              frameBorder="0"
+              allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
+              allowFullScreen
+              referrerPolicy="strict-origin-when-cross-origin"
+              className="absolute top-0 left-0 w-full h-full rounded-md shadow-lg"
+            ></iframe>
+          </div>
+        </div>
+      )}
     </div>
   );
 };
-- 
cgit v1.2.3


From 7647104348478302778c0afbd3a3d1b2637bc03b Mon Sep 17 00:00:00 2001
From: "Indoteknik ." <andrifebriyadiputra@gmail.com>
Date: Mon, 11 Aug 2025 15:35:25 +0700
Subject: (andri) set true checklist ubah ke akun bisnis

---
 src/lib/pengajuan-tempo/component/FinishTempo.jsx | 58 +++++++++++++++--------
 1 file changed, 39 insertions(+), 19 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/FinishTempo.jsx')

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>
-- 
cgit v1.2.3


From dd0c699d8a866b53b962f92f98939ebb527dded0 Mon Sep 17 00:00:00 2001
From: "Indoteknik ." <andrifebriyadiputra@gmail.com>
Date: Mon, 11 Aug 2025 15:56:53 +0700
Subject: (andri) fix layout

---
 src/lib/pengajuan-tempo/component/FinishTempo.jsx | 55 +++++++++++++----------
 1 file changed, 32 insertions(+), 23 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/FinishTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/FinishTempo.jsx b/src/lib/pengajuan-tempo/component/FinishTempo.jsx
index 9d912b1a..ad8a7e67 100644
--- a/src/lib/pengajuan-tempo/component/FinishTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/FinishTempo.jsx
@@ -106,11 +106,41 @@ const FinishTempo = ({ query }) => {
           'Proses pengajuan tempo anda sudah berhasil terdaftar di indoteknik.com. Nikmati pembelian anda di website indoteknik dengan menggunakan pembayaran tempo'}
       </div>
 
+      <hr className="border-gray-300 w-full" />
+      
+      {/* Video panduan khusus tampil saat status switch-account */}
+      {query?.status === 'switch-account' && (
+        <div className="w-full max-w-3xl mx-auto px-4 text-center text-gray-700 mb-6">
+          <div className="mb-3 font-medium">
+            <h1
+              className={`text-red-500 text-center font-semibold ${
+                isMobile ? 'text-lg' : 'text-3xl'
+              }`}
+              // Mengganti py-4 dengan my-6 supaya jarak vertikalnya sama dengan hr
+              style={{ marginTop: 24, marginBottom: 24 }}
+            >
+              Video Panduan Pengajuan Tempo
+            </h1>
+          </div>
+          <div className="relative" style={{ paddingTop: '56.25%' /* 16:9 aspect ratio */ }}>
+            <iframe
+              src="https://www.youtube.com/embed/m15f8-eLqUc?si=frNbGnJu1zjINnDT"
+              title="YouTube video player"
+              frameBorder="0"
+              allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
+              allowFullScreen
+              referrerPolicy="strict-origin-when-cross-origin"
+              className="absolute top-0 left-0 w-full h-full rounded-md shadow-lg"
+            ></iframe>
+          </div>
+        </div>
+      )}
+
       {/* 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'
+          className='btn-solid-red rounded-md text-base flex flex-row items-center justify-center mb-10'
         >
           Ubah Akun
           <ChevronRightIcon className='w-5' />
@@ -122,7 +152,7 @@ const FinishTempo = ({ query }) => {
               ? '/my/tempo/'
               : '/'
           }
-          className='btn-solid-red rounded-md text-base flex flex-row items-center justify-center'
+          className='btn-solid-red rounded-md text-base flex flex-row items-center justify-center mb-10'
         >
           {query?.status === 'approve'
             ? 'Lihat Detail Tempo'
@@ -130,27 +160,6 @@ const FinishTempo = ({ query }) => {
           <ChevronRightIcon className='w-5' />
         </Link>
       )}
-
-      {/* Video panduan khusus tampil saat status switch-account */}
-      {query?.status === 'switch-account' && (
-        <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>
-          <div className="relative" style={{ paddingTop: '56.25%' /* 16:9 aspect ratio */ }}>
-            <iframe
-              src="https://www.youtube.com/embed/m15f8-eLqUc?si=frNbGnJu1zjINnDT"
-              title="YouTube video player"
-              frameBorder="0"
-              allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
-              allowFullScreen
-              referrerPolicy="strict-origin-when-cross-origin"
-              className="absolute top-0 left-0 w-full h-full rounded-md shadow-lg"
-            ></iframe>
-          </div>
-        </div>
-      )}
     </div>
   );
 };
-- 
cgit v1.2.3


From 1085602ad84e73692e3ab8b9141c5f61381a8cea Mon Sep 17 00:00:00 2001
From: "Indoteknik ." <andrifebriyadiputra@gmail.com>
Date: Wed, 13 Aug 2025 10:57:36 +0700
Subject: (andri) layout pengajuan tempo jika status akun pending

---
 src/lib/pengajuan-tempo/component/FinishTempo.jsx | 77 +++++++++++++++++------
 1 file changed, 57 insertions(+), 20 deletions(-)

(limited to 'src/lib/pengajuan-tempo/component/FinishTempo.jsx')

diff --git a/src/lib/pengajuan-tempo/component/FinishTempo.jsx b/src/lib/pengajuan-tempo/component/FinishTempo.jsx
index ad8a7e67..abf218d9 100644
--- a/src/lib/pengajuan-tempo/component/FinishTempo.jsx
+++ b/src/lib/pengajuan-tempo/component/FinishTempo.jsx
@@ -9,9 +9,12 @@ import axios from 'axios';
 import { toast } from 'react-hot-toast';
 import { ChevronRightIcon, ChevronLeftIcon } from '@heroicons/react/24/outline';
 import { useRouter } from 'next/router';
+import switchAccountProgresApi from '@/lib/auth/api/switchAccountProgresApi.js';
 
 const FinishTempo = ({ query }) => {
   const [data, setData] = useState();
+  const [switchStatus, setSwitchStatus] = useState(null);
+  const [loadingStatus, setLoadingStatus] = useState(true);
   const [transactionData, setTransactionData] = useState();
   const { isDesktop, isMobile } = useDevice();
   const auth = useAuth();
@@ -29,16 +32,46 @@ const FinishTempo = ({ query }) => {
     fetchData();
   }, [query]);
 
+  useEffect(() => {
+    const fetchSwitchStatus = async () => {
+      try {
+        const progres = await switchAccountProgresApi();
+        setSwitchStatus(progres?.status);
+      } catch (err) {
+        console.error('Gagal cek progres switch account:', err);
+      } finally {
+        setLoadingStatus(false);
+      }
+    };
+    fetchSwitchStatus();
+  }, []);
+
   // Handler khusus untuk tombol Ubah Akun
   const handleSwitchAccountClick = () => {
-    // Set flag di localStorage
+    if (switchStatus === 'pending') {
+      toast.info('Akun sedang menunggu verifikasi. Tidak dapat mengubah akun saat ini.', { duration: 2500 });
+      return;
+    }
     localStorage.setItem('autoCheckProfile', 'true');
-    // Navigate tanpa query param ke halaman profile
     router.push('/my/profile');
   };
 
+  if (loadingStatus) {
+    return (
+      <div className="container flex flex-col items-center gap-4">
+        <div className="py-20 text-gray-500">Memuat data...</div>
+      </div>
+    );
+  }
+
   return (
-    <div className='container flex flex-col items-center gap-4'>
+    <div
+      className={`container flex flex-col items-center gap-4 pb-20 ${
+        switchStatus === 'pending'
+          ? 'min-h-[calc(100vh-80px)] md:min-h-[calc(100vh-100px)] lg:min-h-[calc(100vh-120px)]'
+          : 'min-h-screen'
+      }`}
+    >
       <div
         className={`flex ${
           isMobile ? 'w-full' : 'w-2/3'
@@ -51,8 +84,11 @@ const FinishTempo = ({ query }) => {
         >
           {query?.status == 'finish' &&
             'Form Pengajuan Tempo kamu Telah Berhasil Didaftarkan Mohon menunggu hingga Proses Verifikasi Selesai Dilakukan'}
-          {query?.status == 'switch-account' &&
-            'Form Pengajuan Tempo Kamu Gagal Dilakukan'}
+          {switchStatus === 'pending'
+            ? 'Form Pengajuan Tempo Kamu Belum Dapat Dilakukan'
+            : query?.status == 'switch-account' &&
+              'Form Pengajuan Tempo Kamu Gagal Dilakukan'
+          }
           {query?.status == 'review' &&
             'Pengajuan Tempo dalam Proses Verifikasi'}
           {query?.status == 'approve' && 'Pengajuan Tempo Berhasil'}
@@ -96,8 +132,11 @@ const FinishTempo = ({ query }) => {
           isMobile ? 'w-full text-sm' : 'w-4/5 text-base'
         }`}
       >
-        {query?.status == 'switch-account' &&
-          'Terima kasih atas minat anda untuk mendaftar Tempo, namun sayangnya akun anda bukan merupakan akun bisnis. Segera ubah akun anda menjadi Bisnis untuk menggunakan fitur ini'}
+        {switchStatus === 'pending'
+          ? 'Proses perubahan ke akun bisnis sedang kami review, mohon menunggu hingga 2x24 jam'
+          : query?.status == 'switch-account' &&
+            'Terima kasih atas minat anda untuk mendaftar Tempo, namun sayangnya akun anda bukan merupakan akun bisnis. Segera ubah akun anda menjadi Bisnis untuk menggunakan fitur ini'
+        }
         {query?.status == 'finish' &&
           'Mohon menunggu untuk verifikasi dokumen dan kelengkapan data yang telah anda berikan. Proses approval pembayaran tempo kamu berhasil atau tidak akan diinfokan melalui email perusahaan / email yang mendaftar'}
         {query?.status == 'review' &&
@@ -106,10 +145,12 @@ const FinishTempo = ({ query }) => {
           'Proses pengajuan tempo anda sudah berhasil terdaftar di indoteknik.com. Nikmati pembelian anda di website indoteknik dengan menggunakan pembayaran tempo'}
       </div>
 
-      <hr className="border-gray-300 w-full" />
+      {switchStatus !== 'pending' && (
+        <hr className="border-gray-300 w-full" />
+      )}
       
       {/* Video panduan khusus tampil saat status switch-account */}
-      {query?.status === 'switch-account' && (
+      {query?.status === 'switch-account' && switchStatus !== 'pending' &&  (
         <div className="w-full max-w-3xl mx-auto px-4 text-center text-gray-700 mb-6">
           <div className="mb-3 font-medium">
             <h1
@@ -137,27 +178,23 @@ const FinishTempo = ({ query }) => {
       )}
 
       {/* Tombol dengan behavior berbeda jika status switch-account */}
-      {query?.status === 'switch-account' ? (
+      {query?.status === 'switch-account' && switchStatus !== 'pending' ? (
         <button
           onClick={handleSwitchAccountClick}
-          className='btn-solid-red rounded-md text-base flex flex-row items-center justify-center mb-10'
+          className="btn-solid-red rounded-md text-base flex flex-row items-center justify-center mb-10"
         >
           Ubah Akun
-          <ChevronRightIcon className='w-5' />
+          <ChevronRightIcon className="w-5" />
         </button>
-      ) : (
+      ) : query?.status !== 'switch-account' && (
         <Link
-          href={
-            query?.status === 'approve'
-              ? '/my/tempo/'
-              : '/'
-          }
-          className='btn-solid-red rounded-md text-base flex flex-row items-center justify-center mb-10'
+          href={query?.status === 'approve' ? '/my/tempo/' : '/'}
+          className="btn-solid-red rounded-md text-base flex flex-row items-center justify-center mb-10"
         >
           {query?.status === 'approve'
             ? 'Lihat Detail Tempo'
             : 'Kembali Ke Beranda'}
-          <ChevronRightIcon className='w-5' />
+          <ChevronRightIcon className="w-5" />
         </Link>
       )}
     </div>
-- 
cgit v1.2.3

