diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-05-11 16:52:33 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-05-11 16:52:33 +0700 |
| commit | c520c39918694e793da661c30975d6c4b60eb63c (patch) | |
| tree | 50256725bb6e13d2b7d497ad259387f0519d5a5d /src/lib | |
| parent | b027c12d678698a9b8adcf4508a6160321c8172a (diff) | |
fix rfq title and customer review
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/form/components/RequestForQuotation.jsx | 2 | ||||
| -rw-r--r-- | src/lib/review/api/customerReviewsApi.js | 6 | ||||
| -rw-r--r-- | src/lib/review/components/CustomerReviews.jsx | 62 |
3 files changed, 69 insertions, 1 deletions
diff --git a/src/lib/form/components/RequestForQuotation.jsx b/src/lib/form/components/RequestForQuotation.jsx index cd8fbfd6..31efb5d6 100644 --- a/src/lib/form/components/RequestForQuotation.jsx +++ b/src/lib/form/components/RequestForQuotation.jsx @@ -77,7 +77,7 @@ const RequestForQuotation = () => { } return ( <div className='container mx-auto p-4 md:p-0 my-0 md:my-10'> - <h1 className='text-h-sm md:text-title-sm font-semibold mb-6'>Kunjungan Sales</h1> + <h1 className='text-h-sm md:text-title-sm font-semibold mb-6'>Request for Quotation</h1> <div className='w-full grid grid-cols-1 md:grid-cols-2'> <form onSubmit={handleSubmit(onSubmitHandler)} className='grid grid-cols-1 gap-y-6'> diff --git a/src/lib/review/api/customerReviewsApi.js b/src/lib/review/api/customerReviewsApi.js new file mode 100644 index 00000000..1058b72e --- /dev/null +++ b/src/lib/review/api/customerReviewsApi.js @@ -0,0 +1,6 @@ +import odooApi from "@/core/api/odooApi" + +export const getCustomerReviews = async () => { + const response = await odooApi('GET', '/api/v1/customer_review') + return response +}
\ No newline at end of file diff --git a/src/lib/review/components/CustomerReviews.jsx b/src/lib/review/components/CustomerReviews.jsx new file mode 100644 index 00000000..935d4a3d --- /dev/null +++ b/src/lib/review/components/CustomerReviews.jsx @@ -0,0 +1,62 @@ +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' + +const { useQuery } = require('react-query') +const { getCustomerReviews } = require('../api/customerReviewsApi') + +const CustomerReviews = () => { + const { data: customerReviews } = useQuery('customerReviews', getCustomerReviews) + + return ( + <div className='px-4 sm:px-0'> + <div className='font-medium sm:text-h-lg mb-4'>Ulasan Konsumen Kami</div> + + <DesktopView> + <Swiper slidesPerView={3.2} spaceBetween={16}> + {customerReviews && + customerReviews?.map((customerReview) => ( + <SwiperSlide className='pb-4' key={customerReview.id}> + <Card customerReview={customerReview} /> + </SwiperSlide> + ))} + </Swiper> + </DesktopView> + + <MobileView> + <Swiper slidesPerView={1.1} spaceBetween={8}> + {customerReviews && + customerReviews?.map((customerReview) => ( + <SwiperSlide className='pb-4' key={customerReview.id}> + <Card customerReview={customerReview} /> + </SwiperSlide> + ))} + </Swiper> + </MobileView> + </div> + ) +} + +const Card = ({ customerReview }) => ( + <div className='bg-gray-200 rounded-md px-5 py-6 shadow-md shadow-gray-500/20 h-full'> + <div className='flex items-center space-x-3 mb-4'> + <Image + src={customerReview.image} + alt={customerReview.customerName} + width={48} + height={48} + className='rounded-full border border-yellow-400' + /> + <div className='text-body-2 sm:text-body-1 font-semibold leading-6 text-gray-900'> + {customerReview.customerName} + </div> + </div> + <div + className='leading-7 text-gray-800' + dangerouslySetInnerHTML={{ __html: customerReview.ulasan }} + /> + </div> +) + +export default CustomerReviews |
