updated display of settle Date and Amount receivedtags/Baseline_30082024_FRONTEND_UAT
@@ -131,6 +131,9 @@ export function convertLocaleStringToNumber(numberString: string): number { | |||||
} | } | ||||
export function timestampToDateString(timestamp: string): string { | export function timestampToDateString(timestamp: string): string { | ||||
if (timestamp === null){ | |||||
return "-" | |||||
} | |||||
const date = new Date(timestamp); | const date = new Date(timestamp); | ||||
const year = date.getFullYear(); | const year = date.getFullYear(); | ||||
const month = String(date.getMonth() + 1).padStart(2, "0"); | const month = String(date.getMonth() + 1).padStart(2, "0"); | ||||
@@ -236,7 +236,7 @@ const InvoiceSearch: React.FC<Props> = ({ issuedInvoice, receivedInvoice, invoic | |||||
{ name: "projectName", label: t("Project Name") }, | { name: "projectName", label: t("Project Name") }, | ||||
{ name: "team", label: t("Team") }, | { name: "team", label: t("Team") }, | ||||
{ name: "issuedDate", label: t("Issue Date") }, | { name: "issuedDate", label: t("Issue Date") }, | ||||
{ name: "receivedAmount", label: t("Amount (HKD)") }, | |||||
{ name: "issuedAmount", label: t("Amount (HKD)") }, | |||||
{ name: "receiptDate", label: t("Settle Date") }, | { name: "receiptDate", label: t("Settle Date") }, | ||||
{ name: "receivedAmount", label: t("Actual Received Amount (HKD)") }, | { name: "receivedAmount", label: t("Actual Received Amount (HKD)") }, | ||||
], | ], | ||||
@@ -56,9 +56,9 @@ const InvoiceSearchWrapper: React.FC & SubComponents = async () => { | |||||
projectName: invoice.projectName, | projectName: invoice.projectName, | ||||
team: invoice.team, | team: invoice.team, | ||||
issuedDate: timestampToDateString(invoice.invoiceDate)!!, | issuedDate: timestampToDateString(invoice.invoiceDate)!!, | ||||
receiptDate: timestampToDateString(invoice.receiptDate??0)!!, | |||||
receiptDate: timestampToDateString(invoice.receiptDate??null)!!, | |||||
issuedAmount: moneyFormatter.format(invoice.issueAmount), | issuedAmount: moneyFormatter.format(invoice.issueAmount), | ||||
receivedAmount: moneyFormatter.format(invoice.paidAmount) | |||||
receivedAmount: invoice.paidAmount === null ? "-" : moneyFormatter.format(invoice.paidAmount) | |||||
} | } | ||||
}) | }) | ||||