From 8fdb589e6788f775b08010c1666f996a2a1874a3 Mon Sep 17 00:00:00 2001 From: keannu125 Date: Sun, 12 Mar 2023 12:43:06 +0800 Subject: [PATCH] Added individual transaction log to product page --- src/Routes/Product/Product.tsx | 57 ++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/src/Routes/Product/Product.tsx b/src/Routes/Product/Product.tsx index f26a575..a45d1dd 100644 --- a/src/Routes/Product/Product.tsx +++ b/src/Routes/Product/Product.tsx @@ -1,13 +1,24 @@ import * as React from "react"; import styles from "../../styles"; -import { Button } from "@mui/material"; +import { + Button, + TableBody, + TableCell, + TableContainer, + TableHead, + TableRow, +} from "@mui/material"; import { useNavigate, useParams } from "react-router-dom"; import LoginChecker from "../../Components/LoginChecker/LoginChecker"; import { DeleteProduct, GetProduct } from "../../Components/Api/Api"; import { useMutation, useQuery, useQueryClient } from "react-query"; import ProductIcon from "../../Components/Icons/ProductIcon/ProductIcon"; import { useSelector } from "react-redux"; -import { OldSessionState } from "../../Interfaces/Interfaces"; +import { + OldSessionState, + ProductHistoryEntry, +} from "../../Interfaces/Interfaces"; +import moment from "moment"; export default function Product() { const navigate = useNavigate(); @@ -91,6 +102,48 @@ export default function Product() { > Delete Product +

+ Individual Transaction Log +

+
+ + + + + Time + + + Quantity + + + + + {product.history.map( + (history_entry: ProductHistoryEntry, index: number) => ( + + + {moment(history_entry.history_date).format( + "MM-DD-YYYY hh:mm A" + )} + + + {history_entry.quantity} + + + ) + )} + + +
);