summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cart/components/Cart.jsx3
-rw-r--r--src/lib/cart/components/CartOld.jsx3
-rw-r--r--src/lib/cart/components/Cartheader.jsx3
-rw-r--r--src/lib/checkout/components/Checkout.jsx1
-rw-r--r--src/lib/checkout/components/CheckoutOld.jsx2
-rw-r--r--src/lib/checkout/email/FinishCheckoutEmail.jsx5
-rw-r--r--src/lib/invoice/components/Invoice.jsx5
-rw-r--r--src/lib/quotation/components/Quotation.jsx7
-rw-r--r--src/lib/transaction/components/Transaction.jsx4
9 files changed, 19 insertions, 14 deletions
diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx
index c6aaa596..1e25d959 100644
--- a/src/lib/cart/components/Cart.jsx
+++ b/src/lib/cart/components/Cart.jsx
@@ -27,6 +27,7 @@ import CardProdcuctsList from '@/core/components/elements/Product/cartProductsLi
// import cardProdcuctsList from '@/core/components/elements/Product/cartProductsList'
const Cart = () => {
+ const PPN = process.env.NEXT_PUBLIC_PPN
const router = useRouter()
const [products, setProducts] = useState(null)
const [isLoading, setIsLoading] = useState(true)
@@ -97,7 +98,7 @@ const Cart = () => {
if (product.canBuy == false) {
toggleSelected(product.id)
}
- let priceBeforeTax = product.price.price / 1.11
+ let priceBeforeTax = product.price.price / PPN
calculateTotalPriceBeforeTax += priceBeforeTax * product.quantity
calculateTotalTaxAmount += (product.price.price - priceBeforeTax) * product.quantity
calculateTotalDiscountAmount +=
diff --git a/src/lib/cart/components/CartOld.jsx b/src/lib/cart/components/CartOld.jsx
index 718541af..358efa49 100644
--- a/src/lib/cart/components/CartOld.jsx
+++ b/src/lib/cart/components/CartOld.jsx
@@ -20,6 +20,7 @@ import whatsappUrl from '@/core/utils/whatsappUrl'
import useAuth from '@/core/hooks/useAuth'
const Cart = () => {
+ const PPN = process.env.NEXT_PUBLIC_PPN
const router = useRouter()
const [products, setProducts] = useState(null)
const auth = useAuth()
@@ -67,7 +68,7 @@ const Cart = () => {
})
if (!product.selected) continue
- let priceBeforeTax = product.price.price / 1.11
+ let priceBeforeTax = product.price.price / PPN
calculateTotalPriceBeforeTax += priceBeforeTax * product.quantity
calculateTotalTaxAmount += (product.price.price - priceBeforeTax) * product.quantity
calculateTotalDiscountAmount +=
diff --git a/src/lib/cart/components/Cartheader.jsx b/src/lib/cart/components/Cartheader.jsx
index 1c30bb13..6d4e2679 100644
--- a/src/lib/cart/components/Cartheader.jsx
+++ b/src/lib/cart/components/Cartheader.jsx
@@ -14,6 +14,7 @@ const { ShoppingCartIcon, PhotoIcon } = require('@heroicons/react/24/outline');
const { default: Link } = require('next/link');
const Cardheader = (cartCount) => {
+ const PPN = process.env.NEXT_PUBLIC_PPN
const router = useRouter();
const [subTotal, setSubTotal] = useState(null);
const [buttonLoading, SetButtonTerapkan] = useState(false);
@@ -66,7 +67,7 @@ const Cardheader = (cartCount) => {
for (const product of products) {
if (product.quantity == '') continue;
- let priceBeforeTax = product.price.price / 1.11;
+ let priceBeforeTax = product.price.price / PPN;
calculateTotalPriceBeforeTax += priceBeforeTax * product.quantity;
calculateTotalTaxAmount +=
(product.price.price - priceBeforeTax) * product.quantity;
diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index 4e182745..e3b586f1 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -588,7 +588,6 @@ const Checkout = () => {
setItemTnC(item);
SetBottomPopupTnC(true);
};
- // const taxTotal = (totalAmount - totalDiscountAmount - discountVoucher) * 0.11
const hasNoPrice = useMemo(() => {
if (!products) return false;
diff --git a/src/lib/checkout/components/CheckoutOld.jsx b/src/lib/checkout/components/CheckoutOld.jsx
index 5b479a73..433c5672 100644
--- a/src/lib/checkout/components/CheckoutOld.jsx
+++ b/src/lib/checkout/components/CheckoutOld.jsx
@@ -239,7 +239,7 @@ const Checkout = () => {
setIsLoading(false)
window.location.href = payment.data.redirectUrl
}
- const taxTotal = (totalAmount - totalDiscountAmount) * 0.11
+ const taxTotal = (totalAmount - totalDiscountAmount) * (PPN - 1)
return (
<>
diff --git a/src/lib/checkout/email/FinishCheckoutEmail.jsx b/src/lib/checkout/email/FinishCheckoutEmail.jsx
index d19ba1ca..9a94587e 100644
--- a/src/lib/checkout/email/FinishCheckoutEmail.jsx
+++ b/src/lib/checkout/email/FinishCheckoutEmail.jsx
@@ -17,6 +17,7 @@ import {
import FinishCheckout from '../components/FinishCheckout'
const FinishCheckoutEmail = ({ transaction, payment, statusPayment }) => {
+ const PPN = process.env.NEXT_PUBLIC_PPN
return (
<Html>
@@ -206,9 +207,9 @@ const FinishCheckoutEmail = ({ transaction, payment, statusPayment }) => {
</Column>
</Row>
<Row style={style.descriptionRow}>
- <Column style={style.descriptionLCol}>PPN 11% (Incl.)</Column>
+ <Column style={style.descriptionLCol}>PPN {((PPN - 1) * 100).toFixed(0)}% (Incl.)</Column>
<Column style={style.descriptionRCol}>
- {currencyFormat(transaction.subtotal * 0.11)}
+ {currencyFormat(transaction.subtotal * (PPN - 1))}
</Column>
</Row>
diff --git a/src/lib/invoice/components/Invoice.jsx b/src/lib/invoice/components/Invoice.jsx
index 81202b1c..15bfa746 100644
--- a/src/lib/invoice/components/Invoice.jsx
+++ b/src/lib/invoice/components/Invoice.jsx
@@ -13,6 +13,7 @@ import { createSlug } from '@/core/utils/slug'
import { useEffect, useState } from 'react'
const Invoice = ({ id }) => {
+ const PPN = process.env.NEXT_PUBLIC_PPN
const { invoice } = useInvoice({ id })
const [totalAmount, setTotalAmount] = useState(0)
@@ -255,8 +256,8 @@ const Invoice = ({ id }) => {
{currencyFormat(invoice.data?.amountTotal)}
</div>
- <div className='text-right'>PPN 11% (Incl.)</div>
- <div className='text-right font-medium'>{currencyFormat(totalAmount * 0.11)}</div>
+ <div className='text-right'>PPN {((PPN - 1) * 100).toFixed(0)}% (Incl.)</div>
+ <div className='text-right font-medium'>{currencyFormat(invoice.data?.amountTotal - totalAmount)}</div>
</div>
</div>
</div>
diff --git a/src/lib/quotation/components/Quotation.jsx b/src/lib/quotation/components/Quotation.jsx
index 5a2f63a5..2f4d6c46 100644
--- a/src/lib/quotation/components/Quotation.jsx
+++ b/src/lib/quotation/components/Quotation.jsx
@@ -37,6 +37,7 @@ const { checkoutApi } = require('@/lib/checkout/api/checkoutApi');
const { getProductsCheckout } = require('@/lib/checkout/api/checkoutApi');
const Quotation = () => {
+ const PPN = process.env.NEXT_PUBLIC_PPN ? parseFloat(process.env.NEXT_PUBLIC_PPN) : 0;
const router = useRouter();
const auth = useAuth();
const query = router.query.source ?? null;
@@ -307,7 +308,7 @@ const Quotation = () => {
toast.error('Gagal melakukan transaksi, terjadi kesalahan internal');
};
- const taxTotal = (totalAmount - totalDiscountAmount) * 0.11;
+ const taxTotal = (totalAmount - totalDiscountAmount) * (PPN - 1);
return (
<>
@@ -425,7 +426,7 @@ const Quotation = () => {
<div>{currencyFormat(cartCheckout?.subtotal)}</div>
</div>
<div className='flex gap-x-2 justify-between'>
- <div className='text-gray_r-11'>PPN 11%</div>
+ <div className='text-gray_r-11'>PPN {((PPN - 1) * 100).toFixed(0)}%</div>
<div>{currencyFormat(cartCheckout?.tax)}</div>
</div>
<div className='flex gap-x-2 justify-between'>
@@ -574,7 +575,7 @@ const Quotation = () => {
<div>{currencyFormat(cartCheckout?.subtotal)}</div>
</div>
<div className='flex gap-x-2 justify-between'>
- <div className='text-gray_r-11'>PPN 11%</div>
+ <div className='text-gray_r-11'>PPN {((PPN - 1) * 100).toFixed(0)}%</div>
<div>{currencyFormat(cartCheckout?.tax)}</div>
</div>
<div className='flex gap-x-2 justify-between'>
diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx
index f5dc507a..273ea3f7 100644
--- a/src/lib/transaction/components/Transaction.jsx
+++ b/src/lib/transaction/components/Transaction.jsx
@@ -207,7 +207,7 @@ const Transaction = ({ id }) => {
<p>{currencyFormat(transaction.data?.amountUntaxed)}</p>
</div>
<div className='flex justify-between mt-1'>
- <p className='text-gray_r-12/70'>PPN 11%</p>
+ <p className='text-gray_r-12/70'>PPN {((PPN - 1) * 100).toFixed(0)}%</p>
<p>{currencyFormat(transaction.data?.amountTax)}</p>
</div>
<div className='flex justify-between mt-1'>
@@ -975,7 +975,7 @@ const Transaction = ({ id }) => {
{currencyFormat(transaction.data?.amountUntaxed)}
</div>
- <div className='text-right'>PPN 11%</div>
+ <div className='text-right'>PPN {((PPN - 1) * 100).toFixed(0)}%</div>
<div className='text-right font-medium'>
{currencyFormat(transaction.data?.amountTax)}
</div>