From bc4fe87e012cc1b06572ca12f1a3b92f6d1757e0 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Thu, 31 Oct 2024 09:09:05 +0700 Subject: detail adress --- src/pages/my/address/[id]/edit.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/pages') diff --git a/src/pages/my/address/[id]/edit.jsx b/src/pages/my/address/[id]/edit.jsx index 19d7af41..fdae8bb6 100644 --- a/src/pages/my/address/[id]/edit.jsx +++ b/src/pages/my/address/[id]/edit.jsx @@ -45,7 +45,10 @@ export async function getServerSideProps(context) { oldSubDistrict: address.subDistrict?.id || '', subDistrict: '', business_name: '', + longtitude: address?.longtitude || 0, + latitude: address?.latitude || 0, + address_maps: address?.address_maps ? JSON.stringify(address?.addressMaps) : '', + }; - // console.log('ini default',defaultValues); return { props: { id, defaultValues } }; } -- cgit v1.2.3 From 053c801a8c43688c2c4eec6800368898a81bfc39 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Thu, 31 Oct 2024 16:55:07 +0700 Subject: integrasi google maps service --- src/pages/my/address/[id]/edit.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pages') diff --git a/src/pages/my/address/[id]/edit.jsx b/src/pages/my/address/[id]/edit.jsx index fdae8bb6..26cde5e1 100644 --- a/src/pages/my/address/[id]/edit.jsx +++ b/src/pages/my/address/[id]/edit.jsx @@ -47,7 +47,7 @@ export async function getServerSideProps(context) { business_name: '', longtitude: address?.longtitude || 0, latitude: address?.latitude || 0, - address_maps: address?.address_maps ? JSON.stringify(address?.addressMaps) : '', + addressMap: address?.address_map || '', }; return { props: { id, defaultValues } }; -- cgit v1.2.3 From 7966f67569d01c25f7a337962d7d0bb1a0c57808 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Wed, 13 Nov 2024 14:46:59 +0700 Subject: get couries, mapping couries and service --- src/pages/api/biteship-service.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/pages/api/biteship-service.js (limited to 'src/pages') diff --git a/src/pages/api/biteship-service.js b/src/pages/api/biteship-service.js new file mode 100644 index 00000000..ed9e2a9f --- /dev/null +++ b/src/pages/api/biteship-service.js @@ -0,0 +1,24 @@ +import biteShipAPI from '../../core/api/biteShip'; + +export default async function handler(req, res) { + const { body } = req.query; + + const parsedBody = JSON.parse(body); + console.log(parsedBody); + + try { + let result = await biteShipAPI('POST', '/v1/rates/couriers', parsedBody); + console.log('ini result', result); + + if (result && result.data && result.data.data) { + res.status(200).json(result.data.data); + } else { + res + .status(500) + .json({ error: 'Unexpected response structure from Biteship API' }); + } + } catch (error) { + console.error('Error:', error); + res.status(400).json({ error: error.message }); + } +} -- cgit v1.2.3 From d1592286eef165533c21d52aec70dbb703cdcfd3 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Wed, 18 Dec 2024 15:03:52 +0700 Subject: feedback uat --- src/pages/my/address/[id]/edit.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pages') diff --git a/src/pages/my/address/[id]/edit.jsx b/src/pages/my/address/[id]/edit.jsx index 26cde5e1..006785d9 100644 --- a/src/pages/my/address/[id]/edit.jsx +++ b/src/pages/my/address/[id]/edit.jsx @@ -47,7 +47,7 @@ export async function getServerSideProps(context) { business_name: '', longtitude: address?.longtitude || 0, latitude: address?.latitude || 0, - addressMap: address?.address_map || '', + addressMap: address?.addressMap || '', }; return { props: { id, defaultValues } }; -- cgit v1.2.3 From 56ba7cb194e8a664cb0144e7091159e10b8c56ab Mon Sep 17 00:00:00 2001 From: Miqdad Date: Fri, 6 Jun 2025 13:20:29 +0700 Subject: private banner section --- src/pages/api/banner-section.js | 74 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 8 deletions(-) (limited to 'src/pages') diff --git a/src/pages/api/banner-section.js b/src/pages/api/banner-section.js index 7d7040c0..ab48f3f4 100644 --- a/src/pages/api/banner-section.js +++ b/src/pages/api/banner-section.js @@ -12,22 +12,81 @@ const connectRedis = async () => { }; export default async function handler(req, res) { + if (req.method !== 'GET') { + return res.status(405).json({ error: 'Method not allowed' }); + } + try { await connectRedis(); - const cacheKey = 'hero-banner'; - // await client.del(cacheKey); + + const type = req.query.type || 'home-banner'; + + if (type === 'private-brand') { + // Handle multiple private brand banner types + const bannerTypes = [ + 'banner-brand-footer', + 'banner-brand-tengah-footer', + 'banner-brand-kanan-footer', + ]; + + const allBanners = []; + + for (const brandType of bannerTypes) { + const brandCacheKey = `homepage_bannerSection_${brandType}`; + + let cachedData = await client.get(brandCacheKey); + + if (cachedData) { + const data = JSON.parse(cachedData); + allBanners.push(...(data || [])); + } else { + try { + const dataBannerSections = await odooApi( + 'GET', + `/api/v1/banner?type=${brandType}` + ); + + if (dataBannerSections && dataBannerSections.length > 0) { + await client.set( + brandCacheKey, + JSON.stringify(dataBannerSections), + 'EX', + 259200 + ); + allBanners.push(...dataBannerSections); + } + } catch (error) { + continue; + } + } + } + + return res.status(200).json({ + data: allBanners, + total: allBanners.length, + }); + } + + // Handle home-banner and other single types + let cacheKey; + let apiEndpoint; + + if (type === 'home-banner') { + cacheKey = 'hero-banner'; + apiEndpoint = '/api/v1/banner?type=home-banner'; + } else { + cacheKey = `homepage_bannerSection_${type}`; + apiEndpoint = `/api/v1/banner?type=${type}`; + } + let cachedData = await client.get(cacheKey); if (cachedData) { const data = JSON.parse(cachedData); return res.status(200).json({ data }); } else { - const dataBannerSections = await odooApi( - 'GET', - '/api/v1/banner?type=home-banner' - ); + const dataBannerSections = await odooApi('GET', apiEndpoint); - // Simpan hasil fetch ke Redis dengan masa kadaluarsa 3 hari (259200 detik) await client.set( cacheKey, JSON.stringify(dataBannerSections), @@ -38,7 +97,6 @@ export default async function handler(req, res) { return res.status(200).json({ data: dataBannerSections }); } } catch (error) { - console.error('Error interacting with Redis or fetching data:', error); return res.status(500).json({ error: 'Internal Server Error' }); } } -- cgit v1.2.3 From 762d7dad3420df8fa0fdaf3ca4484f37b2d5c5a7 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 18 Jun 2025 11:15:22 +0700 Subject: fix pengajuan tempo --- src/pages/pengajuan-tempo/[status].jsx | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/pages') diff --git a/src/pages/pengajuan-tempo/[status].jsx b/src/pages/pengajuan-tempo/[status].jsx index 29886892..eff30e46 100644 --- a/src/pages/pengajuan-tempo/[status].jsx +++ b/src/pages/pengajuan-tempo/[status].jsx @@ -8,12 +8,6 @@ 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: {} }; } -- cgit v1.2.3 From 9946d919c2c66cfbb28f6c76639c8a670780f21d Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 24 Jun 2025 11:53:38 +0700 Subject: dragable banner --- src/pages/index.jsx | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/pages') diff --git a/src/pages/index.jsx b/src/pages/index.jsx index df5047a3..809f00ae 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -5,6 +5,7 @@ import DelayRender from '@/core/components/elements/DelayRender/DelayRender'; import DesktopView from '@/core/components/views/DesktopView'; import MobileView from '@/core/components/views/MobileView'; import PreferredBrandSkeleton from '@/lib/home/components/Skeleton/PreferredBrandSkeleton'; +import PagePopupInformation from '@/lib/home/components/PopupBannerPromotion'; import dynamic from 'next/dynamic'; import { useRef } from 'react'; import { getAuth } from '~/libs/auth'; @@ -116,6 +117,7 @@ export default function Home({ categoryId }) { +
+ -- cgit v1.2.3