diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2025-01-20 10:39:35 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2025-01-20 10:39:35 +0700 |
| commit | 00afe24409bf3cd517597e7c59cf1c12535c54c0 (patch) | |
| tree | 2e3e573ead141c8381e9b962b442de3a80f17529 /src/pages | |
| parent | bd4cdf2125f717875ba90e03893b319dd962f753 (diff) | |
| parent | 389382046d804053d8e5c6de13d7d0b197175022 (diff) | |
Merge branch 'new-release' into feature/integrasi_biteship
# Conflicts:
# src/lib/address/components/CreateAddress.jsx
# src/lib/address/components/EditAddress.jsx
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/api/shop/midtrans-payment.js | 1 | ||||
| -rw-r--r-- | src/pages/daftar-merchant.jsx (renamed from src/pages/my/daftar-merchant.jsx) | 0 | ||||
| -rw-r--r-- | src/pages/google_merchant/products/[page].js | 6 | ||||
| -rw-r--r-- | src/pages/kunjungan-sales.jsx (renamed from src/pages/my/kunjungan-sales.jsx) | 0 | ||||
| -rw-r--r-- | src/pages/kunjungan-service.jsx (renamed from src/pages/my/kunjungan-service.jsx) | 0 | ||||
| -rw-r--r-- | src/pages/my/menu.jsx | 13 | ||||
| -rw-r--r-- | src/pages/my/pembayaran-tempo.jsx | 15 | ||||
| -rw-r--r-- | src/pages/my/profile.jsx | 107 | ||||
| -rw-r--r-- | src/pages/my/tempo/index.jsx | 51 | ||||
| -rw-r--r-- | src/pages/pembayaran-tempo-detail.jsx | 13 | ||||
| -rw-r--r-- | src/pages/pembayaran-tempo.jsx | 14 | ||||
| -rw-r--r-- | src/pages/pengajuan-tempo/[status].jsx | 47 | ||||
| -rw-r--r-- | src/pages/pengajuan-tempo/index.jsx | 81 | ||||
| -rw-r--r-- | src/pages/request-for-quotation.jsx (renamed from src/pages/my/request-for-quotation.jsx) | 0 | ||||
| -rw-r--r-- | src/pages/sitemap/homepage.xml.js | 28 | ||||
| -rw-r--r-- | src/pages/surat-dukungan.jsx (renamed from src/pages/my/surat-dukungan.jsx) | 0 |
16 files changed, 336 insertions, 40 deletions
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/my/daftar-merchant.jsx b/src/pages/daftar-merchant.jsx index e1fa9bcb..e1fa9bcb 100644 --- a/src/pages/my/daftar-merchant.jsx +++ b/src/pages/daftar-merchant.jsx diff --git a/src/pages/google_merchant/products/[page].js b/src/pages/google_merchant/products/[page].js index 0c2cf3c5..ae3348cb 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,8 +78,9 @@ 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`, }, + 'g:custom_label_3': { '#text': product.categories[0]?.name || 'Tidak Ada Kategori' }, }; if (product.stockTotal == 0) { @@ -93,7 +95,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); diff --git a/src/pages/my/kunjungan-sales.jsx b/src/pages/kunjungan-sales.jsx index 052991d9..052991d9 100644 --- a/src/pages/my/kunjungan-sales.jsx +++ b/src/pages/kunjungan-sales.jsx diff --git a/src/pages/my/kunjungan-service.jsx b/src/pages/kunjungan-service.jsx index 37de5a0b..37de5a0b 100644 --- a/src/pages/my/kunjungan-service.jsx +++ b/src/pages/kunjungan-service.jsx diff --git a/src/pages/my/menu.jsx b/src/pages/my/menu.jsx index 1b35d6ba..2a46d866 100644 --- a/src/pages/my/menu.jsx +++ b/src/pages/my/menu.jsx @@ -90,6 +90,19 @@ export default function Menu() { <p>Invoice & Faktur Pajak</p> </div> </LinkItem> + {(auth?.partnerTempo || auth?.tempoProgres == 'review') && ( + <LinkItem href='/my/tempo'> + {' '} + <div className='flex gap-x-3 items-center'> + <ImageNext + src='/images/icon/icon_tempo.svg' + width={18} + height={20} + /> + <p>Pembayaran Tempo</p> + </div> + </LinkItem> + )} <LinkItem href='/my/wishlist'> <div className='flex gap-x-3 items-center'> <ImageNext diff --git a/src/pages/my/pembayaran-tempo.jsx b/src/pages/my/pembayaran-tempo.jsx deleted file mode 100644 index 8947bdd9..00000000 --- a/src/pages/my/pembayaran-tempo.jsx +++ /dev/null @@ -1,15 +0,0 @@ -import Seo from '@/core/components/Seo' -import BasicLayout from '@/core/components/layouts/BasicLayout' -import PembayaranTempo from '@/lib/form/components/PembayaranTempo' - -export default function pembayaranTempo() { - return ( - <> - <Seo title='Pembayaran Tempo - Indoteknik.com' /> - - <BasicLayout> - <PembayaranTempo /> - </BasicLayout> - </> - ) -} diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index 7cf1bcbb..eaf3341c 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -5,19 +5,96 @@ 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 Seo from '@/core/components/Seo'; - +// 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'; +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(); + const [changeConfirmation, setChangeConfirmation] = useState(false); + const handleChange = async () => { + if (isChecked) { + setIsChecked(!isChecked); + } else { + setChangeConfirmation(true); + } + }; + useEffect(() => { + const loadPromo = async () => { + const progresSwitchAccount = await switchAccountProgresApi(); + if (progresSwitchAccount) { + setIsAprove(progresSwitchAccount.status); + setUbahAkun(progresSwitchAccount.status); + } + }; + loadPromo(); + }, []); + const handleConfirmSubmit = () => { + setChangeConfirmation(false); + setIsChecked(true); + }; return ( <> - <Seo title='Profile - Indoteknik.com' /> + <BottomPopup + active={changeConfirmation} + close={() => setChangeConfirmation(false)} // Menutup popup + title='Ubah type akun' + > + <div className='leading-7 text-gray_r-12/80'> + Anda akan mengubah type akun anda? + </div> + <div className='flex mt-6 gap-x-4 md:justify-end'> + <button + className='btn-solid-red flex-1 md:flex-none' + type='button' + onClick={handleConfirmSubmit} + > + Yakin + </button> + <button + className='btn-light flex-1 md:flex-none' + type='button' + onClick={() => setChangeConfirmation(false)} + > + Batal + </button> + </div> + </BottomPopup> <IsAuth> <MobileView> <AppLayout title='Akun Saya'> + {!auth?.parentId && !ubahAkun && ( + <div className='text-sm p-4 flex items-center'> + <Checkbox + borderColor='gray.600' + colorScheme='red' + size='lg' + isChecked={isChecked} + onChange={handleChange} + /> + <p className='ml-2'>Ubah ke akun bisnis</p> + </div> + )} + {isChecked && ( + <div> + <SwitchAccount company_type='nonpkp' /> + <Divider /> + </div> + )} + {/* {!auth?.parentId + ? auth?.parentId + : auth?.parent_id && + isAprove != 'unknown' && ( + <StatusSwitchAccount status={isAprove} /> + )} */} <PersonalProfile /> <Divider /> {auth?.parentId && <CompanyProfile />} @@ -31,6 +108,30 @@ export default function Profile() { <Menu /> </div> <div className='w-9/12 bg-white border border-gray_r-6 rounded'> + {!auth?.parentId && !ubahAkun && ( + <div className='text-sm p-4 flex items-center'> + <Checkbox + borderColor='gray.600' + colorScheme='red' + size='lg' + isChecked={isChecked} + onChange={handleChange} + /> + <p className='ml-2'>Ubah ke akun bisnis</p> + </div> + )} + {isChecked && ( + <div> + <SwitchAccount company_type='nonpkp' /> + <Divider /> + </div> + )} + {/* {!auth?.parentId + ? auth?.parentId + : auth?.parent_id && + isAprove != 'unknown' && ( + <StatusSwitchAccount status={isAprove} /> + )} */} <PersonalProfile /> <Divider /> {auth?.parentId && <CompanyProfile />} diff --git a/src/pages/my/tempo/index.jsx b/src/pages/my/tempo/index.jsx new file mode 100644 index 00000000..5fb9deba --- /dev/null +++ b/src/pages/my/tempo/index.jsx @@ -0,0 +1,51 @@ +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/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') && + // !auth.company + // ) { + // 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 ( + <IsAuth> + <Seo title='Tempo - Indoteknik.com' /> + + <MobileView> + <AppLayout title='Pembayaran Tempo'> + <InvoicesComponent /> + </AppLayout> + </MobileView> + + <DesktopView> + <BasicLayout> + <InvoicesComponent /> + </BasicLayout> + </DesktopView> + </IsAuth> + ); +} diff --git a/src/pages/pembayaran-tempo-detail.jsx b/src/pages/pembayaran-tempo-detail.jsx new file mode 100644 index 00000000..363e3099 --- /dev/null +++ b/src/pages/pembayaran-tempo-detail.jsx @@ -0,0 +1,13 @@ +import Seo from '@/core/components/Seo' +import BasicLayout from '@/core/components/layouts/BasicLayout' +import IframeContent from '@/lib/iframe/components/IframeContent' + +export default function PembnayaranTempo() { + return ( + <BasicLayout> + <Seo title='Pambayaran Tempo - Indoteknik.com' /> + + <IframeContent url={`${process.env.NEXT_PUBLIC_ODOO_HOST}/content?url=pembayaran-tempo`} /> + </BasicLayout> + ) +} diff --git a/src/pages/pembayaran-tempo.jsx b/src/pages/pembayaran-tempo.jsx index 363e3099..8947bdd9 100644 --- a/src/pages/pembayaran-tempo.jsx +++ b/src/pages/pembayaran-tempo.jsx @@ -1,13 +1,15 @@ import Seo from '@/core/components/Seo' import BasicLayout from '@/core/components/layouts/BasicLayout' -import IframeContent from '@/lib/iframe/components/IframeContent' +import PembayaranTempo from '@/lib/form/components/PembayaranTempo' -export default function PembnayaranTempo() { +export default function pembayaranTempo() { return ( - <BasicLayout> - <Seo title='Pambayaran Tempo - Indoteknik.com' /> + <> + <Seo title='Pembayaran Tempo - Indoteknik.com' /> - <IframeContent url={`${process.env.NEXT_PUBLIC_ODOO_HOST}/content?url=pembayaran-tempo`} /> - </BasicLayout> + <BasicLayout> + <PembayaranTempo /> + </BasicLayout> + </> ) } diff --git a/src/pages/pengajuan-tempo/[status].jsx b/src/pages/pengajuan-tempo/[status].jsx new file mode 100644 index 00000000..29886892 --- /dev/null +++ b/src/pages/pengajuan-tempo/[status].jsx @@ -0,0 +1,47 @@ +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 { useState, useEffect } from 'react'; +import Seo from '@/core/components/Seo'; +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 } + ); + return { props: {} }; +} + +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 { + setIsLoading(false); + } + }, [auth]); + + if (isLoading || !auth) { + return null; // Tidak render apa pun selama loading atau auth/tempo belum tersedia + } + return ( + <> + <Seo title='Pengajuan Tempo Indoteknik.com' /> + + <IsAuth> + <BasicLayout> + <FinishTempoComponent query={router.query || {}} /> + </BasicLayout> + </IsAuth> + </> + ); +} diff --git a/src/pages/pengajuan-tempo/index.jsx b/src/pages/pengajuan-tempo/index.jsx new file mode 100644 index 00000000..6987bd29 --- /dev/null +++ b/src/pages/pengajuan-tempo/index.jsx @@ -0,0 +1,81 @@ +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'; +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(); + const router = useRouter(); + + useEffect(() => { + 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); + } + }, []); + useEffect(() => { + if (!auth) { + const nextUrl = encodeURIComponent(router.asPath); + router.push(`/login?next=${nextUrl}`); + } else if (auth.tempoProgres === 'approve' || auth?.partnerTempo) { + 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); + } + }, [tempo]); + + if (isLoading || !auth || !tempo) { + return null; // Tidak render apa pun selama loading atau auth/tempo belum tersedia + } + + return ( + <> + <Seo title='Pengajuan Tempo - Indoteknik.com' /> + <DesktopView> + <BasicLayout> + <PagePengajuanTempo /> + </BasicLayout> + </DesktopView> + <MobileView> + <BasicLayout> + <PagePengajuanTempo /> + </BasicLayout> + </MobileView> + </> + ); +} diff --git a/src/pages/my/request-for-quotation.jsx b/src/pages/request-for-quotation.jsx index 40fda009..40fda009 100644 --- a/src/pages/my/request-for-quotation.jsx +++ b/src/pages/request-for-quotation.jsx diff --git a/src/pages/sitemap/homepage.xml.js b/src/pages/sitemap/homepage.xml.js index 08c52112..fa622d5c 100644 --- a/src/pages/sitemap/homepage.xml.js +++ b/src/pages/sitemap/homepage.xml.js @@ -5,29 +5,29 @@ export async function getServerSideProps({ res }) { { label: 'Hubungi Kami', url: 'https://indoteknik.com/hubungi-kami' }, { label: 'Tentang Kami', url: 'https://indoteknik.com/tentang-kami' }, { label: 'Karir', url: 'https://indoteknik.com/karir' }, - { label: 'Daftar Tempo', url: 'https://indoteknik.com/my/pembayaran-tempo' }, + { label: 'Daftar Tempo', url: 'https://indoteknik.com/pembayaran-tempo' }, ]; const sitemap = create('urlset', { encoding: 'utf-8' }).att( 'xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9' - ) + ); - const date = new Date() + const date = new Date(); links.forEach((link) => { - const url = sitemap.ele('url') - url.ele('loc', link.url) - url.ele('lastmod', date.toISOString().slice(0, 10)) - url.ele('changefreq', 'daily') - url.ele('priority', '1.0') - }) + const url = sitemap.ele('url'); + url.ele('loc', link.url); + url.ele('lastmod', date.toISOString().slice(0, 10)); + url.ele('changefreq', 'daily'); + url.ele('priority', '1.0'); + }); - res.setHeader('Content-Type', 'text/xml') - res.write(sitemap.end()) - res.end() + res.setHeader('Content-Type', 'text/xml'); + res.write(sitemap.end()); + res.end(); - return { props: {} } + return { props: {} }; } export default function SitemapProducts() { - return null + return null; } diff --git a/src/pages/my/surat-dukungan.jsx b/src/pages/surat-dukungan.jsx index 8058f34d..8058f34d 100644 --- a/src/pages/my/surat-dukungan.jsx +++ b/src/pages/surat-dukungan.jsx |
