From 07819844d5ef7e323fd956eacfedecb2f4f4bb80 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Fri, 17 Nov 2023 15:16:23 +0700
Subject: Update result feature

---
 src/modules/result/components/DetailRow.tsx | 38 ++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 14 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 99ccb01..29cf984 100644
--- a/src/modules/result/components/DetailRow.tsx
+++ b/src/modules/result/components/DetailRow.tsx
@@ -7,6 +7,7 @@ import styles from './table.module.css'
 import { CornerDownRightIcon } from 'lucide-react';
 import { User } from '@prisma/client';
 import clsxm from '@/common/libs/clsxm';
+import getClientCredential from '@/common/libs/getClientCredential';
 
 const DetailRow = ({ productId }: { productId: number }) => {
   const { filter } = useResultStore()
@@ -26,7 +27,7 @@ const DetailRow = ({ productId }: { productId: number }) => {
   if (detailLocation.isLoading) {
     return (
       <tr>
-        <td colSpan={7}>
+        <td colSpan={8}>
           <div className='grid grid-cols-1 gap-y-2 w-full'>
             <Skeleton className='w-full h-8' />
             <Skeleton className='w-full h-8' />
@@ -53,6 +54,9 @@ const DetailRow = ({ productId }: { productId: number }) => {
           <td className={styles.td}>
             <QuantityColumn data={location.COUNT2} />
           </td>
+          <td className={styles.td}>
+            <QuantityColumn data={location.COUNT3} />
+          </td>
           <td className={styles.td}>
             <QuantityColumn data={location.VERIFICATION} />
           </td>
@@ -64,18 +68,24 @@ const DetailRow = ({ productId }: { productId: number }) => {
   )
 }
 
-const QuantityColumn = ({ data }: { data: { quantity?: number | undefined, user?: User } }) => (
-  <div className='grid grid-cols-1'>
-    {typeof data?.quantity !== 'number' && '-'}
-    {data.quantity !== null && (
-      <>
-        <span>{data.quantity}</span>
-        <div className='text-xs'>
-          {data.user?.name}
-        </div>
-      </>
-    )}
-  </div>
-)
+const QuantityColumn = ({ data }: { data: { quantity?: number | undefined, user?: User } }) => {
+  const credential = getClientCredential()
+
+  if (!(credential?.team == "VERIFICATION")) return '-'
+
+  return (
+    <div className='grid grid-cols-1'>
+      {typeof data?.quantity !== 'number' && '-'}
+      {data.quantity !== null && (
+        <>
+          <span>{data.quantity}</span>
+          <div className='text-xs text-neutral-500'>
+            {data.user?.name}
+          </div>
+        </>
+      )}
+    </div>
+  )
+}
 
 export default DetailRow
\ No newline at end of file
-- 
cgit v1.2.3

