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') 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 2ce7d2605e3c20963589a19abd5ae3e9f6aae6fe Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 23 Jan 2025 09:28:23 +0700 Subject: set selected varian ke yang is_in_bu = true --- src/lib/product/components/Product/ProductMobile.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx index 4cfd3755..16182271 100644 --- a/src/lib/product/components/Product/ProductMobile.jsx +++ b/src/lib/product/components/Product/ProductMobile.jsx @@ -95,7 +95,11 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { useEffect(() => { if (!selectedVariant && variantOptions.length == 1) { - setSelectedVariant(variantOptions[0]); + const selectedVariant = + variantOptions?.find((variant) => variant.is_in_bu) || + variantOptions?.[0]; + setSelectedVariant(selectedVariant); + // setSelectedVariant(variantOptions[0]); } }, [selectedVariant, variantOptions]); -- 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') 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') 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 1bd83d0dccc3d02113e0939c7acaa25a39042fa7 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 3 Feb 2025 15:41:44 +0700 Subject: ubah link --- src/lib/home/components/ServiceList.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/home/components/ServiceList.jsx b/src/lib/home/components/ServiceList.jsx index e32e8747..8fa1cf22 100644 --- a/src/lib/home/components/ServiceList.jsx +++ b/src/lib/home/components/ServiceList.jsx @@ -59,7 +59,7 @@ const ServiceList = () => {
-- 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') 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') 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/lib/auth/components/CompanyProfile.jsx | 2 +- src/pages/my/profile.jsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib/auth/components/CompanyProfile.jsx b/src/lib/auth/components/CompanyProfile.jsx index 410d6a23..47f2f1a1 100644 --- a/src/lib/auth/components/CompanyProfile.jsx +++ b/src/lib/auth/components/CompanyProfile.jsx @@ -59,7 +59,7 @@ const CompanyProfile = () => { useEffect(() => { const loadProfile = async () => { const dataProfile = await addressApi({ - id: auth.parentId ? auth.parentId : auth.parent_id, + id: auth?.company ? auth.partnerId : auth.parentId, }); setCompany_type(dataProfile?.companyType); setValue('name', dataProfile?.name); 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 88b1c01453a60a2ce286052f35dc7d7837a79f2e Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 10 Feb 2025 11:00:46 +0700 Subject: update get data name tempo --- src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx b/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx index 25a3a7ee..4e99f9f5 100644 --- a/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx +++ b/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx @@ -470,7 +470,7 @@ const InformasiPerusahaan = ({ useEffect(() => { const loadProfile = async () => { try { - const dataProfile = await addressApi({ id: auth.parentId }); + const dataProfile = await addressApi({ id: auth.parentId ? auth.parentId : auth.partnerId }); if (dataProfile.name) { updateForm('name', dataProfile.name); } @@ -507,7 +507,7 @@ const InformasiPerusahaan = ({ } }; - if (auth?.parentId) { + if (auth?.parentId || auth?.partnerId) { loadProfile(); } }, [auth?.parentId]); -- cgit v1.2.3 From 24700c2f3555da3df4537a28e7145e6bd25dafb0 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 11 Feb 2025 11:39:57 +0700 Subject: update if no parent using partnerId --- src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx index 5bef5134..9a554e42 100644 --- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx +++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx @@ -173,11 +173,11 @@ const PengajuanTempo = () => { } return data; // Jika bukan object atau array, kembalikan nilai aslinya }; - + const payment = auth.parentId ? auth.parentId : auth.partnerId try { const dataPaymentTerm = await odooApi( 'GET', - `/api/v1/partner/detail-tempo/${auth.parentId}` + `/api/v1/partner/detail-tempo/${payment}` ); const transformedData = transformKeysToCamelCase(dataPaymentTerm); setBigData(transformedData); @@ -293,7 +293,7 @@ const PengajuanTempo = () => { try { const address = await createPengajuanTempoApi({ id: idTempo, - user_id: auth.parentId, + user_id: auth.parentId ? auth.parentId : auth.partnerId, partner_id: auth.partnerId, section: label, tempo_request: tempoRequest, @@ -341,7 +341,7 @@ const PengajuanTempo = () => { try { const address = await createPengajuanTempoApi({ id: idTempo, - user_id: auth.parentId, + user_id: auth.parentId ? auth.parentId : auth.partnerId, partner_id: auth.partnerId, formDocs: JSON.stringify(formattedDokumen), }); @@ -402,7 +402,7 @@ const PengajuanTempo = () => { try { const address = await createPengajuanTempoApi({ id: idTempo, - user_id: auth.parentId, + user_id: auth.parentId ? auth.parentId : auth.partnerId, partner_id: auth.partnerId, formSupplier: JSON.stringify(productOrder), }); @@ -447,7 +447,7 @@ const PengajuanTempo = () => { const address = await createPengajuanTempoApi({ id: 0, partner_id: auth.partnerId, - user_id: auth.parentId, + user_id: auth.parentId ? auth.parentId : auth.partnerId, tempo_request: false, ...form, }); -- cgit v1.2.3 From 6192c7c267827dd41c592900dd55001ee82c78cc Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 12 Feb 2025 09:43:38 +0700 Subject: ubah posisi code --- src/lib/auth/components/CompanyProfile.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/auth/components/CompanyProfile.jsx b/src/lib/auth/components/CompanyProfile.jsx index 47f2f1a1..c6ba1a81 100644 --- a/src/lib/auth/components/CompanyProfile.jsx +++ b/src/lib/auth/components/CompanyProfile.jsx @@ -59,8 +59,9 @@ const CompanyProfile = () => { useEffect(() => { const loadProfile = async () => { const dataProfile = await addressApi({ - id: auth?.company ? auth.partnerId : auth.parentId, + id: auth?.company ? auth.parentId : auth.partnerId, }); + setCompany_type(dataProfile?.companyType); setValue('name', dataProfile?.name); setValue('industry', dataProfile?.industryId); -- cgit v1.2.3 From 0abd15f6f59ba443c231585822b64db4c1e5ee1a Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 13 Feb 2025 10:48:24 +0700 Subject: add action button log out --- src/lib/auth/components/Menu.jsx | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/lib/auth/components/Menu.jsx b/src/lib/auth/components/Menu.jsx index 4682dbab..df33314c 100644 --- a/src/lib/auth/components/Menu.jsx +++ b/src/lib/auth/components/Menu.jsx @@ -197,6 +197,7 @@ const Menu = () => {
-
+

Sisa Kredit Limit

{limitTempo && amountDue ? currencyFormat( @@ -468,7 +472,11 @@ const Tempo = () => { isLoaded={!isLoading} // h='36px' // w={16} - className='font-semibold text-sm text-nowrap text-green-700 ' + className={`font-semibold text-sm text-nowrap ${ + limitTempo - amountDue < 0 + ? 'text-red-500' + : 'text-green-700' + }`} > {limitTempo && amountDue ? currencyFormat( diff --git a/src/lib/tracking-order/component/TrackingOrder.jsx b/src/lib/tracking-order/component/TrackingOrder.jsx index 8a7b2579..31ebd012 100644 --- a/src/lib/tracking-order/component/TrackingOrder.jsx +++ b/src/lib/tracking-order/component/TrackingOrder.jsx @@ -8,12 +8,17 @@ import { useQuery } from 'react-query'; import { Spinner } from '@chakra-ui/react'; import { Search } from 'lucide-react'; import Link from 'next/link'; +import odooApi from '~/libs/odooApi'; +import Image from '~/components/ui/image'; +import useDevice from '@/core/hooks/useDevice'; const TrackingOrder = () => { const [idAWB, setIdAWB] = useState(null); + const { isDesktop, isMobile } = useDevice(); const [inputQuery, setInputQuery] = useState(null); const [buttonClick, setButtonClick] = useState(false); const [apiError, setApiError] = useState(null); // State to store API error message + const [BannerTracking, setBannerTracking] = useState(); const closePopup = () => { setIdAWB(null); @@ -65,13 +70,35 @@ const TrackingOrder = () => { setButtonClick(true); }; + useEffect(() => { + const getBanner = async () => { + const get = await odooApi( + 'GET', + '/api/v1/banner?type=tracking-order-banner' + ); + setBannerTracking(get[0].image); + }; + getBanner(); + }, []); + return (
+
+ {BannerTracking && ( + Tracking Order + )} +

Tracking Order

-

+

{`Untuk melacak pesanan Anda, masukkan Nomor Transaksi di kotak bawah ini dan masukkan Email login anda lalu tekan tombol "Lacak". Nomor Transaksi ini dapat Anda lihat dalam menu `} Daftar Transaksi @@ -93,7 +120,11 @@ const TrackingOrder = () => { onSubmit={handleSubmit(onSubmitHandler)} className='flex mt-4 flex-row w-full ' > -

+
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') 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 63ff83b83e87f6e9fb5974ed3e310ed1597d07c4 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 17 Feb 2025 16:21:04 +0700 Subject: add x logo --- src/core/components/elements/Navbar/NavbarDesktop.jsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx index d6b1bdea..03d7fa0c 100644 --- a/src/core/components/elements/Navbar/NavbarDesktop.jsx +++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx @@ -423,6 +423,20 @@ const SocialMedias = () => ( loading='eager' /> + + + {/* ( loading='eager' /> +
); -- cgit v1.2.3 From 77184327fd3490dd822d60b97f37052f3feec186 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 18 Feb 2025 10:16:02 +0700 Subject: bug profile get company --- src/lib/auth/components/CompanyProfile.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/auth/components/CompanyProfile.jsx b/src/lib/auth/components/CompanyProfile.jsx index c6ba1a81..6d4da1d1 100644 --- a/src/lib/auth/components/CompanyProfile.jsx +++ b/src/lib/auth/components/CompanyProfile.jsx @@ -59,9 +59,8 @@ const CompanyProfile = () => { useEffect(() => { const loadProfile = async () => { const dataProfile = await addressApi({ - id: auth?.company ? auth.parentId : auth.partnerId, + id: auth?.company ? (auth.parentId ? auth.parentId : auth.partnerId) : auth.partnerId, }); - setCompany_type(dataProfile?.companyType); setValue('name', dataProfile?.name); setValue('industry', dataProfile?.industryId); -- cgit v1.2.3 From bfa3cf8546e1a45941e8388b251b91975f95bfd3 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 19 Feb 2025 15:28:16 +0700 Subject: update code dari qty_available ke free_bandengan --- src/lib/variant/components/VariantCard.jsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/variant/components/VariantCard.jsx b/src/lib/variant/components/VariantCard.jsx index 08b7a97e..d8cd5c93 100644 --- a/src/lib/variant/components/VariantCard.jsx +++ b/src/lib/variant/components/VariantCard.jsx @@ -7,12 +7,12 @@ import { createSlug } from '@/core/utils/slug' import currencyFormat from '@/core/utils/currencyFormat' import { updateItemCart } from '@/core/utils/cart' import whatsappUrl from '@/core/utils/whatsappUrl' -import {useState } from 'react'; +import { useEffect, useState } from 'react'; import rejectProductApi from '../../../lib/transaction/api/rejectProductApi' // import {useTransaction} from 'C:\Users\Indoteknik\next-indoteknik\src\lib\transaction\hooks\useTransaction.js' import useTransaction from '../../../lib/transaction/hooks/useTransaction'; import ImageNext from 'next/image'; - +import odooApi from '~/libs/odooApi'; const VariantCard = ({ product, openOnClick = true, buyMore = false }) => { const router = useRouter() const id = router.query.id @@ -21,7 +21,7 @@ const VariantCard = ({ product, openOnClick = true, buyMore = false }) => { const [isModalOpen, setIsModalOpen] = useState(false); const [selectedProduct, setSelectedProduct] = useState(null); const [reason, setReason] = useState(''); - + const [qtyPickUp, setQtyPickUp] = useState(0); const addItemToCart = () => { @@ -67,6 +67,17 @@ const VariantCard = ({ product, openOnClick = true, buyMore = false }) => { toast.error('Gagal reject produk. Silakan coba lagi.'); } }; + + useEffect(() => { + const fetchData = async () => { + const qty_available = await odooApi( + 'GET', + `/api/v1/product_variant/${product.id}/qty_available` + ); + setQtyPickUp(qty_available?.qty); + }; + fetchData(); + }, [product]); const Card = () => (
@@ -118,7 +129,7 @@ const VariantCard = ({ product, openOnClick = true, buyMore = false }) => { Berat Item : {product?.weight} Kg x {product?.quantity} Barang

- {product.availableQuantity} barang ini bisa di pickup maksimal pukul + {qtyPickUp} barang ini bisa di pickup maksimal pukul 16.00

-- cgit v1.2.3 From a7160110ab082109e96696c3bc2321f28610958c Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 20 Feb 2025 11:25:55 +0700 Subject: add google tag button add to cart --- .../components/Product/ProductDesktopVariant.jsx | 52 ++++++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/product/components/Product/ProductDesktopVariant.jsx b/src/lib/product/components/Product/ProductDesktopVariant.jsx index 5dfd452b..de88e5bb 100644 --- a/src/lib/product/components/Product/ProductDesktopVariant.jsx +++ b/src/lib/product/components/Product/ProductDesktopVariant.jsx @@ -26,7 +26,7 @@ import ProductCard from '../ProductCard'; import ProductSimilar from '../ProductSimilar'; import ProductPromoSection from '~/modules/product-promo/components/Section'; import SimilarBottom from '~/modules/product-detail/components/SimilarBottom'; - +import { gtagAddToCart } from '@/core/utils/googleTag'; const SELF_HOST = process.env.NEXT_PUBLIC_SELF_HOST; const ProductDesktopVariant = ({ @@ -41,14 +41,38 @@ const ProductDesktopVariant = ({ const { srsltid } = router.query; const [askAdminUrl, setAskAdminUrl, isApproval] = useState(); const [lowestPrice, setLowestPrice] = useState(null); - + const [qtyPickUp, setQtyPickUp] = useState(0); const [addCartAlert, setAddCartAlert] = useState(false); const [isLoadingSLA, setIsLoadingSLA] = useState(true); - + const [selectedVariant, setSelectedVariant] = useState(product.id); const { setRefreshCart } = useProductCartContext(); const [quantityInput, setQuantityInput] = useState(1); + const [activeVariant, setActiveVariant] = useState({ + id: null, + code: product.code, + name: product.name, + price: lowestPrice, + stock: product.stockTotal, + weight: product.weight, + isFlashSale: product.isFlashSale, + }); + + useEffect(() => { + if (selectedVariant) { + setActiveVariant({ + id: product.id, + code: product.code, + name: product.name, + price: product.price, + stock: product.stockTotal, + weight: product.weight, + isFlashSale: product.isFlashSale, + }); + } + }, [selectedVariant, product]); + const createdAskUrl = whatsappUrl({ template: 'product', payload: { @@ -95,6 +119,7 @@ const ProductDesktopVariant = ({ } const quantity = quantityInput; if (!validQuantity(quantity)) return; + gtagAddToCart(activeVariant, quantity); updateItemCart({ productId: product.id, quantity, @@ -232,6 +257,17 @@ const ProductDesktopVariant = ({ fetchData(); }, [product]); + useEffect(() => { + const fetchData = async () => { + const qty_available = await odooApi( + 'GET', + `/api/v1/product_variant/${product.id}/qty_available` + ); + setQtyPickUp(qty_available?.qty); + }; + fetchData(); + }, [product]); + return (
@@ -451,7 +487,7 @@ const ProductDesktopVariant = ({
- {product?.sla?.qty > 0 && ( + {qtyPickUp > 0 && (
+ {qtyPickUp > 0 && ( + <> +
+ * {qtyPickUp} barang bisa di pickup +
+
+ + )}
+
+
+ + {!isKonfirmasi && ( + + isi nomor PIC penerimaan barang yang bertanggung jawab di + perusahaan anda + + )} +
+
+ + {chekValid && ( +
+ {errorsPengiriman.PICBarangMobile} +
+ )} +
+
+
+ +
+
+ +
+ +
+ {chekValid && ( +
+ {errorsPengiriman.invoicePicMobile} +
+ )} +
+
+
+ +
+ +
+ {chekValid && ( +
+ {errorsPengiriman.PICBarangMobile} +
+ )} +
+
+
+
+ +
+ +
+ {chekValid && ( +
+ {errorsPengiriman.PICBarangMobile} +
+ )} +
+
- -
-
- -
+
+
+ + {!isKonfirmasi && ( + + isi nomor PIC penerimaan invoice yang bertanggung jawab di + perusahaan anda + + )} +
+
+ {chekValid && ( +
+ {errorsPengiriman.invoicePicMobile} +
+ )}
- {chekValid && ( -
- {errorsPengiriman.invoicePicMobile} -
- )}
@@ -1497,6 +1560,47 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { )}
+
+
+ + + Format: pdf, jpeg, jpg, png. max file size 2MB + +
+
+
+ + + + {formPengiriman?.dokumenProsedur?.name} + +
+ {chekValid && ( +
+ {errorsPengiriman.dokumenProsedur} +
+ )} +
+
@@ -1753,7 +1857,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
-
+ +
+
+ +
+
+
+ + + + {formPengiriman?.dokumenProsedur?.name} + +
+ {chekValid && ( +
+ {errorsPengiriman.dokumenProsedur} +
+ )} + + Format: pdf, jpeg, jpg, png. max file size 2MB + +
+
-- cgit v1.2.3 From 2a761d20af5c0e6f40ed3e17f00a7cda95350978 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 6 Mar 2025 14:37:20 +0700 Subject: update --- src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 13 +++++++++++-- src/lib/pengajuan-tempo/component/Pengiriman.jsx | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx index ba184057..ffc25463 100644 --- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx +++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx @@ -218,6 +218,11 @@ const PengajuanTempo = () => { : String(bigData[key]); // Untuk tipe primitif // Kirim data yang sudah diubah ke string ke stepDivsUpdateForm stepDivsUpdateForm[currentStep](key, stringData); + if (key == 'dokumenProsedur') { + const stringData = bigData[key]; + console.log("stringData",stringData) + stepDivsUpdateForm[currentStep](key, stringData); + } } }); } @@ -298,7 +303,9 @@ const PengajuanTempo = () => { section: label, tempo_request: tempoRequest, ...formData, - formDokumenProsedur: formData.dokumenProsedur ? JSON.stringify(formData.dokumenProsedur) : false, + formDokumenProsedur: formData.dokumenProsedur + ? JSON.stringify(formData.dokumenProsedur) + : false, }); if (address.id) { setIdTempo(address.id); @@ -467,7 +474,9 @@ const PengajuanTempo = () => { user_id: address2.userId, tempo_request: false, ...formPengiriman, - formDocs: JSON.stringify(formPengiriman.dokumenProsedur), + formDokumenProsedur: formData.dokumenProsedur + ? JSON.stringify(formData.dokumenProsedur) + : false, }); if (address3.id && formattedDokumen.length > 0) { // Kirim dokumen yang sudah difilter diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx index 097f82a3..ae8b1c78 100644 --- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx +++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx @@ -1590,7 +1590,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { onChange={handleInputChangeFile} accept='.pdf,.png,.jpg,.jpeg' /> - + {formPengiriman?.dokumenProsedur?.name}
-- cgit v1.2.3 From 91e98f591c65499d543e49188deb156e77fbd494 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 6 Mar 2025 16:12:12 +0700 Subject: fix code --- src/lib/pengajuan-tempo/component/PengajuanTempo.jsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx index ffc25463..7cf201b7 100644 --- a/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx +++ b/src/lib/pengajuan-tempo/component/PengajuanTempo.jsx @@ -191,7 +191,6 @@ const PengajuanTempo = () => { useEffect(() => { const cachedData = bigData; - console.log('cachedData', cachedData); const loadBigData = async () => { if (cachedData) { // Ambil kunci-kunci yang relevan berdasarkan currentStep dari stepDivsForm @@ -219,8 +218,7 @@ const PengajuanTempo = () => { // Kirim data yang sudah diubah ke string ke stepDivsUpdateForm stepDivsUpdateForm[currentStep](key, stringData); if (key == 'dokumenProsedur') { - const stringData = bigData[key]; - console.log("stringData",stringData) + const stringData = bigData[key]; stepDivsUpdateForm[currentStep](key, stringData); } } @@ -474,9 +472,9 @@ const PengajuanTempo = () => { user_id: address2.userId, tempo_request: false, ...formPengiriman, - formDokumenProsedur: formData.dokumenProsedur - ? JSON.stringify(formData.dokumenProsedur) - : false, + formDokumenProsedur: formPengiriman.dokumenProsedur + ? JSON.stringify(formPengiriman.dokumenProsedur) + : false, }); if (address3.id && formattedDokumen.length > 0) { // Kirim dokumen yang sudah difilter @@ -529,7 +527,7 @@ const PengajuanTempo = () => { toast.dismiss(toastId); setIsLoading(false); - toast.error('Terjadi kesalahan dalam pengiriman formulir'); + toast.error('Terjadi kesalahan dalam pengiriman formulir hehehehe'); console.error(error); } }; @@ -658,11 +656,14 @@ const PengajuanTempo = () => {
)} -- cgit v1.2.3 From 8c82c09d82a01be290608b78e7b5f8f166cd357b Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 6 Mar 2025 16:35:19 +0700 Subject: cr no manadory kelurahan tempo --- src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx b/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx index 4e99f9f5..4898a3f8 100644 --- a/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx +++ b/src/lib/pengajuan-tempo/component/informasiPerusahaan.jsx @@ -782,7 +782,7 @@ const InformasiPerusahaan = ({ ) : ( @@ -793,7 +793,7 @@ const InformasiPerusahaan = ({ ref={zipRef} placeholder='Kode Pos' type='number' - disabled={!watchsubDistrict} + // disabled={!watchsubDistrict} value={form.zip} className='form-input' onChange={handleInputChange} @@ -1333,7 +1333,7 @@ const InformasiPerusahaan = ({ ) : ( @@ -1344,7 +1344,7 @@ const InformasiPerusahaan = ({ ref={zipRef} placeholder='Kode Pos' type='number' - disabled={!watchsubDistrict} + // disabled={!watchsubDistrict} value={form.zip} className='form-input' onChange={handleInputChange} -- cgit v1.2.3 From f0914e957be3dd73b69388e028505c7ce1361e9e Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 7 Mar 2025 16:31:30 +0700 Subject: update code --- src/lib/pengajuan-tempo/component/Pengiriman.jsx | 169 ++++++++++++----------- 1 file changed, 86 insertions(+), 83 deletions(-) (limited to 'src') diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx index ae8b1c78..52376f61 100644 --- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx +++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx @@ -355,7 +355,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { validatePengiriman(); } }; - console.log('formPengiriman', formPengiriman); const isFormValid = useMemo( () => Object.keys(errorsPengiriman).length === 0, [errorsPengiriman] @@ -1411,6 +1410,48 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { +
+
+ + + Format: pdf, jpeg, jpg, png. max file size 2MB + +
+
+
+ + + + {formPengiriman?.dokumenProsedur?.name} + +
+ {chekValid && ( +
+ {errorsPengiriman.dokumenProsedur} +
+ )} +
+
+
-
-
- - - Format: pdf, jpeg, jpg, png. max file size 2MB - -
-
-
- - - - {formPengiriman?.dokumenProsedur?.name} - -
- {chekValid && ( -
- {errorsPengiriman.dokumenProsedur} -
- )} -
-
+ @@ -2140,6 +2141,48 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { +
+
+ +
+
+
+ + + + {formPengiriman?.dokumenProsedur?.name} + +
+ {chekValid && ( +
+ {errorsPengiriman.dokumenProsedur} +
+ )} + + Format: pdf, jpeg, jpg, png. max file size 2MB + +
+
+
-
-
- -
-
-
- - - - {formPengiriman?.dokumenProsedur?.name} - -
- {chekValid && ( -
- {errorsPengiriman.dokumenProsedur} -
- )} - - Format: pdf, jpeg, jpg, png. max file size 2MB - -
-
+ -- cgit v1.2.3 From 842bd5348263dabbfb5579ba823fd32ae40ca781 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 10 Mar 2025 08:41:27 +0700 Subject: change not mandatory subDistrict --- src/lib/pengajuan-tempo/component/Pengiriman.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx index 755cf45d..7ec68bfa 100644 --- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx +++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx @@ -955,7 +955,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { {...props} options={zips} disabled={ - !watchsubDistrict || sameAddressStreet + sameAddressStreet } placeholder='Zip' /> @@ -968,7 +968,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { placeholder='Kode Pos' type='number' disabled={ - !watchsubDistrict || sameAddressStreet + sameAddressStreet } value={formPengiriman.zipPengiriman} className='form-input' @@ -1193,7 +1193,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { {...props} options={zipsInvoice} disabled={ - !watchsubDistrictInvoice || sameAddress + sameAddress } placeholder='Zip' /> @@ -1205,7 +1205,7 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { placeholder='Kode Pos' type='number' disabled={ - !watchsubDistrictInvoice || sameAddress + sameAddress } value={formPengiriman.zipInvoice} className='form-input' -- cgit v1.2.3 From b0aaa0efee7e7025926bb84a22e97bfc12d1e46b Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 10 Mar 2025 09:51:15 +0700 Subject: fix tempo --- src/lib/pengajuan-tempo/component/Dokumen.jsx | 4 ++-- src/lib/pengajuan-tempo/component/KonfirmasiDokumen.jsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/pengajuan-tempo/component/Dokumen.jsx b/src/lib/pengajuan-tempo/component/Dokumen.jsx index f986d47a..aedb9016 100644 --- a/src/lib/pengajuan-tempo/component/Dokumen.jsx +++ b/src/lib/pengajuan-tempo/component/Dokumen.jsx @@ -566,7 +566,7 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { >
Format: pdf, jpeg, jpg, png. max file size 2MB @@ -1144,7 +1144,7 @@ const Dokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { ref={dokumenTempatBekerjaRef} >