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/lib') 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 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/lib') 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 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 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') 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); -- 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/lib') 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/lib') 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/lib') 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/lib') 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: 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/lib') 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/lib') 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/lib') 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/lib') 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/lib') 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/lib') 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/lib') 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/lib') 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/lib') 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} >
@@ -2330,8 +2333,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
- - -- cgit v1.2.3 From fa6879b95f9d8128b6bbed53a52b6b54dd3266e0 Mon Sep 17 00:00:00 2001 From: Linc2427 Date: Wed, 16 Apr 2025 10:07:04 +0700 Subject: Disable NPWP input --- src/lib/auth/components/CompanyProfile.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/auth/components/CompanyProfile.jsx b/src/lib/auth/components/CompanyProfile.jsx index 6d4da1d1..4692fef6 100644 --- a/src/lib/auth/components/CompanyProfile.jsx +++ b/src/lib/auth/components/CompanyProfile.jsx @@ -59,7 +59,11 @@ const CompanyProfile = () => { useEffect(() => { const loadProfile = async () => { const dataProfile = await addressApi({ - id: auth?.company ? (auth.parentId ? auth.parentId : auth.partnerId) : auth.partnerId, + id: auth?.company + ? auth.parentId + ? auth.parentId + : auth.partnerId + : auth.partnerId, }); setCompany_type(dataProfile?.companyType); setValue('name', dataProfile?.name); @@ -311,9 +315,13 @@ const CompanyProfile = () => { + + *Untuk mengganti NPWP bisa menghubungi Sales +
{errors.npwp?.message}
-- cgit v1.2.3 From ee135f9d54e92350c5e639d64f1948ca41f47509 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 16 Apr 2025 14:40:48 +0700 Subject: make scroll to the error field --- src/lib/pengajuan-tempo/component/Pengiriman.jsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/pengajuan-tempo/component/Pengiriman.jsx b/src/lib/pengajuan-tempo/component/Pengiriman.jsx index bbf22345..a8e7fd22 100644 --- a/src/lib/pengajuan-tempo/component/Pengiriman.jsx +++ b/src/lib/pengajuan-tempo/component/Pengiriman.jsx @@ -360,6 +360,8 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { [errorsPengiriman] ); + const tukarInvoiceInputRef = useRef(null); + const tukarInvoiceInputPembayaranRef = useRef(null); const PICNameRef = useRef(null); const streetPengirimanRef = useRef(null); const statePengirimanRef = useRef(null); @@ -390,6 +392,14 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { behavior: 'smooth', block: 'center', }; + if (errorsPengiriman.tukarInvoiceInput && tukarInvoiceInputRef.current) { + tukarInvoiceInputRef.current.scrollIntoView(options); + return; + } + if (errorsPengiriman.tukarInvoiceInputPembayaran && tukarInvoiceInputPembayaranRef.current) { + tukarInvoiceInputPembayaranRef.current.scrollIntoView(options); + return; + } if (errorsPengiriman.PICName && PICNameRef.current) { PICNameRef.current.scrollIntoView(options); return; @@ -1353,7 +1363,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
{!isKonfirmasi && ( @@ -1370,6 +1379,8 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { value={formPengiriman.tukarInvoiceInput} className='form-input' rows={4} + aria-invalid={errorsPengiriman.tukarInvoiceInput} + ref={tukarInvoiceInputRef} cols={40} onChange={handleInputChange} required @@ -1386,7 +1397,6 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
{!isKonfirmasi && ( @@ -1401,6 +1411,8 @@ const Pengiriman = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => { placeholder='Masukkan jadwal pembayaran' value={formPengiriman.tukarInvoiceInputPembayaran} className='form-input' + aria-invalid={errorsPengiriman.tukarInvoiceInputPembayaran} + ref={tukarInvoiceInputPembayaranRef} rows={4} cols={40} onChange={handleInputChange} -- cgit v1.2.3 From ba8a6b9b6dc731d66a0d9cef3e29c4d5153d2172 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 17 Apr 2025 09:52:39 +0700 Subject: add text decoration for the a tag --- src/lib/auth/components/CompanyProfile.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/auth/components/CompanyProfile.jsx b/src/lib/auth/components/CompanyProfile.jsx index 4692fef6..77cf536f 100644 --- a/src/lib/auth/components/CompanyProfile.jsx +++ b/src/lib/auth/components/CompanyProfile.jsx @@ -320,7 +320,7 @@ const CompanyProfile = () => { maxLength={16} /> - *Untuk mengganti NPWP bisa menghubungi Sales + *Untuk mengganti NPWP bisa menghubungi kami disini.
{errors.npwp?.message} -- cgit v1.2.3 From a5fd7a01e98779beb52232a874a332d769240d54 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Mon, 21 Apr 2025 09:28:02 +0700 Subject: add noref for WA link --- src/lib/auth/components/CompanyProfile.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/auth/components/CompanyProfile.jsx b/src/lib/auth/components/CompanyProfile.jsx index 77cf536f..ca2dcafe 100644 --- a/src/lib/auth/components/CompanyProfile.jsx +++ b/src/lib/auth/components/CompanyProfile.jsx @@ -320,7 +320,15 @@ const CompanyProfile = () => { maxLength={16} /> - *Untuk mengganti NPWP bisa menghubungi kami disini. + *Untuk mengganti NPWP bisa menghubungi kami{' '} + + disini. +
{errors.npwp?.message} -- cgit v1.2.3 From c6c409c7fbff247c9aeb8df55a4d76dd4f682560 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Mon, 21 Apr 2025 13:14:52 +0700 Subject: bugs fix expedisi tidak muncul --- src/lib/checkout/components/Checkout.jsx | 2 +- src/lib/checkout/components/CheckoutSection.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index a8b31ece..c9bff3c1 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -1710,7 +1710,7 @@ const SectionAddress = ({ address, label, url }) => ( ); const SectionValidation = ({ address }) => - address?.stateId == 0 && ( + address?.stateId == 0 || address?.rajaongkirCityId == 0 && (
Mohon untuk memperbarui alamat Anda dengan mengklik tombol di bawah ini.{' '} diff --git a/src/lib/checkout/components/CheckoutSection.jsx b/src/lib/checkout/components/CheckoutSection.jsx index c82e15c7..c6be9056 100644 --- a/src/lib/checkout/components/CheckoutSection.jsx +++ b/src/lib/checkout/components/CheckoutSection.jsx @@ -33,7 +33,7 @@ export const SectionAddress = ({ address, label, url }) => { }; export const SectionValidation = ({ address }) => - address?.stateId == 0 && ( + address?.stateId == 0 || address?.rajaongkirCityId == 0 && (
Mohon untuk memperbarui alamat Anda dengan mengklik tombol di bawah ini.{' '} -- cgit v1.2.3 From d2852cb7b157b4ab7f583b8b5dc61480ea400ea0 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Mon, 21 Apr 2025 13:21:37 +0700 Subject: bug fixing compile company profile --- src/lib/auth/components/CompanyProfile.jsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/auth/components/CompanyProfile.jsx b/src/lib/auth/components/CompanyProfile.jsx index ca2dcafe..d404ebe7 100644 --- a/src/lib/auth/components/CompanyProfile.jsx +++ b/src/lib/auth/components/CompanyProfile.jsx @@ -322,9 +322,7 @@ const CompanyProfile = () => { *Untuk mengganti NPWP bisa menghubungi kami{' '} disini. -- cgit v1.2.3 From d402970949b78b0091a8ae49f9f2018da1991170 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Tue, 29 Apr 2025 10:00:08 +0700 Subject: bug fix flash sale --- src/lib/flashSale/api/flashSaleApi.js | 5 +++-- src/lib/flashSale/components/FlashSaleNonDisplay.jsx | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/flashSale/api/flashSaleApi.js b/src/lib/flashSale/api/flashSaleApi.js index 115b07dc..410b720c 100644 --- a/src/lib/flashSale/api/flashSaleApi.js +++ b/src/lib/flashSale/api/flashSaleApi.js @@ -1,8 +1,9 @@ import odooApi from '@/core/api/odooApi' -const flashSaleApi = async () => { - const flashSale = await odooApi('GET', '/api/v1/flashsale/header') +const flashSaleApi = async ({isShow = true}) => { + const flashSale = await odooApi('GET', '/api/v1/flashsale/header?is_show_program='+isShow) return flashSale } export default flashSaleApi + \ No newline at end of file diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx index 4b420fac..dc2b9fb5 100644 --- a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx +++ b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx @@ -13,7 +13,7 @@ const FlashSaleNonDisplay = () => { const router = useRouter(); useEffect(() => { const loadFlashSales = async () => { - const dataFlashSales = await flashSaleApi(); + const dataFlashSales = await flashSaleApi({isShow: false}); setFlashSales(dataFlashSales); setIsLoading(false); }; -- cgit v1.2.3 From 480e89a0d2ccd274b956b4c4fb7ff520765c6606 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 29 Apr 2025 14:53:53 +0700 Subject: fix bug flashsale --- src/lib/flashSale/components/FlashSaleNonDisplay.jsx | 10 +++++----- src/lib/product/components/ProductSearch.jsx | 7 ++----- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'src/lib') diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx index dc2b9fb5..adcc7ba0 100644 --- a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx +++ b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx @@ -19,8 +19,8 @@ const FlashSaleNonDisplay = () => { }; loadFlashSales(); }, []); - const handleSubmit = () => { - router.push(`/shop/search?penawaran=${flashSales[0]?.pricelistId}`); + const handleSubmit = (flashSale) => { + router.push(`/shop/search?penawaran=${flashSale?.pricelistId}`); }; if (isLoading) { return ; @@ -33,10 +33,10 @@ const FlashSaleNonDisplay = () => {
- Penawaran Terbatas + {flashSale.name}
handleSubmit(flashSale)} className='!text-red-500 font-semibold cursor-pointer' > Lihat Semua @@ -56,7 +56,7 @@ const FlashSaleProduct = ({ flashSaleId }) => { useEffect(() => { const loadProducts = async () => { const dataProducts = await productSearchApi({ - query: `fq=-flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=25&orderBy=flashsale-discount-desc&source=similar`, + query: `fq=flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=25&orderBy=flashsale-discount-desc&source=similar`, operation: 'AND', }); setProducts(dataProducts.response); diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index e2e1f859..eb86485d 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -84,10 +84,7 @@ const ProductSearch = ({ if (router.asPath.includes('penawaran')) { query = { ...query, - fq: [ - `-flashsale_id_i:${router.query.penawaran}`, - `flashsale_price_f:[1 TO *]`, - ], + fq:`flashsale_id_i:${router.query.penawaran} AND flashsale_price_f:[1 TO *]`, orderBy: 'flashsale-discount-desc', }; setFinalQuery(query); @@ -152,7 +149,7 @@ const ProductSearch = ({ }, [dataCategoriesProduct, dataLob]); useEffect(() => { - if (prefixUrl.includes('category') || prefixUrl.includes('lob')) { + if (prefixUrl.includes('category') || prefixUrl.includes('lob') || router.asPath.includes('penawaran')) { setQueryFinal({ ...finalQuery, q, limit, orderBy }); } else { setQueryFinal({ ...query, q, limit, orderBy }); -- cgit v1.2.3 From 5c8a5df24a9758f3b3a6366d326f61c2c6a13c42 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Tue, 6 May 2025 14:43:58 +0700 Subject: bugfix addres validation on checkout --- src/lib/checkout/components/Checkout.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index c9bff3c1..1ad2782d 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -1127,7 +1127,7 @@ const Checkout = () => { )} - + { )} - + ( ); const SectionValidation = ({ address }) => - address?.stateId == 0 || address?.rajaongkirCityId == 0 && ( + (address?.stateId === 0 || address?.rajaongkirCityId === 0) && (
Mohon untuk memperbarui alamat Anda dengan mengklik tombol di bawah ini.{' '} -- cgit v1.2.3 From 166191e8f7335810cd0073b9aa2436a908a21d34 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 7 May 2025 09:20:55 +0700 Subject: voucher category --- src/lib/checkout/api/checkoutApi.js | 8 ++++ src/lib/checkout/components/Checkout.jsx | 67 ++++++++++++++++++++++++++------ 2 files changed, 64 insertions(+), 11 deletions(-) (limited to 'src/lib') diff --git a/src/lib/checkout/api/checkoutApi.js b/src/lib/checkout/api/checkoutApi.js index fd982fff..39d25068 100644 --- a/src/lib/checkout/api/checkoutApi.js +++ b/src/lib/checkout/api/checkoutApi.js @@ -18,3 +18,11 @@ export const getProductsCheckout = async (query) => { const result = await odooApi('GET', url); return result; }; + +async function checkVoucherApplicability(voucherId, productCategoryId) { + const response = await fetch( + `/api/voucher/${voucherId}/check_applicability?category_id=${productCategoryId}` + ); + const data = await response.json(); + return data.is_applicable; // true jika voucher berlaku untuk kategori, false jika tidak +} diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index c9bff3c1..9ccebe72 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -39,18 +39,20 @@ const { getProductsCheckout } = require('../api/checkoutApi'); function convertToInternational(number) { if (typeof number !== 'string') { - throw new Error("Input harus berupa string"); + throw new Error('Input harus berupa string'); } if (number.startsWith('08')) { - return '+62' + number.slice(2); + return '+62' + number.slice(2); } return number; } const Checkout = () => { - const PPN = process.env.NEXT_PUBLIC_PPN ? parseFloat(process.env.NEXT_PUBLIC_PPN) : 0; + const PPN = process.env.NEXT_PUBLIC_PPN + ? parseFloat(process.env.NEXT_PUBLIC_PPN) + : 0; const router = useRouter(); const query = router.query.source ?? null; const qVoucher = router.query.voucher ?? null; @@ -145,16 +147,37 @@ const Checkout = () => { if (!listVouchers) { try { setLoadingVoucher(true); + const productCategories = products + ?.reduce((categories, product) => { + console.log('Processing product:', product.name); + console.log('Product categories:', product.categories); + + if (product.categories && Array.isArray(product.categories)) { + product.categories.forEach((category) => { + if (category.id && !categories.includes(category.id)) { + categories.push(category.id); + } + }); + } + return categories; + }, []) + .join(','); + + console.log('Final categories string:', productCategories); + let dataVoucher = await getVoucher(auth?.id, { source: query, type: 'all,brand', - partner_id : auth?.partnerId, + partner_id: auth?.partnerId, + voucher_category: productCategories, // Add the product categories }); + console.log('All vouchers received:', dataVoucher); SetListVoucher(dataVoucher); let dataVoucherShipping = await getVoucher(auth?.id, { source: query, type: 'shipping', + voucher_category: productCategories, // Add the product categories }); SetListVoucherShipping(dataVoucherShipping); } finally { @@ -164,10 +187,25 @@ const Checkout = () => { }; const VoucherCode = async (code) => { - // let dataVoucher = await findVoucher(code, auth.id, query); + const productCategories = products + ?.reduce((categories, product) => { + if (product.categories && Array.isArray(product.categories)) { + product.categories.forEach((category) => { + if (category.id && !categories.includes(category.id)) { + categories.push(category.id); + } + }); + } + return categories; + }, []) + .join(','); + + console.log('Voucher code search with categories:', productCategories); + let dataVoucher = await getVoucher(auth?.id, { source: query, code: code, + voucher_category: productCategories, // Add the product categories }); if (dataVoucher.length <= 0) { SetFindVoucher(1); @@ -517,10 +555,12 @@ const Checkout = () => { gtag('set', 'user_data', { email: auth.email, - phone_number: convertToInternational(auth.mobile) ?? convertToInternational(auth.phone), + phone_number: + convertToInternational(auth.mobile) ?? + convertToInternational(auth.phone), }); - gtag('config', 'AW-954540379', { ' allow_enhanced_conversions':true } ) ; + gtag('config', 'AW-954540379', { ' allow_enhanced_conversions': true }); for (const product of products) deleteItemCart({ productId: product.id }); if (grandTotal > 0) { @@ -1223,7 +1263,9 @@ const Checkout = () => {
{currencyFormat(cartCheckout?.subtotal)}
-
PPN {((PPN - 1) * 100).toFixed(0)}%
+
+ PPN {((PPN - 1) * 100).toFixed(0)}% +
{currencyFormat(cartCheckout?.tax)}
@@ -1527,7 +1569,9 @@ const Checkout = () => {
{currencyFormat(cartCheckout?.subtotal)}
-
PPN {((PPN - 1) * 100).toFixed(0)}%
+
+ PPN {((PPN - 1) * 100).toFixed(0)}% +
{currencyFormat(cartCheckout?.tax)}
@@ -1710,7 +1754,8 @@ const SectionAddress = ({ address, label, url }) => ( ); const SectionValidation = ({ address }) => - address?.stateId == 0 || address?.rajaongkirCityId == 0 && ( + address?.stateId == 0 || + (address?.rajaongkirCityId == 0 && (
Mohon untuk memperbarui alamat Anda dengan mengklik tombol di bawah ini.{' '} @@ -1724,7 +1769,7 @@ const SectionValidation = ({ address }) =>
- ); + )); const SectionExpedisi = ({ address, -- cgit v1.2.3 From 11ea9426239b88181e5074a8e7246f8955346180 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 7 May 2025 11:51:15 +0700 Subject: Remove unused code --- src/lib/checkout/api/checkoutApi.js | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/lib') diff --git a/src/lib/checkout/api/checkoutApi.js b/src/lib/checkout/api/checkoutApi.js index 39d25068..fd982fff 100644 --- a/src/lib/checkout/api/checkoutApi.js +++ b/src/lib/checkout/api/checkoutApi.js @@ -18,11 +18,3 @@ export const getProductsCheckout = async (query) => { const result = await odooApi('GET', url); return result; }; - -async function checkVoucherApplicability(voucherId, productCategoryId) { - const response = await fetch( - `/api/voucher/${voucherId}/check_applicability?category_id=${productCategoryId}` - ); - const data = await response.json(); - return data.is_applicable; // true jika voucher berlaku untuk kategori, false jika tidak -} -- cgit v1.2.3 From a9a92c02e24bf77b9e490be51d7002cc2ef41bf1 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 8 May 2025 17:31:04 +0700 Subject: Remove log --- src/lib/checkout/components/Checkout.jsx | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/lib') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index be490d32..5256a328 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -149,9 +149,6 @@ const Checkout = () => { setLoadingVoucher(true); const productCategories = products ?.reduce((categories, product) => { - console.log('Processing product:', product.name); - console.log('Product categories:', product.categories); - if (product.categories && Array.isArray(product.categories)) { product.categories.forEach((category) => { if (category.id && !categories.includes(category.id)) { @@ -163,15 +160,12 @@ const Checkout = () => { }, []) .join(','); - console.log('Final categories string:', productCategories); - let dataVoucher = await getVoucher(auth?.id, { source: query, type: 'all,brand', partner_id: auth?.partnerId, voucher_category: productCategories, // Add the product categories }); - console.log('All vouchers received:', dataVoucher); SetListVoucher(dataVoucher); let dataVoucherShipping = await getVoucher(auth?.id, { @@ -200,8 +194,6 @@ const Checkout = () => { }, []) .join(','); - console.log('Voucher code search with categories:', productCategories); - let dataVoucher = await getVoucher(auth?.id, { source: query, code: code, -- cgit v1.2.3