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 From 9ce1b5ea896ace6f2a8cf2566a61410d7020e4c3 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 23 Jan 2025 12:03:55 +0700 Subject: ganti label 3 menjadi label 4 --- src/pages/google_merchant/products/[page].js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/pages') diff --git a/src/pages/google_merchant/products/[page].js b/src/pages/google_merchant/products/[page].js index 8dd28a39..63d52d91 100644 --- a/src/pages/google_merchant/products/[page].js +++ b/src/pages/google_merchant/products/[page].js @@ -98,7 +98,8 @@ export async function getServerSideProps({ res, query }) { 'g:price': { '#text': `${Math.round(product.lowestPrice.price * PPN)} IDR`, }, - 'g:custom_label_3': { + // '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', }, }; -- cgit v1.2.3 From cb58889bc19bf60ba24f6a38804c990b0f0083a1 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 30 Jan 2025 17:06:25 +0700 Subject: update pengajuan tempo --- src/pages/pengajuan-tempo/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pages') 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'); -- cgit v1.2.3 From 8efe9fb6dd906431dcaed1818aae07692aeaa094 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 4 Feb 2025 15:16:37 +0700 Subject: update logic switch account --- src/pages/my/profile.jsx | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/pages') diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index eaf3341c..77c108cb 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -108,18 +108,19 @@ export default function Profile() {
- {!auth?.parentId && !ubahAkun && ( -
- -

Ubah ke akun bisnis

-
- )} + {auth?.company || + (!ubahAkun && ( +
+ +

Ubah ke akun bisnis

+
+ ))} {isChecked && (
-- cgit v1.2.3 From 5187f40005dd2e391ae601c11886b539dffe4dd7 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 4 Feb 2025 15:19:14 +0700 Subject: update mobile --- src/pages/my/profile.jsx | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/pages') diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx index 77c108cb..54e9024a 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -71,18 +71,19 @@ export default function Profile() { - {!auth?.parentId && !ubahAkun && ( -
- -

Ubah ke akun bisnis

-
- )} + {auth?.company || + (!ubahAkun && ( +
+ +

Ubah ke akun bisnis

+
+ ))} {isChecked && (
-- cgit v1.2.3 From 7dd2b66958fbe63c1fa68a9c3fb5eab7ee389342 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 4 Feb 2025 17:02:17 +0700 Subject: munculin company profile --- 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 54e9024a..859b6960 100644 --- a/src/pages/my/profile.jsx +++ b/src/pages/my/profile.jsx @@ -98,7 +98,7 @@ export default function Profile() { )} */} - {auth?.parentId && } + {(auth?.parentId || auth?.company) && } @@ -136,7 +136,7 @@ export default function Profile() { )} */} - {auth?.parentId && } + {(auth?.parentId || auth?.company) && }
-- cgit v1.2.3 From 818246e40ae6f851224ffb376c77fe8c18cc8c45 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 17 Feb 2025 16:04:49 +0700 Subject: add query sitemap --- src/pages/sitemap/products/[page].js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/pages') 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', -- cgit v1.2.3 From 95322b2c473da6160af0e3d685ec3d5eb924df05 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 21 Feb 2025 15:02:27 +0700 Subject: update code /my/tempo --- src/pages/my/tempo/index.jsx | 54 +++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'src/pages') 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 ( - - + if (isLoading && !auth) { + return null; + } else { + return ( + + - - - - - + + + + + - - - - - - - ); + + + + + + + ); + } } -- cgit v1.2.3 From 8aceceb3350c7dd89fae1762c9e415399be14bcd Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Mon, 3 Mar 2025 15:00:11 +0700 Subject: add og mage di index --- src/pages/index.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/pages') diff --git a/src/pages/index.jsx b/src/pages/index.jsx index fce2202a..84cb061e 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -97,6 +97,18 @@ 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={ + { + images: [ + { + url: 'https://indoteknik.com/icon.jpg', + width: 800, + height: 600, + alt: 'indoteknik.com', + }, + ], + } + } /> -- cgit v1.2.3 From d81883a63ac49fbcffe77a6a4220d910214b25a4 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Tue, 4 Mar 2025 09:49:48 +0700 Subject: opengrap --- src/pages/index.jsx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/pages') diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 84cb061e..df5047a3 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -99,6 +99,8 @@ export default function Home({ categoryId }) { ]} 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', -- cgit v1.2.3 From d9ffc1e045a75629d9debfac12b8be340b57c70c Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Wed, 19 Mar 2025 16:58:23 +0700 Subject: api webhook biteshi[ --- src/pages/api/webhook/biteship.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/pages/api/webhook/biteship.js (limited to 'src/pages') 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 -- cgit v1.2.3