diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2025-03-27 14:44:54 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2025-03-27 14:44:54 +0700 |
| commit | 969e193708e01ffb88c0d81d72d63dad200e0ef8 (patch) | |
| tree | 59c44292727bdfecb2970cb1d8130c53c0075653 /src/pages | |
| parent | f88f457fd1b91298ea8a7f9f396e49660a81e276 (diff) | |
| parent | d64f70fbc89e2cea6cbd95f5c3e3af437a3c2810 (diff) | |
Merge branch 'new-release' into feature/integrasi_biteship
# Conflicts:
# src/lib/address/components/EditAddress.jsx
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/api/shop/variant.js | 1 | ||||
| -rw-r--r-- | src/pages/api/webhook/biteship.js | 13 | ||||
| -rw-r--r-- | src/pages/google_merchant/products/[page].js | 34 | ||||
| -rw-r--r-- | src/pages/index.jsx | 14 | ||||
| -rw-r--r-- | src/pages/my/profile.jsx | 54 | ||||
| -rw-r--r-- | src/pages/my/tempo/index.jsx | 54 | ||||
| -rw-r--r-- | src/pages/pengajuan-tempo/index.jsx | 2 | ||||
| -rw-r--r-- | src/pages/sitemap/products/[page].js | 5 |
8 files changed, 120 insertions, 57 deletions
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/api/webhook/biteship.js b/src/pages/api/webhook/biteship.js new file mode 100644 index 00000000..f1100d2d --- /dev/null +++ b/src/pages/api/webhook/biteship.js @@ -0,0 +1,13 @@ +import odooApi from '@/core/api/odooApi'; + + +export default async function handler(req, res) { + const body = req.body + + if(req.body){ + let result = odooApi('POST', '/api/v1/webhook/biteship', body) + } + + res.status(200).send("ok"); + +}
\ No newline at end of file diff --git a/src/pages/google_merchant/products/[page].js b/src/pages/google_merchant/products/[page].js index ae3348cb..63d52d91 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,10 @@ 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': product.categories[0]?.name || 'Tidak Ada Kategori' }, + 'g:custom_label_4': { + '#text': category_level_1?.name_s || 'Tidak Ada Kategori', + }, }; if (product.stockTotal == 0) { @@ -128,6 +149,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}` diff --git a/src/pages/index.jsx b/src/pages/index.jsx index fce2202a..df5047a3 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -97,6 +97,20 @@ export default function Home({ categoryId }) { 'indoteknik, indoteknik.com, toko teknik, toko perkakas, jual genset, jual fogging, jual krisbow, harga krisbow, harga alat safety, harga pompa air', }, ]} + openGraph={ + { + title : 'Indoteknik.com: B2B Industrial Supply & Solution', + description : 'Temukan pilihan produk B2B Industri & Alat Teknik untuk Perusahaan, UMKM & Pemerintah dengan lengkap, mudah dan transparan.', + images: [ + { + url: 'https://indoteknik.com/icon.jpg', + width: 800, + height: 600, + alt: 'indoteknik.com', + }, + ], + } + } /> <PagePopupIformation /> diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index eaf3341c..859b6960 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -71,18 +71,19 @@ export default function Profile() { <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> - )} + {auth?.company || + (!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' /> @@ -97,7 +98,7 @@ export default function Profile() { )} */} <PersonalProfile /> <Divider /> - {auth?.parentId && <CompanyProfile />} + {(auth?.parentId || auth?.company) && <CompanyProfile />} </AppLayout> </MobileView> @@ -108,18 +109,19 @@ 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> - )} + {auth?.company || + (!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' /> @@ -134,7 +136,7 @@ export default function Profile() { )} */} <PersonalProfile /> <Divider /> - {auth?.parentId && <CompanyProfile />} + {(auth?.parentId || auth?.company) && <CompanyProfile />} </div> </div> </BasicLayout> diff --git a/src/pages/my/tempo/index.jsx b/src/pages/my/tempo/index.jsx index 5fb9deba..6ca5c718 100644 --- a/src/pages/my/tempo/index.jsx +++ b/src/pages/my/tempo/index.jsx @@ -13,39 +13,41 @@ export default function MyTempo() { const router = useRouter(); const [isLoading, setIsLoading] = useState(true); useEffect(() => { + setIsLoading(true); 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.partnerTempo && + (!auth.partnerTempo || auth.tempoProgres === 'review') + ) { + setIsLoading(true); + router.push('/pengajuan-tempo'); + } 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' /> + if (isLoading && !auth) { + return null; + } else { + return ( + <IsAuth> + <Seo title='Tempo - Indoteknik.com' /> - <MobileView> - <AppLayout title='Pembayaran Tempo'> - <InvoicesComponent /> - </AppLayout> - </MobileView> + <MobileView> + <AppLayout title='Pembayaran Tempo'> + <InvoicesComponent /> + </AppLayout> + </MobileView> - <DesktopView> - <BasicLayout> - <InvoicesComponent /> - </BasicLayout> - </DesktopView> - </IsAuth> - ); + <DesktopView> + <BasicLayout> + <InvoicesComponent /> + </BasicLayout> + </DesktopView> + </IsAuth> + ); + } } diff --git a/src/pages/pengajuan-tempo/index.jsx b/src/pages/pengajuan-tempo/index.jsx index 6987bd29..5ddd3e18 100644 --- a/src/pages/pengajuan-tempo/index.jsx +++ b/src/pages/pengajuan-tempo/index.jsx @@ -48,7 +48,7 @@ export default function TrackingOrder() { router.push(`/login?next=${nextUrl}`); } else if (auth.tempoProgres === 'approve' || auth?.partnerTempo) { router.push('/pengajuan-tempo/approve'); - } else if (!auth.parentId) { + } else if (!auth.parentId && !auth.company) { router.push('/pengajuan-tempo/switch-account'); } else if (auth.tempoProgres === 'review' && !tempo?.paymentTerm) { router.push('/pengajuan-tempo/review'); diff --git a/src/pages/sitemap/products/[page].js b/src/pages/sitemap/products/[page].js index e39755d6..3419489b 100644 --- a/src/pages/sitemap/products/[page].js +++ b/src/pages/sitemap/products/[page].js @@ -7,7 +7,10 @@ export async function getServerSideProps({ query, res }) { const baseUrl = process.env.SELF_HOST + '/shop/product/' const { page } = query const limit = 2500 - const queries = { limit, page: page.replace('.xml', '') } + const queries = { limit, page: page.replace('.xml', ''), + '-publish_b': false, + product_rating_f: '[8 TO *]', + price_tier1_v2_f: '[1 TO *]', } const products = await productSearchApi({ query: _.toQuery(queries) }) const sitemap = create('urlset', { encoding: 'utf-8' }).att( 'xmlns', |
