@evenicanpm/portal-table-ui 1.8.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/auth/auth-context.tsx +3 -3
- package/src/features/table/components/dashboard/table/data-mask-map.ts +20 -2
- package/src/features/table/components/dashboard/table/details/templates/invoice-details.tsx +11 -2
- package/src/features/table/components/dashboard/table/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evenicanpm/portal-table-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@arrows/multimethod": "^2.1.0",
|
|
44
|
-
"@evenicanpm/portal-types-schemas": "^
|
|
45
|
-
"@evenicanpm/ui": "^
|
|
44
|
+
"@evenicanpm/portal-types-schemas": "^2.0.0",
|
|
45
|
+
"@evenicanpm/ui": "^2.0.0",
|
|
46
46
|
"@mui/lab": "^7.0.1-beta.19",
|
|
47
47
|
"@tanstack/react-query": "^5.90.11",
|
|
48
48
|
"date-fns": "^4.1.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "7552c1e700a0027b8a65506c77cb10dae092fdfb"
|
|
51
51
|
}
|
|
@@ -5,10 +5,28 @@ import type * as Table from "../../../types/";
|
|
|
5
5
|
export const dataMaskMap: Table.Handlers.DataMaskMap = {
|
|
6
6
|
// DATE TIME HAS SPECIFIC MASK HANDLING
|
|
7
7
|
datetime: (value: string | number, _dataMask: string) => {
|
|
8
|
-
|
|
8
|
+
if (!value) return "";
|
|
9
|
+
|
|
10
|
+
const date = new Date(value);
|
|
11
|
+
|
|
12
|
+
if (isNaN(date.getTime())) {
|
|
13
|
+
console.warn("Invalid datetime value:", value);
|
|
14
|
+
return "";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return format(date, "MM/dd/yyyy");
|
|
9
18
|
},
|
|
10
19
|
date: (value: string | number, _dataMask: string) => {
|
|
11
|
-
|
|
20
|
+
if (!value) return "";
|
|
21
|
+
|
|
22
|
+
const date = new Date(value);
|
|
23
|
+
|
|
24
|
+
if (isNaN(date.getTime())) {
|
|
25
|
+
console.warn("Invalid date value:", value);
|
|
26
|
+
return "";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return format(date, "MM/dd/yyyy");
|
|
12
30
|
},
|
|
13
31
|
numeric: (value: string | number, dataMask: string) => {
|
|
14
32
|
// IS CURRENCY?
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import FlagIcon from "@mui/icons-material/Flag";
|
|
2
3
|
import {
|
|
3
4
|
Box,
|
|
4
5
|
Card,
|
|
@@ -35,7 +36,7 @@ const formatDate = (dateString?: string): string => {
|
|
|
35
36
|
if (!dateString) return "—";
|
|
36
37
|
try {
|
|
37
38
|
const date = new Date(dateString);
|
|
38
|
-
if (isNaN(date.getTime())) return dateString;
|
|
39
|
+
if (Number.isNaN(date.getTime())) return dateString;
|
|
39
40
|
return new Intl.DateTimeFormat("en-US", {
|
|
40
41
|
year: "numeric",
|
|
41
42
|
month: "long",
|
|
@@ -60,6 +61,7 @@ interface InvoiceLine {
|
|
|
60
61
|
|
|
61
62
|
interface InvoiceData {
|
|
62
63
|
Status?: string | number;
|
|
64
|
+
IsOverdue?: boolean;
|
|
63
65
|
SalesInvoiceLine?: InvoiceLine[];
|
|
64
66
|
InvoiceSubtotal?: number;
|
|
65
67
|
TotalTaxAmount?: number;
|
|
@@ -337,7 +339,14 @@ export const InvoiceDetailsTemplate = ({
|
|
|
337
339
|
<Typography variant="body2" color="text.secondary">
|
|
338
340
|
Due Date
|
|
339
341
|
</Typography>
|
|
340
|
-
|
|
342
|
+
|
|
343
|
+
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
|
|
344
|
+
<Typography>{formatDate(invoice.DueDate)}</Typography>
|
|
345
|
+
|
|
346
|
+
{invoice?.IsOverdue && (
|
|
347
|
+
<FlagIcon sx={{ color: "error.main" }} fontSize="small" />
|
|
348
|
+
)}
|
|
349
|
+
</Box>
|
|
341
350
|
</Grid2>
|
|
342
351
|
)}
|
|
343
352
|
</Grid2>
|