From e72c16eb549488e1ed847b022880f542d2a9c525 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Thu, 5 Oct 2023 09:32:12 +0700 Subject: add component list product for cart, quotation, and checkout --- src/lib/cart/components/Cart.jsx | 257 +-------------------- src/lib/checkout/components/Checkout.jsx | 8 +- .../product/components/Product/ProductDesktop.jsx | 4 +- src/lib/product/components/ProductCard.jsx | 6 +- src/lib/quotation/components/Quotation.jsx | 66 +----- 5 files changed, 16 insertions(+), 325 deletions(-) (limited to 'src/lib') diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index 5716d01b..c6aaa596 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -23,6 +23,8 @@ import { getPromotionProgram } from '@/lib/promotinProgram/api/homepageApi' import PromotionType from '@/lib/promotinProgram/components/PromotionType' import { gtagBeginCheckout } from '@/core/utils/googleTag' import { useProductCartContext } from '@/contexts/ProductCartContext' +import CardProdcuctsList from '@/core/components/elements/Product/cartProductsList' +// import cardProdcuctsList from '@/core/components/elements/Product/cartProductsList' const Cart = () => { const router = useRouter() @@ -530,260 +532,7 @@ const Cart = () => {

Keranjang

- - - - - - - - - - - - {isLoading && ( - - - - )} - {!isLoading && (!products || products?.length == 0) && ( - - - - )} - {products && - products?.map((product) => ( - <> - {product.hasProgram && ( - - - - )} - - - - - - - - - {product?.program?.items && ( - - {product.program.items.map((item) => ( - <> - - - - - - - - ))} - - )} - - ))} - -
Nama ProdukJumlahHargaSubtotalAction
-
- -
-
Keranjang belanja anda masih kosong
-
- {product.program ? ( - <> -
- - {product.program.type.label} - -
-
- {product.program.type.value == 'merchandise' ? ( - <>Selamat anda mendapatkan merchandise indoteknik.com - ) : ( - <> - Selamat! Pembelian anda lebih hemat - - {' '} - {currencyFormat(product.program?.totalSavings)} - - - )} -
- - ) : ( - <> -
- Promo -
-
- Pilih Promo Yang Tersedia Bisa lebih Hemat -
- - )} -
- handlePopUpPromo( - product.id, - product.quantity, - product.program?.id - ) - } - className='ml-auto text-red-500 flex gap-x-1 cursor-pointer' - > -
Cek Promo
-
- -
-
-
-
- - toggleSelected(product.id)} - checked={product?.selected} - className='accent-danger-500 w-4' - /> - - - - {product?.name} - -
- - {product?.parent?.name} - -
- {product?.code}{' '} - {product?.attributes.length > 0 - ? `| ${product?.attributes.join(', ')}` - : ''} -
-
-
- - updateQuantity(e.target.value, product?.id)} - onBlur={(e) => updateQuantity(e.target.value, product?.id, 'BLUR')} - /> - - - {product?.hasFlashsale ? ( - <> -
-
- {currencyFormat(product?.price?.price)} -
-
- {product?.price?.discountPercentage}% -
-
-
- {currencyFormat(product?.price?.priceDiscount)} -
- - ) : ( -
- {currencyFormat(product?.price?.price)} -
- )} -
- -
- {currencyFormat(product?.price?.priceDiscount * product?.quantity)} -
-
-
- -
-
- - - -
- {item.name} -
-
-
- - {product.program.type.label} - -
-
{item.name}
-
-
- - - - - {item?.price?.discountPercentage > 0 && ( -
-
- {currencyFormat(product?.price?.price)} -
-
- )} -
- {item?.price.priceDiscount > 0 ? 'Gratis' : ''} -
-
- -
- {item.price.priceDiscount > 0 ? 'Gratis' : ''} -
-
+
{
Detail Pesanan
- + + + + {/*
@@ -1148,7 +1152,7 @@ const Checkout = () => { )) )} -
Nama Produk
+ */}
diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 5e827089..4c8c3ae9 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -594,7 +594,7 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
{' '}
- + PPN:{' '} + Inc. PPN:{' '} {currencyFormat( variant.price.priceDiscount * process.env.NEXT_PUBLIC_PPN )} @@ -608,7 +608,7 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => { {currencyFormat(variant?.price?.price)}
{' '}
- + PPN:{' '} + Inc. PPN:{' '} {currencyFormat( variant?.price?.priceDiscount * process.env.NEXT_PUBLIC_PPN )} diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 16c63c00..6a5e29ab 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -113,8 +113,8 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { {product?.lowestPrice.price > 0 ? ( <> {currencyFormat(product?.lowestPrice.price)} -
- + PPN: {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN)} +
+ Inc. PPN: {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN )}
) : ( @@ -217,7 +217,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { <> {currencyFormat(product?.lowestPrice.price)}
- + PPN: {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN)} + Inc. PPN: {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN)}
) : ( diff --git a/src/lib/quotation/components/Quotation.jsx b/src/lib/quotation/components/Quotation.jsx index cee35457..8c379ead 100644 --- a/src/lib/quotation/components/Quotation.jsx +++ b/src/lib/quotation/components/Quotation.jsx @@ -16,6 +16,7 @@ import MobileView from '@/core/components/views/MobileView' import DesktopView from '@/core/components/views/DesktopView' import Image from '@/core/components/elements/Image/Image' import { useQuery } from 'react-query' +import CardProdcuctsList from '@/core/components/elements/Product/cartProductsList' const { checkoutApi } = require('@/lib/checkout/api/checkoutApi') const { getProductsCheckout } = require('@/lib/checkout/api/checkoutApi') @@ -174,70 +175,7 @@ const Quotation = () => {
Detail Barang
- - - - - - - - - - - {products?.map((product) => ( - - - - - - - ))} - -
Nama ProdukJumlahHargaSubtotal
-
- {product?.name} -
-
-
- {product?.parent?.name} -
-
- {product?.code}{' '} - {product?.attributes.length > 0 - ? `| ${product?.attributes.join(', ')}` - : ''} -
-
-
- - - {product?.price?.discountPercentage > 0 && ( -
-
- {currencyFormat(product?.price?.price)} -
-
- {product?.price?.discountPercentage}% -
-
- )} -
- {currencyFormat(product?.price?.priceDiscount)} -
-
-
- {currencyFormat(product?.price?.priceDiscount * product?.quantity)} -
-
+
-- cgit v1.2.3