From c653472382834bb5f900523e15befa7ce98faf11 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Mon, 18 Sep 2023 15:02:22 +0700 Subject: homepage service list --- src/lib/home/components/ServiceList.jsx | 105 ++++++++++++++++++++++++++++++++ src/pages/index.jsx | 5 ++ 2 files changed, 110 insertions(+) create mode 100644 src/lib/home/components/ServiceList.jsx (limited to 'src') diff --git a/src/lib/home/components/ServiceList.jsx b/src/lib/home/components/ServiceList.jsx new file mode 100644 index 00000000..56e7fc0d --- /dev/null +++ b/src/lib/home/components/ServiceList.jsx @@ -0,0 +1,105 @@ +import Image from 'next/image' +import Link from '@/core/components/elements/Link/Link' + +const ServiceList = () => { + return ( +
+
+
+ +
+ +
+
+

One Stop Solution

+

+ Temukan Solusi Lengkap Anda dalam Satu Tempat. +

+
+ +
+
+ +
+ +
+
+

Garansi Resmi

+

+ Garansi dan Kualitas produk yang terjamin ke aslianya. +

+
+ +
+
+ +
+ +
+
+

Pembayaran Tempo

+

+ Lebih mudah mengatur pembelian dengan pembayaran tempo. +

+
+ +
+
+ +
+ +
+
+

Faktur Pajak

+

+ Dapat Faktur pajak untuk setiap transaksi dengan indoteknik.com +

+
+ +
+
+
+ ) +} + +export default ServiceList diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 47a0a493..64f3ac10 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -31,6 +31,7 @@ const FlashSale = dynamic(() => import('@/lib/flashSale/components/FlashSale'), const BannerSection = dynamic(() => import('@/lib/home/components/BannerSection')) const CategoryHomeId = dynamic(() => import('@/lib/home/components/CategoryHomeId')) const CustomerReviews = dynamic(() => import('@/lib/review/components/CustomerReviews')) +const ServiceList = dynamic(() => import('@/lib/home/components/ServiceList')) export default function Home() { const bannerRef = useRef(null) @@ -72,6 +73,7 @@ export default function Home() {
+ @@ -87,6 +89,9 @@ export default function Home() {
+ + + -- cgit v1.2.3 From 46da815603ee8e53eeaa7480f62eaf6369681373 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 19 Sep 2023 09:21:13 +0700 Subject: add rounded --- src/lib/home/components/ServiceList.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/home/components/ServiceList.jsx b/src/lib/home/components/ServiceList.jsx index 56e7fc0d..8613a37c 100644 --- a/src/lib/home/components/ServiceList.jsx +++ b/src/lib/home/components/ServiceList.jsx @@ -8,7 +8,7 @@ const ServiceList = () => {
{
{
{
Date: Fri, 22 Sep 2023 10:35:48 +0700 Subject: fixing error cart --- src/lib/cart/components/Cartheader.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/cart/components/Cartheader.jsx b/src/lib/cart/components/Cartheader.jsx index dd6c276e..ab5dfdaa 100644 --- a/src/lib/cart/components/Cartheader.jsx +++ b/src/lib/cart/components/Cartheader.jsx @@ -158,14 +158,14 @@ const Cardheader = (cartCount) => {
))} - {products.length === 0 && !isLoading && ( + {auth && products.length === 0 && !isLoading && (

Tidak Ada Produk di Keranjang Belanja Anda

)} - {products.length > 0 && !isLoading && ( + {auth && products.length > 0 && !isLoading && ( <>
    {products && @@ -251,10 +251,10 @@ const Cardheader = (cartCount) => { )}
- {products.length > 0 && !isLoading && ( + {auth && products.length > 0 && !isLoading && ( <>
- Sub Total Sebelum PPN : + Subtotal Sebelum PPN : Rp. {currencyFormat(subTotal)}
-- cgit v1.2.3 From 8e4e981060b612f5d21f141d62656df80e2a0a4b Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Fri, 22 Sep 2023 11:31:14 +0700 Subject: bugs fix rp double --- src/lib/cart/components/Cartheader.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/cart/components/Cartheader.jsx b/src/lib/cart/components/Cartheader.jsx index ab5dfdaa..863b8a46 100644 --- a/src/lib/cart/components/Cartheader.jsx +++ b/src/lib/cart/components/Cartheader.jsx @@ -255,7 +255,7 @@ const Cardheader = (cartCount) => { <>
Subtotal Sebelum PPN : - Rp. {currencyFormat(subTotal)} + {currencyFormat(subTotal)}

+ {/* */}
{!auth && (
diff --git a/src/lib/product/components/Product/ProductDesktopVariant.jsx b/src/lib/product/components/Product/ProductDesktopVariant.jsx index 940ba46f..df294df5 100644 --- a/src/lib/product/components/Product/ProductDesktopVariant.jsx +++ b/src/lib/product/components/Product/ProductDesktopVariant.jsx @@ -17,6 +17,7 @@ import whatsappUrl from '@/core/utils/whatsappUrl' import useAuth from '@/core/hooks/useAuth' import odooApi from '@/core/api/odooApi' import { Button, Spinner } from 'flowbite-react' +import { useProductCartContext } from '@/contexts/ProductCartContext' const ProductDesktopVariant = ({ product, wishlist, toggleWishlist, isVariant }) => { const router = useRouter() @@ -28,6 +29,8 @@ const ProductDesktopVariant = ({ product, wishlist, toggleWishlist, isVariant }) const [addCartAlert, setAddCartAlert] = useState(false) const [isLoadingSLA, setIsLoadingSLA] = useState(true) + const {setRefreshCart} = useProductCartContext() + const getLowestPrice = useCallback(() => { const lowest = product.price /* const lowest = prices.reduce((lowest, price) => { @@ -72,6 +75,7 @@ const ProductDesktopVariant = ({ product, wishlist, toggleWishlist, isVariant }) selected: true, source: null }) + setRefreshCart(true) setAddCartAlert(true) } -- cgit v1.2.3 From 40f7958bc995fbe098598448097308180a359b8b Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Fri, 22 Sep 2023 16:47:25 +0700 Subject: update label service list garansi resmi --- src/lib/home/components/ServiceList.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/home/components/ServiceList.jsx b/src/lib/home/components/ServiceList.jsx index 8613a37c..b8799d7d 100644 --- a/src/lib/home/components/ServiceList.jsx +++ b/src/lib/home/components/ServiceList.jsx @@ -46,7 +46,7 @@ const ServiceList = () => {

Garansi Resmi

- Garansi dan Kualitas produk yang terjamin ke aslianya. + Garansi Keaslian Barang dan Jaminan Purna Jual.

-- cgit v1.2.3 From 48cd6983f253319940cb27b2fbbb14eb597253a6 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Mon, 25 Sep 2023 09:21:33 +0700 Subject: add update cart di page variant product --- src/lib/cart/components/Cartheader.jsx | 3 +-- src/lib/product/components/Product/ProductDesktopVariant.jsx | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/cart/components/Cartheader.jsx b/src/lib/cart/components/Cartheader.jsx index 085b9408..d330ccb6 100644 --- a/src/lib/cart/components/Cartheader.jsx +++ b/src/lib/cart/components/Cartheader.jsx @@ -49,7 +49,7 @@ const Cardheader = (cartCount) => { setProductCart(cart) setCountCart(cart.productTotal) setIsloading(false) - }, [setProductCart]) + }, [setProductCart, setIsloading]) useEffect(() => { if (!products) return @@ -74,7 +74,6 @@ const Cardheader = (cartCount) => { useEffect(() => { if (refreshCart) { refreshCartf() - console.log('ini masuk') } setRefreshCart(false) }, [refreshCart, refreshCartf, setRefreshCart]) diff --git a/src/lib/product/components/Product/ProductDesktopVariant.jsx b/src/lib/product/components/Product/ProductDesktopVariant.jsx index df294df5..3ed68ba3 100644 --- a/src/lib/product/components/Product/ProductDesktopVariant.jsx +++ b/src/lib/product/components/Product/ProductDesktopVariant.jsx @@ -29,7 +29,7 @@ const ProductDesktopVariant = ({ product, wishlist, toggleWishlist, isVariant }) const [addCartAlert, setAddCartAlert] = useState(false) const [isLoadingSLA, setIsLoadingSLA] = useState(true) - const {setRefreshCart} = useProductCartContext() + const { setRefreshCart } = useProductCartContext() const getLowestPrice = useCallback(() => { const lowest = product.price @@ -74,8 +74,9 @@ const ProductDesktopVariant = ({ product, wishlist, toggleWishlist, isVariant }) programLineId: null, selected: true, source: null + }).then(() => { + setRefreshCart(true) }) - setRefreshCart(true) setAddCartAlert(true) } -- cgit v1.2.3 From 4d329fbe4ecadd7864809f340d9e4f46d910e418 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Mon, 25 Sep 2023 09:28:23 +0700 Subject: delete coponent summary product --- src/lib/cart/components/Cartheader.jsx | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/lib/cart/components/Cartheader.jsx b/src/lib/cart/components/Cartheader.jsx index d330ccb6..cbe7c7e1 100644 --- a/src/lib/cart/components/Cartheader.jsx +++ b/src/lib/cart/components/Cartheader.jsx @@ -8,7 +8,6 @@ import { useRouter } from 'next/router' import odooApi from '@/core/api/odooApi' import { useProductCartContext } from '@/contexts/ProductCartContext' import whatsappUrl from '@/core/utils/whatsappUrl' -import SummaryProduct from '@/core/components/elements/Product/SummaryProduct' const { ShoppingCartIcon, PhotoIcon } = require('@heroicons/react/24/outline') const { default: Link } = require('next/link') @@ -132,7 +131,6 @@ const Cardheader = (cartCount) => {

- {/* */}
{!auth && (
-- cgit v1.2.3 From 58bd0bad3ba10720b59fd3de11e34483365289d5 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 25 Sep 2023 13:14:25 +0700 Subject: Add opacity and eager loading on image --- src/core/components/elements/Image/Image.jsx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/core/components/elements/Image/Image.jsx b/src/core/components/elements/Image/Image.jsx index ba6bf50d..1562444c 100644 --- a/src/core/components/elements/Image/Image.jsx +++ b/src/core/components/elements/Image/Image.jsx @@ -15,8 +15,10 @@ const Image = ({ ...props }) => ( {...props} src={props.src || '/images/noimage.jpeg'} placeholderSrc='/images/indoteknik-placeholder.png' + effect='opacity' alt={props.src ? props.alt : 'Image Not Found - Indoteknik'} wrapperClassName='bg-white' + loading='eager' /> ) -- cgit v1.2.3 From 065a0e341cc42443fe5e2380e078983b3c66f111 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Mon, 25 Sep 2023 16:48:25 +0700 Subject: migrasi get brand di homepage dan page all brand ke solr --- src/lib/brand/components/Brands.jsx | 18 +++++++++--- src/lib/home/components/PreferredBrand.jsx | 7 +++-- src/lib/home/hooks/usePreferredBrand.js | 13 ++++++++- src/pages/api/shop/brands.js | 44 ++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 7 deletions(-) create mode 100644 src/pages/api/shop/brands.js (limited to 'src') diff --git a/src/lib/brand/components/Brands.jsx b/src/lib/brand/components/Brands.jsx index c7483e40..ccdd134d 100644 --- a/src/lib/brand/components/Brands.jsx +++ b/src/lib/brand/components/Brands.jsx @@ -2,6 +2,7 @@ import odooApi from '@/core/api/odooApi' import { useCallback, useEffect, useState } from 'react' import BrandCard from './BrandCard' import LogoSpinner from '@/core/components/elements/Spinner/LogoSpinner' +import axios from 'axios' const Brands = () => { const alpha = Array.from(Array(26)).map((e, i) => i + 65) @@ -13,13 +14,22 @@ const Brands = () => { const loadBrand = useCallback(async () => { setIsLoading(true) - const name = startWith ? `${startWith}%` : '' - const result = await odooApi( + const name = startWith ? `${startWith}*` : '' + //Get brand from odoo + /*const result = await odooApi( 'GET', `/api/v1/manufacture?limit=0&offset=${manufactures.length}&name=${name}` - ) + )*/ + + // Change get brands from solr + let result = null + if (name) { + result = await axios(`${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/brands?params=${name}`) + } else { + result = await axios(`${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/brands`) + } setIsLoading(false) - setManufactures((manufactures) => [...manufactures, ...result.manufactures]) + setManufactures((manufactures) => [...manufactures, ...result.data]) }, [startWith]) const toggleStartWith = (alphabet) => { diff --git a/src/lib/home/components/PreferredBrand.jsx b/src/lib/home/components/PreferredBrand.jsx index 55abe0b7..0b80bcf1 100644 --- a/src/lib/home/components/PreferredBrand.jsx +++ b/src/lib/home/components/PreferredBrand.jsx @@ -6,7 +6,10 @@ import useDevice from '@/core/hooks/useDevice' import Link from '@/core/components/elements/Link/Link' const PreferredBrand = () => { - const { preferredBrands } = usePreferredBrand() + let query = 'level_s' + let params = 'prioritas' + const { preferredBrands } = usePreferredBrand(query, params) + console.log('ini brands level', preferredBrands?.data?.data) const { isMobile, isDesktop } = useDevice() return ( @@ -22,7 +25,7 @@ const PreferredBrand = () => { {preferredBrands.isLoading && } {!preferredBrands.isLoading && ( - {preferredBrands.data?.manufactures.map((brand) => ( + {preferredBrands.data?.data.map((brand) => ( diff --git a/src/lib/home/hooks/usePreferredBrand.js b/src/lib/home/hooks/usePreferredBrand.js index e56d361f..d2f2bcf1 100644 --- a/src/lib/home/hooks/usePreferredBrand.js +++ b/src/lib/home/hooks/usePreferredBrand.js @@ -1,3 +1,4 @@ +import axios from 'axios' import preferredBrandApi from '../api/preferredBrandApi' import { useQuery } from 'react-query' @@ -10,4 +11,14 @@ const usePreferredBrand = () => { } } -export default usePreferredBrand +const GetBrands = (query, params) => { + const fetchingbrand = async () => + await axios(`${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/brands?params=` + query) + + const { data, isLoading } = useQuery('preferredBrand', fetchingbrand) + return { + preferredBrands: { data, isLoading } + } +} + +export default GetBrands diff --git a/src/pages/api/shop/brands.js b/src/pages/api/shop/brands.js new file mode 100644 index 00000000..e4619d15 --- /dev/null +++ b/src/pages/api/shop/brands.js @@ -0,0 +1,44 @@ +import axios from 'axios' + +export default async function handler(req, res) { + try { + let params = '*:*' + let sort = 'sort=if(exists(sequence_i),0,1) asc,sequence_i asc' + let rows = 2000 + + if (req.query.params) { + rows = 100 + switch (req?.query?.params) { + case 'level_s': + params = 'level_s:prioritas' + break + default: + params = `name_s:${req.query.params}` + } + } + let brands = await axios( + process.env.SOLR_HOST + + `/solr/brands/select?q=${params}&q.op=OR&indent=true&rows=${rows}&${sort}` + ) + + let dataBrands = responseMap(brands.data.response.docs) + + res.status(200).json(dataBrands) + } catch (error) { + console.error('Error fetching data from Solr:', error) + res.status(500).json({ error: 'Internal Server Error' }) + } +} + +const responseMap = (brands) => { + return brands.map((brand) => { + let brandMapping = { + id: brand.id, + name: brand.display_name_s, + logo: brand.image_s || '', + sequance: brand.sequence_i || '' + } + + return brandMapping + }) +} -- cgit v1.2.3 From 5b281f755af9277b75a199195d693cf49dc49d29 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Mon, 25 Sep 2023 17:09:09 +0700 Subject: asc by image --- src/lib/brand/components/Brands.jsx | 1 - src/pages/api/shop/brands.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/brand/components/Brands.jsx b/src/lib/brand/components/Brands.jsx index ccdd134d..c94e47c2 100644 --- a/src/lib/brand/components/Brands.jsx +++ b/src/lib/brand/components/Brands.jsx @@ -1,4 +1,3 @@ -import odooApi from '@/core/api/odooApi' import { useCallback, useEffect, useState } from 'react' import BrandCard from './BrandCard' import LogoSpinner from '@/core/components/elements/Spinner/LogoSpinner' diff --git a/src/pages/api/shop/brands.js b/src/pages/api/shop/brands.js index e4619d15..e93fe2c9 100644 --- a/src/pages/api/shop/brands.js +++ b/src/pages/api/shop/brands.js @@ -3,7 +3,7 @@ import axios from 'axios' export default async function handler(req, res) { try { let params = '*:*' - let sort = 'sort=if(exists(sequence_i),0,1) asc,sequence_i asc' + let sort = 'sort=if(exists(sequence_i),0,1) asc,sequence_i asc, if(exists(image_s),0,1) asc ' let rows = 2000 if (req.query.params) { -- cgit v1.2.3 From 2471cde6bdfbcc3bbc76f26656fdc79bd1f6bdb1 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 26 Sep 2023 09:33:01 +0700 Subject: Update Image component with next image --- src/core/components/elements/Image/Image.jsx | 45 ++++++++++++++++++---------- src/lib/product/components/ProductSlider.jsx | 3 +- 2 files changed, 31 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/core/components/elements/Image/Image.jsx b/src/core/components/elements/Image/Image.jsx index 1562444c..be275e8d 100644 --- a/src/core/components/elements/Image/Image.jsx +++ b/src/core/components/elements/Image/Image.jsx @@ -1,5 +1,6 @@ -import { LazyLoadImage } from 'react-lazy-load-image-component' -import 'react-lazy-load-image-component/src/effects/opacity.css' +import NextImage from 'next/image' +import { useState } from 'react' +import classNames from 'classnames' /** * The `Image` component is used to display lazy-loaded images. @@ -9,20 +10,32 @@ import 'react-lazy-load-image-component/src/effects/opacity.css' * @param {string} props.alt - Alternative text to be displayed if the image is not found. * @returns {JSX.Element} - Rendered `Image` component. */ -const Image = ({ ...props }) => ( - <> - - -) +const Image = ({ ...props }) => { + const [isLoading, setIsLoading] = useState(true) -Image.defaultProps = LazyLoadImage.defaultProps + const imageClassNames = classNames( + 'duration-500 ease-in-out', + { + 'blur-2xl grayscale': isLoading, + 'blur-0 grayscale-0': !isLoading + }, + props.className + ) + + return ( + <> + setIsLoading(false)} + /> + + ) +} export default Image diff --git a/src/lib/product/components/ProductSlider.jsx b/src/lib/product/components/ProductSlider.jsx index dedbd6ab..2f8101b0 100644 --- a/src/lib/product/components/ProductSlider.jsx +++ b/src/lib/product/components/ProductSlider.jsx @@ -10,7 +10,7 @@ import MobileView from '@/core/components/views/MobileView' import DesktopView from '@/core/components/views/DesktopView' const bannerClassName = - 'absolute rounded-r top-0 left-0 h-full w-auto md:w-[20%] idt-transition border border-gray_r-6' + 'absolute rounded-r top-0 left-0 h-full w-auto md:w-[20%] border border-gray_r-6' const ProductSlider = ({ products, simpleTitle = false, bannerMode = false }) => { const bannerRef = useRef('') @@ -52,6 +52,7 @@ const ProductSlider = ({ products, simpleTitle = false, bannerMode = false }) => {bannerMode && (
{products.banner.name} Date: Tue, 26 Sep 2023 10:11:13 +0700 Subject: brand solr dan sort by image --- src/lib/brand/components/Brands.jsx | 10 +++------- src/lib/home/components/PreferredBrand.jsx | 3 +-- src/lib/home/hooks/usePreferredBrand.js | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/lib/brand/components/Brands.jsx b/src/lib/brand/components/Brands.jsx index c94e47c2..f6cb4fbf 100644 --- a/src/lib/brand/components/Brands.jsx +++ b/src/lib/brand/components/Brands.jsx @@ -21,14 +21,10 @@ const Brands = () => { )*/ // Change get brands from solr - let result = null - if (name) { - result = await axios(`${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/brands?params=${name}`) - } else { - result = await axios(`${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/brands`) - } + const result = await axios(`${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/brands?params=${name}`) + setIsLoading(false) - setManufactures((manufactures) => [...manufactures, ...result.data]) + setManufactures((manufactures) => [...result.data]) }, [startWith]) const toggleStartWith = (alphabet) => { diff --git a/src/lib/home/components/PreferredBrand.jsx b/src/lib/home/components/PreferredBrand.jsx index 0b80bcf1..571c4745 100644 --- a/src/lib/home/components/PreferredBrand.jsx +++ b/src/lib/home/components/PreferredBrand.jsx @@ -8,8 +8,7 @@ import Link from '@/core/components/elements/Link/Link' const PreferredBrand = () => { let query = 'level_s' let params = 'prioritas' - const { preferredBrands } = usePreferredBrand(query, params) - console.log('ini brands level', preferredBrands?.data?.data) + const { preferredBrands } = usePreferredBrand(query) const { isMobile, isDesktop } = useDevice() return ( diff --git a/src/lib/home/hooks/usePreferredBrand.js b/src/lib/home/hooks/usePreferredBrand.js index d2f2bcf1..b7d707e6 100644 --- a/src/lib/home/hooks/usePreferredBrand.js +++ b/src/lib/home/hooks/usePreferredBrand.js @@ -11,7 +11,7 @@ const usePreferredBrand = () => { } } -const GetBrands = (query, params) => { +const GetBrands = (query) => { const fetchingbrand = async () => await axios(`${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/brands?params=` + query) -- cgit v1.2.3 From 8402f53f80fe34dc926b9eebaab143884294cdb0 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 26 Sep 2023 10:10:35 +0700 Subject: Revert Image with Next Image to React Lazy Load --- src/core/components/elements/Image/Image.jsx | 37 +++++++++------------------- src/lib/product/components/ProductSlider.jsx | 1 - 2 files changed, 11 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/core/components/elements/Image/Image.jsx b/src/core/components/elements/Image/Image.jsx index be275e8d..d7b19821 100644 --- a/src/core/components/elements/Image/Image.jsx +++ b/src/core/components/elements/Image/Image.jsx @@ -1,6 +1,5 @@ -import NextImage from 'next/image' -import { useState } from 'react' -import classNames from 'classnames' +import { LazyLoadImage } from 'react-lazy-load-image-component' +import 'react-lazy-load-image-component/src/effects/opacity.css' /** * The `Image` component is used to display lazy-loaded images. @@ -11,30 +10,16 @@ import classNames from 'classnames' * @returns {JSX.Element} - Rendered `Image` component. */ const Image = ({ ...props }) => { - const [isLoading, setIsLoading] = useState(true) - - const imageClassNames = classNames( - 'duration-500 ease-in-out', - { - 'blur-2xl grayscale': isLoading, - 'blur-0 grayscale-0': !isLoading - }, - props.className - ) - return ( - <> - setIsLoading(false)} - /> - + ) } diff --git a/src/lib/product/components/ProductSlider.jsx b/src/lib/product/components/ProductSlider.jsx index 2f8101b0..54f209cc 100644 --- a/src/lib/product/components/ProductSlider.jsx +++ b/src/lib/product/components/ProductSlider.jsx @@ -52,7 +52,6 @@ const ProductSlider = ({ products, simpleTitle = false, bannerMode = false }) => {bannerMode && (
{products.banner.name} Date: Wed, 27 Sep 2023 10:23:50 +0700 Subject: Update globals css and app js --- src/pages/_app.jsx | 33 ++++++++++----------------------- src/styles/globals.css | 2 -- 2 files changed, 10 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index 0062f7fc..d5b59486 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -1,15 +1,16 @@ import '../styles/globals.css' import 'react-loading-skeleton/dist/skeleton.css' +import '@fontsource/inter' + import NextProgress from 'next-progress' import { useRouter, Router } from 'next/router' import { AnimatePresence, motion } from 'framer-motion' import { Toaster } from 'react-hot-toast' import { QueryClient, QueryClientProvider } from 'react-query' import useDevice from '@/core/hooks/useDevice' -import { createContext, useContext, useEffect, useState } from 'react' +import { createContext, useEffect, useState } from 'react' import LogoSpinner from '@/core/components/elements/Spinner/LogoSpinner' import { SessionProvider } from 'next-auth/react' -import { getAuth } from '@/core/utils/auth' import { ProductProvider } from '@/contexts/ProductContext' import { ProductCartProvider } from '@/contexts/ProductCartContext' @@ -25,12 +26,6 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }) { const { isMobile } = useDevice() const [animateLoader, setAnimateLoader] = useState(false) - const [authenticated, setAuthenticated] = useState(null) - const auth = getAuth() - - // useEffect(() => { - // setAuthenticated(auth) - // }, [auth]) useEffect(() => { const handleRouteChangeStart = () => setAnimateLoader(true) @@ -63,14 +58,13 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }) { }, [isMobile]) return ( - // {animateLoader && ( - window.scrollTo(0, 0)} - > - - - {!animateLoader && } - - - + + + + + - // ) } diff --git a/src/styles/globals.css b/src/styles/globals.css index 06ae7ca2..58afd5d8 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -1,5 +1,3 @@ -@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap'); - @tailwind base; @tailwind components; @tailwind utilities; -- cgit v1.2.3 From 616e9292cd1db6bbc0cd28208e5403dd667152b9 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 27 Sep 2023 14:05:15 +0700 Subject: Update with chakra UI theme --- src/lib/checkout/components/CheckoutOld.jsx | 1 - src/lib/product/components/Product/ColumnsSLA.jsx | 89 ++++------- .../product/components/Product/ProductDesktop.jsx | 98 +++++------- .../components/Product/ProductDesktopVariant.jsx | 88 ++++------- .../product/components/Product/ProductMobile.jsx | 1 - .../components/Product/ProductMobileVariant.jsx | 11 +- .../product/components/ProductFilterDesktop.jsx | 165 ++++++++++++--------- src/lib/product/components/ProductSearch.jsx | 8 +- src/pages/_app.jsx | 14 +- src/styles/globals.css | 2 + 10 files changed, 207 insertions(+), 270 deletions(-) (limited to 'src') diff --git a/src/lib/checkout/components/CheckoutOld.jsx b/src/lib/checkout/components/CheckoutOld.jsx index 088b641b..6852059e 100644 --- a/src/lib/checkout/components/CheckoutOld.jsx +++ b/src/lib/checkout/components/CheckoutOld.jsx @@ -22,7 +22,6 @@ import DesktopView from '@/core/components/views/DesktopView' import ExpedisiList from '../api/ExpedisiList' import whatsappUrl from '@/core/utils/whatsappUrl' import { createSlug } from '@/core/utils/slug' -import { Button, Modal } from 'flowbite-react' import BottomPopup from '@/core/components/elements/Popup/BottomPopup' const SELF_PICKUP_ID = 32 diff --git a/src/lib/product/components/Product/ColumnsSLA.jsx b/src/lib/product/components/Product/ColumnsSLA.jsx index 33da703a..e5296f96 100644 --- a/src/lib/product/components/Product/ColumnsSLA.jsx +++ b/src/lib/product/components/Product/ColumnsSLA.jsx @@ -1,8 +1,9 @@ import odooApi from '@/core/api/odooApi' import { createSlug } from '@/core/utils/slug' import whatsappUrl from '@/core/utils/whatsappUrl' -import { Button, Spinner } from 'flowbite-react' -import { memo, useEffect, useState } from 'react' +import { Box, Skeleton, Tooltip } from '@chakra-ui/react' +import { Info } from 'lucide-react' +import { memo } from 'react' import { useQuery } from 'react-query' const ColumnSLA = ({ variant, product }) => { @@ -12,67 +13,35 @@ const ColumnSLA = ({ variant, product }) => { return ( <> - {dataSLA.isFetching ? ( -
- -
- ) : dataSLA?.data?.qty > 0 ? ( - dataSLA?.data?.qty - ) : ( - - Tanya Admin - - )} + + {dataSLA?.data?.qty > 0 ? ( + dataSLA?.data?.qty + ) : ( + + Tanya Admin + + )} + + - {dataSLA.isFetching ? ( - - ) : dataSLA?.data?.slaDate != '-' ? ( - - ) : ( - '-' - )} + + + + ) diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 6da289bc..5cc35df7 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -15,7 +15,6 @@ import ProductCard from '../ProductCard' import productSimilarApi from '../../api/productSimilarApi' import whatsappUrl from '@/core/utils/whatsappUrl' import odooApi from '@/core/api/odooApi' -import { Button, Spinner } from 'flowbite-react' import PromotionType from '@/lib/promotinProgram/components/PromotionType' import useAuth from '@/core/hooks/useAuth' import ImageNext from 'next/image' @@ -23,6 +22,8 @@ import CountDown2 from '@/core/components/elements/CountDown/CountDown2' import { LazyLoadComponent } from 'react-lazy-load-image-component' import ColumnsSLA from './ColumnsSLA' import { useProductCartContext } from '@/contexts/ProductCartContext' +import { Box, Skeleton, Tooltip } from '@chakra-ui/react' +import { Info } from 'lucide-react' const ProductDesktop = ({ products, wishlist, toggleWishlist }) => { const router = useRouter() @@ -40,7 +41,7 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => { const [selectVariantPromoActive, setSelectVariantPromoActive] = useState(null) const [backgorundFlashSale, setBackgorundFlashSale] = useState(null) - const {setRefreshCart , refreshCart} = useProductCartContext() + const { setRefreshCart, refreshCart } = useProductCartContext() const getLowestPrice = useCallback(() => { const prices = product.variants.map((variant) => variant.price) @@ -256,16 +257,16 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {

{product?.name}

-
Nomor SKU
-
SKU-{product.id}
+
Nomor SKU
+
SKU-{product.id}
-
Part Number
-
{product.code || '-'}
+
Part Number
+
{product.code || '-'}
-
Manufacture
-
+
Manufacture
+
{product.manufacture?.name ? ( {
-
Persiapan Barang
-
- {product.variants.length > 1 ? ( +
Persiapan Barang
+
+ {product.variants.length > 1 && ( - ) : product.variants[0].sla ? ( - product.variants[0].sla?.slaDate != '-' ? ( - - ) : ( - '-' - ) - ) : ( - + + {product.variants[0]?.sla?.slaDate} + + + + )} + )}
+ {product.variants.length === 1 && (
-
Stock
-
- {isLoadingSLA && ( -
- -
- )} +
Stock
+
+ {!product.variants[0]?.sla && } {product?.variants[0].sla?.qty > 0 && ( {product?.variants[0].sla?.qty} )} @@ -366,9 +337,10 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
)} +
1 ? '' : 'bg-gray_r-4'} `}> -
Berat Barang
-
+
Berat Barang
+
{product?.weight > 0 && {product?.weight} KG} {product?.weight == 0 && ( { const router = useRouter() @@ -149,16 +150,16 @@ const ProductDesktopVariant = ({ product, wishlist, toggleWishlist, isVariant })

{product?.name}

-
Nomor SKU
-
SKU-{product.id}
+
Nomor SKU
+
SKU-{product.id}
-
Part Number
-
{product.code || '-'}
+
Part Number
+
{product.code || '-'}
-
Manufacture
-
+
Manufacture
+
{product.manufacture?.name ? (
+
-
Persiapan Barang
-
- {product.sla ? ( - product.sla?.slaDate != '-' ? ( - - ) : ( - '-' - ) - ) : ( - +
Persiapan Barang
+
+ {!product?.sla && } + {product?.sla && ( + + + {product?.sla?.slaDate} + + + )}
+
-
Stock
-
- {isLoadingSLA && ( -
- -
- )} +
Stock
+
-
Berat Barang
-
+
Berat Barang
+
- ): ( + ) : ( '-' )} diff --git a/src/lib/product/components/ProductFilterDesktop.jsx b/src/lib/product/components/ProductFilterDesktop.jsx index ce6c12ed..b64349c7 100644 --- a/src/lib/product/components/ProductFilterDesktop.jsx +++ b/src/lib/product/components/ProductFilterDesktop.jsx @@ -2,7 +2,21 @@ import { useRouter } from 'next/router' import { useState } from 'react' import _ from 'lodash' import { toQuery } from 'lodash-contrib' -import { Accordion, Checkbox, Label, TextInput } from 'flowbite-react' +import { + Accordion, + AccordionButton, + AccordionIcon, + AccordionItem, + AccordionPanel, + Box, + Button, + Checkbox, + Input, + InputGroup, + InputLeftAddon, + Stack, + VStack +} from '@chakra-ui/react' const ProductFilterDesktop = ({ brands, categories, prefixUrl, defaultBrand = null }) => { const router = useRouter() @@ -13,7 +27,7 @@ const ProductFilterDesktop = ({ brands, categories, prefixUrl, defaultBrand = nu const [priceFrom, setPriceFrom] = useState(query?.priceFrom) const [priceTo, setPriceTo] = useState(query?.priceTo) - const handleCategorysChange = (event) => { + const handleCategoriesChange = (event) => { const value = event.target.value const isChecked = event.target.checked if (isChecked) { @@ -48,80 +62,95 @@ const ProductFilterDesktop = ({ brands, categories, prefixUrl, defaultBrand = nu return ( <> - - - Kategori - -
+ + + + + Brand + + + + + + + {brands.map((brand, index) => ( +
+ + {brand} + +
+ ))} +
+
+
+ + + + + Kategori + + + + + + {categories.map((category, index) => (
- +
))} -
-
-
- - {!defaultBrand && ( - <> - Brand - -
- {brands.map((brand, index) => ( -
- - -
- ))} -
-
- - )} -
- - Harga - -
- setPriceFrom(e.target.value)} - /> -
-
- setPriceTo(e.target.value)} - /> -
-
-
+ + + + + + + + Harga + + + + + + + + Rp + setPriceFrom(e.target.value)} + /> + + + Rp + setPriceTo(e.target.value)} + /> + + + +
-
- -
+ + ) } diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index ae9618d2..df9aa91b 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -39,9 +39,11 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => { const oddIndexSuggestions = response.data.spellcheck.suggestions.filter( (_, index) => index % 2 === 1 ) + const oddIndexCollations = response.data.spellcheck.collations.filter( (_, index) => index % 2 === 1 ) + const dataSpellings = oddIndexSuggestions.reduce((acc, curr) => { oddIndexCollations.forEach((collation) => { acc.push(collation.collationQuery) @@ -52,7 +54,9 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => { return acc }, []) - setQ(dataSpellings[0]) + if (dataSpellings.length > 0) { + setQ(dataSpellings[0]) + } setSpellings(dataSpellings) }) @@ -183,7 +187,7 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => { defaultBrand={defaultBrand} />
-
+

Hasil Pencarian

diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index d5b59486..afebc293 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -1,6 +1,5 @@ import '../styles/globals.css' import 'react-loading-skeleton/dist/skeleton.css' -import '@fontsource/inter' import NextProgress from 'next-progress' import { useRouter, Router } from 'next/router' @@ -8,19 +7,16 @@ import { AnimatePresence, motion } from 'framer-motion' import { Toaster } from 'react-hot-toast' import { QueryClient, QueryClientProvider } from 'react-query' import useDevice from '@/core/hooks/useDevice' -import { createContext, useEffect, useState } from 'react' +import { useEffect, useState } from 'react' import LogoSpinner from '@/core/components/elements/Spinner/LogoSpinner' import { SessionProvider } from 'next-auth/react' import { ProductProvider } from '@/contexts/ProductContext' import { ProductCartProvider } from '@/contexts/ProductCartContext' +import { ChakraProvider } from '@chakra-ui/react' +import theme from '../../chakra.theme' const queryClient = new QueryClient() -export const AuthContext = createContext({ - authenticated: false, - setAuthenticated: (auth) => {} -}) - function MyApp({ Component, pageProps: { session, ...pageProps } }) { const router = useRouter() const { isMobile } = useDevice() @@ -86,7 +82,9 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }) { - + + + diff --git a/src/styles/globals.css b/src/styles/globals.css index 58afd5d8..06ae7ca2 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -1,3 +1,5 @@ +@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap'); + @tailwind base; @tailwind components; @tailwind utilities; -- cgit v1.2.3 From 607b943dae3cacffcd76a6763fddc3c218792d74 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 29 Sep 2023 15:35:44 +0700 Subject: Add except for non publish product solr --- .../elements/Skeleton/ProductCardSkeleton.jsx | 68 ++++++++++++++-------- .../components/Skeleton/PopularProductSkeleton.jsx | 3 +- src/pages/api/shop/search.js | 3 +- 3 files changed, 48 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/core/components/elements/Skeleton/ProductCardSkeleton.jsx b/src/core/components/elements/Skeleton/ProductCardSkeleton.jsx index 84d1c0d1..e46511f8 100644 --- a/src/core/components/elements/Skeleton/ProductCardSkeleton.jsx +++ b/src/core/components/elements/Skeleton/ProductCardSkeleton.jsx @@ -1,26 +1,46 @@ -const ProductCardSkeleton = () => ( -
-
- -
-
-
-
-
-
- Loading... -
-) +import { Box, HStack, Skeleton, SkeletonText, VStack, useBreakpointValue } from '@chakra-ui/react' + +const ProductCardSkeleton = () => { + const wrapperHeight = useBreakpointValue({ base: '300px', md: '350px' }) + return ( + + + + + + + + + + + + + + + + + + Loading... + + ) +} + +const skeletonColors = { + startColor: 'gray.100', + endColor: 'gray.300' +} export default ProductCardSkeleton diff --git a/src/lib/home/components/Skeleton/PopularProductSkeleton.jsx b/src/lib/home/components/Skeleton/PopularProductSkeleton.jsx index 29fda966..754bdd57 100644 --- a/src/lib/home/components/Skeleton/PopularProductSkeleton.jsx +++ b/src/lib/home/components/Skeleton/PopularProductSkeleton.jsx @@ -11,7 +11,8 @@ const PopularProductSkeleton = () => (
-
+
+ diff --git a/src/pages/api/shop/search.js b/src/pages/api/shop/search.js index d465d94b..54c89716 100644 --- a/src/pages/api/shop/search.js +++ b/src/pages/api/shop/search.js @@ -49,7 +49,8 @@ export default async function handler(req, res) { 'qf=name_s', `start=${offset}`, `rows=${limit}`, - `sort=${paramOrderBy}` + `sort=${paramOrderBy}`, + `facet.query=-publish_b:false` ] if (priceFrom > 0 || priceTo > 0) { -- cgit v1.2.3 From c88f012e3e53845fcaf9833ba800c1ff4ff30c62 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 29 Sep 2023 15:45:46 +0700 Subject: Update product card skeleton color --- src/core/components/elements/Skeleton/ProductCardSkeleton.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/components/elements/Skeleton/ProductCardSkeleton.jsx b/src/core/components/elements/Skeleton/ProductCardSkeleton.jsx index e46511f8..1e0ca6a3 100644 --- a/src/core/components/elements/Skeleton/ProductCardSkeleton.jsx +++ b/src/core/components/elements/Skeleton/ProductCardSkeleton.jsx @@ -39,8 +39,8 @@ const ProductCardSkeleton = () => { } const skeletonColors = { - startColor: 'gray.100', - endColor: 'gray.300' + startColor: 'gray.200', + endColor: 'gray.400' } export default ProductCardSkeleton -- cgit v1.2.3 From 435912559bf2d251b5c29d09d275445638fe1c32 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 2 Oct 2023 09:11:05 +0700 Subject: Add except query for not publish product solr --- src/pages/api/shop/search.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/pages/api/shop/search.js b/src/pages/api/shop/search.js index 54c89716..57b16db8 100644 --- a/src/pages/api/shop/search.js +++ b/src/pages/api/shop/search.js @@ -50,7 +50,7 @@ export default async function handler(req, res) { `start=${offset}`, `rows=${limit}`, `sort=${paramOrderBy}`, - `facet.query=-publish_b:false` + `fq=-publish_b:false` ] if (priceFrom > 0 || priceTo > 0) { -- cgit v1.2.3 From bdfaa0b8564e89d72ffd2de93eb088e8cf0db31e Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Mon, 2 Oct 2023 17:07:20 +0700 Subject: mapping new pricelist --- src/lib/product/components/ProductCard.jsx | 43 +++++++++++++++++++++--------- src/pages/api/shop/search.js | 14 +++++----- 2 files changed, 38 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 10ffdaec..83b26449 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -89,23 +89,40 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { > {product?.name} - {product?.lowestPrice.discountPercentage > 0 && ( -
-
- {currencyFormat(product.lowestPrice.price)} + {product?.flashSale?.id > 0 ? ( + <> + {product?.lowestPrice.discountPercentage > 0 && ( +
+
+ {currencyFormat(product.lowestPrice.price)} +
+
{product?.lowestPrice.discountPercentage}%
+
+ )} + +
-
{product?.lowestPrice.discountPercentage}%
+ + ) : ( +
)} -
- {product?.lowestPrice.priceDiscount > 0 ? ( - currencyFormat(product?.lowestPrice.priceDiscount) - ) : ( - Call for price - )} -
- {product?.stockTotal > 0 && (
Ready Stock
diff --git a/src/pages/api/shop/search.js b/src/pages/api/shop/search.js index 57b16db8..79083ee7 100644 --- a/src/pages/api/shop/search.js +++ b/src/pages/api/shop/search.js @@ -104,17 +104,19 @@ const escapeSolrQuery = (query) => { const productResponseMap = (products, pricelist) => { return products.map((product) => { - let price = product.price_f || 0 + let price = price_tier1_v2_f || 0 let priceDiscount = product.price_discount_f || 0 let discountPercentage = product.discount_f || 0 if (pricelist) { - const pricelistDiscount = product?.[`price_${pricelist}_f`] || false - const pricelistDiscountPerc = product?.[`discount_${pricelist}_f`] || false + // const pricelistDiscount = product?.[`price_${pricelist}_f`] || false + // const pricelistDiscountPerc = product?.[`discount_${pricelist}_f`] || false - if (pricelistDiscount && pricelistDiscount > 0) priceDiscount = pricelistDiscount - if (pricelistDiscountPerc && pricelistDiscountPerc > 0) - discountPercentage = pricelistDiscountPerc + // if (pricelistDiscount && pricelistDiscount > 0) priceDiscount = pricelistDiscount + // if (pricelistDiscountPerc && pricelistDiscountPerc > 0) + // discountPercentage = pricelistDiscountPerc + + price = product?.[`price_${pricelist}_v2_f`] || 0 } if (product?.flashsale_id_i > 0) { -- cgit v1.2.3 From 787d3aaa3187d3432c8e6b743b555ea3e4a4980c Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 3 Oct 2023 15:25:14 +0700 Subject: new pricelist di page product cart, product detail & product variant --- .../product/components/Product/ProductDesktop.jsx | 74 +++++++++++++++------- .../components/Product/ProductDesktopVariant.jsx | 71 ++++++++++++--------- .../product/components/Product/ProductMobile.jsx | 69 ++++++++++++-------- .../components/Product/ProductMobileVariant.jsx | 73 +++++++++++---------- src/lib/product/components/ProductCard.jsx | 50 ++++++++++----- src/pages/api/shop/search.js | 2 +- 6 files changed, 206 insertions(+), 133 deletions(-) (limited to 'src') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 5cc35df7..0df60673 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -413,13 +413,13 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
Harga mulai dari:
)} - {lowestPrice?.discountPercentage > 0 && ( + {/* {lowestPrice?.discountPercentage > 0 && (
{lowestPrice?.discountPercentage}%
-
- {currencyFormat(lowestPrice?.price)} +
+ Include PPN {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)}
{product.flashSale.remainingTime > 0 && (
@@ -436,28 +436,54 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => {
)}
+ )} */} + + {product?.flashSale?.remainingTime > 0 ? ( + <> +
+
+ {lowestPrice?.discountPercentage}% +
+
+ {currencyFormat(lowestPrice?.price)} +
+
+ {currencyFormat(lowestPrice?.priceDiscount)} +
+
+
+ Termasuk PPN: {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)} +
+ + ) : ( +

+ {lowestPrice?.price > 0 ? ( + <> + {currencyFormat(lowestPrice?.price)} +
+ Termasuk PPN: {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)} +
+ + ) : ( + + Hubungi kami untuk dapatkan harga terbaik,  + + klik disini + + + )} +

)} -

- {lowestPrice?.priceDiscount > 0 ? ( - currencyFormat(lowestPrice?.priceDiscount) - ) : ( - - Hubungi kami untuk dapatkan harga terbaik,  - - klik disini - - - )} -

+ {product.variants.length > 1 ? (
*/}
- {lowestPrice?.priceDiscount > 0 ? ( + {product?.flashSale?.remainingTime > 0 ? ( <> -
-
- Harga Sebelum PPN : -
-
- - {currencyFormat(lowestPrice?.priceDiscount)} - -
-
- Termasuk PPN : -
+
{lowestPrice?.discountPercentage}%
-
- {currencyFormat(lowestPrice?.price * 1.11)} +
+ {currencyFormat(lowestPrice?.price)}
-

- {currencyFormat(lowestPrice?.priceDiscount * 1.11)} -

+
+ {currencyFormat(lowestPrice?.priceDiscount)} +
+
+
+ Termasuk PPN:{' '} + {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
) : ( - - Hubungi kami untuk dapatkan harga terbaik,  - - klik disini - - +

+ {lowestPrice?.price > 0 ? ( + <> + {currencyFormat(lowestPrice?.price)} +
+ Termasuk PPN:{' '} + {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)} +
+ + ) : ( + + Hubungi kami untuk dapatkan harga terbaik,  + + klik disini + + + )} +

)}
{ price: variant.price, stock: variant.stock, weight: variant.weight, - hasProgram: variant.hasProgram + hasProgram: variant.hasProgram, + isFlashsale: variant.isFlashsale } setActiveVariant(newActiveVariant) @@ -151,6 +152,8 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { router.push(`/shop/checkout?source=buy`) } + console.log('ini log', activeVariant) + const productSimilarQuery = [ product?.name, `fq=-product_id_i:${product.id}`, @@ -231,32 +234,48 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {
Harga mulai dari:
)} - {activeVariant?.price?.discountPercentage > 0 && ( -
-
- {currencyFormat(activeVariant?.price?.price)} + {activeVariant.isFlashsale ? ( + <> +
+
{activeVariant?.price?.discountPercentage}%
+
+ {currencyFormat(activeVariant?.price?.price)} +
+
+ {currencyFormat(activeVariant?.price?.priceDiscount)} +
-
{activeVariant?.price?.discountPercentage}%
-
+
+ Termasuk PPN:{' '} + {currencyFormat(activeVariant?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)} +
+ + ) : ( +

+ {activeVariant?.price?.priceDiscount > 0 ? ( + <> + {currencyFormat(activeVariant?.price?.priceDiscount)} +
+ Termasuk PPN:{' '} + {currencyFormat(activeVariant?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)} +
+ + ) : ( + + Hubungi kami untuk dapatkan harga terbaik,  + + klik disini + + + )} +

)} -

- {activeVariant?.price?.priceDiscount > 0 ? ( - currencyFormat(activeVariant?.price?.priceDiscount) - ) : ( - - Hubungi kami untuk dapatkan harga terbaik,  - - klik disini - - - )} -

diff --git a/src/lib/product/components/Product/ProductMobileVariant.jsx b/src/lib/product/components/Product/ProductMobileVariant.jsx index d0c209cc..a7b1a543 100644 --- a/src/lib/product/components/Product/ProductMobileVariant.jsx +++ b/src/lib/product/components/Product/ProductMobileVariant.jsx @@ -39,7 +39,8 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { name: product.name, price: getLowestPrice(), stock: product.stockTotal, - weight: product.weight + weight: product.weight, + isFlashSale: product.isFlashsale }) useEffect(() => { @@ -50,7 +51,8 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { name: product.name, price: product.price, stock: product.stock, - weight: product.weight + weight: product.weight, + isFlashSale: product.isFlashsale }) } }, [selectedVariant, product]) @@ -80,6 +82,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => { }) setAddCartAlert(true) } + console.log('ini log', activeVariant) const handleClickBuy = () => { if (!validAction()) return @@ -139,47 +142,47 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {

{activeVariant?.name}

- {activeVariant?.price?.priceDiscount > 0 ? ( + {activeVariant.isFlashsale ? ( <>
-
Harga Sebelum PPN :
-
- {' '} +
{activeVariant?.price?.discountPercentage}%
+
+ {currencyFormat(activeVariant?.price?.price)} +
+
{currencyFormat(activeVariant?.price?.priceDiscount)}
-
- Termasuk PPN : -
- {activeVariant?.price?.discountPercentage > 0 && ( - <> -
- {activeVariant?.price?.discountPercentage}% -
-
- {currencyFormat(activeVariant?.price?.price * 1.11)} -
- - )} -

- {currencyFormat(activeVariant?.price?.priceDiscount * 1.11)} -

-
+
+ Termasuk PPN:{' '} + {currencyFormat(activeVariant?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
) : ( - - Hubungi kami untuk dapatkan harga terbaik,  - - klik disini - - +

+ {activeVariant?.price?.priceDiscount > 0 ? ( + <> + {currencyFormat(activeVariant?.price?.priceDiscount)} +
+ Termasuk PPN:{' '} + {currencyFormat(activeVariant?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)} +
+ + ) : ( + + Hubungi kami untuk dapatkan harga terbaik,  + + klik disini + + + )} +

)}
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 83b26449..16c63c00 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -82,7 +82,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { )} { {product?.lowestPrice.price > 0 ? ( <> {currencyFormat(product?.lowestPrice.price)} -
- Incl {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN )} +
+ + PPN: {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN)}
) : ( @@ -186,30 +186,46 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { )} {product?.name} + {product?.flashSale?.id > 0 ? ( + <> + {product?.lowestPrice.discountPercentage > 0 && ( +
+
{product?.lowestPrice?.discountPercentage}%
+
+ {currencyFormat(product?.lowestPrice?.price)} +
+
+ )} - {product?.lowestPrice?.discountPercentage > 0 && ( -
-
{product?.lowestPrice?.discountPercentage}%
-
- {currencyFormat(product?.lowestPrice?.price)} +
+ {product?.lowestPrice?.priceDiscount > 0 ? ( + currencyFormat(product?.lowestPrice?.priceDiscount) + ) : ( + Call for price + )}
+ + ) : ( +
+ {product?.lowestPrice.price > 0 ? ( + <> + {currencyFormat(product?.lowestPrice.price)} +
+ + PPN: {currencyFormat(product.lowestPrice.price * process.env.NEXT_PUBLIC_PPN)} +
+ + ) : ( + Call for price + )}
)} -
- {product?.lowestPrice?.priceDiscount > 0 ? ( - currencyFormat(product?.lowestPrice?.priceDiscount) - ) : ( - Call for price - )} -
- {product?.stockTotal > 0 && (
Ready Stock
diff --git a/src/pages/api/shop/search.js b/src/pages/api/shop/search.js index 79083ee7..7b44ef37 100644 --- a/src/pages/api/shop/search.js +++ b/src/pages/api/shop/search.js @@ -104,7 +104,7 @@ const escapeSolrQuery = (query) => { const productResponseMap = (products, pricelist) => { return products.map((product) => { - let price = price_tier1_v2_f || 0 + let price = product.price_tier1_v2_f || 0 let priceDiscount = product.price_discount_f || 0 let discountPercentage = product.discount_f || 0 -- cgit v1.2.3