From 2a030239105dba1f78a3fdc51ccc49a46bc60ca2 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 30 Sep 2024 13:57:59 +0700 Subject: update switch account --- .../modules/register/components/FormBisnis.tsx | 31 +++++++++++++++------- src/lib/auth/components/Menu.jsx | 17 +++++++----- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src-migrate/modules/register/components/FormBisnis.tsx b/src-migrate/modules/register/components/FormBisnis.tsx index 97c0acad..16747ff3 100644 --- a/src-migrate/modules/register/components/FormBisnis.tsx +++ b/src-migrate/modules/register/components/FormBisnis.tsx @@ -348,12 +348,22 @@ const form: React.FC = ({ const [hasNPWP, setHasNpwp] = useState(false); const [hasSPPKP, setHasSPPKP] = useState(false); const [fileUrlSppkp, setFileUrlSppkp] = useState(''); - useEffect(() => { - const checkUrl = async (url: string | URL | Request) => { + const checkUrlNPWP = async (url: string | URL | Request) => { + try { + const response = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/chek/npwp/${auth?.parentId}`; + + return response; // Returns true if status is 200-299 + } catch (error) { + console.error('Error accessing URL:', url, error); + return false; + } + }; + const checkUrlSPPKP = async (url: string | URL | Request) => { try { - const response = await fetch(url, { method: 'HEAD' }); - return response.ok; // Returns true if status is 200-299 + const response = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/chek/sppkp/${auth?.parentId}`; + + return response; // Returns true if status is 200-299 } catch (error) { console.error('Error accessing URL:', url, error); return false; @@ -364,14 +374,16 @@ const form: React.FC = ({ const sppkpUrl = `${process.env.NEXT_PUBLIC_ODOO_API_HOST}/api/v1/user/download/sppkp/${auth?.parentId}`; if (auth?.parentId) { - checkUrl(npwpUrl).then((isAccessible) => { + checkUrlNPWP(npwpUrl).then((isAccessible) => { if (isAccessible) { setFileUrl(npwpUrl); setHasNpwp(true); + updateForm('npwp_document', ' '); + updateForm('sppkp_document', ' '); } }); - checkUrl(sppkpUrl).then((isAccessible) => { + checkUrlSPPKP(sppkpUrl).then((isAccessible) => { if (isAccessible) { setFileUrlSppkp(sppkpUrl); setHasSPPKP(true); @@ -835,6 +847,9 @@ const form: React.FC = ({ accept='.pdf,.png,.jpg,.jpeg' content='lagu.jpg' /> + {chekValid && isPKP && !required && !!errors.sppkp_document && ( + {errors.sppkp_document} + )} Format: .pdf, .png, .jpg, atau .jpeg, Maks 2MB @@ -858,10 +873,6 @@ const form: React.FC = ({ )} - - {chekValid && isPKP && !required && !!errors.sppkp_document && ( - {errors.sppkp_document} - )} diff --git a/src/lib/auth/components/Menu.jsx b/src/lib/auth/components/Menu.jsx index 06eb6c2d..8eaa769b 100644 --- a/src/lib/auth/components/Menu.jsx +++ b/src/lib/auth/components/Menu.jsx @@ -31,8 +31,9 @@ const Menu = () => {

Akun Bisnis

-
- Ini adalah akun bisnis. +
+ Anda terdaftar sebagai akun bisnis, segala bentuk transaksi anda + untuk perusahaan yang sudah anda daftarkan di Indoteknik.com
)} @@ -42,8 +43,9 @@ const Menu = () => {

Review

-
- Akun sedang dalam proses review. +
+ Proses perubahan akun anda sedang kami review, mohon menunggu + hingga 2x24 jam.
)} @@ -53,8 +55,11 @@ const Menu = () => {

Akun Individu

-
- Ini adalah akun individu. +
+

+ Anda terdaftar sebagai akun individu, Segala bentuk transaksi + anda untuk Pribadi/Individu. +

)} -- cgit v1.2.3