From f62b2345f463695ef0f8f79830cd76b6e0332821 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Sat, 13 Jan 2024 10:35:22 +0700 Subject: Refactor src migrate folder --- src-migrate/pages/shop/cart/cart.module.css | 31 ++++++++++ src-migrate/pages/shop/cart/index.tsx | 93 +++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 src-migrate/pages/shop/cart/cart.module.css create mode 100644 src-migrate/pages/shop/cart/index.tsx (limited to 'src-migrate/pages/shop/cart') diff --git a/src-migrate/pages/shop/cart/cart.module.css b/src-migrate/pages/shop/cart/cart.module.css new file mode 100644 index 00000000..d523a55a --- /dev/null +++ b/src-migrate/pages/shop/cart/cart.module.css @@ -0,0 +1,31 @@ +.title { + @apply text-h-lg font-semibold; +} + +.content { + @apply flex flex-wrap; +} + +.item-wrapper { + @apply w-full md:w-3/4; +} + +.item-skeleton { + @apply grid grid-cols-1 gap-y-4; +} + +.items { + @apply flex flex-col gap-y-6 border-t border-gray-300 pt-6; +} + +.summary-wrapper { + @apply w-full md:w-1/4 md:pl-6 mt-6 md:mt-0; +} + +.summary { + @apply border border-gray-300 p-4 rounded-md sticky top-[180px]; +} + +.summary-buttons { + @apply grid grid-cols-2 gap-x-3 mt-6; +} diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx new file mode 100644 index 00000000..397852f9 --- /dev/null +++ b/src-migrate/pages/shop/cart/index.tsx @@ -0,0 +1,93 @@ +import style from './cart.module.css' + +import React, { useEffect, useMemo } from 'react' +import Link from 'next/link' +import { Button, Tooltip } from '@chakra-ui/react' + +import { getAuth } from '~/libs/auth' +import { useCartStore } from '~/modules/cart/stores/useCartStore' + +import CartItem from '~/modules/cart/components/Item' +import CartSummary from '~/modules/cart/components/Summary' + +const CartPage = () => { + const auth = getAuth() + + const { loadCart, cart, summary } = useCartStore() + + useEffect(() => { + if (typeof auth === 'object' && !cart) loadCart(auth.id) + }, [auth, loadCart, cart]) + + const hasSelectedPromo = useMemo(() => { + if (!cart) return false + for (const item of cart.products) { + if (item.cart_type === 'promotion' && item.selected) return true + } + return false + }, [cart]) + + const hasSelected = useMemo(() => { + if (!cart) return false + for (const item of cart.products) { + if (item.selected) return true + } + return false + }, [cart]) + + return ( + <> +
+ Keranjang Belanja +
+ +
+ +
+
+
+ {!cart && } +
+ +
+ {cart?.products.map((item) => )} +
+
+ +
+
+ + +
+ + + + + + + +
+
+
+
+ + ) +} + +export default CartPage \ No newline at end of file -- cgit v1.2.3 From fb80b92d502437160e45b237b380071ab102c838 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 22 Jan 2024 10:41:53 +0700 Subject: Update disable checkout when has product price 0 and fix filter brand --- src-migrate/pages/shop/cart/index.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src-migrate/pages/shop/cart') diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx index 397852f9..9ec58a48 100644 --- a/src-migrate/pages/shop/cart/index.tsx +++ b/src-migrate/pages/shop/cart/index.tsx @@ -9,6 +9,7 @@ import { useCartStore } from '~/modules/cart/stores/useCartStore' import CartItem from '~/modules/cart/components/Item' import CartSummary from '~/modules/cart/components/Summary' +import clsxm from '~/libs/clsxm' const CartPage = () => { const auth = getAuth() @@ -35,6 +36,14 @@ const CartPage = () => { return false }, [cart]) + const hasSelectNoPrice = useMemo(() => { + if (!cart) return false + for (const item of cart.products) { + if (item.selected && item.price.price_discount == 0) return true + } + return false + }, [cart]) + return ( <>
@@ -71,11 +80,14 @@ const CartPage = () => { - +
-- cgit v1.2.3 From 9a52d9f835e2f30480142c6197fdf14b3fee5ead Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 12 Mar 2024 09:17:01 +0700 Subject: feedback kerajang di mobile --- src-migrate/pages/shop/cart/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src-migrate/pages/shop/cart') diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx index 9ec58a48..6c37b434 100644 --- a/src-migrate/pages/shop/cart/index.tsx +++ b/src-migrate/pages/shop/cart/index.tsx @@ -10,11 +10,15 @@ import { useCartStore } from '~/modules/cart/stores/useCartStore' import CartItem from '~/modules/cart/components/Item' import CartSummary from '~/modules/cart/components/Summary' import clsxm from '~/libs/clsxm' +import useDevice from '@/core/hooks/useDevice' +import CartSummaryMobile from '~/modules/cart/components/CartSummaryMobile' const CartPage = () => { const auth = getAuth() const { loadCart, cart, summary } = useCartStore() + + const useDivvice = useDevice(); useEffect(() => { if (typeof auth === 'object' && !cart) loadCart(auth.id) @@ -65,7 +69,8 @@ const CartPage = () => {
- + {useDivvice.isMobile && } + {!useDivvice.isMobile && }
-- cgit v1.2.3 From 5234b7c85ac984bc76d8945934a90b75f4a0d8c0 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 12 Mar 2024 15:07:56 +0700 Subject: feeback review --- src-migrate/pages/shop/cart/cart.module.css | 4 +- src-migrate/pages/shop/cart/index.tsx | 129 +++++++++++++++++----------- 2 files changed, 82 insertions(+), 51 deletions(-) (limited to 'src-migrate/pages/shop/cart') diff --git a/src-migrate/pages/shop/cart/cart.module.css b/src-migrate/pages/shop/cart/cart.module.css index 353b131a..98a6ac86 100644 --- a/src-migrate/pages/shop/cart/cart.module.css +++ b/src-migrate/pages/shop/cart/cart.module.css @@ -3,11 +3,11 @@ } .content { - @apply flex flex-wrap; + @apply flex flex-wrap ; } .item-wrapper { - @apply w-full md:w-3/4; + @apply w-full md:w-3/4 min-h-screen; } .item-skeleton { diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx index d1a6a6ff..4b4de92b 100644 --- a/src-migrate/pages/shop/cart/index.tsx +++ b/src-migrate/pages/shop/cart/index.tsx @@ -1,59 +1,57 @@ -import style from './cart.module.css' +import style from './cart.module.css'; -import React, { useEffect, useMemo } from 'react' -import Link from 'next/link' -import { Button, Tooltip } from '@chakra-ui/react' +import React, { useEffect, useMemo } from 'react'; +import Link from 'next/link'; +import { Button, Tooltip } from '@chakra-ui/react'; -import { getAuth } from '~/libs/auth' -import { useCartStore } from '~/modules/cart/stores/useCartStore' +import { getAuth } from '~/libs/auth'; +import { useCartStore } from '~/modules/cart/stores/useCartStore'; -import CartItem from '~/modules/cart/components/Item' -import CartSummary from '~/modules/cart/components/Summary' -import clsxm from '~/libs/clsxm' -import useDevice from '@/core/hooks/useDevice' -import CartSummaryMobile from '~/modules/cart/components/CartSummaryMobile' -import Image from '~/components/ui/image' +import CartItem from '~/modules/cart/components/Item'; +import CartSummary from '~/modules/cart/components/Summary'; +import clsxm from '~/libs/clsxm'; +import useDevice from '@/core/hooks/useDevice'; +import CartSummaryMobile from '~/modules/cart/components/CartSummaryMobile'; +import Image from '~/components/ui/image'; const CartPage = () => { - const auth = getAuth() + const auth = getAuth(); + + const { loadCart, cart, summary } = useCartStore(); - const { loadCart, cart, summary } = useCartStore() - const useDivvice = useDevice(); useEffect(() => { - if (typeof auth === 'object' && !cart) loadCart(auth.id) - }, [auth, loadCart, cart]) + if (typeof auth === 'object' && !cart) loadCart(auth.id); + }, [auth, loadCart, cart]); const hasSelectedPromo = useMemo(() => { - if (!cart) return false + if (!cart) return false; for (const item of cart.products) { - if (item.cart_type === 'promotion' && item.selected) return true + if (item.cart_type === 'promotion' && item.selected) return true; } - return false - }, [cart]) + return false; + }, [cart]); const hasSelected = useMemo(() => { - if (!cart) return false + if (!cart) return false; for (const item of cart.products) { - if (item.selected) return true + if (item.selected) return true; } - return false - }, [cart]) + return false; + }, [cart]); const hasSelectNoPrice = useMemo(() => { - if (!cart) return false + if (!cart) return false; for (const item of cart.products) { - if (item.selected && item.price.price_discount == 0) return true + if (item.selected && item.price.price_discount == 0) return true; } - return false - }, [cart]) + return false; + }, [cart]); return ( <> -
- Keranjang Belanja -
+
Keranjang Belanja
@@ -64,26 +62,57 @@ const CartPage = () => {
- {cart?.products.map((item) => )} + {cart?.products.map((item) => ( + + ))} {cart?.products?.length === 0 && (
- Empty Cart -
Keranjangnya masih kosong nih
-
Yuk, tambahin barang-barang yang kamu mau ke keranjang sekarang!
Ada banyak potongan belanjanya pakai kode voucher
- Mulai Belanja + Empty Cart +
+ Keranjangnya masih kosong nih +
+
+ Yuk, tambahin barang-barang yang kamu mau ke keranjang + sekarang! +
+ Ada banyak potongan belanjanya pakai kode voucher +
+ + Mulai Belanja +
)}
- -
+
- {useDivvice.isMobile && } - {!useDivvice.isMobile && } + {useDivvice.isMobile && ( + + )} + {!useDivvice.isMobile && ( + + )}
- + - +
- ) -} + ); +}; -export default CartPage \ No newline at end of file +export default CartPage; -- cgit v1.2.3 From ed0d0293f88adf3c5312cb556bc464e330b3672a Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Fri, 26 Apr 2024 09:44:31 +0700 Subject: hide button checkout if is step approval is true --- src-migrate/pages/shop/cart/index.tsx | 39 ++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'src-migrate/pages/shop/cart') diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx index 4b4de92b..9866be46 100644 --- a/src-migrate/pages/shop/cart/index.tsx +++ b/src-migrate/pages/shop/cart/index.tsx @@ -16,13 +16,17 @@ import Image from '~/components/ui/image'; const CartPage = () => { const auth = getAuth(); + const [isStepApproval, setIsStepApproval] = React.useState(false); const { loadCart, cart, summary } = useCartStore(); const useDivvice = useDevice(); useEffect(() => { - if (typeof auth === 'object' && !cart) loadCart(auth.id); + if (typeof auth === 'object' && !cart) { + loadCart(auth.id); + setIsStepApproval(auth?.feature?.soApproval); + } }, [auth, loadCart, cart]); const hasSelectedPromo = useMemo(() => { @@ -123,23 +127,24 @@ const CartPage = () => { Quotation - - - - + + + )}
-- cgit v1.2.3 From 145f9edfd32b385771483b9b95a9fa0fa24c2dec Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Fri, 26 Apr 2024 13:57:55 +0700 Subject: css --- src-migrate/pages/shop/cart/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-migrate/pages/shop/cart') diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx index 9866be46..e101b5ad 100644 --- a/src-migrate/pages/shop/cart/index.tsx +++ b/src-migrate/pages/shop/cart/index.tsx @@ -110,7 +110,7 @@ const CartPage = () => { )} -
+
Date: Tue, 2 Jul 2024 10:40:06 +0700 Subject: IS SO APPROVAL --- src-migrate/pages/shop/cart/cart.module.css | 4 ++++ src-migrate/pages/shop/cart/index.tsx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src-migrate/pages/shop/cart') diff --git a/src-migrate/pages/shop/cart/cart.module.css b/src-migrate/pages/shop/cart/cart.module.css index 98a6ac86..806104be 100644 --- a/src-migrate/pages/shop/cart/cart.module.css +++ b/src-migrate/pages/shop/cart/cart.module.css @@ -29,3 +29,7 @@ .summary-buttons { @apply grid grid-cols-2 gap-x-3 mt-6; } + +.summary-buttons-step-approval { + @apply grid grid-cols-1 gap-y-3 mt-6; +} diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx index e101b5ad..d89707d2 100644 --- a/src-migrate/pages/shop/cart/index.tsx +++ b/src-migrate/pages/shop/cart/index.tsx @@ -110,7 +110,7 @@ const CartPage = () => { )} -
+