From 36601aba6017aeef16f89351eb487238402ab52e Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 24 Sep 2024 16:12:50 +0700 Subject: update Perapihan Tag --- src/lib/home/components/BannerSection.jsx | 20 +- src/lib/home/components/CategoryDynamic.jsx | 15 +- src/lib/home/components/CategoryDynamicMobile.jsx | 14 +- src/lib/home/components/CategoryHomeId.jsx | 18 +- src/lib/home/components/CategoryPilihan.jsx | 265 +++++++++++--------- src/lib/home/components/PromotionProgram.jsx | 118 ++++----- src/lib/home/components/ServiceList.jsx | 34 ++- src/lib/quotation/components/Quotationheader.jsx | 131 +++++++--- src/lib/review/components/CustomerReviews.jsx | 37 +-- src/lib/tracking-order/component/TrackingOrder.jsx | 272 +++++++++++---------- 10 files changed, 537 insertions(+), 387 deletions(-) (limited to 'src/lib') 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 = () => { {banner.name} { ))} ) - ) -} + ); +}; -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 = () => {
-
+

{category.name} -

+ {/*

{countLevel1} Produk tersedia

*/} @@ -113,9 +112,9 @@ const CategoryDynamic = () => { className='object-fit p-4' />
-
+

{subCategory?.name} -

+ {/*

{countLevel2} Produk tersedia @@ -157,9 +156,9 @@ const CategoryDynamic = () => { height={40} />

-
+

{childCategory.name} -

+
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) => (
-
- {category?.name} -
+

+ {category.name} +

{ className='' />
-
+

{index?.name} -

+
@@ -131,9 +131,9 @@ const CategoryDynamicMobile = () => { className='p-2' />
-
+

{x?.name} -

+
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 (
-
Kategori Pilihan
+

+ Kategori Pilihan +

{categoryHomeIds.data?.map((id) => ( @@ -16,7 +18,7 @@ const CategoryHomeId = () => { ))}
- ) -} + ); +}; -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 && ( -
- {isDesktop && ( -
-
-
LOB Kategori Pilihan
-

200 Rb+ Produk Unggulan & 800+ Brand Rekomendasi tersedia!

-
- {heroBanner.data && - heroBanner.data?.length > 0 && ( -
- - {heroBanner.data[0].name} - -
- )} -
- {categoryPilihan?.data?.map((category) => ( -
-
-
-
- {category?.name} -
-

{category?.industries}

-
-
-
- - Lihat semua - -
-
- ))} + const { isDesktop, isMobile } = useDevice(); + const { categoryPilihan } = useCategoryPilihan(); + const heroBanner = useQuery( + 'categoryPilihan', + bannerApi({ type: 'banner-category-list' }) + ); + return ( + categoryPilihan.length > 0 && ( +
+ {isDesktop && ( +
+
+
+ LOB Kategori Pilihan +
+

+ 200 Rb+ Produk Unggulan & 800+ Brand Rekomendasi tersedia! +

+
+ {heroBanner.data && heroBanner.data?.length > 0 && ( +
+ + {heroBanner.data[0].name} + +
+ )} +
+ {categoryPilihan?.data?.map((category) => ( +
+
+
+
+ {category?.name} +
+

+ {category?.industries} +

+
+
+ + Lihat semua + +
- )} - {isMobile && ( -
-
-
LOB Kategori Pilihan
- {/*

200 Rb+ Produk Unggulan & 800+ Brand Rekomendasi tersedia!

*/} + ))} +
+
+ )} + {isMobile && ( +
+
+
+ LOB Kategori Pilihan +
+ {/*

200 Rb+ Produk Unggulan & 800+ Brand Rekomendasi tersedia!

*/} +
+
+ {heroBanner.data && heroBanner.data?.length > 0 && ( +
+ + {heroBanner.data[0].name} + +
+ )} +
+ + {categoryPilihan?.data?.map((category) => ( + +
+
+
+
+ {category?.name} +
+

+ {category?.industries} +

+
-
- {heroBanner.data && - heroBanner.data?.length > 0 && ( -
- - {heroBanner.data[0].name} - -
- )} +
+ + Lihat semua +
- - {categoryPilihan?.data?.map((category) => ( - -
-
-
-
- {category?.name} -
-

{category?.industries}

-
-
-
- - Lihat semua - -
-
-
- ))} - -
- -
- )} -
- - ) - ) -} +
+ + ))} + +
+ )} +
+ ) + ); +}; -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 ; @@ -16,60 +19,65 @@ const BannerSection = () => { return (
-

Promo Tersedia

+

+ {' '} + + Promo Tersedia + +

{isDesktop && ( - Lihat Semua - + Lihat Semua + )} {isMobile && ( - - Lihat Semua - - )} -
- {isDesktop && (promotionProgram.data && - promotionProgram.data?.length > 0 && ( -
- {promotionProgram.data?.map((banner) => ( - - {banner.name} + + Lihat Semua - ))} + )}
- - ))} + {isDesktop && + promotionProgram.data && + promotionProgram.data?.length > 0 && ( +
+ {promotionProgram.data?.map((banner) => ( + + {banner.name} + + ))} +
+ )} -{isMobile && ( - - - {promotionProgram.data?.map((banner) => ( - - - {banner.name} - - - ))} - - - )} + {isMobile && ( + + {promotionProgram.data?.map((banner) => ( + + + {banner.name} + + + ))} + + )}
- - ) -} + ); +}; -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 = () => {
-

One Stop Solution

+

+ One Stop Solution +

Temukan Solusi Lengkap Anda dalam Satu Tempat.

@@ -37,14 +39,16 @@ const ServiceList = () => {
-

Garansi Resmi

+

+ Garansi Resmi +

Garansi Keaslian Barang dan Jaminan Purna Jual.

@@ -60,14 +64,16 @@ const ServiceList = () => {
-

Pembayaran Tempo

+

+ Pembayaran Tempo +

Lebih mudah mengatur pembelian dengan pembayaran tempo.

@@ -83,14 +89,16 @@ const ServiceList = () => {
-

Faktur Pajak

+

+ Faktur Pajak +

Dapat Faktur pajak untuk setiap transaksi dengan indoteknik.com

@@ -99,7 +107,7 @@ const ServiceList = () => {
- ) -} + ); +}; -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' >
-
Daftar Quotation
+
+ Daftar Quotation +

@@ -158,7 +181,10 @@ const Quotationheader = (quotationCount) => {

Silahkan{' '} - + Login {' '} Untuk Melihat Daftar Quotation Anda @@ -167,7 +193,11 @@ const Quotationheader = (quotationCount) => { )} {isLoading && itemLoading.map((item) => ( -

+
@@ -189,43 +219,70 @@ const Quotationheader = (quotationCount) => { )} {auth && qotation.length > 0 && !isLoading && ( <> -
    +
      {qotation && qotation?.map((product, index) => ( <>
    • - + className='hover:border-red-500' + >
      -

      Sales :

      -

      {product.sales}

      +

      + Sales :{' '} +

      +

      + {product.sales} +

      -

      Status :

      -

      Pending Quotation

      +

      + Status : +

      +

      + Pending Quotation +

      -

      No. Transaksi

      -

      {product.name}

      +

      + No. Transaksi +

      +

      + {' '} + {product.name} +

      -

      No. Purchase Order

      -

      {product.purchaseOrderName ? product.purchaseOrderName : '-'}

      +

      + No. Purchase Order +

      +

      + {' '} + {product.purchaseOrderName + ? product.purchaseOrderName + : '-'} +

      {/*
      */}
      -

      Total

      -

      {currencyFormat(product.amountUntaxed)}

      +

      + Total +

      +

      + {currencyFormat(product.amountUntaxed)} +

      - +
    • @@ -238,8 +295,12 @@ const Quotationheader = (quotationCount) => { {auth && qotation.length > 0 && !isLoading && ( <>
      - Subtotal Sebelum PPN : - {currencyFormat(subTotal)} + + Subtotal Sebelum PPN :{' '} + + + {currencyFormat(subTotal)} +
      -
      - - {/* Display the API error message */} - {apiError &&
      {apiError}
      } - +
      + + +
      + {errors.email?.message} +
      -
- ) -} +
+
+ +
+ + {/* Display the API error message */} + {apiError &&
{apiError}
} + +
+
+ ); +}; 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; -- cgit v1.2.3 From 6448a83e088b68195e9b94036d3e8e2184ae701c Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 24 Sep 2024 16:54:37 +0700 Subject: update code --- src/lib/brand/components/BrandCard.jsx | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src/lib') 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 ( { }`} > {brand.logo && ( - {brand.name} )} {!brand.logo && ( - + {brand.name} )} - ) -} + ); +}; -export default BrandCard +export default BrandCard; -- cgit v1.2.3