From ae3207e9778c3f2fb01d64714ff15fc073ec093d Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 1 Dec 2023 10:16:12 +0700 Subject: Update compute different, result, and product list feature --- src/modules/result/components/DetailRow.tsx | 32 +++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'src/modules/result/components/DetailRow.tsx') diff --git a/src/modules/result/components/DetailRow.tsx b/src/modules/result/components/DetailRow.tsx index 18dcb8f..bb5b1ef 100644 --- a/src/modules/result/components/DetailRow.tsx +++ b/src/modules/result/components/DetailRow.tsx @@ -4,10 +4,11 @@ import { StockOpnameLocationRes } from '@/common/types/stockOpname'; import { Skeleton } from '@nextui-org/react'; import { useQuery } from '@tanstack/react-query' import styles from './table.module.css' -import { CornerDownRightIcon } from 'lucide-react'; -import { User } from 'prisma/generated/client'; +import { CheckIcon, CornerDownRightIcon, XIcon } from 'lucide-react'; +import { Team, User } from 'prisma/generated/client'; import clsxm from '@/common/libs/clsxm'; import getClientCredential from '@/common/libs/getClientCredential'; +import _ from 'lodash'; const DetailRow = ({ productId }: { productId: number }) => { const { filter } = useResultStore() @@ -48,16 +49,16 @@ const DetailRow = ({ productId }: { productId: number }) => { - + - + - + - + @@ -67,14 +68,29 @@ const DetailRow = ({ productId }: { productId: number }) => { ) } -const QuantityColumn = ({ data }: { data: { quantity?: number | undefined, user?: User } }) => { +type Data = { quantity?: number | undefined, user?: User } + +const Column = ({ team, data }: { team: Team, data: Data }) => { + const credential = getClientCredential() + + return credential?.team === team && credential.team !== 'VERIFICATION' ? ( +
+ {_.isNumber(data.quantity) && } + {_.isUndefined(data.quantity) && } +
+ ) : ( + + ) +} + +const QuantityColumn = ({ data }: { data: Data }) => { const credential = getClientCredential() if (!(credential?.team == "VERIFICATION")) return '-' return (
- {typeof data?.quantity !== 'number' && '-'} + {_.isUndefined(data.quantity) && '-'} {data.quantity !== null && ( <> {data.quantity} -- cgit v1.2.3