From a1b0e672387747085c85c6c446cea49f09af7719 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Sat, 23 Aug 2025 08:49:46 +0700 Subject: Move stock position mobile --- .../product-detail/components/PriceAction.tsx | 43 ++++++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'src-migrate/modules/product-detail/components/PriceAction.tsx') diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx index 850c2d9d..f5c2d7b3 100644 --- a/src-migrate/modules/product-detail/components/PriceAction.tsx +++ b/src-migrate/modules/product-detail/components/PriceAction.tsx @@ -17,7 +17,9 @@ type Props = { product: IProductDetail; }; -const PPN : number = process.env.NEXT_PUBLIC_PPN ? parseFloat(process.env.NEXT_PUBLIC_PPN) : 0; +const PPN: number = process.env.NEXT_PUBLIC_PPN + ? parseFloat(process.env.NEXT_PUBLIC_PPN) + : 0; const PriceAction = ({ product }: Props) => { const { activePrice, @@ -104,6 +106,21 @@ const PriceAction = ({ product }: Props) => { Termasuk PPN: Rp{' '} {formatCurrency(Math.round(activePrice.price_discount * PPN))} + {isMobile && ( +
+ + Stock : {sla?.qty}{' '} + + {/* + {' '} + */} +
+ )} )} @@ -149,19 +166,21 @@ const PriceAction = ({ product }: Props) => { -
- - Stock : {sla?.qty}{' '} - - {/* + {isDesktop && ( +
+ + Stock : {sla?.qty}{' '} + + {/* {' '} */} -
+
+ )}
{qtyPickUp > 0 && ( -- cgit v1.2.3 From 47cc09c7f74b2c37f0fc1a98e50f7d76774ea4a4 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Sat, 23 Aug 2025 08:55:34 +0700 Subject: Move price --- .../product-detail/components/PriceAction.tsx | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src-migrate/modules/product-detail/components/PriceAction.tsx') diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx index f5c2d7b3..7548e016 100644 --- a/src-migrate/modules/product-detail/components/PriceAction.tsx +++ b/src-migrate/modules/product-detail/components/PriceAction.tsx @@ -92,13 +92,13 @@ const PriceAction = ({ product }: Props) => {
{Math.floor(activePrice.discount_percentage)}%
-
- Rp {formatCurrency(activePrice.price || 0)} +
+ Rp {formatCurrency(activePrice.price_discount || 0)}
)} -
- Rp {formatCurrency(activePrice.price_discount || 0)} +
+ Rp {formatCurrency(activePrice.price || 0)}
@@ -107,19 +107,19 @@ const PriceAction = ({ product }: Props) => { {formatCurrency(Math.round(activePrice.price_discount * PPN))}
{isMobile && ( -
- - Stock : {sla?.qty}{' '} - - {/* +
+ + Stock : {sla?.qty}{' '} + + {/* {' '} */} -
+
)} )} -- cgit v1.2.3 From bb2763a47ae15b718b9ed532b4b3bdd68d0d8867 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Sat, 23 Aug 2025 09:32:03 +0700 Subject: Button Position --- .../product-detail/components/PriceAction.tsx | 68 ++++++++++++++++------ 1 file changed, 50 insertions(+), 18 deletions(-) (limited to 'src-migrate/modules/product-detail/components/PriceAction.tsx') diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx index 7548e016..9d45a7c3 100644 --- a/src-migrate/modules/product-detail/components/PriceAction.tsx +++ b/src-migrate/modules/product-detail/components/PriceAction.tsx @@ -12,6 +12,8 @@ import { getAuth } from '~/libs/auth'; import useDevice from '@/core/hooks/useDevice'; import odooApi from '~/libs/odooApi'; import { Button, Skeleton } from '@chakra-ui/react'; +import DesktopView from '@/core/components/views/DesktopView'; +import MobileView from '@/core/components/views/MobileView'; type Props = { product: IProductDetail; @@ -201,30 +203,60 @@ const PriceAction = ({ product }: Props) => {
)}
- -
- - {!isApproval && ( + +
+ {!isApproval && ( + + )} +
+
+ - )} -
-
- -
+
+ + +
+
+ +
+
+ {!isApproval && ( + + )} +
+
+ +
+
+
); }; -- cgit v1.2.3 From d61567c690970806273e40ee4748856d65a43d14 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Sat, 23 Aug 2025 10:21:38 +0700 Subject: More mobile change --- .../product-detail/components/PriceAction.tsx | 44 +++++++++++++++------- 1 file changed, 31 insertions(+), 13 deletions(-) (limited to 'src-migrate/modules/product-detail/components/PriceAction.tsx') diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx index 9d45a7c3..2cdfc9a2 100644 --- a/src-migrate/modules/product-detail/components/PriceAction.tsx +++ b/src-migrate/modules/product-detail/components/PriceAction.tsx @@ -89,19 +89,37 @@ const PriceAction = ({ product }: Props) => { {!!activePrice && activePrice.price > 0 && ( <>
- {activePrice.discount_percentage > 0 && ( - <> -
- {Math.floor(activePrice.discount_percentage)}% -
-
- Rp {formatCurrency(activePrice.price_discount || 0)} -
- - )} -
- Rp {formatCurrency(activePrice.price || 0)} -
+ + {activePrice.discount_percentage > 0 && ( + <> +
+ {Math.floor(activePrice.discount_percentage)}% +
+
+ Rp {formatCurrency(activePrice.price_discount || 0)} +
+ + )} +
+ Rp {formatCurrency(activePrice.price || 0)} +
+
+ + {activePrice.discount_percentage > 0 && ( + <> +
+ {Math.floor(activePrice.discount_percentage)}% +
+ +
+ Rp {formatCurrency(activePrice.price || 0)} +
+ + )} +
+ Rp {formatCurrency(activePrice.price_discount || 0)} +
+
-- cgit v1.2.3 From 8067589f21bc41b651622240c491bf1a9e5e9d51 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Sat, 23 Aug 2025 11:21:21 +0700 Subject: Done --- .../product-detail/components/PriceAction.tsx | 227 +++++++++++++-------- 1 file changed, 147 insertions(+), 80 deletions(-) (limited to 'src-migrate/modules/product-detail/components/PriceAction.tsx') diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx index 2cdfc9a2..a90faee0 100644 --- a/src-migrate/modules/product-detail/components/PriceAction.tsx +++ b/src-migrate/modules/product-detail/components/PriceAction.tsx @@ -88,59 +88,49 @@ const PriceAction = ({ product }: Props) => { > {!!activePrice && activePrice.price > 0 && ( <> -
- + +
{activePrice.discount_percentage > 0 && ( <>
{Math.floor(activePrice.discount_percentage)}%
-
- Rp {formatCurrency(activePrice.price_discount || 0)} +
+ Rp {formatCurrency(activePrice.price || 0)}
)} -
- Rp {formatCurrency(activePrice.price || 0)} +
+ Rp {formatCurrency(activePrice.price_discount || 0)}
- - +
+
+
+ Termasuk PPN: Rp{' '} + {formatCurrency(Math.round(activePrice.price_discount * PPN))} +
+ + +
{activePrice.discount_percentage > 0 && ( <>
{Math.floor(activePrice.discount_percentage)}% -
- -
- Rp {formatCurrency(activePrice.price || 0)} +
{' '} +
+ Rp {formatCurrency(activePrice.price_discount || 0)}
)} -
- Rp {formatCurrency(activePrice.price_discount || 0)} +
+ Rp {formatCurrency(activePrice.price || 0)}
- -
-
-
- Termasuk PPN: Rp{' '} - {formatCurrency(Math.round(activePrice.price_discount * PPN))} -
- {isMobile && ( -
- - Stock : {sla?.qty}{' '} - - {/* - {' '} - */}
- )} +
+ Termasuk PPN: Rp{' '} + {formatCurrency(Math.round(activePrice.price_discount * PPN))} +
+ )} @@ -157,70 +147,147 @@ const PriceAction = ({ product }: Props) => { )} +
-
-
- - setQuantityInput(e.target.value)} - className={style['quantity-input']} - /> - -
+
+ {/* Qty */} +
+ + setQuantityInput(e.target.value)} + className='w-12 text-center outline-none border-x' + /> + +
- {isDesktop && ( + {/* Stok */}
Stock : {sla?.qty}{' '} - {/* - {' '} - */}
- )} -
- {qtyPickUp > 0 && ( - - pickup now + {qtyPickUp > 0 && ( + + pickup now + + )} +
+
+ + + {/* ===== MOBILE: grid kiri-kanan, kanan hanya qty ===== */} + +
+ {/* Kiri */} +
+ + Stock : {sla?.qty}{' '} + + + {qtyPickUp > 0 && ( +
+ + pickup now + +
+ * {qtyPickUp} barang bisa di pickup +
+
+ )} +
+ + {/* Kanan: hanya qty, rata kanan */} +
+
+ + setQuantityInput(e.target.value)} + className='w-12 text-center outline-none border-x' /> - - )} + +
+
-
+ {qtyPickUp > 0 && (
* {qtyPickUp} barang bisa di pickup
)}
+
Date: Sat, 23 Aug 2025 12:04:15 +0700 Subject: Fix Price --- .../product-detail/components/PriceAction.tsx | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src-migrate/modules/product-detail/components/PriceAction.tsx') diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx index a90faee0..25a1aa47 100644 --- a/src-migrate/modules/product-detail/components/PriceAction.tsx +++ b/src-migrate/modules/product-detail/components/PriceAction.tsx @@ -112,22 +112,32 @@ const PriceAction = ({ product }: Props) => {
- {activePrice.discount_percentage > 0 && ( + {activePrice.discount_percentage > 0 ? ( <>
{Math.floor(activePrice.discount_percentage)}% -
{' '} +
+ + {/* harga setelah diskon (main-price) di kiri */}
Rp {formatCurrency(activePrice.price_discount || 0)}
+ + {/* harga coret di kanan */} +
+ Rp {formatCurrency(activePrice.price || 0)} +
+ ) : ( + // kalau tidak ada diskon, tampilkan harga normal saja +
+ Rp {formatCurrency(activePrice.price || 0)} +
)} -
- Rp {formatCurrency(activePrice.price || 0)} -
-
- Termasuk PPN: Rp{' '} + +
+ Termasuk PPN: Rp{' '} {formatCurrency(Math.round(activePrice.price_discount * PPN))}
@@ -148,7 +158,7 @@ const PriceAction = ({ product }: Props) => { )} -
+
{/* Qty */}
-- cgit v1.2.3 From 7911c3d291b322a9832f9f4c65392552c11c8d10 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Tue, 26 Aug 2025 09:35:51 +0700 Subject: Fix --- .../product-detail/components/PriceAction.tsx | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src-migrate/modules/product-detail/components/PriceAction.tsx') diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx index 25a1aa47..60834880 100644 --- a/src-migrate/modules/product-detail/components/PriceAction.tsx +++ b/src-migrate/modules/product-detail/components/PriceAction.tsx @@ -206,18 +206,23 @@ const PriceAction = ({ product }: Props) => { {/* Pickup badge */}
{qtyPickUp > 0 && ( - - pickup now - +
+ + pickup now + +
)}
+ + * {qtyPickUp} barang bisa di pickup + {/* ===== MOBILE: grid kiri-kanan, kanan hanya qty ===== */} @@ -291,11 +296,6 @@ const PriceAction = ({ product }: Props) => {
- {qtyPickUp > 0 && ( -
- * {qtyPickUp} barang bisa di pickup -
- )}
-- cgit v1.2.3 From 28f9a1235fcf6fdde1983d0a4cf88fc3ba4fbdd2 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Tue, 26 Aug 2025 09:53:09 +0700 Subject: Fix lg --- .../product-detail/components/PriceAction.tsx | 54 +++++++++++++--------- 1 file changed, 32 insertions(+), 22 deletions(-) (limited to 'src-migrate/modules/product-detail/components/PriceAction.tsx') diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx index 60834880..2c678c6b 100644 --- a/src-migrate/modules/product-detail/components/PriceAction.tsx +++ b/src-migrate/modules/product-detail/components/PriceAction.tsx @@ -229,42 +229,47 @@ const PriceAction = ({ product }: Props) => {
{/* Kiri */} -
- - Stock : {sla?.qty}{' '} - +
+
+ + Stock : {sla?.qty} + - {qtyPickUp > 0 && ( -
+ {qtyPickUp > 0 && ( pickup now -
- * {qtyPickUp} barang bisa di pickup -
+ )} +
+ + {qtyPickUp > 0 && ( +
+ * {qtyPickUp} barang bisa di pickup
)}
{/* Kanan: hanya qty, rata kanan */}
-
+
+ setQuantityInput(e.target.value)} - className='w-12 text-center outline-none border-x' + className='h-11 md:h-12 w-16 md:w-20 text-center text-lg md:text-xl outline-none border-x + [appearance:textfield] + [&::-webkit-outer-spin-button]:appearance-none + [&::-webkit-inner-spin-button]:appearance-none' /> +
-- cgit v1.2.3 From 8e92e0b4bfb74ebdf99fbc9d4ca7d47e2513c4e0 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Tue, 26 Aug 2025 10:42:38 +0700 Subject: bring back old set qty for desktop view --- .../modules/product-detail/components/PriceAction.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src-migrate/modules/product-detail/components/PriceAction.tsx') diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx index 2c678c6b..5daf5bed 100644 --- a/src-migrate/modules/product-detail/components/PriceAction.tsx +++ b/src-migrate/modules/product-detail/components/PriceAction.tsx @@ -161,16 +161,15 @@ const PriceAction = ({ product }: Props) => {
{/* Qty */} -
+
{ min={1} value={quantityInput} onChange={(e) => setQuantityInput(e.target.value)} - className='w-12 text-center outline-none border-x' + className={style['quantity-input']} /> -- cgit v1.2.3 From 37bda78dec58cb8c218849a77620d95682b201b9 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Tue, 26 Aug 2025 15:38:29 +0700 Subject: Major Fix --- .../modules/product-detail/components/PriceAction.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src-migrate/modules/product-detail/components/PriceAction.tsx') diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx index 5daf5bed..ffc9ba40 100644 --- a/src-migrate/modules/product-detail/components/PriceAction.tsx +++ b/src-migrate/modules/product-detail/components/PriceAction.tsx @@ -341,6 +341,13 @@ const PriceAction = ({ product }: Props) => { quantity={Number(quantityInput)} />
+
+ +
{!isApproval && ( { /> )}
-
- -
-- cgit v1.2.3