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') 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