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 From da44e90efe705239ac7419da1874161acb88299a Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 15 Oct 2024 15:23:29 +0700 Subject: add feature pengajuan tempo --- src/pages/pengajuan-tempo.jsx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/pages/pengajuan-tempo.jsx (limited to 'src/pages') diff --git a/src/pages/pengajuan-tempo.jsx b/src/pages/pengajuan-tempo.jsx new file mode 100644 index 00000000..f27fb907 --- /dev/null +++ b/src/pages/pengajuan-tempo.jsx @@ -0,0 +1,29 @@ +import Seo from '@/core/components/Seo'; +import dynamic from 'next/dynamic'; +import SimpleFooter from '@/core/components/elements/Footer/SimpleFooter'; +import BasicLayout from '@/core/components/layouts/BasicLayout'; +import DesktopView from '@/core/components/views/DesktopView'; +import MobileView from '@/core/components/views/MobileView'; +const PagePengajuanTempo = dynamic(() => + import('@/lib/pengajuan-tempo/component/PengajuanTempo') +); + +export default function TrackingOrder() { + return ( + <> + + + + + + + + + + + + + + + ); +} -- cgit v1.2.3 From abcce110895d767a16fb961a65e7c78f9213ca0d Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 24 Oct 2024 17:11:32 +0700 Subject: update pengajuan tempo --- src/pages/pengajuan-tempo.jsx | 29 ----------------------------- src/pages/pengajuan-tempo/[status].jsx | 32 ++++++++++++++++++++++++++++++++ src/pages/pengajuan-tempo/index.jsx | 29 +++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 29 deletions(-) delete mode 100644 src/pages/pengajuan-tempo.jsx create mode 100644 src/pages/pengajuan-tempo/[status].jsx create mode 100644 src/pages/pengajuan-tempo/index.jsx (limited to 'src/pages') diff --git a/src/pages/pengajuan-tempo.jsx b/src/pages/pengajuan-tempo.jsx deleted file mode 100644 index f27fb907..00000000 --- a/src/pages/pengajuan-tempo.jsx +++ /dev/null @@ -1,29 +0,0 @@ -import Seo from '@/core/components/Seo'; -import dynamic from 'next/dynamic'; -import SimpleFooter from '@/core/components/elements/Footer/SimpleFooter'; -import BasicLayout from '@/core/components/layouts/BasicLayout'; -import DesktopView from '@/core/components/views/DesktopView'; -import MobileView from '@/core/components/views/MobileView'; -const PagePengajuanTempo = dynamic(() => - import('@/lib/pengajuan-tempo/component/PengajuanTempo') -); - -export default function TrackingOrder() { - return ( - <> - - - - - - - - - - - - - - - ); -} diff --git a/src/pages/pengajuan-tempo/[status].jsx b/src/pages/pengajuan-tempo/[status].jsx new file mode 100644 index 00000000..8476d08a --- /dev/null +++ b/src/pages/pengajuan-tempo/[status].jsx @@ -0,0 +1,32 @@ +import BasicLayout from '@/core/components/layouts/BasicLayout'; +import IsAuth from '@/lib/auth/components/IsAuth'; +import FinishTempoComponent from '@/lib/pengajuan-tempo/component/FinishTempo'; +import { useRouter } from 'next/router'; +import axios from 'axios'; +import Seo from '@/core/components/Seo'; + +export async function getServerSideProps(context) { + const { tempo_id } = context.query; + await axios.post( + `${process.env.NEXT_PUBLIC_SELF_HOST}/api/pengajuan-tempo?formId=${tempo_id}`, + {}, + { headers: context.req.headers } + ); + return { props: {} }; +} + +export default function Finish() { + const router = useRouter(); + + return ( + <> + + + + + + + + + ); +} diff --git a/src/pages/pengajuan-tempo/index.jsx b/src/pages/pengajuan-tempo/index.jsx new file mode 100644 index 00000000..23d7aaba --- /dev/null +++ b/src/pages/pengajuan-tempo/index.jsx @@ -0,0 +1,29 @@ +import Seo from '@/core/components/Seo'; +import dynamic from 'next/dynamic'; +import SimpleFooter from '@/core/components/elements/Footer/SimpleFooter'; +import BasicLayout from '@/core/components/layouts/BasicLayout'; +import DesktopView from '@/core/components/views/DesktopView'; +import MobileView from '@/core/components/views/MobileView'; +const PagePengajuanTempo = dynamic(() => + import('@/lib/pengajuan-tempo/component/PengajuanTempo') +); + +export default function TrackingOrder() { + return ( + <> + + + + + + + + + + + + + + + ); +} -- cgit v1.2.3 From 9054afb2c842a1177dbcf0842aadf2ad14403cde Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 25 Oct 2024 09:04:25 +0700 Subject: update pengajuan tempo finsish --- src/pages/pengajuan-tempo/[status].jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/pages') diff --git a/src/pages/pengajuan-tempo/[status].jsx b/src/pages/pengajuan-tempo/[status].jsx index 8476d08a..a5c630da 100644 --- a/src/pages/pengajuan-tempo/[status].jsx +++ b/src/pages/pengajuan-tempo/[status].jsx @@ -7,11 +7,11 @@ import Seo from '@/core/components/Seo'; export async function getServerSideProps(context) { const { tempo_id } = context.query; - await axios.post( - `${process.env.NEXT_PUBLIC_SELF_HOST}/api/pengajuan-tempo?formId=${tempo_id}`, - {}, - { headers: context.req.headers } - ); + // await axios.post( + // `${process.env.NEXT_PUBLIC_SELF_HOST}/api/pengajuan-tempo?formId=${tempo_id}`, + // {}, + // { headers: context.req.headers } + // ); return { props: {} }; } -- cgit v1.2.3 From 803d93cd36abdf5de5882ba9e9cda24e9a32ab80 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 31 Oct 2024 16:07:18 +0700 Subject: update pengajuan tempo fix suplier ids --- src/pages/pengajuan-tempo/[status].jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pages') diff --git a/src/pages/pengajuan-tempo/[status].jsx b/src/pages/pengajuan-tempo/[status].jsx index a5c630da..1ebf167b 100644 --- a/src/pages/pengajuan-tempo/[status].jsx +++ b/src/pages/pengajuan-tempo/[status].jsx @@ -20,7 +20,7 @@ export default function Finish() { return ( <> - + -- cgit v1.2.3 From 9622bff4d4902fcef81214236cc7ff035163e5e7 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 13 Nov 2024 16:46:14 +0700 Subject: pengajuan tempo --- src/pages/my/menu.jsx | 104 +++++++++++++++++++++++++++++++------------ src/pages/my/tempo/index.jsx | 27 +++++++++++ 2 files changed, 102 insertions(+), 29 deletions(-) create mode 100644 src/pages/my/tempo/index.jsx (limited to 'src/pages') diff --git a/src/pages/my/menu.jsx b/src/pages/my/menu.jsx index a0ce223e..63b4d35c 100644 --- a/src/pages/my/menu.jsx +++ b/src/pages/my/menu.jsx @@ -1,24 +1,24 @@ -import Divider from '@/core/components/elements/Divider/Divider' -import Link from '@/core/components/elements/Link/Link' -import AppLayout from '@/core/components/layouts/AppLayout' -import useAuth from '@/core/hooks/useAuth' -import { deleteAuth } from '@/core/utils/auth' -import IsAuth from '@/lib/auth/components/IsAuth' -import { ChevronRightIcon, UserIcon } from '@heroicons/react/24/solid' -import { signOut, useSession } from 'next-auth/react' -import { useRouter } from 'next/router' -import ImageNext from 'next/image' +import Divider from '@/core/components/elements/Divider/Divider'; +import Link from '@/core/components/elements/Link/Link'; +import AppLayout from '@/core/components/layouts/AppLayout'; +import useAuth from '@/core/hooks/useAuth'; +import { deleteAuth } from '@/core/utils/auth'; +import IsAuth from '@/lib/auth/components/IsAuth'; +import { ChevronRightIcon, UserIcon } from '@heroicons/react/24/solid'; +import { signOut, useSession } from 'next-auth/react'; +import { useRouter } from 'next/router'; +import ImageNext from 'next/image'; export default function Menu() { - const auth = useAuth() - const router = useRouter() - const { data: session } = useSession() + const auth = useAuth(); + const router = useRouter(); + const { data: session } = useSession(); const logout = () => { deleteAuth().then(() => { - router.push('/login') - }) - } + router.push('/login'); + }); + }; return ( @@ -29,8 +29,12 @@ export default function Menu() {
{auth?.name}
- {auth?.company &&
Akun Bisnis
} - {!auth?.company &&
Akun Individu
} + {auth?.company && ( +
Akun Bisnis
+ )} + {!auth?.company && ( +
Akun Individu
+ )}
@@ -47,32 +51,63 @@ export default function Menu() { {' '}
- +

Daftar Quotation

- +

Daftar Transaksi

- +

Daftar Pengiriman

{' '}
- +

Invoice & Faktur Pajak

+ + {' '} +
+ +

Pembayaran Tempo

+
+
- +

Wishlist

@@ -86,7 +121,11 @@ export default function Menu() { {' '}
- +

Layanan Pelanggan

@@ -99,7 +138,11 @@ export default function Menu() {
- +

Daftar Alamat

@@ -112,20 +155,23 @@ export default function Menu() {
- ) + ); } const MenuHeader = ({ children, ...props }) => (
{children}
-) +); const LinkItem = ({ children, ...props }) => ( - + {children}
-) +); diff --git a/src/pages/my/tempo/index.jsx b/src/pages/my/tempo/index.jsx new file mode 100644 index 00000000..e540fbda --- /dev/null +++ b/src/pages/my/tempo/index.jsx @@ -0,0 +1,27 @@ +import Seo from '@/core/components/Seo'; +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 IsAuth from '@/lib/auth/components/IsAuth'; +import InvoicesComponent from '@/lib/invoice/components/Invoices'; + +export default function MyTempo() { + return ( + + + + + + + + + + + + + + + + ); +} -- cgit v1.2.3 From f481bae4d28b770d85ca2340cff60acbec70d0ee Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 14 Nov 2024 09:45:15 +0700 Subject: --- src/pages/my/tempo/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pages') diff --git a/src/pages/my/tempo/index.jsx b/src/pages/my/tempo/index.jsx index e540fbda..365986f4 100644 --- a/src/pages/my/tempo/index.jsx +++ b/src/pages/my/tempo/index.jsx @@ -4,7 +4,7 @@ import BasicLayout from '@/core/components/layouts/BasicLayout'; import DesktopView from '@/core/components/views/DesktopView'; import MobileView from '@/core/components/views/MobileView'; import IsAuth from '@/lib/auth/components/IsAuth'; -import InvoicesComponent from '@/lib/invoice/components/Invoices'; +import InvoicesComponent from '@/lib/tempo/components/Tempo'; export default function MyTempo() { return ( -- cgit v1.2.3 From 6bbf1dbd94355f34f58f4b72f134f3dbeac776aa Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 23 Nov 2024 11:55:59 +0700 Subject: update tempo --- src/pages/pengajuan-tempo/index.jsx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/pages') diff --git a/src/pages/pengajuan-tempo/index.jsx b/src/pages/pengajuan-tempo/index.jsx index 23d7aaba..9f772ddd 100644 --- a/src/pages/pengajuan-tempo/index.jsx +++ b/src/pages/pengajuan-tempo/index.jsx @@ -4,11 +4,31 @@ import SimpleFooter from '@/core/components/elements/Footer/SimpleFooter'; import BasicLayout from '@/core/components/layouts/BasicLayout'; import DesktopView from '@/core/components/views/DesktopView'; import MobileView from '@/core/components/views/MobileView'; +import { getAuth } from '~/libs/auth'; +import { useRouter } from 'next/router'; +import { useEffect } from 'react'; + const PagePengajuanTempo = dynamic(() => import('@/lib/pengajuan-tempo/component/PengajuanTempo') ); export default function TrackingOrder() { + const auth = getAuth(); + const router = useRouter(); + + useEffect(() => { + if (!auth) { + const nextUrl = encodeURIComponent(router.asPath); + router.push(`/login?next=${nextUrl}`); + } else if (!auth?.parentId) { + router.push('/pengajuan-tempo/switch-account'); + } + }, [auth, router]); + + if (!auth?.parentId) { + return null; + } + return ( <> -- cgit v1.2.3 From 77f9843ad5072583cb1797d7ecf5ac80394bad3f Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 2 Dec 2024 09:31:44 +0700 Subject: pengajuan tempo --- src/pages/my/menu.jsx | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/pages') diff --git a/src/pages/my/menu.jsx b/src/pages/my/menu.jsx index 407e400f..4099a935 100644 --- a/src/pages/my/menu.jsx +++ b/src/pages/my/menu.jsx @@ -90,17 +90,20 @@ export default function Menu() {

Invoice & Faktur Pajak

- - {' '} -
- -

Pembayaran Tempo

-
-
+ {(atuh?.partnerTempo.toLowerCase().includes('tempo') || + atuh.tempoProgres == 'review') && ( + + {' '} +
+ +

Pembayaran Tempo

+
+
+ )}
Date: Wed, 4 Dec 2024 10:59:21 +0700 Subject: update pengajuan tempo --- src/pages/pengajuan-tempo/index.jsx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/pages') diff --git a/src/pages/pengajuan-tempo/index.jsx b/src/pages/pengajuan-tempo/index.jsx index 9f772ddd..25db0c4b 100644 --- a/src/pages/pengajuan-tempo/index.jsx +++ b/src/pages/pengajuan-tempo/index.jsx @@ -6,7 +6,7 @@ import DesktopView from '@/core/components/views/DesktopView'; import MobileView from '@/core/components/views/MobileView'; import { getAuth } from '~/libs/auth'; import { useRouter } from 'next/router'; -import { useEffect } from 'react'; +import { useEffect, useState } from 'react'; const PagePengajuanTempo = dynamic(() => import('@/lib/pengajuan-tempo/component/PengajuanTempo') @@ -15,30 +15,35 @@ const PagePengajuanTempo = dynamic(() => export default function TrackingOrder() { const auth = getAuth(); const router = useRouter(); + const [isLoading, setIsLoading] = useState(true); // Set default isLoading to true useEffect(() => { - if (!auth) { + if (!auth) return; // Prevent unnecessary processing if auth is not ready + + if (auth.tempoProgres === 'review') { + router.push('/pengajuan-tempo/review'); + } else if (!auth.parentId) { + router.push('/pengajuan-tempo/switch-account'); + } else if (!auth) { const nextUrl = encodeURIComponent(router.asPath); router.push(`/login?next=${nextUrl}`); - } else if (!auth?.parentId) { - router.push('/pengajuan-tempo/switch-account'); + } else { + setIsLoading(false); // Set isLoading to false only when routing is not required } }, [auth, router]); - if (!auth?.parentId) { - return null; + if (isLoading || !auth) { + return null; // Show nothing while loading or if auth is not ready } return ( <> - - -- cgit v1.2.3 From e9cd13307f0095dc4edc5048752675d80c551564 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 6 Dec 2024 17:06:26 +0700 Subject: pengajuan tempo --- src/pages/pengajuan-tempo/index.jsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/pages') diff --git a/src/pages/pengajuan-tempo/index.jsx b/src/pages/pengajuan-tempo/index.jsx index 25db0c4b..271914c3 100644 --- a/src/pages/pengajuan-tempo/index.jsx +++ b/src/pages/pengajuan-tempo/index.jsx @@ -14,19 +14,24 @@ const PagePengajuanTempo = dynamic(() => export default function TrackingOrder() { const auth = getAuth(); + console.log('auth', auth); const router = useRouter(); const [isLoading, setIsLoading] = useState(true); // Set default isLoading to true useEffect(() => { - if (!auth) return; // Prevent unnecessary processing if auth is not ready + // if (!auth) return; // Prevent unnecessary processing if auth is not ready - if (auth.tempoProgres === 'review') { - router.push('/pengajuan-tempo/review'); - } else if (!auth.parentId) { - router.push('/pengajuan-tempo/switch-account'); - } else if (!auth) { + if (!auth) { const nextUrl = encodeURIComponent(router.asPath); router.push(`/login?next=${nextUrl}`); + } else if (!auth.parentId) { + router.push('/pengajuan-tempo/switch-account'); + } else if (auth.tempoProgres === 'review') { + router.push('/pengajuan-tempo/review'); + } else if (auth.tempoProgres === 'approve') { + router.push('/pengajuan-tempo/approve'); + } else if (auth.tempoProgres === 'rejected') { + router.push('/pengajuan-tempo/rejected'); } else { setIsLoading(false); // Set isLoading to false only when routing is not required } -- cgit v1.2.3 From f2451beed670dc697aa2026b2df6ad1ad1e90da2 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 9 Dec 2024 15:00:45 +0700 Subject: update pengajuan tempo --- src/pages/pengajuan-tempo/index.jsx | 44 ++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 10 deletions(-) (limited to 'src/pages') diff --git a/src/pages/pengajuan-tempo/index.jsx b/src/pages/pengajuan-tempo/index.jsx index 271914c3..f0681663 100644 --- a/src/pages/pengajuan-tempo/index.jsx +++ b/src/pages/pengajuan-tempo/index.jsx @@ -7,38 +7,62 @@ import MobileView from '@/core/components/views/MobileView'; import { getAuth } from '~/libs/auth'; import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; +import odooApi from '@/core/api/odooApi'; const PagePengajuanTempo = dynamic(() => import('@/lib/pengajuan-tempo/component/PengajuanTempo') ); export default function TrackingOrder() { + const [tempo, setTempo] = useState(null); + const [isLoading, setIsLoading] = useState(true); const auth = getAuth(); - console.log('auth', auth); const router = useRouter(); - const [isLoading, setIsLoading] = useState(true); // Set default isLoading to true useEffect(() => { - // if (!auth) return; // Prevent unnecessary processing if auth is not ready + const loadTempo = async () => { + try { + if (auth?.partnerId) { + const dataTempo = await odooApi( + 'GET', + `/api/v1/check/${auth.partnerId}/tempo` + ); + setTempo(dataTempo); + } + } catch (error) { + console.error('Error fetching tempo data:', error); + } finally { + setIsLoading(false); + } + }; + if (auth) { + loadTempo(); + } else { + setIsLoading(false); + } + }, [auth]); + + useEffect(() => { if (!auth) { const nextUrl = encodeURIComponent(router.asPath); router.push(`/login?next=${nextUrl}`); } else if (!auth.parentId) { router.push('/pengajuan-tempo/switch-account'); - } else if (auth.tempoProgres === 'review') { + } else if (auth.tempoProgres === 'review' && !tempo?.paymentTerm) { router.push('/pengajuan-tempo/review'); - } else if (auth.tempoProgres === 'approve') { + } else if ( + auth.tempoProgres === 'approve' && + tempo?.paymentTerm?.toLowerCase().includes('tempo') + ) { router.push('/pengajuan-tempo/approve'); } else if (auth.tempoProgres === 'rejected') { router.push('/pengajuan-tempo/rejected'); - } else { - setIsLoading(false); // Set isLoading to false only when routing is not required } - }, [auth, router]); + }, [auth, router, tempo]); - if (isLoading || !auth) { - return null; // Show nothing while loading or if auth is not ready + if (isLoading || !auth || !tempo) { + return null; // Tidak render apa pun selama loading atau auth/tempo belum tersedia } return ( -- cgit v1.2.3 From 0f84963214ee6dc5b5a44d945540826a66bec9e0 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 11 Dec 2024 11:51:45 +0700 Subject: update pengajuan tempo --- src/pages/pengajuan-tempo/[status].jsx | 20 ++++++++++++++++++++ src/pages/pengajuan-tempo/index.jsx | 15 ++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) (limited to 'src/pages') diff --git a/src/pages/pengajuan-tempo/[status].jsx b/src/pages/pengajuan-tempo/[status].jsx index 1ebf167b..c97b5897 100644 --- a/src/pages/pengajuan-tempo/[status].jsx +++ b/src/pages/pengajuan-tempo/[status].jsx @@ -3,7 +3,9 @@ import IsAuth from '@/lib/auth/components/IsAuth'; import FinishTempoComponent from '@/lib/pengajuan-tempo/component/FinishTempo'; import { useRouter } from 'next/router'; import axios from 'axios'; +import { useState, useEffect } from 'react'; import Seo from '@/core/components/Seo'; +import { getAuth } from '~/libs/auth'; export async function getServerSideProps(context) { const { tempo_id } = context.query; @@ -16,8 +18,26 @@ export async function getServerSideProps(context) { } export default function Finish() { + const [isLoading, setIsLoading] = useState(true); const router = useRouter(); + const auth = getAuth(); + useEffect(() => { + if (!auth) { + const nextUrl = encodeURIComponent(router.asPath); + router.push(`/login?next=${nextUrl}`); + } else if ( + (router.query.status == 'approve' || router.query.status == 'review') && + auth.tempoProgres === '' + ) { + router.push('/pengajuan-tempo'); + } else { + setIsLoading(false); + } + }, [auth]); + if (isLoading || !auth) { + return null; // Tidak render apa pun selama loading atau auth/tempo belum tersedia + } return ( <> diff --git a/src/pages/pengajuan-tempo/index.jsx b/src/pages/pengajuan-tempo/index.jsx index f0681663..d485c721 100644 --- a/src/pages/pengajuan-tempo/index.jsx +++ b/src/pages/pengajuan-tempo/index.jsx @@ -41,25 +41,26 @@ export default function TrackingOrder() { } else { setIsLoading(false); } - }, [auth]); - + }, []); useEffect(() => { if (!auth) { const nextUrl = encodeURIComponent(router.asPath); router.push(`/login?next=${nextUrl}`); - } else if (!auth.parentId) { - router.push('/pengajuan-tempo/switch-account'); - } else if (auth.tempoProgres === 'review' && !tempo?.paymentTerm) { - router.push('/pengajuan-tempo/review'); } else if ( auth.tempoProgres === 'approve' && tempo?.paymentTerm?.toLowerCase().includes('tempo') ) { router.push('/pengajuan-tempo/approve'); + } else if (!auth.parentId) { + router.push('/pengajuan-tempo/switch-account'); + } else if (auth.tempoProgres === 'review' && !tempo?.paymentTerm) { + router.push('/pengajuan-tempo/review'); } else if (auth.tempoProgres === 'rejected') { router.push('/pengajuan-tempo/rejected'); + } else { + setIsLoading(false); } - }, [auth, router, tempo]); + }, [tempo]); if (isLoading || !auth || !tempo) { return null; // Tidak render apa pun selama loading atau auth/tempo belum tersedia -- cgit v1.2.3 From 0178a1f88d7d34824562e1413be073c0795a47cf Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 16 Dec 2024 17:42:31 +0700 Subject: update code --- src/pages/my/menu.jsx | 4 ++-- src/pages/my/tempo/index.jsx | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'src/pages') diff --git a/src/pages/my/menu.jsx b/src/pages/my/menu.jsx index 4099a935..b626be30 100644 --- a/src/pages/my/menu.jsx +++ b/src/pages/my/menu.jsx @@ -90,8 +90,8 @@ export default function Menu() {

Invoice & Faktur Pajak

- {(atuh?.partnerTempo.toLowerCase().includes('tempo') || - atuh.tempoProgres == 'review') && ( + {(auth?.partnerTempo?.toLowerCase().includes('tempo') || + auth?.tempoProgres == 'review') && ( {' '}
diff --git a/src/pages/my/tempo/index.jsx b/src/pages/my/tempo/index.jsx index 365986f4..f52fe960 100644 --- a/src/pages/my/tempo/index.jsx +++ b/src/pages/my/tempo/index.jsx @@ -5,8 +5,27 @@ import DesktopView from '@/core/components/views/DesktopView'; import MobileView from '@/core/components/views/MobileView'; import IsAuth from '@/lib/auth/components/IsAuth'; import InvoicesComponent from '@/lib/tempo/components/Tempo'; - +import { getAuth } from '~/libs/auth'; +import { useRouter } from 'next/router'; +import { useEffect, useState } from 'react'; export default function MyTempo() { + const auth = getAuth(); + const router = useRouter(); + const [isLoading, setIsLoading] = useState(true); + useEffect(() => { + if (!auth) { + const nextUrl = encodeURIComponent(router.asPath); + router.push(`/login?next=${nextUrl}`); + } else if (auth.tempoProgres === '' || auth.tempoProgres === 'rejected') { + router.push('/pengajuan-tempo'); + } else { + setIsLoading(false); + } + }, [auth]); + + if (isLoading || !auth) { + return null; // Tidak render apa pun selama loading atau auth/tempo belum tersedia + } return ( -- cgit v1.2.3 From d20adeb6a5f6e153e2d1cfc8c8c77f4cceb743e8 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Tue, 31 Dec 2024 09:53:27 +0700 Subject: ppn 12% --- src/pages/api/shop/midtrans-payment.js | 1 + src/pages/google_merchant/products/[page].js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/pages') diff --git a/src/pages/api/shop/midtrans-payment.js b/src/pages/api/shop/midtrans-payment.js index 12aaa51f..f90e9e81 100644 --- a/src/pages/api/shop/midtrans-payment.js +++ b/src/pages/api/shop/midtrans-payment.js @@ -3,6 +3,7 @@ import camelcaseObjectDeep from 'camelcase-object-deep' import midtransClient from 'midtrans-client' export default async function handler(req, res) { + const PPN = process.env.NEXT_PUBLIC_PPN const { transactionId = null } = req.query if (!transactionId) { diff --git a/src/pages/google_merchant/products/[page].js b/src/pages/google_merchant/products/[page].js index 0c2cf3c5..8395f839 100644 --- a/src/pages/google_merchant/products/[page].js +++ b/src/pages/google_merchant/products/[page].js @@ -6,6 +6,7 @@ import _ from 'lodash-contrib'; import { create } from 'xmlbuilder'; export async function getServerSideProps({ res, query }) { + const PPN = process.env.NEXT_PUBLIC_PPN const titleContent = 'Indoteknik.com: B2B Industrial Supply & Solution'; const descriptionContent = 'Temukan pilihan produk B2B Industri & Alat Teknik untuk Perusahaan, UMKM & Pemerintah dengan lengkap, mudah dan transparan.'; @@ -77,7 +78,7 @@ export async function getServerSideProps({ res, query }) { 'g:availability': { '#text': availability }, 'g:brand': { '#text': product.manufacture?.name || '' }, 'g:price': { - '#text': `${Math.round(product.lowestPrice.price * 1.11)} IDR`, + '#text': `${Math.round(product.lowestPrice.price * PPN)} IDR`, }, }; @@ -93,7 +94,7 @@ export async function getServerSideProps({ res, query }) { if (product.lowestPrice.discountPercentage > 0) { item['g:sale_price'] = { - '#text': `${Math.round(product.lowestPrice.priceDiscount * 1.11)} IDR`, + '#text': `${Math.round(product.lowestPrice.priceDiscount * PPN)} IDR`, }; } productItems.push(item); -- cgit v1.2.3 From 21999682d2d6193d1033015c4e45f436a958f643 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 7 Jan 2025 15:56:56 +0700 Subject: update --- src/pages/my/tempo/index.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/pages') diff --git a/src/pages/my/tempo/index.jsx b/src/pages/my/tempo/index.jsx index f52fe960..a1897e51 100644 --- a/src/pages/my/tempo/index.jsx +++ b/src/pages/my/tempo/index.jsx @@ -16,7 +16,10 @@ export default function MyTempo() { if (!auth) { const nextUrl = encodeURIComponent(router.asPath); router.push(`/login?next=${nextUrl}`); - } else if (auth.tempoProgres === '' || auth.tempoProgres === 'rejected') { + } else if ( + (auth.tempoProgres === '' || auth.tempoProgres === 'rejected') && + !auth.company + ) { router.push('/pengajuan-tempo'); } else { setIsLoading(false); -- cgit v1.2.3 From fedaceac3e41741c198c94fd20917c9572fa7ec1 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 10 Jan 2025 15:26:44 +0700 Subject: update tempo page mobile view --- src/pages/my/menu.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/pages') diff --git a/src/pages/my/menu.jsx b/src/pages/my/menu.jsx index b626be30..2a46d866 100644 --- a/src/pages/my/menu.jsx +++ b/src/pages/my/menu.jsx @@ -90,8 +90,7 @@ export default function Menu() {

Invoice & Faktur Pajak

- {(auth?.partnerTempo?.toLowerCase().includes('tempo') || - auth?.tempoProgres == 'review') && ( + {(auth?.partnerTempo || auth?.tempoProgres == 'review') && ( {' '}
-- cgit v1.2.3 From 40f762589601de0fe1d5b06164b2553ebdbf5ecd Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 11 Jan 2025 09:27:46 +0700 Subject: update code --- src/pages/pengajuan-tempo/[status].jsx | 9 ++------- src/pages/pengajuan-tempo/index.jsx | 5 +---- 2 files changed, 3 insertions(+), 11 deletions(-) (limited to 'src/pages') diff --git a/src/pages/pengajuan-tempo/[status].jsx b/src/pages/pengajuan-tempo/[status].jsx index c97b5897..fa0a1749 100644 --- a/src/pages/pengajuan-tempo/[status].jsx +++ b/src/pages/pengajuan-tempo/[status].jsx @@ -8,9 +8,9 @@ import Seo from '@/core/components/Seo'; import { getAuth } from '~/libs/auth'; export async function getServerSideProps(context) { - const { tempo_id } = context.query; + const { status } = context.query; // await axios.post( - // `${process.env.NEXT_PUBLIC_SELF_HOST}/api/pengajuan-tempo?formId=${tempo_id}`, + // `${process.env.NEXT_PUBLIC_SELF_HOST}/api/pengajuan-tempo/${status}`, // {}, // { headers: context.req.headers } // ); @@ -25,11 +25,6 @@ export default function Finish() { if (!auth) { const nextUrl = encodeURIComponent(router.asPath); router.push(`/login?next=${nextUrl}`); - } else if ( - (router.query.status == 'approve' || router.query.status == 'review') && - auth.tempoProgres === '' - ) { - router.push('/pengajuan-tempo'); } else { setIsLoading(false); } diff --git a/src/pages/pengajuan-tempo/index.jsx b/src/pages/pengajuan-tempo/index.jsx index d485c721..6987bd29 100644 --- a/src/pages/pengajuan-tempo/index.jsx +++ b/src/pages/pengajuan-tempo/index.jsx @@ -46,10 +46,7 @@ export default function TrackingOrder() { if (!auth) { const nextUrl = encodeURIComponent(router.asPath); router.push(`/login?next=${nextUrl}`); - } else if ( - auth.tempoProgres === 'approve' && - tempo?.paymentTerm?.toLowerCase().includes('tempo') - ) { + } else if (auth.tempoProgres === 'approve' || auth?.partnerTempo) { router.push('/pengajuan-tempo/approve'); } else if (!auth.parentId) { router.push('/pengajuan-tempo/switch-account'); -- cgit v1.2.3 From 76afb8aaa5d2aaaf68529e11e9ed4d003d953f76 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 14 Jan 2025 09:09:05 +0700 Subject: update pengajuan tempo --- src/pages/pengajuan-tempo/[status].jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/pages') diff --git a/src/pages/pengajuan-tempo/[status].jsx b/src/pages/pengajuan-tempo/[status].jsx index fa0a1749..29886892 100644 --- a/src/pages/pengajuan-tempo/[status].jsx +++ b/src/pages/pengajuan-tempo/[status].jsx @@ -9,11 +9,11 @@ import { getAuth } from '~/libs/auth'; export async function getServerSideProps(context) { const { status } = context.query; - // await axios.post( - // `${process.env.NEXT_PUBLIC_SELF_HOST}/api/pengajuan-tempo/${status}`, - // {}, - // { headers: context.req.headers } - // ); + await axios.post( + `${process.env.NEXT_PUBLIC_SELF_HOST}/api/pengajuan-tempo/${status}`, + {}, + { headers: context.req.headers } + ); return { props: {} }; } -- cgit v1.2.3 From 7a14ed5ccdde86d0400d6aa02ac866317d4add63 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 15 Jan 2025 16:17:54 +0700 Subject: update menu pembayaran tempo logic --- src/pages/my/tempo/index.jsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/pages') diff --git a/src/pages/my/tempo/index.jsx b/src/pages/my/tempo/index.jsx index a1897e51..5fb9deba 100644 --- a/src/pages/my/tempo/index.jsx +++ b/src/pages/my/tempo/index.jsx @@ -16,12 +16,14 @@ export default function MyTempo() { if (!auth) { const nextUrl = encodeURIComponent(router.asPath); router.push(`/login?next=${nextUrl}`); - } else if ( - (auth.tempoProgres === '' || auth.tempoProgres === 'rejected') && - !auth.company - ) { - router.push('/pengajuan-tempo'); - } else { + } + // else if ( + // (auth.tempoProgres === '' || auth.tempoProgres === 'rejected') && + // !auth.company + // ) { + // router.push('/pengajuan-tempo'); + // } + else { setIsLoading(false); } }, [auth]); -- cgit v1.2.3 From 389382046d804053d8e5c6de13d7d0b197175022 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Sat, 18 Jan 2025 10:49:49 +0700 Subject: update google merchant --- src/pages/google_merchant/products/[page].js | 1 + 1 file changed, 1 insertion(+) (limited to 'src/pages') diff --git a/src/pages/google_merchant/products/[page].js b/src/pages/google_merchant/products/[page].js index 8395f839..ae3348cb 100644 --- a/src/pages/google_merchant/products/[page].js +++ b/src/pages/google_merchant/products/[page].js @@ -80,6 +80,7 @@ export async function getServerSideProps({ res, query }) { 'g:price': { '#text': `${Math.round(product.lowestPrice.price * PPN)} IDR`, }, + 'g:custom_label_3': { '#text': product.categories[0]?.name || 'Tidak Ada Kategori' }, }; if (product.stockTotal == 0) { -- cgit v1.2.3 From 6d9c1067b6e857eb95f12864cc88117350ae6cfb Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 20 Jan 2025 15:23:52 +0700 Subject: ubah tag category --- src/pages/api/shop/variant.js | 1 + src/pages/google_merchant/products/[page].js | 33 +++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) (limited to 'src/pages') diff --git a/src/pages/api/shop/variant.js b/src/pages/api/shop/variant.js index 249d087e..47e4f121 100644 --- a/src/pages/api/shop/variant.js +++ b/src/pages/api/shop/variant.js @@ -119,6 +119,7 @@ const productResponseMap = (products, pricelist) => { let productMapped = { id: product.product_id_i || '', + productTemplate: product.template_id_i || '', image: product.image_s || '', code: product.default_code_s || '', name: product.name_s || '', diff --git a/src/pages/google_merchant/products/[page].js b/src/pages/google_merchant/products/[page].js index ae3348cb..8dd28a39 100644 --- a/src/pages/google_merchant/products/[page].js +++ b/src/pages/google_merchant/products/[page].js @@ -6,7 +6,7 @@ import _ from 'lodash-contrib'; import { create } from 'xmlbuilder'; export async function getServerSideProps({ res, query }) { - const PPN = process.env.NEXT_PUBLIC_PPN + const PPN = process.env.NEXT_PUBLIC_PPN; const titleContent = 'Indoteknik.com: B2B Industrial Supply & Solution'; const descriptionContent = 'Temukan pilihan produk B2B Industri & Alat Teknik untuk Perusahaan, UMKM & Pemerintah dengan lengkap, mudah dan transparan.'; @@ -24,7 +24,7 @@ export async function getServerSideProps({ res, query }) { const brandsData = {}; const categoriesData = {}; - + let i = 0; const productItems = []; for (const product of products.response.products) { const productUrl = createSlug( @@ -49,6 +49,7 @@ export async function getServerSideProps({ res, query }) { let brandId = product.manufacture?.id ?? null; let categoryId = null; + let category_level_1 = null; if (brandId && brandId in brandsData) { categoryId = brandsData[brandId]?.category_ids?.[0] ?? null; @@ -57,6 +58,23 @@ export async function getServerSideProps({ res, query }) { brandsData[brandId] = solrBrand; categoryId = solrBrand?.category_ids?.[0] ?? null; } + if (product.categories[0]?.id) { + const getProductTemplate = await getProductTemplateId( + product?.productTemplate ?? null + ); + i = i + 1; + const id = + getProductTemplate?.category_parent_ids?.length > 0 + ? getProductTemplate.category_parent_ids[0] + : null; + if (id) { + category_level_1 = await getCategoryById(id); + } else { + category_level_1 = null; + } + } else { + category_level_1 = null; + } if (categoryId && categoryId in categoriesData) { categoryName = categoriesData[categoryId]?.name_s ?? null; @@ -80,7 +98,9 @@ export async function getServerSideProps({ res, query }) { 'g:price': { '#text': `${Math.round(product.lowestPrice.price * PPN)} IDR`, }, - 'g:custom_label_3': { '#text': product.categories[0]?.name || 'Tidak Ada Kategori' }, + 'g:custom_label_3': { + '#text': category_level_1?.name_s || 'Tidak Ada Kategori', + }, }; if (product.stockTotal == 0) { @@ -128,6 +148,13 @@ const getBrandById = async (id) => { return brand.data.response.docs[0] ?? null; }; +const getProductTemplateId = async (id) => { + const category = await axios( + `${process.env.SOLR_HOST}/solr/product/select?q=id:${id}` + ); + return category.data.response.docs[0] ?? null; +}; + const getCategoryById = async (id) => { const category = await axios( `${process.env.SOLR_HOST}/solr/categories/select?q=id:${id}` -- cgit v1.2.3