|
|
@@ -44,7 +44,15 @@ const PoSearch: React.FC<Props> = ({ |
|
|
|
const [totalCount, setTotalCount] = useState(initTotalCount); |
|
|
|
const searchCriteria: Criterion<SearchParamNames>[] = useMemo(() => { |
|
|
|
const searchCriteria: Criterion<SearchParamNames>[] = [ |
|
|
|
{ label: t("Code"), paramName: "code", type: "text" }, |
|
|
|
{ label: t("Po No."), paramName: "code", type: "text" }, |
|
|
|
{ label: t("Order Date"), label2: t("Order Date To"), paramName: "orderDate", type: "dateRange" }, |
|
|
|
{ |
|
|
|
label: t("Escalated"), |
|
|
|
paramName: "escalated", |
|
|
|
type: "select", |
|
|
|
options: [t("Escalated"), t("NotEscalated")], |
|
|
|
}, |
|
|
|
{ label: t("ETA"), label2: t("ETA To"), paramName: "estimatedArrivalDate", type: "dateRange" }, |
|
|
|
{ |
|
|
|
label: t("Status"), |
|
|
|
paramName: "status", |
|
|
@@ -55,12 +63,6 @@ const PoSearch: React.FC<Props> = ({ |
|
|
|
{ label: t(`completed`), value: `completed` }, |
|
|
|
], |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: t("Escalated"), |
|
|
|
paramName: "escalated", |
|
|
|
type: "select", |
|
|
|
options: [t("Escalated"), t("NotEscalated")], |
|
|
|
}, |
|
|
|
]; |
|
|
|
return searchCriteria; |
|
|
|
}, [t, po]); |
|
|
@@ -84,22 +86,33 @@ const PoSearch: React.FC<Props> = ({ |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: "code", |
|
|
|
label: t("Code"), |
|
|
|
label: `${t("Po No.")} &\n${t("Supplier")}`, |
|
|
|
renderCell: (params) => { |
|
|
|
return <>{params.code}<br/>{params.supplier}</> |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: "orderDate", |
|
|
|
label: t("OrderDate"), |
|
|
|
label: `${t("Order Date")} &\n${t("ETA")}`, |
|
|
|
renderCell: (params) => { |
|
|
|
return ( |
|
|
|
dayjs(params.orderDate) |
|
|
|
.add(-1, "month") |
|
|
|
.format(OUTPUT_DATE_FORMAT) |
|
|
|
); |
|
|
|
// return ( |
|
|
|
// dayjs(params.estimatedArrivalDate) |
|
|
|
// .add(-1, "month") |
|
|
|
// .format(OUTPUT_DATE_FORMAT) |
|
|
|
// ); |
|
|
|
return <>{arrayToDateString(params.orderDate)}<br/>{arrayToDateString(params.estimatedArrivalDate)}</> |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: "supplier", |
|
|
|
label: t("Supplier"), |
|
|
|
name: "itemDetail", |
|
|
|
label: t("Item Detail"), |
|
|
|
renderCell: (params) => { |
|
|
|
if (!params.itemDetail) { |
|
|
|
return "N/A" |
|
|
|
} |
|
|
|
const items = params.itemDetail.split(",") |
|
|
|
return items.map((item) => <p>{item}</p>) |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: "status", |
|
|
@@ -165,7 +178,7 @@ const PoSearch: React.FC<Props> = ({ |
|
|
|
<Grid container> |
|
|
|
<Grid item xs={8}> |
|
|
|
<Typography variant="h4" marginInlineEnd={2}> |
|
|
|
{t("Purchase Order")} |
|
|
|
{t("Purchase Receipt")} |
|
|
|
</Typography> |
|
|
|
</Grid> |
|
|
|
<Grid item xs={4} display="flex" justifyContent="end" alignItems="end"> |
|
|
@@ -189,6 +202,10 @@ const PoSearch: React.FC<Props> = ({ |
|
|
|
query.escalated === "All" |
|
|
|
? undefined |
|
|
|
: query.escalated === t("Escalated"), |
|
|
|
estimatedArrivalDate: query.estimatedArrivalDate === "Invalid Date" ? "" : query.estimatedArrivalDate, |
|
|
|
estimatedArrivalDateTo: query.estimatedArrivalDateTo === "Invalid Date" ? "" : query.estimatedArrivalDateTo, |
|
|
|
orderDate: query.orderDate === "Invalid Date" ? "" : query.orderDate, |
|
|
|
orderDateTo: query.orderDateTo === "Invalid Date" ? "" : query.orderDateTo, |
|
|
|
}); |
|
|
|
// setFilteredPo((prev) => |
|
|
|
// po.filter((p) => { |
|
|
|