From 325fe90403cc9febb1017eb27c620e4dd921aa24 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 2 Dec 2024 16:34:52 +0700 Subject: delete console log --- src/lib/product/components/ProductCard.jsx | 1 - 1 file changed, 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 16e20703..174e5cb1 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -21,7 +21,6 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { voucherPastiHemat = product?.newVoucherPastiHemat[0] ? product?.newVoucherPastiHemat[0] : product?.newVoucherPastiHemat; - console.log('voucherPastiHemat', voucherPastiHemat); const callForPriceWhatsapp = whatsappUrl('product', { name: product.name, -- cgit v1.2.3 From 1b4d7f65ee08a56ca6cc57bfc6336ca3ccad3a21 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Tue, 3 Dec 2024 14:42:36 +0700 Subject: update performance desktop --- src/lib/brand/components/BrandCard.jsx | 1 + src/lib/flashSale/components/FlashSale.jsx | 2 ++ src/lib/home/components/BannerSection.jsx | 1 + src/lib/home/components/CategoryDynamic.jsx | 2 ++ src/lib/home/components/CategoryDynamicMobile.jsx | 2 ++ src/lib/home/components/PromotionProgram.jsx | 12 +++++++----- src/lib/home/components/ServiceList.jsx | 4 ++++ src/lib/product/components/ProductCard.jsx | 8 ++++++++ 8 files changed, 27 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/brand/components/BrandCard.jsx b/src/lib/brand/components/BrandCard.jsx index ebd41a67..8bb4b904 100644 --- a/src/lib/brand/components/BrandCard.jsx +++ b/src/lib/brand/components/BrandCard.jsx @@ -20,6 +20,7 @@ const BrandCard = ({ brand }) => { height={500} quality={85} className='h-full w-[122px] object-contain object-center' + loading='eager' /> )} {!brand.logo && ( diff --git a/src/lib/flashSale/components/FlashSale.jsx b/src/lib/flashSale/components/FlashSale.jsx index 6d90cad7..f4be279e 100644 --- a/src/lib/flashSale/components/FlashSale.jsx +++ b/src/lib/flashSale/components/FlashSale.jsx @@ -47,6 +47,7 @@ const FlashSale = () => { width={1080} height={192} className='w-full rounded mb-4 hidden sm:block' + loading='eager' /> { width={256} height={48} className='w-full rounded mb-4 block sm:hidden' + loading='eager' /> { src={banner.image} alt={banner.name} className='h-auto w-full rounded' + loading='eager' /> ))} diff --git a/src/lib/home/components/CategoryDynamic.jsx b/src/lib/home/components/CategoryDynamic.jsx index d72fe1f1..b6994f60 100644 --- a/src/lib/home/components/CategoryDynamic.jsx +++ b/src/lib/home/components/CategoryDynamic.jsx @@ -85,6 +85,7 @@ const CategoryDynamic = () => { width={90} height={30} className='object-fit p-4' + loading='eager' />

@@ -127,6 +128,7 @@ const CategoryDynamic = () => { height={40} placeholder='blur' blurDataURL='/icon.jpg' + loading='eager' />

diff --git a/src/lib/home/components/CategoryDynamicMobile.jsx b/src/lib/home/components/CategoryDynamicMobile.jsx index 67ae6f5f..5d9e872c 100644 --- a/src/lib/home/components/CategoryDynamicMobile.jsx +++ b/src/lib/home/components/CategoryDynamicMobile.jsx @@ -90,6 +90,7 @@ const CategoryDynamicMobile = () => { width={30} height={30} className='' + loading='eager' />

@@ -123,6 +124,7 @@ const CategoryDynamicMobile = () => { width={40} height={40} className='p-2' + loading='eager' />

diff --git a/src/lib/home/components/PromotionProgram.jsx b/src/lib/home/components/PromotionProgram.jsx index fc23bf78..d8bf3edb 100644 --- a/src/lib/home/components/PromotionProgram.jsx +++ b/src/lib/home/components/PromotionProgram.jsx @@ -69,7 +69,8 @@ const BannerSection = () => { quality={85} src={banner.image} alt={banner.name} - className='h-auto w-full rounded hover:scale-105 transition duration-500 ease-in-out' + className='rounded hover:scale-105 transition duration-500 ease-in-out' + loading='eager' /> ))} @@ -82,12 +83,13 @@ const BannerSection = () => { {banner.name} diff --git a/src/lib/home/components/ServiceList.jsx b/src/lib/home/components/ServiceList.jsx index b3cc8fe5..6d03a587 100644 --- a/src/lib/home/components/ServiceList.jsx +++ b/src/lib/home/components/ServiceList.jsx @@ -18,6 +18,7 @@ const ServiceList = () => { src='/images/icon_service/ONE-STOP-SOLUTIONS.svg' alt='' className='h-20 w-20 rounded' + loading='eager' />

@@ -43,6 +44,7 @@ const ServiceList = () => { src='/images/icon_service/WARRANTY.svg' alt='' className='h-20 w-20 rounded' + loading='eager' />
@@ -68,6 +70,7 @@ const ServiceList = () => { src='/images/icon_service/DUE-PAYMENT.svg' alt='' className='h-20 w-20 rounded' + loading='eager' />
@@ -93,6 +96,7 @@ const ServiceList = () => { src='/images/icon_service/TAX.svg' alt='' className='h-20 w-20 rounded' + loading='eager' />
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 174e5cb1..4e80083b 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -90,6 +90,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { className='w-4 h-5 object-contain object-top sm:h-6' width={50} height={50} + loading='eager' /> )}
@@ -101,6 +102,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { className='w-11 h-6 object-contain object-top ml-1 mr-1 sm:h-6' width={50} height={50} + loading='eager' /> )}

@@ -115,6 +117,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { className='h-full' width={1000} height={100} + loading='eager' />

@@ -129,6 +132,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { src='/images/ICON_FLASH_SALE_WEBSITE_INDOTEKNIK.svg' width={13} height={5} + loading='eager' /> {product?.flashSale?.tag != 'false' || @@ -164,6 +168,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { alt='pickup now' width={90} height={12} + loading='eager' /> )} @@ -267,6 +272,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { className='w-4 h-5 object-contain object-top sm:h-6' width={50} height={50} + loading='eager' /> )}
@@ -278,6 +284,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { className='w-11 h-6 object-contain object-top ml-1 sm:h-6' width={50} height={50} + loading='eager' /> )}

@@ -297,6 +304,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { src='/images/ICON_FLASH_SALE_WEBSITE_INDOTEKNIK.svg' width={15} height={10} + loading='eager' /> {' '} -- cgit v1.2.3 From 57f400411555351f0b96799f5e4493c9c49b68e0 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Tue, 3 Dec 2024 15:38:11 +0700 Subject: update performance --- src/lib/brand/components/BrandCard.jsx | 1 + src/lib/product/components/ProductCard.jsx | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/brand/components/BrandCard.jsx b/src/lib/brand/components/BrandCard.jsx index 8bb4b904..dff61b24 100644 --- a/src/lib/brand/components/BrandCard.jsx +++ b/src/lib/brand/components/BrandCard.jsx @@ -11,6 +11,7 @@ const BrandCard = ({ brand }) => { className={`py-1 px-2 border-gray_r-6 flex justify-center items-center hover:scale-110 transition duration-500 ease-in-out ${ isMobile ? 'h-16' : 'h-24' }`} + aria-label={brand.name} > {brand.logo && ( { if (variant == 'vertical') { return ( -
+
{
{product?.manufacture?.name ? ( - + {product.manufacture.name} ) : (
-
)} {product?.isInBu && ( - + {
@@ -199,6 +200,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { rel='noopener noreferrer' target='_blank' href={callForPriceWhatsapp} + aria-label='Call for Inquiry' > Call for Inquiry @@ -222,6 +224,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { rel='noopener noreferrer' target='_blank' href={callForPriceWhatsapp} + aria-label='Call for Inquiry' > Call for Inquiry @@ -256,7 +259,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { return (
- +
{ )} {product?.manufacture?.name ? (
- + {product.manufacture.name} {/* {product?.is_in_bu && ( @@ -332,6 +335,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { )} {product?.name} @@ -358,6 +362,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { rel='noopener noreferrer' target='_blank' href={callForPriceWhatsapp} + aria-label='Call for Inquiry' > Call for Inquiry @@ -381,6 +386,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { rel='noopener noreferrer' target='_blank' href={callForPriceWhatsapp} + aria-label='Call for Inquiry' > Call for Inquiry -- cgit v1.2.3 From 4c8d08def514cb441007c0bd2bc78e105e6d0153 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Wed, 4 Dec 2024 11:50:21 +0700 Subject: cr popup information method --- src/lib/product/components/Product/ProductDesktop.jsx | 1 + src/lib/product/components/Product/ProductMobile.jsx | 1 + src/lib/product/components/ProductCard.jsx | 6 ++++-- src/lib/product/components/ProductSlider.jsx | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 444ddd8e..19e76a2b 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -255,6 +255,7 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => { > diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx index 113a1e42..4cfd3755 100644 --- a/src/lib/product/components/Product/ProductMobile.jsx +++ b/src/lib/product/components/Product/ProductMobile.jsx @@ -219,6 +219,7 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { > diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 2291398d..a8ed90a4 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -73,8 +73,8 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { if (variant == 'vertical') { return ( -
- +
+
{
{
<> {bannerMode && ( - + )} {products?.products?.map((product, index) => ( -- cgit v1.2.3 From b3be7e6d5c320764ef3ca38df196218abf9be25b Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 10 Dec 2024 10:05:47 +0700 Subject: move formulis & add state field --- src/lib/form/components/KunjunganSales.jsx | 215 +++++++++----- src/lib/form/components/KunjunganService.jsx | 361 ++++++++++++++---------- src/lib/form/components/Merchant.jsx | 56 +++- src/lib/form/components/RequestForQuotation.jsx | 215 +++++++++----- src/lib/form/components/SuratDukungan.jsx | 33 +-- 5 files changed, 569 insertions(+), 311 deletions(-) (limited to 'src/lib') diff --git a/src/lib/form/components/KunjunganSales.jsx b/src/lib/form/components/KunjunganSales.jsx index ffa8f135..3779b836 100644 --- a/src/lib/form/components/KunjunganSales.jsx +++ b/src/lib/form/components/KunjunganSales.jsx @@ -1,17 +1,18 @@ -import odooApi from '@/core/api/odooApi' -import HookFormSelect from '@/core/components/elements/Select/HookFormSelect' -import cityApi from '@/lib/address/api/cityApi' -import { yupResolver } from '@hookform/resolvers/yup' -import React, { useEffect, useRef, useState } from 'react' -import ReCAPTCHA from 'react-google-recaptcha' -import { Controller, useForm } from 'react-hook-form' -import { toast } from 'react-hot-toast' -import * as Yup from 'yup' -import createLeadApi from '../api/createLeadApi' -import PageContent from '@/lib/content/components/PageContent' - -import useAuth from '@/core/hooks/useAuth' -import { useRouter } from 'next/router' +import odooApi from '@/core/api/odooApi'; +import HookFormSelect from '@/core/components/elements/Select/HookFormSelect'; +import cityApi from '@/lib/address/api/cityApi'; +import stateApi from '@/lib/address/api/stateApi.js'; +import { yupResolver } from '@hookform/resolvers/yup'; +import React, { useEffect, useRef, useState } from 'react'; +import ReCAPTCHA from 'react-google-recaptcha'; +import { Controller, useForm } from 'react-hook-form'; +import { toast } from 'react-hot-toast'; +import * as Yup from 'yup'; +import createLeadApi from '../api/createLeadApi'; +import PageContent from '@/lib/content/components/PageContent'; + +import useAuth from '@/core/hooks/useAuth'; +import { useRouter } from 'next/router'; const KunjunganSales = () => { const { @@ -19,44 +20,72 @@ const KunjunganSales = () => { handleSubmit, formState: { errors }, control, - reset + reset, + watch, + setValue, } = useForm({ resolver: yupResolver(validationSchema), - defaultValues - }) - const [cities, setCities] = useState([]) - const [companyTypes, setCompanyTypes] = useState([]) - const router = useRouter() + defaultValues, + }); + const [cities, setCities] = useState([]); + const [state, setState] = useState([]); + const [companyTypes, setCompanyTypes] = useState([]); + const router = useRouter(); + + const auth = useAuth(); - const auth = useAuth() + const recaptchaRef = useRef(null); - + if (auth == false) { + router.push(`/login?next=${encodeURIComponent('/kunjungan-sales')}`); + } + + useEffect(() => { + const loadState = async () => { + let dataState = await stateApi(); + dataState = dataState.map((state) => ({ + value: state.id, + label: state.name, + })); + setState(dataState); + }; + loadState(); + }, []); - const recaptchaRef = useRef(null) + const watchState = watch('state'); useEffect(() => { - if(auth == false) { - router.push('/login') + if (auth == false) { + return; } const loadCities = async () => { - let dataCities = await cityApi() - dataCities = dataCities.map((obj) => ({ value: obj.name, label: obj.name })) - setCities(dataCities) - } + setValue('city', ''); + let dataCities = await cityApi({ stateId: watchState }); + dataCities = dataCities?.map((obj) => ({ + value: obj.name, + label: obj.name, + })); + setCities(dataCities); + }; const loadCompanyTypes = async () => { - const dataCompanyTypes = await odooApi('GET', '/api/v1/partner/company_type') - setCompanyTypes(dataCompanyTypes?.map((obj) => ({ value: obj.name, label: obj.name }))) - } + const dataCompanyTypes = await odooApi( + 'GET', + '/api/v1/partner/company_type' + ); + setCompanyTypes( + dataCompanyTypes?.map((obj) => ({ value: obj.name, label: obj.name })) + ); + }; - loadCompanyTypes() - loadCities() - }, [auth]) + loadCompanyTypes(); + loadCities(); + }, [auth, watchState, setValue]); const onSubmitHandler = async (values) => { - const recaptchaValue = recaptchaRef.current.getValue() + const recaptchaValue = recaptchaRef.current.getValue(); if (!recaptchaValue) { - toast.error('Recaptcha harus diisi') - return + toast.error('Recaptcha harus diisi'); + return; } const data = { @@ -71,29 +100,37 @@ const KunjunganSales = () => { `Unit Perusahaan: ${values.companyType}`, `No. Handphone: ${values.mobile}`, `Alamat Email: ${values.email}`, - `Keterangan: ${values.description}` - ].join('\n') - } + `Keterangan: ${values.description}`, + ].join('\n'), + }; - const createLead = await createLeadApi({ data }) + const createLead = await createLeadApi({ data }); if (createLead) { - toast.success('Berhasil mengirimkan formulir kunjungan sales') - reset() - recaptchaRef.current.reset() + toast.success('Berhasil mengirimkan formulir kunjungan sales'); + reset(); + recaptchaRef.current.reset(); } + }; + if (!auth) { + return; } return (
-

Kunjungan Sales

+

+ Kunjungan Sales +

-
+
- Hubungi kami untuk mendapatkan kunjungan sales kami dan dapatkan berbagai kelebihannya - dengan menjadi pelanggan korporat kami. + Hubungi kami untuk mendapatkan kunjungan sales kami dan dapatkan + berbagai kelebihannya dengan menjadi pelanggan korporat kami.
@@ -104,7 +141,9 @@ const KunjunganSales = () => { className='form-input' aria-invalid={errors.company?.message} /> -
{errors.company?.message}
+
+ {errors.company?.message} +
@@ -116,7 +155,9 @@ const KunjunganSales = () => { className='form-input' aria-invalid={errors.phone?.message} /> -
{errors.phone?.message}
+
+ {errors.phone?.message} +
@@ -128,7 +169,21 @@ const KunjunganSales = () => { className='form-input' aria-invalid={errors.address?.message} /> -
{errors.address?.message}
+
+ {errors.address?.message} +
+
+ +
+ + } + /> +
+ {errors.stateId?.message} +
@@ -138,7 +193,9 @@ const KunjunganSales = () => { control={control} render={(props) => } /> -
{errors.city?.message}
+
+ {errors.city?.message} +
@@ -146,9 +203,13 @@ const KunjunganSales = () => { } + render={(props) => ( + + )} /> -
{errors.companyType?.message}
+
+ {errors.companyType?.message} +
@@ -160,7 +221,9 @@ const KunjunganSales = () => { className='form-input' aria-invalid={errors.mobile?.message} /> -
{errors.mobile?.message}
+
+ {errors.mobile?.message} +
@@ -172,34 +235,49 @@ const KunjunganSales = () => { className='form-input' aria-invalid={errors.email?.message} /> -
{errors.email?.message}
+
+ {errors.email?.message} +
-