summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrisusilo48 <tri.susilo@altama.co.id>2024-08-23 14:20:08 +0700
committertrisusilo48 <tri.susilo@altama.co.id>2024-08-23 14:20:08 +0700
commite17210013af6aa12e1641cd9055d892e16409e1e (patch)
tree3cc3adb21f804c75379970b36835cb5ae985a744
parent67731281227f961c9b56f9f310951a8e5c82ab39 (diff)
parent0cf2e5aa835155904a1242e74ff7935760513c48 (diff)
Merge branch 'release' of https://bitbucket.org/altafixco/next-indoteknik into release
-rw-r--r--public/images/PICKUP-NOW.pngbin0 -> 1926 bytes
-rw-r--r--src-migrate/modules/cart/components/Item.tsx9
-rw-r--r--src-migrate/types/cart.ts2
-rw-r--r--src-migrate/types/product.ts1
-rw-r--r--src/api/productApi.js5
-rw-r--r--src/components/ui/PopularProduct.jsx23
-rw-r--r--src/lib/checkout/components/Checkout.jsx4
-rw-r--r--src/lib/product/components/ProductCard.jsx32
-rw-r--r--src/pages/_document.jsx8
-rw-r--r--src/pages/api/activation-request.js2
-rw-r--r--src/pages/shop/brands/[slug].jsx2
-rw-r--r--src/utils/solrMapping.js1
12 files changed, 68 insertions, 21 deletions
diff --git a/public/images/PICKUP-NOW.png b/public/images/PICKUP-NOW.png
new file mode 100644
index 00000000..d7c01f44
--- /dev/null
+++ b/public/images/PICKUP-NOW.png
Binary files differ
diff --git a/src-migrate/modules/cart/components/Item.tsx b/src-migrate/modules/cart/components/Item.tsx
index 47893498..6ffbb524 100644
--- a/src-migrate/modules/cart/components/Item.tsx
+++ b/src-migrate/modules/cart/components/Item.tsx
@@ -17,11 +17,11 @@ import CartItemSelect from './ItemSelect'
type Props = {
item: CartItemProps
editable?: boolean
+ selfPicking?: boolean
pilihSemuaCart?: boolean
}
-const CartItem = ({ item, editable = true,}: Props) => {
-
+const CartItem = ({ item, editable = true, selfPicking}: Props) => {
return (
<div className={style.wrapper}>
{item.cart_type === 'promotion' && (
@@ -53,6 +53,11 @@ const CartItem = ({ item, editable = true,}: Props) => {
<CartItem.Image item={item} />
<div className={style.details}>
+ {(item.is_in_bu) && (item.on_hand_qty >= item.quantity) && (
+ <div className='text-[10px] text-red-500 italic'>
+ *Barang ini bisa di pickup maksimal pukul 16.00
+ </div>
+ )}
<CartItem.Name item={item} />
<div className='mt-2 flex justify-between w-full'>
diff --git a/src-migrate/types/cart.ts b/src-migrate/types/cart.ts
index 4e3c8b99..a3115103 100644
--- a/src-migrate/types/cart.ts
+++ b/src-migrate/types/cart.ts
@@ -32,6 +32,8 @@ export type CartItem = {
id: number;
name: string;
stock: number;
+ is_in_bu: boolean;
+ on_hand_qty: number;
weight: number;
attributes: string[];
parent: {
diff --git a/src-migrate/types/product.ts b/src-migrate/types/product.ts
index 681cdc8e..31ea0ce1 100644
--- a/src-migrate/types/product.ts
+++ b/src-migrate/types/product.ts
@@ -12,6 +12,7 @@ export interface IProduct {
variant_total: number;
description: string;
isSni: boolean;
+ is_in_bu: boolean;
isTkdn: boolean;
categories: {
id: string;
diff --git a/src/api/productApi.js b/src/api/productApi.js
index 009d95ef..4a29b59d 100644
--- a/src/api/productApi.js
+++ b/src/api/productApi.js
@@ -2,8 +2,11 @@ import axios from 'axios'
export const popularProductApi = () => {
return async () => {
+ const today = new Date();
+ const dayOfYear = Math.floor((today - new Date(today.getFullYear(), 0, 0)) / 86400000);
+ const page = (dayOfYear % 24) + 1;
const dataPopularProducts = await axios(
- `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/search?q=*&page=1&orderBy=popular-weekly&priceFrom=1`
+ `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/search?q=*&page=${page}&orderBy=stock&priceFrom=1`
)
return dataPopularProducts.data.response
}
diff --git a/src/components/ui/PopularProduct.jsx b/src/components/ui/PopularProduct.jsx
index bbbd18bc..92b2a1b6 100644
--- a/src/components/ui/PopularProduct.jsx
+++ b/src/components/ui/PopularProduct.jsx
@@ -5,6 +5,7 @@ import { useQuery } from 'react-query'
import { PopularProductSkeleton } from '../skeleton/PopularProductSkeleton'
import DesktopView from '@/core/components/views/DesktopView'
import ProductCard from '@/lib/product/components/ProductCard'
+import Link from '@/core/components/elements/Link/Link'
const PopularProduct = () => {
const popularProduct = useQuery('popularProduct', popularProductApi())
@@ -16,15 +17,31 @@ const PopularProduct = () => {
<>
<MobileView>
<div className='px-4'>
- <div className='font-semibold mb-4'>Produk Banyak Dilihat</div>
+ <div className='font-semibold mb-4 flex justify-between items-center'><p>
+ Produk Ready Stock
+ </p>
+ <Link
+ href='/shop/search?orderBy=stock'
+ className=''
+ >
+ <p className='text-danger-500 font-semibold'>Lihat Semua</p>
+ </Link></div>
<ProductSlider products={popularProduct.data} simpleTitle />
</div>
</MobileView>
<DesktopView>
<div className='border border-gray_r-6 h-full overflow-auto'>
- <div className='font-semibold text-center p-4 bg-gray_r-1 border-b border-gray_r-6 sticky top-0 z-10'>
- Produk Banyak Dilihat
+ <div className='font-semibold text-center p-4 bg-gray_r-1 border-b border-gray_r-6 sticky top-0 z-10 flex justify-between items-center'>
+ <p>
+ Produk Ready Stock
+ </p>
+ <Link
+ href='/shop/search?orderBy=stock'
+ className=''
+ >
+ <p className='text-danger-500 font-semibold'>Lihat Semua</p>
+ </Link>
</div>
<div className='h-full divide-y divide-gray_r-6'>
{popularProduct.data &&
diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index 47f148d1..58d1403a 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -1020,7 +1020,7 @@ const Checkout = () => {
<div className='p-4 flex flex-col gap-y-4'>
{!!products &&
snakecaseKeys(products).map((item, index) => (
- <CartItem key={index} item={item} editable={false} />
+ <CartItem key={index} item={item} editable={false} selfPicking={selectedExpedisi === '1,32' ? true : false}/>
))}
</div>
@@ -1311,7 +1311,7 @@ const Checkout = () => {
<div className='flex flex-col gap-y-8 border-t border-gray-300 pt-8'>
{!!products &&
snakecaseKeys(products).map((item, index) => (
- <CartItem key={index} item={item} editable={false} />
+ <CartItem key={index} item={item} editable={false} selfPicking={selectedExpedisi === '1,32' ? true : false} />
))}
</div>
</div>
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index 35e2a665..22ce0533 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -146,13 +146,22 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
)}
</Link>
<div className='p-2 sm:p-3 pb-3 text-caption-2 sm:text-body-2 leading-5'>
- {product?.manufacture?.name ? (
- <Link href={URL.manufacture} className='mb-1'>
- {product.manufacture.name}
+ <div className='flex justify-between '>
+ {product?.manufacture?.name ? (
+ <Link href={URL.manufacture} className='mb-1 mt-1'>
+ {product.manufacture.name}
+ </Link>
+ ) : (
+ <div>-</div>
+ )}
+ {product?.isInBu && (
+ <Link href='/panduan-pick-up-service' className='group'>
+ <Image src='/images/PICKUP-NOW.png' className='group-hover:scale-105 transition-transform duration-200' alt='pickup now' width={90} height={12} />
</Link>
- ) : (
- <div>-</div>
- )}
+
+
+ )}
+ </div>
<Link
href={URL.product}
className={`mb-2 !text-gray_r-12 leading-6 block line-clamp-3 h-[64px]`}
@@ -292,9 +301,18 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
</div>
)}
{product?.manufacture?.name ? (
- <Link href={URL.manufacture} className='mb-1'>
+ <div className='flex justify-between'>
+ <Link href={URL.manufacture} className='mb-1'>
{product.manufacture.name}
</Link>
+ {/* {product?.is_in_bu && (
+ <div className='bg-red-500 rounded'>
+ <span className='p-[6px] text-xs text-white'>
+ Click & Pickup
+ </span>
+ </div>
+ )} */}
+ </div>
) : (
<div>-</div>
)}
diff --git a/src/pages/_document.jsx b/src/pages/_document.jsx
index cd60bd89..6af6294f 100644
--- a/src/pages/_document.jsx
+++ b/src/pages/_document.jsx
@@ -41,13 +41,13 @@ export default function MyDocument() {
content='328wmjs7hcnz74rwsqzxvq50rmbtm2'
/>
- <Script
+ {/* <Script
async
strategy='beforeInteractive'
src='https://www.googletagmanager.com/gtag/js?id=UA-10501937-1'
- />
+ /> */}
- <Script
+ {/* <Script
async
id='google-analytics-ua'
strategy='beforeInteractive'
@@ -59,7 +59,7 @@ export default function MyDocument() {
gtag('config', 'UA-10501937-1');
`,
}}
- />
+ /> */}
<Script
async
diff --git a/src/pages/api/activation-request.js b/src/pages/api/activation-request.js
index 64a67bbc..98d27f78 100644
--- a/src/pages/api/activation-request.js
+++ b/src/pages/api/activation-request.js
@@ -7,7 +7,7 @@ export default async function handler(req, res) {
let result = await odooApi('POST', '/api/v1/user/activation-request', { email })
if (result.activationRequest) {
mailer.sendMail({
- from: 'noreply@indoteknik.com',
+ from: 'Indoteknik.com <noreply@indoteknik.com>',
to: result.user.email,
subject: 'Permintaan Aktivasi Akun Indoteknik',
html: `
diff --git a/src/pages/shop/brands/[slug].jsx b/src/pages/shop/brands/[slug].jsx
index e786ef78..88e9b302 100644
--- a/src/pages/shop/brands/[slug].jsx
+++ b/src/pages/shop/brands/[slug].jsx
@@ -18,7 +18,7 @@ export default function BrandDetail() {
const brandName = getNameFromSlug(slug)
const id = getIdFromSlug(slug)
const {brand} = useBrand({id})
- if (!brand || !brand.data || _.isEmpty(brand.data)) {
+ if ( !brand.isLoading && _.isEmpty(brand.data)) {
return <PageNotFound />;
}
return (
diff --git a/src/utils/solrMapping.js b/src/utils/solrMapping.js
index d4694eb2..fee474be 100644
--- a/src/utils/solrMapping.js
+++ b/src/utils/solrMapping.js
@@ -38,6 +38,7 @@ export const productMappingSolr = (products, pricelist) => {
qtySold: product?.qty_sold_f || 0,
isTkdn:product?.tkdn_b || false,
isSni:product?.sni_b || false,
+ is_in_bu:product?.is_in_bu_b || false,
voucherPastiHemat:product?.voucher_pastihemat || []
};