From f45452d71062bf7c57e31d45ec8800fcc4deca64 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 18 Sep 2024 13:42:10 +0700 Subject: update notifikasi berhasil checkout --- src/lib/checkout/components/FinishCheckout.jsx | 66 +++++++++++++++++++------- 1 file changed, 48 insertions(+), 18 deletions(-) (limited to 'src/lib/checkout/components') diff --git a/src/lib/checkout/components/FinishCheckout.jsx b/src/lib/checkout/components/FinishCheckout.jsx index 92245e31..fa600389 100644 --- a/src/lib/checkout/components/FinishCheckout.jsx +++ b/src/lib/checkout/components/FinishCheckout.jsx @@ -1,27 +1,57 @@ -import Link from '@/core/components/elements/Link/Link' +import Link from 'next/link'; +import Image from '~/components/ui/image'; +import whatsappUrl from '@/core/utils/whatsappUrl'; +import { useEffect, useState } from 'react'; +import odooApi from '@/core/api/odooApi'; const FinishCheckout = ({ query }) => { + const [data, setData] = useState(); + + useEffect(() => { + const fetchData = async () => { + const so_order = query?.order_id?.replaceAll('_', '/'); + const data = await odooApi( + 'GET', + `/api/v1/sale_order_number?sale_number=${so_order}` + ); + setData(data[0]); + }; + fetchData(); + }, [query]); return ( -
-
-
-

Terima Kasih atas Pembelian Anda

-

- Rincian belanja sudah kami kirimkan ke email anda. Mohon dicek kembali. jika tidak - menerima email, anda dapat menghubungi kami disini. -

-

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

-

No. Transaksi

-
+
+ Checkout Pesanan +
+ Terima Kasih atas Pembelian Kamu +
+
+

No. Transaksi

+

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

- Lihat detail pembelian Anda disini + Cek Detail Transaksi
+
+ Rincian pembelian sudah kami kirimkan ke email kamu. Mohon dicek + kembali. jika tidak menerima email, +
kamu dapat menghubungi kami{' '} + + di sini + {' '} + atau kirim rincian pesanan ulang. +
- ) -} + ); +}; -export default FinishCheckout +export default FinishCheckout; -- cgit v1.2.3 From 5cfa2d67c93e45c44d8d76cd5e08261a2ee08bd7 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 19 Sep 2024 15:46:05 +0700 Subject: update notif after checkout --- src/lib/checkout/components/FinishCheckout.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/lib/checkout/components') diff --git a/src/lib/checkout/components/FinishCheckout.jsx b/src/lib/checkout/components/FinishCheckout.jsx index fa600389..69bd935f 100644 --- a/src/lib/checkout/components/FinishCheckout.jsx +++ b/src/lib/checkout/components/FinishCheckout.jsx @@ -41,10 +41,9 @@ const FinishCheckout = ({ query }) => { Cek Detail Transaksi
-
+
Rincian pembelian sudah kami kirimkan ke email kamu. Mohon dicek - kembali. jika tidak menerima email, -
kamu dapat menghubungi kami{' '} + kembali. jika tidak menerima email, kamu dapat menghubungi kami{' '} di sini {' '} -- cgit v1.2.3 From 87f284a2cc4ce1e618a1c7ad63898dbcb76a8b83 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 20 Sep 2024 09:22:13 +0700 Subject: save sementara --- src/lib/checkout/components/FinishCheckout.jsx | 34 ++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'src/lib/checkout/components') diff --git a/src/lib/checkout/components/FinishCheckout.jsx b/src/lib/checkout/components/FinishCheckout.jsx index 69bd935f..e2f40d8d 100644 --- a/src/lib/checkout/components/FinishCheckout.jsx +++ b/src/lib/checkout/components/FinishCheckout.jsx @@ -3,28 +3,44 @@ import Image from '~/components/ui/image'; import whatsappUrl from '@/core/utils/whatsappUrl'; import { useEffect, useState } from 'react'; import odooApi from '@/core/api/odooApi'; +import useDevice from '@/core/hooks/useDevice'; +import useAuth from '@/core/hooks/useAuth'; +import axios from 'axios'; const FinishCheckout = ({ query }) => { const [data, setData] = useState(); + const [transactionData, setTransactionData] = useState(); + const { isDesktop, isMobile } = useDevice(); + const auth = useAuth(); + const so_order = query?.order_id?.replaceAll('-', '/'); useEffect(() => { const fetchData = async () => { - const so_order = query?.order_id?.replaceAll('_', '/'); - const data = await odooApi( + const fetchedData = await odooApi( 'GET', `/api/v1/sale_order_number?sale_number=${so_order}` ); - setData(data[0]); + setData(fetchedData[0]); }; fetchData(); }, [query]); + console.log('auth', auth); + + // Kirim email ketika komponen ini dimount atau sesuai kondisi + const sendEmail = async () => { + await axios.post( + `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/finish-checkout?orderName=${query?.order_id}`, + {} + ); + }; + return (
Checkout Pesanan
Terima Kasih atas Pembelian Kamu @@ -32,7 +48,7 @@ const FinishCheckout = ({ query }) => {

No. Transaksi

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

{ di sini {' '} - atau kirim rincian pesanan ulang. + atau{' '} + + kirim rincian pesanan ulang + + .
); -- cgit v1.2.3 From 56ed5980588447c6ba05529e91d6f82820f1b764 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 20 Sep 2024 09:43:57 +0700 Subject: delete console log --- src/lib/checkout/components/FinishCheckout.jsx | 1 - 1 file changed, 1 deletion(-) (limited to 'src/lib/checkout/components') diff --git a/src/lib/checkout/components/FinishCheckout.jsx b/src/lib/checkout/components/FinishCheckout.jsx index e2f40d8d..1be5c841 100644 --- a/src/lib/checkout/components/FinishCheckout.jsx +++ b/src/lib/checkout/components/FinishCheckout.jsx @@ -24,7 +24,6 @@ const FinishCheckout = ({ query }) => { }; fetchData(); }, [query]); - console.log('auth', auth); // Kirim email ketika komponen ini dimount atau sesuai kondisi const sendEmail = async () => { -- cgit v1.2.3 From ec69b6f0131939ebfbff1d5082b1229f7b58799b Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 21 Sep 2024 11:08:50 +0700 Subject: add try catch --- src/lib/checkout/components/FinishCheckout.jsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/lib/checkout/components') diff --git a/src/lib/checkout/components/FinishCheckout.jsx b/src/lib/checkout/components/FinishCheckout.jsx index 1be5c841..4a67b252 100644 --- a/src/lib/checkout/components/FinishCheckout.jsx +++ b/src/lib/checkout/components/FinishCheckout.jsx @@ -6,6 +6,7 @@ import odooApi from '@/core/api/odooApi'; import useDevice from '@/core/hooks/useDevice'; import useAuth from '@/core/hooks/useAuth'; import axios from 'axios'; +import { toast } from 'react-hot-toast'; const FinishCheckout = ({ query }) => { const [data, setData] = useState(); @@ -27,10 +28,20 @@ const FinishCheckout = ({ query }) => { // Kirim email ketika komponen ini dimount atau sesuai kondisi const sendEmail = async () => { - await axios.post( - `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/finish-checkout?orderName=${query?.order_id}`, - {} - ); + try { + const send = await axios.post( + `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/finish-checkout?orderName=${query?.order_id}`, + {} + ); + if (send.status === 200) { + toast.success('Berhasil mengirim rincian pesanan'); + } else { + toast.error('Gagal mengirimkan rincian pesanan'); + } + } catch (error) { + console.error(error); + toast.error('Gagal mengirimkan rincian pesanan'); + } }; return ( -- cgit v1.2.3 From 0f856f3902c0782ebb6c5989defccb2333818f08 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Mon, 7 Oct 2024 14:58:15 +0700 Subject: bugfix required state on update alamat --- src/lib/checkout/components/Checkout.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib/checkout/components') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 4c7e852f..a1b0116a 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -67,6 +67,7 @@ const Checkout = () => { const getAddresses = async () => { const dataAddresses = await addressesApi(); + console.log('ini adalah adress',dataAddresses); setAddresses(dataAddresses); }; @@ -1664,7 +1665,7 @@ const SectionAddress = ({ address, label, url }) => ( ); const SectionValidation = ({ address }) => - address?.rajaongkirCityId == 0 && ( + address?.stateId == null && (
Mohon untuk memperbarui alamat Anda dengan mengklik tombol di bawah ini.{' '} -- cgit v1.2.3 From 94a96e371f554c7d87e2a6edbc6bdb7fe9228fd6 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 16 Oct 2024 13:19:45 +0700 Subject: add CR tambahin info jumlah barang ready stock yang bisa di pick up --- src/lib/checkout/components/Checkout.jsx | 1 + 1 file changed, 1 insertion(+) (limited to 'src/lib/checkout/components') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 4c7e852f..e872b7f6 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -442,6 +442,7 @@ const Checkout = () => { const productOrder = products.map((product) => ({ product_id: product.id, quantity: product.quantity, + available_quantity: product?.availableQuantity, })); let data = { // partner_shipping_id: auth.partnerId, -- cgit v1.2.3 From dca7af433ca57e976b29620c58de98e94388e2b9 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 22 Oct 2024 14:24:31 +0700 Subject: CR variant beli langsung --- src/lib/checkout/components/Checkout.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/lib/checkout/components') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index a1b0116a..0e180d9c 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -67,7 +67,6 @@ const Checkout = () => { const getAddresses = async () => { const dataAddresses = await addressesApi(); - console.log('ini adalah adress',dataAddresses); setAddresses(dataAddresses); }; @@ -1665,7 +1664,7 @@ const SectionAddress = ({ address, label, url }) => ( ); const SectionValidation = ({ address }) => - address?.stateId == null && ( + address?.stateId == 0 && (
Mohon untuk memperbarui alamat Anda dengan mengklik tombol di bawah ini.{' '} -- cgit v1.2.3 From 6e7aa296bae3e290785da7ad941c521a685be1e9 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Thu, 14 Nov 2024 10:58:15 +0700 Subject: add google tag ads --- src/lib/checkout/components/Checkout.jsx | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/lib/checkout/components') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index e83e719c..afbf1e6c 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -413,7 +413,12 @@ const Checkout = () => { Math.round(parseInt(finalShippingAmt * 1.1) / 1000) * 1000; const finalGT = GT < 0 ? 0 : GT; setGrandTotal(finalGT); - }, [biayaKirim, cartCheckout?.grandTotal, activeVoucher, activeVoucherShipping]); + }, [ + biayaKirim, + cartCheckout?.grandTotal, + activeVoucher, + activeVoucherShipping, + ]); const checkout = async () => { const file = poFile.current.files[0]; @@ -484,6 +489,11 @@ const Checkout = () => { transaction_id: isCheckouted.id, }); + gtag('set', 'user_data', { + email: auth.email, + phone_number: auth.mobile ?? auth.phone, + }); + for (const product of products) deleteItemCart({ productId: product.id }); if (grandTotal > 0) { const payment = await axios.post( @@ -501,7 +511,7 @@ const Checkout = () => { } } - /* const midtrans = async () => { + /* const midtrans = async () => { for (const product of products) deleteItemCart({ productId: product.id }); if (grandTotal > 0) { const payment = await axios.post( @@ -1193,7 +1203,11 @@ const Checkout = () => {
Biaya Kirim

{etdFix}

-
{currencyFormat(Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000)}
+
+ {currencyFormat( + Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000 + )} +
{activeVoucherShipping && voucherShippingAmt && (
@@ -1494,7 +1508,11 @@ const Checkout = () => { Biaya Kirim

{etdFix}

-
{currencyFormat(Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000) }
+
+ {currencyFormat( + Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000 + )} +
{activeVoucherShipping && voucherShippingAmt && (
-- cgit v1.2.3 From ab35d72d65501251f579adf210051e2847cad41b Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Mon, 18 Nov 2024 10:59:40 +0700 Subject: CR gtag user_data on page checkout --- src/lib/checkout/components/Checkout.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/lib/checkout/components') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index afbf1e6c..4c5cca62 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -37,6 +37,18 @@ const SELF_PICKUP_ID = 32; const { checkoutApi } = require('../api/checkoutApi'); const { getProductsCheckout } = require('../api/checkoutApi'); +function convertToInternational(number) { + if (typeof number !== 'string') { + throw new Error("Input harus berupa string"); + } + + if (number.startsWith('08')) { + return '+62' + number.slice(2); + } + + return number; +} + const Checkout = () => { const router = useRouter(); const query = router.query.source ?? null; @@ -491,7 +503,7 @@ const Checkout = () => { gtag('set', 'user_data', { email: auth.email, - phone_number: auth.mobile ?? auth.phone, + phone_number: convertToInternational(auth.mobile) ?? convertToInternational(auth.phone), }); for (const product of products) deleteItemCart({ productId: product.id }); -- cgit v1.2.3 From bde516b6b39cccfe8ac3248cd7f85592e6298d7a Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Mon, 18 Nov 2024 11:24:56 +0700 Subject: add google tag allow_enhanced_conversions --- src/lib/checkout/components/Checkout.jsx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/lib/checkout/components') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 4c5cca62..6fb5cdb4 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -506,6 +506,8 @@ const Checkout = () => { phone_number: convertToInternational(auth.mobile) ?? convertToInternational(auth.phone), }); + gtag('config', 'AW-954540379', { ' allow_enhanced_conversions':true } ) ; + for (const product of products) deleteItemCart({ productId: product.id }); if (grandTotal > 0) { const payment = await axios.post( -- cgit v1.2.3