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/checkout') 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 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/checkout') 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/checkout') 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/checkout') 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/checkout') 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 From 60cbad2ae4b551d8f1e6959a3c90134c16b10e26 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 22 May 2025 15:33:04 +0700 Subject: form-merchant & quotation tampilan --- src/lib/checkout/components/FinishCheckout.jsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/lib/checkout') diff --git a/src/lib/checkout/components/FinishCheckout.jsx b/src/lib/checkout/components/FinishCheckout.jsx index 4a67b252..232f8a67 100644 --- a/src/lib/checkout/components/FinishCheckout.jsx +++ b/src/lib/checkout/components/FinishCheckout.jsx @@ -43,7 +43,7 @@ const FinishCheckout = ({ query }) => { toast.error('Gagal mengirimkan rincian pesanan'); } }; - +console.log(data) return (
{ height={isMobile ? 300 : 450} />
- Terima Kasih atas Pembelian Kamu + Terima Kasih atas Pembelian di Indoteknik.com
+

No. Transaksi: {query?.order_id?.replaceAll('-', '/')}

-

No. Transaksi

-

- {query?.order_id?.replaceAll('-', '/')} -

+

Estimasi Barang Siap pada Tanggal

+

{data?.expectedReadyToShip}

Date: Fri, 23 May 2025 10:41:53 +0700 Subject: Revert "form-merchant & quotation tampilan" This reverts commit 60cbad2ae4b551d8f1e6959a3c90134c16b10e26. --- src/lib/checkout/components/FinishCheckout.jsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/lib/checkout') diff --git a/src/lib/checkout/components/FinishCheckout.jsx b/src/lib/checkout/components/FinishCheckout.jsx index 232f8a67..4a67b252 100644 --- a/src/lib/checkout/components/FinishCheckout.jsx +++ b/src/lib/checkout/components/FinishCheckout.jsx @@ -43,7 +43,7 @@ const FinishCheckout = ({ query }) => { toast.error('Gagal mengirimkan rincian pesanan'); } }; -console.log(data) + return (
- Terima Kasih atas Pembelian di Indoteknik.com + Terima Kasih atas Pembelian Kamu
-

No. Transaksi: {query?.order_id?.replaceAll('-', '/')}

-

Estimasi Barang Siap pada Tanggal

-

{data?.expectedReadyToShip}

+

No. Transaksi

+

+ {query?.order_id?.replaceAll('-', '/')} +

Date: Fri, 23 May 2025 11:26:04 +0700 Subject: expected ready to ship di quotation --- src/lib/checkout/components/FinishCheckout.jsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/lib/checkout') diff --git a/src/lib/checkout/components/FinishCheckout.jsx b/src/lib/checkout/components/FinishCheckout.jsx index 4a67b252..d533325e 100644 --- a/src/lib/checkout/components/FinishCheckout.jsx +++ b/src/lib/checkout/components/FinishCheckout.jsx @@ -53,13 +53,12 @@ const FinishCheckout = ({ query }) => { height={isMobile ? 300 : 450} />
- Terima Kasih atas Pembelian Kamu + Terima Kasih atas Pembelian di Indoteknik.com
+

No. Transaksi: {query?.order_id?.replaceAll('-', '/')}

-

No. Transaksi

-

- {query?.order_id?.replaceAll('-', '/')} -

+

Estimasi Barang Siap pada Tanggal

+

{data?.expectedReadyToShip}