diff --git a/src/Components/DashboardPage/RecentTransactionsWidget/RecentTransactionsWidget.tsx b/src/Components/DashboardPage/RecentTransactionsWidget/RecentTransactionsWidget.tsx new file mode 100644 index 0000000..1465f57 --- /dev/null +++ b/src/Components/DashboardPage/RecentTransactionsWidget/RecentTransactionsWidget.tsx @@ -0,0 +1,42 @@ +import * as React from "react"; +import { ProductLog, ProductLogList } from "../../../Interfaces/Interfaces"; +import styles from "../../../styles"; +import LogsIcon from "../../Icons/LogsIcon/LogsIcon"; +import Moment from "react-moment"; + +export default function RecentTransactionsWidget(props: ProductLogList) { + return ( +
+
+
+ +
+

Recent

+

+ Transactions +

+
+
+ {props.ProductLogs.slice(0, 5).map((log: ProductLog, index: number) => { + return ( +
+
+

+ {log.name} +

+

+ Quantity: {log.quantity} +

+

+ {log.history_date} +

+

+ Transaction ID: {log.history_id} +

+
+ ); + })} +
+
+ ); +} diff --git a/src/Components/GetToday/GetToday.tsx b/src/Components/GetToday/GetToday.tsx new file mode 100644 index 0000000..be17d04 --- /dev/null +++ b/src/Components/GetToday/GetToday.tsx @@ -0,0 +1,11 @@ +export default function GetToday() { + const current = new Date(); + const date = + ("0" + (current.getMonth() + 1)).slice(-2) + + "-" + + ("0" + current.getDate()).slice(-2) + + "-" + + current.getFullYear(); + console.log("Today is " + date); + return date; +} diff --git a/src/Routes/Dashboard/Dashboard.tsx b/src/Routes/Dashboard/Dashboard.tsx index 11e5df2..fdf1d57 100644 --- a/src/Routes/Dashboard/Dashboard.tsx +++ b/src/Routes/Dashboard/Dashboard.tsx @@ -25,6 +25,7 @@ import LowestStockWidget from "../../Components/DashboardPage/LowestStockWidget/ import RecentlyAddedWidget from "../../Components/DashboardPage/RecentlyAddedWidget/RecentlyAddedWidget"; import TotalProductsWidget from "../../Components/DashboardPage/TotalProductsWidget/TotalProductsWidget"; import SessionStatsWidget from "../../Components/DashboardPage/SessionStatsWidget/SessionStatsWidget"; +import RecentTransactionsWidget from "../../Components/DashboardPage/RecentTransactionsWidget/RecentTransactionsWidget"; export default function Dashboard() { const logs = useQuery("logs", GetLogs, { retry: 0 }); @@ -107,38 +108,7 @@ export default function Dashboard() {
-
-
-
- -
-

Recent

-

- Transactions -

-
-
- {logs.data.slice(0, 5).map((log: ProductLog, index: number) => { - return ( -
-
-

- {log.name} -

-

- Quantity: {log.quantity} -

-

- Date: {log.history_date} -

-

- Transaction ID: {log.history_id} -

-
- ); - })} -
-
+
);