diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-09-25 01:53:07 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2024-09-25 01:53:07 +0000 |
| commit | ad952b397b1cebcf85b66877da8e949e7e7a891f (patch) | |
| tree | c174d9dabd75a97544884f47b513f5b4b58443a0 /src/lib | |
| parent | 1e834e45f9a11911036496151b71f99de480862e (diff) | |
| parent | a66b690ad0445452816f3ac8f8e98dba2e53ca31 (diff) | |
Merged in perapihan-tag (pull request #331)
Perapihan tag
Approved-by: trisusilo
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/brand/components/BrandCard.jsx | 28 | ||||
| -rw-r--r-- | src/lib/home/components/BannerSection.jsx | 20 | ||||
| -rw-r--r-- | src/lib/home/components/CategoryDynamic.jsx | 15 | ||||
| -rw-r--r-- | src/lib/home/components/CategoryDynamicMobile.jsx | 14 | ||||
| -rw-r--r-- | src/lib/home/components/CategoryHomeId.jsx | 18 | ||||
| -rw-r--r-- | src/lib/home/components/CategoryPilihan.jsx | 265 | ||||
| -rw-r--r-- | src/lib/home/components/PromotionProgram.jsx | 118 | ||||
| -rw-r--r-- | src/lib/home/components/ServiceList.jsx | 34 | ||||
| -rw-r--r-- | src/lib/quotation/components/Quotationheader.jsx | 131 | ||||
| -rw-r--r-- | src/lib/review/components/CustomerReviews.jsx | 37 | ||||
| -rw-r--r-- | src/lib/tracking-order/component/TrackingOrder.jsx | 272 |
11 files changed, 553 insertions, 399 deletions
diff --git a/src/lib/brand/components/BrandCard.jsx b/src/lib/brand/components/BrandCard.jsx index 2d78d956..ebd41a67 100644 --- a/src/lib/brand/components/BrandCard.jsx +++ b/src/lib/brand/components/BrandCard.jsx @@ -1,10 +1,10 @@ -import Image from '~/components/ui/image' -import Link from '@/core/components/elements/Link/Link' -import useDevice from '@/core/hooks/useDevice' -import { createSlug } from '@/core/utils/slug' +import NextImage from 'next/image'; +import Link from '@/core/components/elements/Link/Link'; +import useDevice from '@/core/hooks/useDevice'; +import { createSlug } from '@/core/utils/slug'; const BrandCard = ({ brand }) => { - const { isMobile } = useDevice() + const { isMobile } = useDevice(); return ( <Link href={createSlug('/shop/brands/', brand.name, brand.id)} @@ -13,21 +13,25 @@ const BrandCard = ({ brand }) => { }`} > {brand.logo && ( - <Image + <NextImage src={brand.logo} alt={brand.name} - width={50} - height={50} + width={500} + height={500} + quality={85} className='h-full w-[122px] object-contain object-center' /> )} {!brand.logo && ( - <span className='text-center' style={{ fontSize: `${16 - brand.name.length * 0.5}px` }}> + <span + className='text-center' + style={{ fontSize: `${16 - brand.name.length * 0.5}px` }} + > {brand.name} </span> )} </Link> - ) -} + ); +}; -export default BrandCard +export default BrandCard; diff --git a/src/lib/home/components/BannerSection.jsx b/src/lib/home/components/BannerSection.jsx index 2010503d..f83c36fc 100644 --- a/src/lib/home/components/BannerSection.jsx +++ b/src/lib/home/components/BannerSection.jsx @@ -1,12 +1,12 @@ -import Link from '@/core/components/elements/Link/Link' -import Image from 'next/image' +import Link from '@/core/components/elements/Link/Link'; +import Image from 'next/image'; -const { useQuery } = require('react-query') -const { default: bannerSectionApi } = require('../api/bannerSectionApi') +const { useQuery } = require('react-query'); +const { default: bannerSectionApi } = require('../api/bannerSectionApi'); const BannerSection = () => { - const fetchBannerSection = async () => await bannerSectionApi() - const bannerSection = useQuery('bannerSection', fetchBannerSection) + const fetchBannerSection = async () => await bannerSectionApi(); + const bannerSection = useQuery('bannerSection', fetchBannerSection); return ( bannerSection.data && @@ -17,7 +17,7 @@ const BannerSection = () => { <Image width={1024} height={512} - quality={100} + quality={85} src={banner.image} alt={banner.name} className='h-auto w-full rounded' @@ -26,7 +26,7 @@ const BannerSection = () => { ))} </div> ) - ) -} + ); +}; -export default BannerSection +export default BannerSection; diff --git a/src/lib/home/components/CategoryDynamic.jsx b/src/lib/home/components/CategoryDynamic.jsx index 79092c9d..49a9a93f 100644 --- a/src/lib/home/components/CategoryDynamic.jsx +++ b/src/lib/home/components/CategoryDynamic.jsx @@ -3,13 +3,12 @@ import { fetchCategoryManagementSolr } from '../api/categoryManagementApi'; import NextImage from 'next/image'; import Link from 'next/link'; import { createSlug } from '@/core/utils/slug'; -import odooApi from '@/core/api/odooApi'; import { Skeleton } from '@chakra-ui/react'; import { Swiper, SwiperSlide } from 'swiper/react'; import 'swiper/css'; import 'swiper/css/navigation'; import 'swiper/css/pagination'; -import { Navigation, Pagination, Autoplay } from 'swiper'; +import { Pagination } from 'swiper'; const CategoryDynamic = () => { const [categoryManagement, setCategoryManagement] = useState([]); @@ -73,9 +72,9 @@ const CategoryDynamic = () => { <Skeleton key={category.id} isLoaded={!isLoading}> <div key={category.id}> <div className='bagian-judul flex flex-row justify-start items-center gap-3 mb-4 mt-4'> - <div className='font-semibold sm:text-h-lg mr-2'> + <h1 className='font-semibold text-[14px] sm:text-h-lg mr-2'> {category.name} - </div> + </h1> {/* <Skeleton isLoaded={countLevel1 != 0}> <p className={`text-gray_r-10 text-sm`}>{countLevel1} Produk tersedia</p> </Skeleton> */} @@ -113,9 +112,9 @@ const CategoryDynamic = () => { className='object-fit p-4' /> <div className='bagian-judul flex flex-col justify-center items-start gap-2 ml-2'> - <div className='font-semibold text-lg mr-2'> + <h2 className='font-semibold text-lg mr-2'> {subCategory?.name} - </div> + </h2> {/* <Skeleton isLoaded={countLevel2 != 0}> <p className={`text-gray_r-10 text-sm`}> {countLevel2} Produk tersedia @@ -157,9 +156,9 @@ const CategoryDynamic = () => { height={40} /> <div className='bagian-judul flex flex-col justify-center items-center gap-2 break-words line-clamp-2 group-hover:text-red-500'> - <div className='font-semibold line-clamp-2 group-hover:text-red-500 text-sm mr-2'> + <h3 className='font-semibold line-clamp-2 group-hover:text-red-500 text-sm mr-2'> {childCategory.name} - </div> + </h3> </div> </Link> </div> diff --git a/src/lib/home/components/CategoryDynamicMobile.jsx b/src/lib/home/components/CategoryDynamicMobile.jsx index af151df2..4a8f13cf 100644 --- a/src/lib/home/components/CategoryDynamicMobile.jsx +++ b/src/lib/home/components/CategoryDynamicMobile.jsx @@ -59,9 +59,9 @@ const CategoryDynamicMobile = () => { categoryManagement?.map((category) => ( <div key={category.id}> <div className='bagian-judul flex flex-row justify-between items-center gap-3 mb-4 mt-4'> - <div className='font-semibold sm:text-h-sm mr-2'> - {category?.name} - </div> + <h1 className='font-semibold text-[14px] sm:text-h-lg mr-2'> + {category.name} + </h1> <Link href={createSlug( '/shop/category/', @@ -98,9 +98,9 @@ const CategoryDynamicMobile = () => { className='' /> <div className='bagian-judul flex flex-col justify-center items-start gap-1 ml-2'> - <div className='font-semibold text-[10px] line-clamp-1'> + <h2 className='font-semibold text-[10px] line-clamp-1'> {index?.name} - </div> + </h2> </div> </div> </div> @@ -131,9 +131,9 @@ const CategoryDynamicMobile = () => { className='p-2' /> <div className='bagian-judul flex flex-col justify-center items-start gap-1 break-words line-clamp-2 group-hover:text-red-500'> - <div className='font-semibold line-clamp-2 group-hover:text-red-500 text-[10px]'> + <h3 className='font-semibold line-clamp-2 group-hover:text-red-500 text-[10px]'> {x?.name} - </div> + </h3> </div> </Link> </div> diff --git a/src/lib/home/components/CategoryHomeId.jsx b/src/lib/home/components/CategoryHomeId.jsx index 71428e27..9f436dac 100644 --- a/src/lib/home/components/CategoryHomeId.jsx +++ b/src/lib/home/components/CategoryHomeId.jsx @@ -1,13 +1,15 @@ -import { LazyLoadComponent } from 'react-lazy-load-image-component' -import useCategoryHomeId from '../hooks/useCategoryHomeId' -import CategoryHome from './CategoryHome' +import { LazyLoadComponent } from 'react-lazy-load-image-component'; +import useCategoryHomeId from '../hooks/useCategoryHomeId'; +import CategoryHome from './CategoryHome'; const CategoryHomeId = () => { - const { categoryHomeIds } = useCategoryHomeId() + const { categoryHomeIds } = useCategoryHomeId(); return ( <div> - <div className='font-semibold sm:text-h-lg mb-6 px-4 sm:px-0'>Kategori Pilihan</div> + <h1 className='font-semibold text-[14px] sm:text-h-lg mb-6 px-4 sm:px-0'> + Kategori Pilihan + </h1> <div className='flex flex-col gap-y-10'> {categoryHomeIds.data?.map((id) => ( <LazyLoadComponent key={id}> @@ -16,7 +18,7 @@ const CategoryHomeId = () => { ))} </div> </div> - ) -} + ); +}; -export default CategoryHomeId +export default CategoryHomeId; diff --git a/src/lib/home/components/CategoryPilihan.jsx b/src/lib/home/components/CategoryPilihan.jsx index 6dbf771e..2e5ca721 100644 --- a/src/lib/home/components/CategoryPilihan.jsx +++ b/src/lib/home/components/CategoryPilihan.jsx @@ -1,123 +1,168 @@ -import Image from 'next/image' -import useCategoryHome from '../hooks/useCategoryHome' -import Link from '@/core/components/elements/Link/Link' -import { createSlug } from '@/core/utils/slug' +import Image from 'next/image'; +import useCategoryHome from '../hooks/useCategoryHome'; +import Link from '@/core/components/elements/Link/Link'; +import { createSlug } from '@/core/utils/slug'; import { useEffect, useState } from 'react'; import { bannerApi } from '../../../api/bannerApi'; -const { useQuery } = require('react-query') +const { useQuery } = require('react-query'); import { HeroBannerSkeleton } from '../../../components/skeleton/BannerSkeleton'; import useCategoryPilihan from '../hooks/useCategoryPilihan'; -import useDevice from '@/core/hooks/useDevice' +import useDevice from '@/core/hooks/useDevice'; import { Swiper, SwiperSlide } from 'swiper/react'; import 'swiper/css'; const CategoryPilihan = ({ id, categories }) => { - const { isDesktop, isMobile } = useDevice() - const { categoryPilihan } = useCategoryPilihan(); - const heroBanner = useQuery('categoryPilihan', bannerApi({ type: 'banner-category-list' })); - return ( - categoryPilihan.length > 0 && ( - <section> - {isDesktop && ( - <div> - <div className='flex flex-row items-center mb-4'> - <div className='font-semibold sm:text-h-lg mr-2'>LOB Kategori Pilihan</div> - <p className='text-gray_r-10 text-sm'>200 Rb+ Produk Unggulan & 800+ Brand Rekomendasi tersedia!</p> - </div> - {heroBanner.data && - heroBanner.data?.length > 0 && ( - <div className='flex w-full h-full justify-center mb-4 bg-cover bg-center'> - <Link key={heroBanner.data[0].id} href={heroBanner.data[0].url}> - <Image - width={1260} - height={170} - quality={100} - src={heroBanner.data[0].image} - alt={heroBanner.data[0].name} - className='h-full object-cover w-full' - /> - </Link> - </div> - )} - <div className="group/item grid grid-cols-6 gap-y-2 w-full h-full col-span-2 "> - {categoryPilihan?.data?.map((category) => ( - <div key={category.id} className="KartuInti h-48 w-60 max-w-sm lg:max-w-full flex flex-col border-[1px] border-gray-200 relative group"> - <div className='KartuB absolute h-48 w-60 inset-0 flex items-center justify-center '> - <div className="group/edit flex items-center justify-end h-48 w-60 flex-col group-hover/item:visible"> - <div className=' h-36 flex justify-end items-end'> - <Image className='group-hover:scale-105 transition-transform duration-300 ' src={category?.image? category?.image : '/images/noimage.jpeg'} width={120} height={120} alt={category?.name} /> - </div> - <h2 className="text-gray-700 content-center h-12 border-t-[1px] px-1 w-60 border-gray-200 font-normal text-sm text-center">{category?.industries}</h2> - </div> - </div> - <div className='KartuA relative inset-0 flex h-36 w-60 items-center justify-center opacity-0 group-hover:opacity-75 group-hover:bg-[#E20613] transition-opacity '> - <Link - href={createSlug('/shop/lob/', category?.industries, category?.id)} - className='category-mega-box__parent text-white rounded-lg' - > - Lihat semua - </Link> - </div> - </div> - ))} + const { isDesktop, isMobile } = useDevice(); + const { categoryPilihan } = useCategoryPilihan(); + const heroBanner = useQuery( + 'categoryPilihan', + bannerApi({ type: 'banner-category-list' }) + ); + return ( + categoryPilihan.length > 0 && ( + <section> + {isDesktop && ( + <div> + <div className='flex flex-row items-center mb-4'> + <div className='font-semibold sm:text-h-lg mr-2'> + LOB Kategori Pilihan + </div> + <p className='text-gray_r-10 text-sm'> + 200 Rb+ Produk Unggulan & 800+ Brand Rekomendasi tersedia! + </p> + </div> + {heroBanner.data && heroBanner.data?.length > 0 && ( + <div className='flex w-full h-full justify-center mb-4 bg-cover bg-center'> + <Link key={heroBanner.data[0].id} href={heroBanner.data[0].url}> + <Image + width={1260} + height={170} + quality={85} + src={heroBanner.data[0].image} + alt={heroBanner.data[0].name} + className='h-full object-cover w-full' + /> + </Link> + </div> + )} + <div className='group/item grid grid-cols-6 gap-y-2 w-full h-full col-span-2 '> + {categoryPilihan?.data?.map((category) => ( + <div + key={category.id} + className='KartuInti h-48 w-60 max-w-sm lg:max-w-full flex flex-col border-[1px] border-gray-200 relative group' + > + <div className='KartuB absolute h-48 w-60 inset-0 flex items-center justify-center '> + <div className='group/edit flex items-center justify-end h-48 w-60 flex-col group-hover/item:visible'> + <div className=' h-36 flex justify-end items-end'> + <Image + className='group-hover:scale-105 transition-transform duration-300 ' + src={ + category?.image + ? category?.image + : '/images/noimage.jpeg' + } + width={120} + height={120} + alt={category?.name} + /> + </div> + <h2 className='text-gray-700 content-center h-12 border-t-[1px] px-1 w-60 border-gray-200 font-normal text-sm text-center'> + {category?.industries} + </h2> </div> + </div> + <div className='KartuA relative inset-0 flex h-36 w-60 items-center justify-center opacity-0 group-hover:opacity-75 group-hover:bg-[#E20613] transition-opacity '> + <Link + href={createSlug( + '/shop/lob/', + category?.industries, + category?.id + )} + className='category-mega-box__parent text-white rounded-lg' + > + Lihat semua + </Link> + </div> </div> - )} - {isMobile && ( - <div className='p-4'> - <div className='flex flex-row items-center mb-4'> - <div className='font-semibold sm:text-h-md mr-2'>LOB Kategori Pilihan</div> - {/* <p className='text-gray_r-10 text-sm'>200 Rb+ Produk Unggulan & 800+ Brand Rekomendasi tersedia!</p> */} + ))} + </div> + </div> + )} + {isMobile && ( + <div className='p-4'> + <div className='flex flex-row items-center mb-4'> + <div className='font-semibold sm:text-h-md mr-2'> + LOB Kategori Pilihan + </div> + {/* <p className='text-gray_r-10 text-sm'>200 Rb+ Produk Unggulan & 800+ Brand Rekomendasi tersedia!</p> */} + </div> + <div className='flex'> + {heroBanner.data && heroBanner.data?.length > 0 && ( + <div className=' object-fill '> + <Link + key={heroBanner.data[0].id} + href={heroBanner.data[0].url} + > + <Image + width={439} + height={150} + quality={85} + src={heroBanner.data[0].image} + alt={heroBanner.data[0].name} + className='object-cover' + /> + </Link> + </div> + )} + </div> + <Swiper slidesPerView={2.1} spaceBetween={10}> + {categoryPilihan?.data?.map((category) => ( + <SwiperSlide key={category.id}> + <div + key={category.id} + className='KartuInti mt-2 h-48 w-48 max-w-sm lg:max-w-full flex flex-col border-[1px] border-gray-200 relative group' + > + <div className='KartuB absolute h-48 w-48 inset-0 flex items-center justify-center '> + <div className='group/edit flex items-center justify-end h-48 w-48 flex-col group-hover/item:visible'> + <div className=' h-36 flex justify-end items-end'> + <Image + className='group-hover:scale-105 transition-transform duration-300 ' + src={ + category?.image + ? category?.image + : '/images/noimage.jpeg' + } + width={120} + height={120} + alt={category?.name} + /> + </div> + <h2 className='text-gray-700 content-center h-12 border-t-[1px] px-1 w-48 border-gray-200 font-normal text-sm text-center'> + {category?.industries} + </h2> + </div> </div> - <div className='flex'> - {heroBanner.data && - heroBanner.data?.length > 0 && ( - <div className=' object-fill '> - <Link key={heroBanner.data[0].id} href={heroBanner.data[0].url}> - <Image - width={439} - height={150} - quality={100} - src={heroBanner.data[0].image} - alt={heroBanner.data[0].name} - className='object-cover' - /> - </Link> - </div> - )} + <div className='KartuA relative inset-0 flex h-36 w-48 items-center justify-center opacity-0 group-hover:opacity-75 group-hover:bg-[#E20613] transition-opacity '> + <Link + href={createSlug( + '/shop/lob/', + category?.industries, + category?.id + )} + className='category-mega-box__parent text-white rounded-lg' + > + Lihat semua + </Link> </div> - <Swiper slidesPerView={2.1} spaceBetween={10}> - {categoryPilihan?.data?.map((category) => ( - <SwiperSlide key={category.id}> - <div key={category.id} className="KartuInti mt-2 h-48 w-48 max-w-sm lg:max-w-full flex flex-col border-[1px] border-gray-200 relative group"> - <div className='KartuB absolute h-48 w-48 inset-0 flex items-center justify-center '> - <div className="group/edit flex items-center justify-end h-48 w-48 flex-col group-hover/item:visible"> - <div className=' h-36 flex justify-end items-end'> - <Image className='group-hover:scale-105 transition-transform duration-300 ' src={category?.image? category?.image : '/images/noimage.jpeg'} width={120} height={120} alt={category?.name} /> - </div> - <h2 className="text-gray-700 content-center h-12 border-t-[1px] px-1 w-48 border-gray-200 font-normal text-sm text-center">{category?.industries}</h2> - </div> - </div> - <div className='KartuA relative inset-0 flex h-36 w-48 items-center justify-center opacity-0 group-hover:opacity-75 group-hover:bg-[#E20613] transition-opacity '> - <Link - href={createSlug('/shop/lob/', category?.industries, category?.id)} - className='category-mega-box__parent text-white rounded-lg' - > - Lihat semua - </Link> - </div> - </div> - </SwiperSlide> - ))} - - </Swiper> - - </div> - )} - </section> - - ) - ) -} + </div> + </SwiperSlide> + ))} + </Swiper> + </div> + )} + </section> + ) + ); +}; -export default CategoryPilihan +export default CategoryPilihan; diff --git a/src/lib/home/components/PromotionProgram.jsx b/src/lib/home/components/PromotionProgram.jsx index ae8d5d6f..ae06bd4d 100644 --- a/src/lib/home/components/PromotionProgram.jsx +++ b/src/lib/home/components/PromotionProgram.jsx @@ -1,13 +1,16 @@ -import Link from '@/core/components/elements/Link/Link' -import Image from 'next/image' +import Link from '@/core/components/elements/Link/Link'; +import Image from 'next/image'; import { bannerApi } from '@/api/bannerApi'; -import useDevice from '@/core/hooks/useDevice' +import useDevice from '@/core/hooks/useDevice'; import { Swiper, SwiperSlide } from 'swiper/react'; -import BannerPromoSkeleton from '../components/Skeleton/BannerPromoSkeleton'; -const { useQuery } = require('react-query') +import BannerPromoSkeleton from '../components/Skeleton/BannerPromoSkeleton'; +const { useQuery } = require('react-query'); const BannerSection = () => { - const promotionProgram = useQuery('promotionProgram', bannerApi({ type: 'banner-promotion' })); - const { isMobile, isDesktop } = useDevice() + const promotionProgram = useQuery( + 'promotionProgram', + bannerApi({ type: 'banner-promotion' }) + ); + const { isMobile, isDesktop } = useDevice(); if (promotionProgram.isLoading) { return <BannerPromoSkeleton />; @@ -16,60 +19,65 @@ const BannerSection = () => { return ( <div className='px-4 sm:px-0'> <div className='flex justify-between items-center mb-4 '> - <h1 className='font-semibold text-[14px] sm:text-h-lg'> <Link href='/shop/promo' className='!text-black font-semibold' >Promo Tersedia</Link></h1> + <h1 className='font-semibold text-[14px] sm:text-h-lg'> + {' '} + <Link href='/shop/promo' className='!text-black font-semibold'> + Promo Tersedia + </Link> + </h1> {isDesktop && ( <Link href='/shop/promo' className='!text-red-500 font-semibold'> - Lihat Semua - </Link> + Lihat Semua + </Link> )} {isMobile && ( - <Link href='/shop/promo' className='!text-red-500 font-semibold sm:text-h-sm'> - Lihat Semua - </Link> - )} - </div> - {isDesktop && (promotionProgram.data && - promotionProgram.data?.length > 0 && ( - <div className='grid grid-cols-3 sm:grid-cols-3 gap-4 rounded-md'> - {promotionProgram.data?.map((banner) => ( - <Link key={banner.id} href={banner.url}> - <Image - width={439} - height={150} - quality={100} - src={banner.image} - alt={banner.name} - className='h-auto w-full rounded hover:scale-105 transition duration-500 ease-in-out' - /> + <Link + href='/shop/promo' + className='!text-red-500 font-semibold sm:text-h-sm' + > + Lihat Semua </Link> - ))} + )} </div> - - ))} + {isDesktop && + promotionProgram.data && + promotionProgram.data?.length > 0 && ( + <div className='grid grid-cols-3 sm:grid-cols-3 gap-4 rounded-md'> + {promotionProgram.data?.map((banner) => ( + <Link key={banner.id} href={banner.url}> + <Image + width={439} + height={150} + quality={85} + src={banner.image} + alt={banner.name} + className='h-auto w-full rounded hover:scale-105 transition duration-500 ease-in-out' + /> + </Link> + ))} + </div> + )} -{isMobile && ( - - <Swiper slidesPerView={1.1} spaceBetween={8} freeMode> - {promotionProgram.data?.map((banner) => ( - <SwiperSlide key={banner.id}> - <Link key={banner.id} href={banner.url}> - <Image - width={439} - height={150} - quality={100} - src={banner.image} - alt={banner.name} - className='h-auto w-full rounded ' - /> - </Link> - </SwiperSlide> - ))} - </Swiper> - - )} + {isMobile && ( + <Swiper slidesPerView={1.1} spaceBetween={8} freeMode> + {promotionProgram.data?.map((banner) => ( + <SwiperSlide key={banner.id}> + <Link key={banner.id} href={banner.url}> + <Image + width={439} + height={150} + quality={85} + src={banner.image} + alt={banner.name} + className='h-auto w-full rounded ' + /> + </Link> + </SwiperSlide> + ))} + </Swiper> + )} </div> - - ) -} + ); +}; -export default BannerSection +export default BannerSection; diff --git a/src/lib/home/components/ServiceList.jsx b/src/lib/home/components/ServiceList.jsx index b8799d7d..5b16915d 100644 --- a/src/lib/home/components/ServiceList.jsx +++ b/src/lib/home/components/ServiceList.jsx @@ -1,5 +1,5 @@ -import Image from 'next/image' -import Link from '@/core/components/elements/Link/Link' +import Image from 'next/image'; +import Link from '@/core/components/elements/Link/Link'; const ServiceList = () => { return ( @@ -14,14 +14,16 @@ const ServiceList = () => { <Image width={24} height={24} - quality={100} + quality={85} src='/images/icon_service/ONE-STOP-SOLUTIONS.svg' alt='' className='h-20 w-20 rounded' /> </div> <div className=''> - <h1 className='text-gray-900 font-semibold text-base'>One Stop Solution</h1> + <h1 className='text-gray-900 font-semibold text-base'> + One Stop Solution + </h1> <p className='text-xs md:text-sm text-gray-500'> Temukan Solusi Lengkap Anda dalam Satu Tempat. </p> @@ -37,14 +39,16 @@ const ServiceList = () => { <Image width={24} height={24} - quality={100} + quality={85} src='/images/icon_service/WARRANTY.svg' alt='' className='h-20 w-20 rounded' /> </div> <div> - <h1 className='text-gray-900 font-semibold text-base'>Garansi Resmi</h1> + <h1 className='text-gray-900 font-semibold text-base'> + Garansi Resmi + </h1> <p className='text-xs md:text-sm text-gray-500'> Garansi Keaslian Barang dan Jaminan Purna Jual. </p> @@ -60,14 +64,16 @@ const ServiceList = () => { <Image width={24} height={24} - quality={100} + quality={85} src='/images/icon_service/DUE-PAYMENT.svg' alt='' className='h-20 w-20 rounded' /> </div> <div> - <h1 className='text-gray-900 font-semibold text-base'>Pembayaran Tempo</h1> + <h1 className='text-gray-900 font-semibold text-base'> + Pembayaran Tempo + </h1> <p className='text-xs md:text-sm text-gray-500'> Lebih mudah mengatur pembelian dengan pembayaran tempo. </p> @@ -83,14 +89,16 @@ const ServiceList = () => { <Image width={24} height={24} - quality={100} + quality={85} src='/images/icon_service/TAX.svg' alt='' className='h-20 w-20 rounded' /> </div> <div> - <h1 className='text-gray-900 font-semibold text-base'>Faktur Pajak</h1> + <h1 className='text-gray-900 font-semibold text-base'> + Faktur Pajak + </h1> <p className='text-xs md:text-sm text-gray-500'> Dapat Faktur pajak untuk setiap transaksi dengan indoteknik.com </p> @@ -99,7 +107,7 @@ const ServiceList = () => { </div> </div> </div> - ) -} + ); +}; -export default ServiceList +export default ServiceList; diff --git a/src/lib/quotation/components/Quotationheader.jsx b/src/lib/quotation/components/Quotationheader.jsx index 4529c977..cb7684ed 100644 --- a/src/lib/quotation/components/Quotationheader.jsx +++ b/src/lib/quotation/components/Quotationheader.jsx @@ -19,14 +19,22 @@ const Quotationheader = (quotationCount) => { context: 'quotation', site: auth?.webRole === null && auth?.site ? auth.site : null, }; - + const router = useRouter(); const [subTotal, setSubTotal] = useState(null); const [buttonLoading, SetButtonTerapkan] = useState(false); const itemLoading = [1, 2, 3]; const [countQuotation, setCountQuotation] = useState(null); - const { productCart, setProductCart, refreshCart, setRefreshCart, isLoading, setIsloading, productQuotation, setProductQuotation } = - useProductCartContext(); + const { + productCart, + setProductCart, + refreshCart, + setRefreshCart, + isLoading, + setIsloading, + productQuotation, + setProductQuotation, + } = useProductCartContext(); const [isHovered, setIsHovered] = useState(false); const [isTop, setIsTop] = useState(true); @@ -49,34 +57,44 @@ const Quotationheader = (quotationCount) => { refreshCartf(); } }; - let { transactions } = useTransactions({ query }); + let transactions = null; + + if (auth) { + transactions = useTransactions({ query }); + } const refreshCartf = useCallback(async () => { setIsloading(true); - let pendingTransactions = transactions?.data?.saleOrders.filter(transaction => transaction.status === 'draft'); + let pendingTransactions = transactions?.data?.saleOrders.filter( + (transaction) => transaction.status === 'draft' + ); setProductQuotation(pendingTransactions); - setCountQuotation(pendingTransactions?.length ? pendingTransactions?.length : pendingTransactions?.length); + setCountQuotation( + pendingTransactions?.length + ? pendingTransactions?.length + : pendingTransactions?.length + ); setIsloading(false); }, [setProductQuotation, setIsloading]); useEffect(() => { - if (!qotation) return + if (!qotation) return; - let calculateTotalDiscountAmount = 0 + let calculateTotalDiscountAmount = 0; for (const product of qotation) { - // if (qotation.quantity == '') continue - calculateTotalDiscountAmount += product.amountUntaxed + // if (qotation.quantity == '') continue + calculateTotalDiscountAmount += product.amountUntaxed; } - let subTotal = calculateTotalDiscountAmount - setSubTotal(subTotal) - }, [qotation]) + let subTotal = calculateTotalDiscountAmount; + setSubTotal(subTotal); + }, [qotation]); useEffect(() => { if (refreshCart) { refreshCartf(); } setRefreshCart(false); - }, [ refreshCartf, setRefreshCart]); + }, [refreshCartf, setRefreshCart]); useEffect(() => { setCountQuotation(quotationCount.quotationCount); @@ -95,7 +113,10 @@ const Quotationheader = (quotationCount) => { const handleCheckout = async () => { SetButtonTerapkan(true); - let checkoutAll = await odooApi('POST', `/api/v1/user/${auth.id}/cart/select-all`); + let checkoutAll = await odooApi( + 'POST', + `/api/v1/user/${auth.id}/cart/select-all` + ); router.push('/my/quotations'); }; @@ -150,7 +171,9 @@ const Quotationheader = (quotationCount) => { className='w-full max-w-md p-2 bg-white border border-gray-200 rounded-lg shadow overflow-hidden' > <div className='p-2 flex justify-between items-center'> - <h5 className='text-base font-semibold leading-none'>Daftar Quotation</h5> + <h5 className='text-base font-semibold leading-none'> + Daftar Quotation + </h5> </div> <hr className='mt-3 mb-3 border border-gray-100' /> <div className='flow-root max-h-[250px] overflow-y-auto'> @@ -158,7 +181,10 @@ const Quotationheader = (quotationCount) => { <div className='justify-center p-4'> <p className='text-gray-500 text-center '> Silahkan{' '} - <Link href='/login' className='text-red-600 underline leading-6'> + <Link + href='/login' + className='text-red-600 underline leading-6' + > Login </Link>{' '} Untuk Melihat Daftar Quotation Anda @@ -167,7 +193,11 @@ const Quotationheader = (quotationCount) => { )} {isLoading && itemLoading.map((item) => ( - <div key={item} role='status' className='max-w-sm animate-pulse'> + <div + key={item} + role='status' + className='max-w-sm animate-pulse' + > <div className='flex items-center space-x-4 mb- 2'> <div className='flex-shrink-0'> <PhotoIcon className='h-16 w-16 text-gray-500' /> @@ -189,43 +219,70 @@ const Quotationheader = (quotationCount) => { )} {auth && qotation.length > 0 && !isLoading && ( <> - <ul role='list' className='divide-y divide-gray-200 dark:divide-gray-700'> + <ul + role='list' + className='divide-y divide-gray-200 dark:divide-gray-700' + > {qotation && qotation?.map((product, index) => ( <> <li className='py-1 sm:py-2'> <div className='flex justify-between border p-2 flex-col gap-y-2 hover:border-red-500'> - <Link + <Link href={`/my/quotations/${product?.id}`} - className='hover:border-red-500' - > + className='hover:border-red-500' + > <div className='flex justify-between mb-2'> <div className='flex flex-row items-center'> - <p className='tanggal text-xs opacity-80 mr-[2px]'>Sales : </p> - <p className='tanggal text-xs text-red-500 font-semibold'>{product.sales}</p> + <p className='tanggal text-xs opacity-80 mr-[2px]'> + Sales :{' '} + </p> + <p className='tanggal text-xs text-red-500 font-semibold'> + {product.sales} + </p> </div> <div className='flex flex-row items-center'> - <p className='text-xs opacity-80 mr-[2px]'>Status :</p> - <p className='badge-red h-fit text-xs whitespace-nowrap'>Pending Quotation</p> + <p className='text-xs opacity-80 mr-[2px]'> + Status : + </p> + <p className='badge-red h-fit text-xs whitespace-nowrap'> + Pending Quotation + </p> </div> </div> <div className='flex justify-between mb-2'> <div className='flex flex-col items-start'> - <p className=' text-xs opacity-80 mr-[2px]'>No. Transaksi</p> - <p className=' text-sm text-red-500 font-semibold'> {product.name}</p> + <p className=' text-xs opacity-80 mr-[2px]'> + No. Transaksi + </p> + <p className=' text-sm text-red-500 font-semibold'> + {' '} + {product.name} + </p> </div> <div className='flex flex-col items-end'> - <p className='text-xs opacity-80 mr-[2px]'>No. Purchase Order</p> - <p className='font-semibold text-sm text-red-500'> {product.purchaseOrderName ? product.purchaseOrderName : '-'}</p> + <p className='text-xs opacity-80 mr-[2px]'> + No. Purchase Order + </p> + <p className='font-semibold text-sm text-red-500'> + {' '} + {product.purchaseOrderName + ? product.purchaseOrderName + : '-'} + </p> </div> </div> {/* <div className='my-0.5 h-0.5 bg-gray-200'></div> */} <hr className='mt-3 mb-3 border border-gray-100' /> <div className='bagian bawah flex justify-between mt-2'> - <p className='font-semibold text-sm'>Total</p> - <p className='font-semibold text-sm'>{currencyFormat(product.amountUntaxed)}</p> + <p className='font-semibold text-sm'> + Total + </p> + <p className='font-semibold text-sm'> + {currencyFormat(product.amountUntaxed)} + </p> </div> - </Link> + </Link> </div> </li> </> @@ -238,8 +295,12 @@ const Quotationheader = (quotationCount) => { {auth && qotation.length > 0 && !isLoading && ( <> <div className='mt-3 ml-1'> - <span className='text-gray-400 text-caption-2'>Subtotal Sebelum PPN : </span> - <span className='font-semibold text-red-600'>{currencyFormat(subTotal)}</span> + <span className='text-gray-400 text-caption-2'> + Subtotal Sebelum PPN :{' '} + </span> + <span className='font-semibold text-red-600'> + {currencyFormat(subTotal)} + </span> </div> <div className='mt-5 mb-2'> <button diff --git a/src/lib/review/components/CustomerReviews.jsx b/src/lib/review/components/CustomerReviews.jsx index 7cad52fb..a6e697f0 100644 --- a/src/lib/review/components/CustomerReviews.jsx +++ b/src/lib/review/components/CustomerReviews.jsx @@ -1,18 +1,23 @@ -import DesktopView from '@/core/components/views/DesktopView' -import MobileView from '@/core/components/views/MobileView' -import Image from 'next/image' -import { Swiper, SwiperSlide } from 'swiper/react' -import { Autoplay } from 'swiper' +import DesktopView from '@/core/components/views/DesktopView'; +import MobileView from '@/core/components/views/MobileView'; +import Image from 'next/image'; +import { Swiper, SwiperSlide } from 'swiper/react'; +import { Autoplay } from 'swiper'; -const { useQuery } = require('react-query') -const { getCustomerReviews } = require('../api/customerReviewsApi') +const { useQuery } = require('react-query'); +const { getCustomerReviews } = require('../api/customerReviewsApi'); const CustomerReviews = () => { - const { data: customerReviews } = useQuery('customerReviews', getCustomerReviews) + const { data: customerReviews } = useQuery( + 'customerReviews', + getCustomerReviews + ); return ( <div className='px-4 sm:px-0'> - <div className='font-semibold sm:text-h-lg mb-4'>Ulasan Konsumen Kami</div> + <h1 className='font-semibold text-[14px] sm:text-h-lg mb-4'> + Ulasan Konsumen Kami + </h1> <DesktopView> <Swiper slidesPerView={3.2} spaceBetween={16} {...swiperProps}> @@ -36,17 +41,17 @@ const CustomerReviews = () => { </Swiper> </MobileView> </div> - ) -} + ); +}; const swiperProps = { autoplay: { delay: 6000, - disableOnInteraction: false + disableOnInteraction: false, }, loop: true, - modules: [Autoplay] -} + modules: [Autoplay], +}; const Card = ({ customerReview }) => ( <div className='bg-gray-200 rounded-md px-5 py-6 shadow-md shadow-gray-500/20 h-full'> @@ -67,6 +72,6 @@ const Card = ({ customerReview }) => ( dangerouslySetInnerHTML={{ __html: customerReview.ulasan }} /> </div> -) +); -export default CustomerReviews +export default CustomerReviews; diff --git a/src/lib/tracking-order/component/TrackingOrder.jsx b/src/lib/tracking-order/component/TrackingOrder.jsx index 394979c1..8a7b2579 100644 --- a/src/lib/tracking-order/component/TrackingOrder.jsx +++ b/src/lib/tracking-order/component/TrackingOrder.jsx @@ -1,139 +1,161 @@ -import { yupResolver } from '@hookform/resolvers/yup' -import React, { useEffect, useState } from 'react' -import { useForm } from 'react-hook-form' -import * as Yup from 'yup' -import Manifest from '@/lib/treckingAwb/component/Manifest' -import { trackingOrder } from '../api/trackingOrder' -import { useQuery } from 'react-query' +import { yupResolver } from '@hookform/resolvers/yup'; +import React, { useEffect, useState } from 'react'; +import { useForm } from 'react-hook-form'; +import * as Yup from 'yup'; +import Manifest from '@/lib/treckingAwb/component/Manifest'; +import { trackingOrder } from '../api/trackingOrder'; +import { useQuery } from 'react-query'; import { Spinner } from '@chakra-ui/react'; import { Search } from 'lucide-react'; -import whatsappUrl from '@/core/utils/whatsappUrl'; -import Link from 'next/link' +import Link from 'next/link'; const TrackingOrder = () => { - const [idAWB, setIdAWB] = useState(null) - const [inputQuery, setInputQuery] = useState(null) - const [buttonClick, setButtonClick] = useState(false) - const [apiError, setApiError] = useState(null) // State to store API error message - - const closePopup = () => { - setIdAWB(null) - setButtonClick(false) - setInputQuery(null) - setApiError(null) // Reset error message on close - } - - const { - register, - handleSubmit, - formState: { errors }, - control, - reset - } = useForm({ - resolver: yupResolver(validationSchema), - defaultValues - }) - - const query = { - email: inputQuery?.email, - so: inputQuery?.id - } - - const { data: tracking, isLoading, isError, error } = useQuery( - ['tracking', query], - () => trackingOrder({ query: query }), - { - enabled: !!query.email && !!query.so, - onSuccess: (data) => { - if (buttonClick) { - if (data?.code === 403 || data?.code === 400 || data?.code === 404) { - setApiError(data?.description); - } else if (data?.pickings?.length > 0) { - setIdAWB(data.pickings[0]?.id); - } else { - setApiError('No pickings data available'); - } - setButtonClick(false); - setInputQuery(null); - } - }, + const [idAWB, setIdAWB] = useState(null); + const [inputQuery, setInputQuery] = useState(null); + const [buttonClick, setButtonClick] = useState(false); + const [apiError, setApiError] = useState(null); // State to store API error message + + const closePopup = () => { + setIdAWB(null); + setButtonClick(false); + setInputQuery(null); + setApiError(null); // Reset error message on close + }; + + const { + register, + handleSubmit, + formState: { errors }, + control, + reset, + } = useForm({ + resolver: yupResolver(validationSchema), + defaultValues, + }); + + const query = { + email: inputQuery?.email, + so: inputQuery?.id, + }; + + const { + data: tracking, + isLoading, + isError, + error, + } = useQuery(['tracking', query], () => trackingOrder({ query: query }), { + enabled: !!query.email && !!query.so, + onSuccess: (data) => { + if (buttonClick) { + if (data?.code === 403 || data?.code === 400 || data?.code === 404) { + setApiError(data?.description); + } else if (data?.pickings?.length > 0) { + setIdAWB(data.pickings[0]?.id); + } else { + setApiError('No pickings data available'); } - ); + setButtonClick(false); + setInputQuery(null); + } + }, + }); - const onSubmitHandler = async (values) => { - setInputQuery(values) - setButtonClick(true) - } + const onSubmitHandler = async (values) => { + setInputQuery(values); + setButtonClick(true); + }; - return ( - <div className='container mx-auto flex py-10 flex-col'> - <h1 className='text-h-sm md:text-title-sm font-semibold mb-6'>Tracking Order</h1> - <div className='flex justify-start items-start'> - <span className='text-base w-full'> - {`Untuk melacak pesanan Anda, masukkan Nomor Transaksi di kotak bawah ini dan masukkan Email login anda lalu tekan tombol "Lacak". Nomor Transaksi ini dapat Anda lihat dalam menu `} - <Link href='/my/transactions' className='text-red-500'> - Daftar Transaksi - </Link> - {`. Jika mengalami kesulitan `} - <Link href='https://wa.me/6281717181922' target='_blank' rel='noreferrer' className='text-red-500'> - hubungi kami - </Link> - {`.`} - </span> + return ( + <div className='container mx-auto flex py-10 flex-col'> + <h1 className='text-h-sm md:text-title-sm font-semibold mb-6'> + Tracking Order + </h1> + <div className='flex justify-start items-start'> + <p className='text-base w-full'> + {`Untuk melacak pesanan Anda, masukkan Nomor Transaksi di kotak bawah ini dan masukkan Email login anda lalu tekan tombol "Lacak". Nomor Transaksi ini dapat Anda lihat dalam menu `} + <Link href='/my/transactions' className='text-red-500'> + Daftar Transaksi + </Link> + {`. Jika mengalami kesulitan `} + <Link + href='https://wa.me/6281717181922' + target='_blank' + rel='noreferrer' + className='text-red-500' + > + hubungi kami + </Link> + {`.`} + </p> + </div> + <div> + <form + onSubmit={handleSubmit(onSubmitHandler)} + className='flex mt-4 flex-row w-full ' + > + <div className='w-[90%] grid grid-cols-2 gap-4'> + <div className='flex flex-col '> + <label className='form-label mb-2'>ID Pesanan*</label> + <input + {...register('id')} + placeholder='dapat dilihat pada email konfirmasi anda' + type='text' + className='form-input mb-2' + aria-invalid={errors.id?.message} + /> + <div className='text-caption-2 text-danger-500 mt-1'> + {errors.id?.message} + </div> </div> - <div> - <form onSubmit={handleSubmit(onSubmitHandler)} className='flex mt-4 flex-row w-full '> - <div className='w-[90%] grid grid-cols-2 gap-4'> - <div className='flex flex-col '> - <label className='form-label mb-2'>ID Pesanan*</label> - <input - {...register('id')} - placeholder='dapat dilihat pada email konfirmasi anda' - type='text' - className='form-input mb-2' - aria-invalid={errors.id?.message} - /> - <div className='text-caption-2 text-danger-500 mt-1'>{errors.id?.message}</div> - </div> - <div className='flex flex-col '> - <label className='form-label mb-2'>Email Penagihan*</label> - <input - {...register('email')} - placeholder='Email yang anda gunakan saat pembayaran' - type='text' - className='form-input' - aria-invalid={errors.email?.message} - /> - <div className='text-caption-2 text-danger-500 mt-1'>{errors.email?.message}</div> - </div> - </div> - <div className={` ${errors.id?.message ? 'mt-2' : 'mt-5'} flex items-center ml-4`}> - <button - type='submit' - className='bg-red-600 border border-red-600 rounded-md text-sm text-white w-24 h-11 mb-1 content-center flex flex-row justify-center items-center' - > - {isLoading && <Spinner size='xs' className='mr-2'/>} - {!isLoading && <Search size={16} strokeWidth={1} className='mr-2'/>} - <p>Lacak</p> - </button> - </div> - </form> - {/* Display the API error message */} - {apiError && <div className='text-danger-500 mt-4'>{apiError}</div>} - <Manifest idAWB={idAWB} closePopup={closePopup} /> + <div className='flex flex-col '> + <label className='form-label mb-2'>Email Penagihan*</label> + <input + {...register('email')} + placeholder='Email yang anda gunakan saat pembayaran' + type='text' + className='form-input' + aria-invalid={errors.email?.message} + /> + <div className='text-caption-2 text-danger-500 mt-1'> + {errors.email?.message} + </div> </div> - </div> - ) -} + </div> + <div + className={` ${ + errors.id?.message ? 'mt-2' : 'mt-5' + } flex items-center ml-4`} + > + <button + type='submit' + className='bg-red-600 border border-red-600 rounded-md text-sm text-white w-24 h-11 mb-1 content-center flex flex-row justify-center items-center' + > + {isLoading && <Spinner size='xs' className='mr-2' />} + {!isLoading && ( + <Search size={16} strokeWidth={1} className='mr-2' /> + )} + <p>Lacak</p> + </button> + </div> + </form> + {/* Display the API error message */} + {apiError && <div className='text-danger-500 mt-4'>{apiError}</div>} + <Manifest idAWB={idAWB} closePopup={closePopup} /> + </div> + </div> + ); +}; const validationSchema = Yup.object().shape({ - email: Yup.string().email('Format harus seperti contoh@email.com').required('Harus di-isi'), - id: Yup.string().required('Harus di-isi'), -}) + email: Yup.string() + .email('Format harus seperti contoh@email.com') + .required('Harus di-isi'), + id: Yup.string().required('Harus di-isi'), +}); const defaultValues = { - email: '', - id: '' -} + email: '', + id: '', +}; -export default TrackingOrder +export default TrackingOrder; |
