From 34f33b1cba1e4fbb6faacc151a3b59a1ba221d60 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 10 Sep 2024 16:26:17 +0700 Subject: add feature switch account --- src/pages/my/profile.jsx | 68 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 22 deletions(-) (limited to 'src/pages') diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index 25c3a608..ca6f4700 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -1,16 +1,23 @@ -import Divider from '@/core/components/elements/Divider/Divider' -import AppLayout from '@/core/components/layouts/AppLayout' -import BasicLayout from '@/core/components/layouts/BasicLayout' -import DesktopView from '@/core/components/views/DesktopView' -import MobileView from '@/core/components/views/MobileView' -import useAuth from '@/core/hooks/useAuth' -import CompanyProfile from '@/lib/auth/components/CompanyProfile' -import IsAuth from '@/lib/auth/components/IsAuth' -import Menu from '@/lib/auth/components/Menu' -import PersonalProfile from '@/lib/auth/components/PersonalProfile' +import Divider from '@/core/components/elements/Divider/Divider'; +import AppLayout from '@/core/components/layouts/AppLayout'; +import BasicLayout from '@/core/components/layouts/BasicLayout'; +import DesktopView from '@/core/components/views/DesktopView'; +import MobileView from '@/core/components/views/MobileView'; +import useAuth from '@/core/hooks/useAuth'; +import CompanyProfile from '@/lib/auth/components/CompanyProfile'; +import SwitchAccount from '@/lib/auth/components/SwitchAccount'; +import IsAuth from '@/lib/auth/components/IsAuth'; +import Menu from '@/lib/auth/components/Menu'; +import PersonalProfile from '@/lib/auth/components/PersonalProfile'; +import { Button, Checkbox, Spinner, Tooltip } from '@chakra-ui/react'; +import { useState } from 'react'; export default function Profile() { - const auth = useAuth() + const auth = useAuth(); + const [isChecked, setIsChecked] = useState(false); + const handleChange = async () => { + setIsChecked(!isChecked); + }; return ( @@ -23,19 +30,36 @@ export default function Profile() { -
-
- -
-
- - - {auth?.parentId && } - -
+
+
+ +
+
+ {!auth?.parentId && ( +
+ +

Ubah ke akun bisnis

+
+ )} + {isChecked && ( +
+ + +
+ )} + + + {auth?.parentId && } +
- ) + ); } -- cgit v1.2.3 From 752e55686dfee0d536f9e4e128336e91681ba794 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 11 Sep 2024 17:07:49 +0700 Subject: update switch account --- src/pages/my/profile.jsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/pages') diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index ca6f4700..c9742a14 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -10,14 +10,25 @@ import IsAuth from '@/lib/auth/components/IsAuth'; import Menu from '@/lib/auth/components/Menu'; import PersonalProfile from '@/lib/auth/components/PersonalProfile'; import { Button, Checkbox, Spinner, Tooltip } from '@chakra-ui/react'; -import { useState } from 'react'; - +import { useState, useEffect } from 'react'; +import switchAccountProgresApi from '@/lib/auth/api/switchAccountProgresApi.js'; export default function Profile() { const auth = useAuth(); const [isChecked, setIsChecked] = useState(false); + const [isAprove, setIsAprove] = useState(false); const handleChange = async () => { setIsChecked(!isChecked); }; + useEffect(() => { + const loadPromo = async () => { + const progresSwitchAccount = await switchAccountProgresApi(); + if (progresSwitchAccount) { + setIsAprove(true); + } + console.log('progresSwitchAccount', progresSwitchAccount); + }; + loadPromo(); + }, []); return ( @@ -35,7 +46,7 @@ export default function Profile() {
- {!auth?.parentId && ( + {!auth?.parentId && !isAprove && (
Date: Thu, 12 Sep 2024 10:11:02 +0700 Subject: update switch account --- src/pages/my/profile.jsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/pages') diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index c9742a14..4beaae5f 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -9,13 +9,14 @@ import SwitchAccount from '@/lib/auth/components/SwitchAccount'; import IsAuth from '@/lib/auth/components/IsAuth'; import Menu from '@/lib/auth/components/Menu'; import PersonalProfile from '@/lib/auth/components/PersonalProfile'; +import StatusSwitchAccount from '@/lib/auth/components/StatusSwitchAccount'; import { Button, Checkbox, Spinner, Tooltip } from '@chakra-ui/react'; import { useState, useEffect } from 'react'; import switchAccountProgresApi from '@/lib/auth/api/switchAccountProgresApi.js'; export default function Profile() { const auth = useAuth(); const [isChecked, setIsChecked] = useState(false); - const [isAprove, setIsAprove] = useState(false); + const [isAprove, setIsAprove] = useState('unknown'); const handleChange = async () => { setIsChecked(!isChecked); }; @@ -23,12 +24,13 @@ export default function Profile() { const loadPromo = async () => { const progresSwitchAccount = await switchAccountProgresApi(); if (progresSwitchAccount) { - setIsAprove(true); + setIsAprove(progresSwitchAccount.status); } console.log('progresSwitchAccount', progresSwitchAccount); }; loadPromo(); }, []); + console.log('isAprove', isAprove); return ( @@ -46,7 +48,7 @@ export default function Profile() {
- {!auth?.parentId && !isAprove && ( + {!auth?.parentId && isAprove == 'unknown' && (
)} + {!auth?.parentId + ? auth?.parentId + : auth?.parent_id && + isAprove != 'unknown' && ( + + )} {auth?.parentId && } -- cgit v1.2.3 From f0f002ff77481db91d264069d09f580d58001a8c Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 23 Sep 2024 13:15:02 +0700 Subject: update switch account --- src/pages/my/profile.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/pages') diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index 4beaae5f..13cab06d 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -16,6 +16,7 @@ import switchAccountProgresApi from '@/lib/auth/api/switchAccountProgresApi.js'; export default function Profile() { const auth = useAuth(); const [isChecked, setIsChecked] = useState(false); + const [ubahAkun, setUbahAkun] = useState(false); const [isAprove, setIsAprove] = useState('unknown'); const handleChange = async () => { setIsChecked(!isChecked); @@ -25,6 +26,7 @@ export default function Profile() { const progresSwitchAccount = await switchAccountProgresApi(); if (progresSwitchAccount) { setIsAprove(progresSwitchAccount.status); + setUbahAkun(progresSwitchAccount.status === 'unknown'); } console.log('progresSwitchAccount', progresSwitchAccount); }; @@ -48,7 +50,7 @@ export default function Profile() {
- {!auth?.parentId && isAprove == 'unknown' && ( + {!auth?.parentId && ubahAkun && (
Date: Mon, 23 Sep 2024 14:17:52 +0700 Subject: delete console.log --- src/pages/my/profile.jsx | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/pages') diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index 13cab06d..0eeec6cf 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -28,11 +28,9 @@ export default function Profile() { setIsAprove(progresSwitchAccount.status); setUbahAkun(progresSwitchAccount.status === 'unknown'); } - console.log('progresSwitchAccount', progresSwitchAccount); }; loadPromo(); }, []); - console.log('isAprove', isAprove); return ( -- cgit v1.2.3 From c0a72c10864ee5e70ebfba4718be25eba910ccf0 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 23 Sep 2024 16:13:10 +0700 Subject: update mobile view --- src/pages/my/profile.jsx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/pages') diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index 0eeec6cf..b87aa69a 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -35,6 +35,30 @@ export default function Profile() { + {!auth?.parentId && ubahAkun && ( +
+ +

Ubah ke akun bisnis

+
+ )} + {isChecked && ( +
+ + +
+ )} + {!auth?.parentId + ? auth?.parentId + : auth?.parent_id && + isAprove != 'unknown' && ( + + )} {auth?.parentId && } -- cgit v1.2.3 From 461d2786935c5c9b3cf627c44fc06fcd1c3e8075 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 26 Sep 2024 11:13:15 +0700 Subject: add pop up yakin ubah type akun --- src/pages/my/profile.jsx | 181 ++++++++++++++++++++++++++++------------------- 1 file changed, 109 insertions(+), 72 deletions(-) (limited to 'src/pages') diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index b87aa69a..f6063ff2 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -10,16 +10,22 @@ import IsAuth from '@/lib/auth/components/IsAuth'; import Menu from '@/lib/auth/components/Menu'; import PersonalProfile from '@/lib/auth/components/PersonalProfile'; import StatusSwitchAccount from '@/lib/auth/components/StatusSwitchAccount'; -import { Button, Checkbox, Spinner, Tooltip } from '@chakra-ui/react'; +import { Checkbox } from '@chakra-ui/react'; import { useState, useEffect } from 'react'; import switchAccountProgresApi from '@/lib/auth/api/switchAccountProgresApi.js'; +import BottomPopup from '@/core/components/elements/Popup/BottomPopup'; export default function Profile() { const auth = useAuth(); const [isChecked, setIsChecked] = useState(false); const [ubahAkun, setUbahAkun] = useState(false); const [isAprove, setIsAprove] = useState('unknown'); + const [changeConfirmation, setChangeConfirmation] = useState(false); const handleChange = async () => { - setIsChecked(!isChecked); + if (isChecked) { + setIsChecked(!isChecked); + } else { + setChangeConfirmation(true); + } }; useEffect(() => { const loadPromo = async () => { @@ -31,78 +37,109 @@ export default function Profile() { }; loadPromo(); }, []); + const handleConfirmSubmit = () => { + setChangeConfirmation(false); + setIsChecked(true); + }; return ( - - - - {!auth?.parentId && ubahAkun && ( -
- -

Ubah ke akun bisnis

-
- )} - {isChecked && ( -
- - -
- )} - {!auth?.parentId - ? auth?.parentId - : auth?.parent_id && - isAprove != 'unknown' && ( - - )} - - - {auth?.parentId && } -
-
+ <> + setChangeConfirmation(false)} // Menutup popup + title='Ubah type akun' + > +
+ Anda akan mengubah type akun anda? +
+
+ + +
+
+ + + + {!auth?.parentId && ubahAkun && ( +
+ +

Ubah ke akun bisnis

+
+ )} + {isChecked && ( +
+ + +
+ )} + {!auth?.parentId + ? auth?.parentId + : auth?.parent_id && + isAprove != 'unknown' && ( + + )} + + + {auth?.parentId && } +
+
- - -
-
- -
-
- {!auth?.parentId && ubahAkun && ( -
- -

Ubah ke akun bisnis

-
- )} - {isChecked && ( -
- - -
- )} - {!auth?.parentId - ? auth?.parentId - : auth?.parent_id && - isAprove != 'unknown' && ( - - )} - - - {auth?.parentId && } + + +
+
+ +
+
+ {!auth?.parentId && ubahAkun && ( +
+ +

Ubah ke akun bisnis

+
+ )} + {isChecked && ( +
+ + +
+ )} + {!auth?.parentId + ? auth?.parentId + : auth?.parent_id && + isAprove != 'unknown' && ( + + )} + + + {auth?.parentId && } +
-
- - - + + + + ); } -- cgit v1.2.3 From 3eb78e21b89bd0bdddb803767ea6ec983794994b Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 28 Sep 2024 10:01:30 +0700 Subject: update temp switch account --- src/pages/my/profile.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/pages') diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index f6063ff2..ee0cd907 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -9,7 +9,7 @@ import SwitchAccount from '@/lib/auth/components/SwitchAccount'; import IsAuth from '@/lib/auth/components/IsAuth'; import Menu from '@/lib/auth/components/Menu'; import PersonalProfile from '@/lib/auth/components/PersonalProfile'; -import StatusSwitchAccount from '@/lib/auth/components/StatusSwitchAccount'; +// import StatusSwitchAccount from '@/lib/auth/components/StatusSwitchAccount'; import { Checkbox } from '@chakra-ui/react'; import { useState, useEffect } from 'react'; import switchAccountProgresApi from '@/lib/auth/api/switchAccountProgresApi.js'; @@ -89,12 +89,12 @@ export default function Profile() {
)} - {!auth?.parentId + {/* {!auth?.parentId ? auth?.parentId : auth?.parent_id && isAprove != 'unknown' && ( - )} + )} */} {auth?.parentId && } @@ -126,12 +126,12 @@ export default function Profile() {
)} - {!auth?.parentId + {/* {!auth?.parentId ? auth?.parentId : auth?.parent_id && isAprove != 'unknown' && ( - )} + )} */} {auth?.parentId && } -- cgit v1.2.3 From 2dc7f7ae3eb62f9821f8ae1fb87db2e7b9234e1b Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 1 Oct 2024 10:57:08 +0700 Subject: update logic switch account --- src/pages/my/profile.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/pages') diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index ee0cd907..f44a44f3 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -18,7 +18,7 @@ export default function Profile() { const auth = useAuth(); const [isChecked, setIsChecked] = useState(false); const [ubahAkun, setUbahAkun] = useState(false); - const [isAprove, setIsAprove] = useState('unknown'); + const [isAprove, setIsAprove] = useState(); const [changeConfirmation, setChangeConfirmation] = useState(false); const handleChange = async () => { if (isChecked) { @@ -32,7 +32,7 @@ export default function Profile() { const progresSwitchAccount = await switchAccountProgresApi(); if (progresSwitchAccount) { setIsAprove(progresSwitchAccount.status); - setUbahAkun(progresSwitchAccount.status === 'unknown'); + setUbahAkun(progresSwitchAccount.status); } }; loadPromo(); @@ -71,7 +71,7 @@ export default function Profile() { - {!auth?.parentId && ubahAkun && ( + {!auth?.parentId && !ubahAkun && (
- {!auth?.parentId && ubahAkun && ( + {!auth?.parentId && !ubahAkun && (
Date: Wed, 2 Oct 2024 13:21:25 +0700 Subject: update switch account --- src/pages/my/profile.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/pages') diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index f44a44f3..eaf3341c 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -85,7 +85,7 @@ export default function Profile() { )} {isChecked && (
- +
)} @@ -122,7 +122,7 @@ export default function Profile() { )} {isChecked && (
- +
)} -- cgit v1.2.3