From af54518f20d83342b9976fcf73cff8d4d303e0e9 Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 27 Jun 2024 15:32:45 +0800 Subject: [PATCH] update status i18n --- src/pages/DemandNote/Search_Public/DataGrid.js | 4 +++- src/utils/ApiPathConst.js | 2 +- src/utils/statusUtils/DnStatus.js | 16 +++++++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/pages/DemandNote/Search_Public/DataGrid.js b/src/pages/DemandNote/Search_Public/DataGrid.js index 1a80c04..d04f153 100644 --- a/src/pages/DemandNote/Search_Public/DataGrid.js +++ b/src/pages/DemandNote/Search_Public/DataGrid.js @@ -20,6 +20,7 @@ export default function SearchDemandNote({ searchCriteria }) { const intl = useIntl(); const theme = useTheme(); const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); + const { locale } = intl; const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria); @@ -65,7 +66,8 @@ export default function SearchDemandNote({ searchCriteria }) { width: isMdOrLg ? 'auto' : 175, flex: isMdOrLg ? 1 : undefined, renderCell: (params) => { - return [StatusUtils.getStatus_Cht(params)] + + return [StatusUtils.getStatus_i18n(params, locale) ] }, }, { diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 5031f9f..531ddc8 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -44,7 +44,7 @@ export const GET_ORG_MARK_AS_CREDITOR = apiPath+'/org/mark-as-creditor'; export const GET_ORG_MARK_AS_NON_CREDITOR = apiPath+'/org/mark-as-non-creditor'; export const GET_SEND_TERMINATION_OF_CREDIT = apiPath+'/org/sendDn_terminationOfCredit'; export const GET_ORG_EXPORT = apiPath+'/org/export'; -export const GET_SEND_OVERDUE_CREDITOR_LIST = apiPath+'/org/sendDn_OverdueCreditorList';//POST +export const GET_SEND_OVERDUE_CREDITOR_LIST = apiPath+'/org/sendDn_OverdueCreditorList'; //public export const GET_PUB_ORG_PATH = apiPath+'/org/pub'; diff --git a/src/utils/statusUtils/DnStatus.js b/src/utils/statusUtils/DnStatus.js index 92dd5e1..9c7e96e 100644 --- a/src/utils/statusUtils/DnStatus.js +++ b/src/utils/statusUtils/DnStatus.js @@ -1,8 +1,8 @@ import {getStatusTag} from "utils/statusUtils/Base"; -const pending = {color:"#f5a83d", eng:"Pending", cht:"待辦"} -const toBePaid = {color:"#f5a83d", eng:"To be Paid", cht:"待付款"} -const paid = {color:"#22a13f", eng:"Paid", cht:"已付款"} +const pending = {color:"#f5a83d", eng:"Pending", cht:"待辦", cn: "待办"} +const toBePaid = {color:"#f5a83d", eng:"To be Paid", cht:"待付款", cn: "待付款"} +const paid = {color:"#22a13f", eng:"Paid", cht:"已付款", cn: "已付款"} export function getStatus_Cht(params) { let status = getStatus(params); @@ -14,6 +14,16 @@ export function getStatus_Eng(params) { return status?getStatusTag({color: status.color, textColor:status.textColor, text:status.eng }):""; } +export function getStatus_i18n(params, locale) { + let status = getStatus(params); + if(locale === 'zh-CN') + return status?getStatusTag({color: status.color, textColor:status.textColor, text:status.cn }):""; + if(locale === 'zh-HK') + return status?getStatusTag({color: status.color, textColor:status.textColor, text:status.cht }):""; + return status?getStatusTag({color: status.color, textColor:status.textColor, text:status.eng }):""; +} + + function getStatus(params) { let status = params?.row?params.row.status:params;