From c6a3b279a6876bf08813d058174ceae39977e112 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Fri, 21 Feb 2025 07:48:04 +0530 Subject: [PATCH 01/40] add translations for UPDATE_AUDIT_RATE. Signed-off-by: krishna2323 --- src/languages/en.ts | 3 +++ src/languages/es.ts | 3 +++ src/languages/params.ts | 3 +++ src/libs/ReportActionsUtils.ts | 10 ++++++++++ src/libs/SidebarUtils.ts | 3 +++ .../home/report/ContextMenu/ContextMenuActions.tsx | 3 +++ src/pages/home/report/PureReportActionItem.tsx | 3 +++ src/types/onyx/OriginalMessage.ts | 6 ++++++ 8 files changed, 34 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index 1b074e343836c..828f7d23ddf7b 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -179,6 +179,7 @@ import type { UnapproveWithIntegrationWarningParams, UnshareParams, UntilTimeParams, + UpdatedPolicyAuditRateParams, UpdatedPolicyCategoryNameParams, UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, @@ -4891,6 +4892,8 @@ const translations = { updateApprovalMode: ({newValue, oldValue}: ChangeFieldParams) => `updated the approval mode to "${newValue}" (previously "${oldValue}")`, upgradedWorkspace: 'upgraded this workspace to the Control plan', downgradedWorkspace: 'downgraded this workspace to the Collect plan', + updatedAuditRate: ({oldAuditRate, newAuditRate}: UpdatedPolicyAuditRateParams) => + `changed the rate of reports randomly routed for manual approval from ${Math.round(oldAuditRate * 100)}% to ${Math.round(newAuditRate * 100)}%`, }, roomMembersPage: { memberNotFound: 'Member not found.', diff --git a/src/languages/es.ts b/src/languages/es.ts index 087ae56ee0b7d..fa7e8cfa5943e 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -178,6 +178,7 @@ import type { UnapproveWithIntegrationWarningParams, UnshareParams, UntilTimeParams, + UpdatedPolicyAuditRateParams, UpdatedPolicyCategoryNameParams, UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, @@ -4945,6 +4946,8 @@ const translations = { updateApprovalMode: ({newValue, oldValue}: ChangeFieldParams) => `actualizó el modo de aprobación a "${newValue}" (previamente "${oldValue}")`, upgradedWorkspace: 'mejoró este espacio de trabajo al plan Controlar', downgradedWorkspace: 'bajó de categoría este espacio de trabajo al plan Recopilar', + updatedAuditRate: ({oldAuditRate, newAuditRate}: UpdatedPolicyAuditRateParams) => + `cambió la tasa de informes asignados aleatoriamente para aprobación manual de ${Math.round(oldAuditRate * 100)}% a ${Math.round(newAuditRate * 100)}%`, }, roomMembersPage: { memberNotFound: 'Miembro no encontrado.', diff --git a/src/languages/params.ts b/src/languages/params.ts index d9ab6a5296a89..bc206efef1c0c 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -321,6 +321,8 @@ type UpdatedPolicyFieldWithValueParam = {value: boolean}; type UpdatedPolicyFrequencyParams = {oldFrequency: string; newFrequency: string}; +type UpdatedPolicyAuditRateParams = {oldAuditRate: number; newAuditRate: number}; + type ChangeTypeParams = {oldType: string; newType: string}; type DelegateSubmitParams = {delegateUser: string; originalManager: string}; @@ -883,4 +885,5 @@ export type { SubmitsToParams, SettlementDateParams, NeedCategoryForExportToIntegrationParams, + UpdatedPolicyAuditRateParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index f60a4bb2e668c..eb78ebd7eb396 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2106,6 +2106,15 @@ function getDemotedFromWorkspaceMessage(reportAction: OnyxEntry) { + const {oldAuditRate, newAuditRate} = getOriginalMessage(reportAction as ReportAction) ?? {}; + + if (typeof oldAuditRate !== 'number' || typeof newAuditRate !== 'number') { + return getReportActionText(reportAction); + } + return translateLocal('workspaceActions.updatedAuditRate', {oldAuditRate, newAuditRate}); +} + function isCardIssuedAction(reportAction: OnyxEntry) { return isActionOfType( reportAction, @@ -2337,6 +2346,7 @@ export { getWorkspaceTagUpdateMessage, getWorkspaceReportFieldUpdateMessage, getWorkspaceReportFieldDeleteMessage, + getUpdatedAuditRateMessage, }; export type {LastVisibleMessage}; diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index d1b5a7bc14db1..cee4ccd712ac9 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -39,6 +39,7 @@ import { getReportAction, getReportActionMessageText, getSortedReportActions, + getUpdatedAuditRateMessage, getUpdateRoomDescriptionMessage, getWorkspaceCategoryUpdateMessage, getWorkspaceCurrencyUpdateMessage, @@ -608,6 +609,8 @@ function getOptionData({ result.alternateText = getReportActionMessageText(lastAction) ?? ''; } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION) { result.alternateText = getRemovedConnectionMessage(lastAction); + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE) { + result.alternateText = getUpdatedAuditRateMessage(lastAction); } else { result.alternateText = lastMessageTextFromReport.length > 0 diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index bfe766db3ee12..24b746c66b16e 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -39,6 +39,7 @@ import { getRemovedConnectionMessage, getRenamedAction, getReportActionMessageText, + getUpdatedAuditRateMessage, getUpdateRoomDescriptionMessage, getWorkspaceCategoryUpdateMessage, getWorkspaceCurrencyUpdateMessage, @@ -602,6 +603,8 @@ const ContextMenuActions: ContextMenuAction[] = [ setClipboardMessage(getCardIssuedMessage({reportAction, shouldRenderHTML: true, policyID: report?.policyID, shouldDisplayLinkToCard: hasCard})); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) { setClipboardMessage(getRemovedConnectionMessage(reportAction)); + } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE)) { + setClipboardMessage(getUpdatedAuditRateMessage(reportAction)); } else if (content) { setClipboardMessage( content.replace(/()(.*?)(<\/mention-user>)/gi, (match, openTag: string, innerContent: string, closeTag: string): string => { diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index ad3e2b4ceb432..5735bfb22bf4e 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -66,6 +66,7 @@ import { getRenamedAction, getReportActionMessage, getReportActionText, + getUpdatedAuditRateMessage, getWhisperedTo, getWorkspaceCategoryUpdateMessage, getWorkspaceCurrencyUpdateMessage, @@ -953,6 +954,8 @@ function PureReportActionItem({ children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) { children = ; + } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE)) { + children = ; } else { const hasBeenFlagged = ![CONST.MODERATION.MODERATOR_DECISION_APPROVED, CONST.MODERATION.MODERATOR_DECISION_PENDING].some((item) => item === moderationDecision) && !isPendingRemove(action); diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index d123cf646dda9..c7aeb00c2ece9 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -404,6 +404,12 @@ type OriginalMessagePolicyChangeLog = { /** Old role of user or old value of the category/tag field */ oldValue?: boolean | string; + + /** Old approval audit rate */ + oldAuditRate?: number; + + /** New approval audit rate */ + newAuditRate?: number; }; /** Model of `join policy changelog` report action */ From 0e0d7134a793433d9fd992389686b8a3dcce4ad7 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Fri, 21 Feb 2025 09:56:54 +0530 Subject: [PATCH 02/40] add translations for UPDATE_MANUAL_APPROVAL_THRESHOLD. Signed-off-by: krishna2323 --- src/languages/en.ts | 3 +++ src/languages/es.ts | 3 +++ src/languages/params.ts | 3 +++ src/libs/ReportActionsUtils.ts | 14 ++++++++++++++ src/libs/SidebarUtils.ts | 3 +++ .../home/report/ContextMenu/ContextMenuActions.tsx | 3 +++ src/pages/home/report/PureReportActionItem.tsx | 3 +++ src/types/onyx/OriginalMessage.ts | 6 ++++++ 8 files changed, 38 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index 828f7d23ddf7b..e756cf191675d 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -187,6 +187,7 @@ import type { UpdatedPolicyFieldWithNewAndOldValueParams, UpdatedPolicyFieldWithValueParam, UpdatedPolicyFrequencyParams, + UpdatedPolicyManualApprovalThresholdParams, UpdatedPolicyPreventSelfApprovalParams, UpdatedPolicyReportFieldDefaultValueParams, UpdatedPolicyTagFieldParams, @@ -4894,6 +4895,8 @@ const translations = { downgradedWorkspace: 'downgraded this workspace to the Collect plan', updatedAuditRate: ({oldAuditRate, newAuditRate}: UpdatedPolicyAuditRateParams) => `changed the rate of reports randomly routed for manual approval from ${Math.round(oldAuditRate * 100)}% to ${Math.round(newAuditRate * 100)}%`, + updatedManualApprovalThreshold: ({oldLimit, newLimit}: UpdatedPolicyManualApprovalThresholdParams) => + `changed the limit for manual approval of all expenses from ${oldLimit} to ${newLimit}`, }, roomMembersPage: { memberNotFound: 'Member not found.', diff --git a/src/languages/es.ts b/src/languages/es.ts index fa7e8cfa5943e..2ebbbe9986262 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -186,6 +186,7 @@ import type { UpdatedPolicyFieldWithNewAndOldValueParams, UpdatedPolicyFieldWithValueParam, UpdatedPolicyFrequencyParams, + UpdatedPolicyManualApprovalThresholdParams, UpdatedPolicyPreventSelfApprovalParams, UpdatedPolicyReportFieldDefaultValueParams, UpdatedPolicyTagFieldParams, @@ -4948,6 +4949,8 @@ const translations = { downgradedWorkspace: 'bajó de categoría este espacio de trabajo al plan Recopilar', updatedAuditRate: ({oldAuditRate, newAuditRate}: UpdatedPolicyAuditRateParams) => `cambió la tasa de informes asignados aleatoriamente para aprobación manual de ${Math.round(oldAuditRate * 100)}% a ${Math.round(newAuditRate * 100)}%`, + updatedManualApprovalThreshold: ({oldLimit, newLimit}: UpdatedPolicyManualApprovalThresholdParams) => + `cambió el límite para la aprobación manual de todos los gastos de ${oldLimit} a ${newLimit}`, }, roomMembersPage: { memberNotFound: 'Miembro no encontrado.', diff --git a/src/languages/params.ts b/src/languages/params.ts index bc206efef1c0c..b2181fc647a81 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -323,6 +323,8 @@ type UpdatedPolicyFrequencyParams = {oldFrequency: string; newFrequency: string} type UpdatedPolicyAuditRateParams = {oldAuditRate: number; newAuditRate: number}; +type UpdatedPolicyManualApprovalThresholdParams = {oldLimit: string; newLimit: string}; + type ChangeTypeParams = {oldType: string; newType: string}; type DelegateSubmitParams = {delegateUser: string; originalManager: string}; @@ -886,4 +888,5 @@ export type { SettlementDateParams, NeedCategoryForExportToIntegrationParams, UpdatedPolicyAuditRateParams, + UpdatedPolicyManualApprovalThresholdParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index eb78ebd7eb396..85ec680952f07 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2115,6 +2115,19 @@ function getUpdatedAuditRateMessage(reportAction: OnyxEntry) { return translateLocal('workspaceActions.updatedAuditRate', {oldAuditRate, newAuditRate}); } +function getUpdatedManualApprovalThresholdMessage(reportAction: OnyxEntry) { + const { + oldLimit, + newLimit, + currency = CONST.CURRENCY.USD, + } = getOriginalMessage(reportAction as ReportAction) ?? {}; + + if (typeof oldLimit !== 'number' || typeof oldLimit !== 'number') { + return getReportActionText(reportAction); + } + return translateLocal('workspaceActions.updatedManualApprovalThreshold', {oldLimit: convertToDisplayString(oldLimit, currency), newLimit: convertToDisplayString(newLimit, currency)}); +} + function isCardIssuedAction(reportAction: OnyxEntry) { return isActionOfType( reportAction, @@ -2347,6 +2360,7 @@ export { getWorkspaceReportFieldUpdateMessage, getWorkspaceReportFieldDeleteMessage, getUpdatedAuditRateMessage, + getUpdatedManualApprovalThresholdMessage, }; export type {LastVisibleMessage}; diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index cee4ccd712ac9..4c1e18bea33e2 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -40,6 +40,7 @@ import { getReportActionMessageText, getSortedReportActions, getUpdatedAuditRateMessage, + getUpdatedManualApprovalThresholdMessage, getUpdateRoomDescriptionMessage, getWorkspaceCategoryUpdateMessage, getWorkspaceCurrencyUpdateMessage, @@ -611,6 +612,8 @@ function getOptionData({ result.alternateText = getRemovedConnectionMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE) { result.alternateText = getUpdatedAuditRateMessage(lastAction); + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD) { + result.alternateText = getUpdatedManualApprovalThresholdMessage(lastAction); } else { result.alternateText = lastMessageTextFromReport.length > 0 diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 24b746c66b16e..83c047d50125a 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -40,6 +40,7 @@ import { getRenamedAction, getReportActionMessageText, getUpdatedAuditRateMessage, + getUpdatedManualApprovalThresholdMessage, getUpdateRoomDescriptionMessage, getWorkspaceCategoryUpdateMessage, getWorkspaceCurrencyUpdateMessage, @@ -605,6 +606,8 @@ const ContextMenuActions: ContextMenuAction[] = [ setClipboardMessage(getRemovedConnectionMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE)) { setClipboardMessage(getUpdatedAuditRateMessage(reportAction)); + } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD)) { + setClipboardMessage(getUpdatedManualApprovalThresholdMessage(reportAction)); } else if (content) { setClipboardMessage( content.replace(/()(.*?)(<\/mention-user>)/gi, (match, openTag: string, innerContent: string, closeTag: string): string => { diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 5735bfb22bf4e..e9559183b0595 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -67,6 +67,7 @@ import { getReportActionMessage, getReportActionText, getUpdatedAuditRateMessage, + getUpdatedManualApprovalThresholdMessage, getWhisperedTo, getWorkspaceCategoryUpdateMessage, getWorkspaceCurrencyUpdateMessage, @@ -956,6 +957,8 @@ function PureReportActionItem({ children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE)) { children = ; + } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD)) { + children = ; } else { const hasBeenFlagged = ![CONST.MODERATION.MODERATOR_DECISION_APPROVED, CONST.MODERATION.MODERATOR_DECISION_PENDING].some((item) => item === moderationDecision) && !isPendingRemove(action); diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index c7aeb00c2ece9..2805b1be26790 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -410,6 +410,12 @@ type OriginalMessagePolicyChangeLog = { /** New approval audit rate */ newAuditRate?: number; + + /** Old limit of manual approval threshold */ + oldLimit?: number; + + /** New limit of manual approval threshold */ + newLimit?: number; }; /** Model of `join policy changelog` report action */ From c750de3e263cef80b5d55c7b9435d6bd4f1affb3 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Sat, 1 Mar 2025 12:05:06 +0530 Subject: [PATCH 03/40] add translation for DELETE_CUSTOM_UNIT_RATE. Signed-off-by: krishna2323 --- src/languages/en.ts | 5 +++-- src/languages/es.ts | 5 +++-- src/languages/params.ts | 4 ++-- src/libs/ReportActionsUtils.ts | 13 +++++++++++++ src/libs/SidebarUtils.ts | 3 +++ .../home/report/ContextMenu/ContextMenuActions.tsx | 3 +++ src/pages/home/report/PureReportActionItem.tsx | 3 +++ 7 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 86150e76281ac..05840de95ab27 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -6,7 +6,6 @@ import type { AccountOwnerParams, ActionsAreCurrentlyRestricted, AddedOrDeletedPolicyReportFieldParams, - AddedPolicyCustomUnitRateParams, AddEmployeeParams, AddressLineParams, AdminCanceledRequestParams, @@ -184,6 +183,7 @@ import type { UpdatedPolicyCategoryNameParams, UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, + UpdatedPolicyCustomUnitRateParams, UpdatedPolicyDescriptionParams, UpdatedPolicyFieldWithNewAndOldValueParams, UpdatedPolicyFieldWithValueParam, @@ -4858,7 +4858,8 @@ const translations = { } return `updated the tag "${tagName}" on the list "${tagListName}" by adding a ${updatedField} of "${newValue}"`; }, - addCustomUnitRate: ({customUnitName, rateName}: AddedPolicyCustomUnitRateParams) => `added a new "${customUnitName}" rate "${rateName}"`, + addCustomUnitRate: ({customUnitName, rateName}: UpdatedPolicyCustomUnitRateParams) => `added a new "${customUnitName}" rate "${rateName}"`, + deleteCustomUnitRate: ({customUnitName, rateName}: UpdatedPolicyCustomUnitRateParams) => `eliminó la tasa "${rateName}" de "${customUnitName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `added ${fieldType} Report Field "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `set the default value of report field "${fieldName}" to "${defaultValue}"`, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `removed ${fieldType} Report Field "${fieldName}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index c06decbaca9e7..cbf00059f0eb9 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -5,7 +5,6 @@ import type { AccountOwnerParams, ActionsAreCurrentlyRestricted, AddedOrDeletedPolicyReportFieldParams, - AddedPolicyCustomUnitRateParams, AddEmployeeParams, AddressLineParams, AdminCanceledRequestParams, @@ -183,6 +182,7 @@ import type { UpdatedPolicyCategoryNameParams, UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, + UpdatedPolicyCustomUnitRateParams, UpdatedPolicyDescriptionParams, UpdatedPolicyFieldWithNewAndOldValueParams, UpdatedPolicyFieldWithValueParam, @@ -4910,7 +4910,8 @@ const translations = { } return `actualizó la etiqueta "${tagName}" en la lista "${tagListName}" añadiendo un ${updatedField} de "${newValue}"`; }, - addCustomUnitRate: ({customUnitName, rateName}: AddedPolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, + addCustomUnitRate: ({customUnitName, rateName}: UpdatedPolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, + deleteCustomUnitRate: ({customUnitName, rateName}: UpdatedPolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `añadió el campo de informe ${fieldType} "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `estableció el valor predeterminado del campo de informe "${fieldName}" en "${defaultValue}"`, diff --git a/src/languages/params.ts b/src/languages/params.ts index 96f0c43be0537..4a1ec021d49a8 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -307,7 +307,7 @@ type UpdatedPolicyTagFieldParams = {oldValue?: string; newValue: string; tagName type UpdatedPolicyCategoryNameParams = {oldName: string; newName?: string}; -type AddedPolicyCustomUnitRateParams = {customUnitName: string; rateName: string}; +type UpdatedPolicyCustomUnitRateParams = {customUnitName: string; rateName: string}; type AddedOrDeletedPolicyReportFieldParams = {fieldType: string; fieldName?: string}; @@ -883,7 +883,7 @@ export type { EditDestinationSubtitleParams, FlightLayoverParams, AddedOrDeletedPolicyReportFieldParams, - AddedPolicyCustomUnitRateParams, + UpdatedPolicyCustomUnitRateParams, UpdatedPolicyTagParams, UpdatedPolicyTagNameParams, UpdatedPolicyTagFieldParams, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 1632c12c4d6ab..99ee81c748f64 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1940,6 +1940,18 @@ function getWorkspaceCustomUnitRateAddedMessage(action: ReportAction): string { return getReportActionText(action); } +function getWorkspaceCustomUnitRateDeletedMessage(action: ReportAction): string { + const {customUnitName, rateName} = getOriginalMessage(action as ReportAction) ?? {}; + if (customUnitName && rateName) { + return translateLocal('workspaceActions.deleteCustomUnitRate', { + customUnitName, + rateName, + }); + } + + return getReportActionText(action); +} + function getWorkspaceReportFieldAddMessage(action: ReportAction): string { const {fieldName, fieldType} = getOriginalMessage(action as ReportAction) ?? {}; @@ -2362,6 +2374,7 @@ export { getWorkspaceReportFieldDeleteMessage, getUpdatedAuditRateMessage, getUpdatedManualApprovalThresholdMessage, + getWorkspaceCustomUnitRateDeletedMessage, }; export type {LastVisibleMessage}; diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index b4677e9ef5b96..5b68293fc6828 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -45,6 +45,7 @@ import { getWorkspaceCategoryUpdateMessage, getWorkspaceCurrencyUpdateMessage, getWorkspaceCustomUnitRateAddedMessage, + getWorkspaceCustomUnitRateDeletedMessage, getWorkspaceDescriptionUpdatedMessage, getWorkspaceFrequencyUpdateMessage, getWorkspaceReportFieldAddMessage, @@ -582,6 +583,8 @@ function getOptionData({ result.alternateText = getCleanedTagName(getWorkspaceTagUpdateMessage(lastAction) ?? ''); } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CUSTOM_UNIT_RATE)) { result.alternateText = getWorkspaceCustomUnitRateAddedMessage(lastAction); + } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CUSTOM_UNIT_RATE)) { + result.alternateText = getWorkspaceCustomUnitRateDeletedMessage(lastAction); } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_REPORT_FIELD)) { result.alternateText = getWorkspaceReportFieldAddMessage(lastAction); } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REPORT_FIELD)) { diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index fbc2968d58d44..821b045256dbf 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -45,6 +45,7 @@ import { getWorkspaceCategoryUpdateMessage, getWorkspaceCurrencyUpdateMessage, getWorkspaceCustomUnitRateAddedMessage, + getWorkspaceCustomUnitRateDeletedMessage, getWorkspaceDescriptionUpdatedMessage, getWorkspaceFrequencyUpdateMessage, getWorkspaceReportFieldAddMessage, @@ -516,6 +517,8 @@ const ContextMenuActions: ContextMenuAction[] = [ Clipboard.setString(getCleanedTagName(getWorkspaceTagUpdateMessage(reportAction))); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CUSTOM_UNIT_RATE) { Clipboard.setString(getWorkspaceCustomUnitRateAddedMessage(reportAction)); + } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CUSTOM_UNIT_RATE) { + Clipboard.setString(getWorkspaceCustomUnitRateDeletedMessage(reportAction)); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_REPORT_FIELD) { Clipboard.setString(getWorkspaceReportFieldAddMessage(reportAction)); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REPORT_FIELD) { diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 6e928af0e8a73..449f8b563ca57 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -72,6 +72,7 @@ import { getWorkspaceCategoryUpdateMessage, getWorkspaceCurrencyUpdateMessage, getWorkspaceCustomUnitRateAddedMessage, + getWorkspaceCustomUnitRateDeletedMessage, getWorkspaceDescriptionUpdatedMessage, getWorkspaceFrequencyUpdateMessage, getWorkspaceReportFieldAddMessage, @@ -904,6 +905,8 @@ function PureReportActionItem({ children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CUSTOM_UNIT_RATE) { children = ; + } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CUSTOM_UNIT_RATE) { + children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_REPORT_FIELD) { children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REPORT_FIELD) { From 9cd2e4b13f80c1e5bd8fbdc949489754767c854b Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Sat, 1 Mar 2025 12:26:41 +0530 Subject: [PATCH 04/40] add translation for ADD_INTEGRATION action. Signed-off-by: krishna2323 --- src/languages/en.ts | 3 ++- src/languages/es.ts | 1 + src/libs/ReportActionsUtils.ts | 10 ++++++++++ src/libs/SidebarUtils.ts | 3 +++ .../home/report/ContextMenu/ContextMenuActions.tsx | 3 +++ src/pages/home/report/PureReportActionItem.tsx | 3 +++ 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 05840de95ab27..037163b1bbe68 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4859,7 +4859,7 @@ const translations = { return `updated the tag "${tagName}" on the list "${tagListName}" by adding a ${updatedField} of "${newValue}"`; }, addCustomUnitRate: ({customUnitName, rateName}: UpdatedPolicyCustomUnitRateParams) => `added a new "${customUnitName}" rate "${rateName}"`, - deleteCustomUnitRate: ({customUnitName, rateName}: UpdatedPolicyCustomUnitRateParams) => `eliminó la tasa "${rateName}" de "${customUnitName}"`, + deleteCustomUnitRate: ({customUnitName, rateName}: UpdatedPolicyCustomUnitRateParams) => `removed the "${customUnitName}" rate "${rateName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `added ${fieldType} Report Field "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `set the default value of report field "${fieldName}" to "${defaultValue}"`, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `removed ${fieldType} Report Field "${fieldName}"`, @@ -5182,6 +5182,7 @@ const translations = { leftWorkspace: ({nameOrEmail}: LeftWorkspaceParams) => `${nameOrEmail} left the workspace`, removeMember: ({email, role}: AddEmployeeParams) => `removed ${role} ${email}`, removedConnection: ({connectionName}: ConnectionNameParams) => `removed connection to ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, + addedConnection: ({connectionName}: ConnectionNameParams) => `connected to ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, }, }, }, diff --git a/src/languages/es.ts b/src/languages/es.ts index cbf00059f0eb9..7dc509f307fab 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -5237,6 +5237,7 @@ const translations = { leftWorkspace: ({nameOrEmail}: LeftWorkspaceParams) => `${nameOrEmail} salió del espacio de trabajo`, removeMember: ({email, role}: AddEmployeeParams) => `eliminado ${role} ${email}`, removedConnection: ({connectionName}: ConnectionNameParams) => `eliminó la conexión a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, + addedConnection: ({connectionName}: ConnectionNameParams) => `conectado a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, }, }, }, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 99ee81c748f64..f8949ce702fdc 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2085,6 +2085,15 @@ function getPolicyChangeLogDeleteMemberMessage(reportAction: OnyxInputOrEntry): string { + if (!isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_INTEGRATION)) { + return ''; + } + const originalMessage = getOriginalMessage(reportAction); + const connectionName = originalMessage?.connectionName; + return connectionName ? translateLocal('report.actions.type.addedConnection', {connectionName}) : ''; +} + function getRemovedConnectionMessage(reportAction: OnyxEntry): string { if (!isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) { return ''; @@ -2375,6 +2384,7 @@ export { getUpdatedAuditRateMessage, getUpdatedManualApprovalThresholdMessage, getWorkspaceCustomUnitRateDeletedMessage, + getAddedConnectionMessage, }; export type {LastVisibleMessage}; diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 5b68293fc6828..24287a2ceb863 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -22,6 +22,7 @@ import Parser from './Parser'; import Performance from './Performance'; import {getCleanedTagName, getPolicy} from './PolicyUtils'; import { + getAddedConnectionMessage, getCardIssuedMessage, getLastVisibleMessage, getMessageOfOldDotReportAction, @@ -617,6 +618,8 @@ function getOptionData({ result.alternateText = getPolicyChangeLogDeleteMemberMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CUSTOM_UNIT_RATE) { result.alternateText = getReportActionMessageText(lastAction) ?? ''; + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_INTEGRATION) { + result.alternateText = getAddedConnectionMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION) { result.alternateText = getRemovedConnectionMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE) { diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 821b045256dbf..49e06f4e9b74c 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -23,6 +23,7 @@ import {getCleanedTagName} from '@libs/PolicyUtils'; import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager'; import { getActionableMentionWhisperMessage, + getAddedConnectionMessage, getCardIssuedMessage, getExportIntegrationMessageHTML, getIOUReportIDFromReportActionPreview, @@ -605,6 +606,8 @@ const ContextMenuActions: ContextMenuAction[] = [ setClipboardMessage(translateLocal('report.actions.type.integrationSyncFailed', {label, errorMessage})); } else if (isCardIssuedAction(reportAction)) { setClipboardMessage(getCardIssuedMessage({reportAction, shouldRenderHTML: true, policyID: report?.policyID, card})); + } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_INTEGRATION)) { + setClipboardMessage(getAddedConnectionMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) { setClipboardMessage(getRemovedConnectionMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE)) { diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 449f8b563ca57..b3df733cd9625 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -49,6 +49,7 @@ import {getDisplayNameOrDefault} from '@libs/PersonalDetailsUtils'; import {getCleanedTagName} from '@libs/PolicyUtils'; import { extractLinksFromMessageHtml, + getAddedConnectionMessage, getAllReportActions, getDemotedFromWorkspaceMessage, getDismissedViolationMessageText, @@ -956,6 +957,8 @@ function PureReportActionItem({ } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.INTEGRATION_SYNC_FAILED)) { const {label, errorMessage} = getOriginalMessage(action) ?? {label: '', errorMessage: ''}; children = ; + } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_INTEGRATION)) { + children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) { children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE)) { From 59978a13b32c87fb6339530ae8a29ea83d7b6d9a Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Sat, 1 Mar 2025 12:50:12 +0530 Subject: [PATCH 05/40] add translation for UPDATE_CUSTOM_UNIT_RATE action. Signed-off-by: krishna2323 --- src/languages/en.ts | 7 +++++-- src/languages/es.ts | 7 +++++-- src/languages/params.ts | 5 ++++- src/libs/ReportActionsUtils.ts | 18 ++++++++++++++++++ src/libs/SidebarUtils.ts | 3 +++ .../report/ContextMenu/ContextMenuActions.tsx | 3 +++ src/pages/home/report/PureReportActionItem.tsx | 3 +++ src/types/onyx/OriginalMessage.ts | 3 +++ 8 files changed, 44 insertions(+), 5 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 037163b1bbe68..95b961dd63ab1 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -7,6 +7,7 @@ import type { ActionsAreCurrentlyRestricted, AddedOrDeletedPolicyReportFieldParams, AddEmployeeParams, + AddOrDeletePolicyCustomUnitRateParams, AddressLineParams, AdminCanceledRequestParams, AlreadySignedInParams, @@ -4858,8 +4859,10 @@ const translations = { } return `updated the tag "${tagName}" on the list "${tagListName}" by adding a ${updatedField} of "${newValue}"`; }, - addCustomUnitRate: ({customUnitName, rateName}: UpdatedPolicyCustomUnitRateParams) => `added a new "${customUnitName}" rate "${rateName}"`, - deleteCustomUnitRate: ({customUnitName, rateName}: UpdatedPolicyCustomUnitRateParams) => `removed the "${customUnitName}" rate "${rateName}"`, + addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `added a new "${customUnitName}" rate "${rateName}"`, + updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => + `updated the rate of the ${customUnitName} ${updatedField} "${customUnitRateName}" from "${oldValue}" to "${newValue}"`, + deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `removed the "${customUnitName}" rate "${rateName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `added ${fieldType} Report Field "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `set the default value of report field "${fieldName}" to "${defaultValue}"`, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `removed ${fieldType} Report Field "${fieldName}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 7dc509f307fab..96ff0d9d44976 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -6,6 +6,7 @@ import type { ActionsAreCurrentlyRestricted, AddedOrDeletedPolicyReportFieldParams, AddEmployeeParams, + AddOrDeletePolicyCustomUnitRateParams, AddressLineParams, AdminCanceledRequestParams, AlreadySignedInParams, @@ -4910,8 +4911,10 @@ const translations = { } return `actualizó la etiqueta "${tagName}" en la lista "${tagListName}" añadiendo un ${updatedField} de "${newValue}"`; }, - addCustomUnitRate: ({customUnitName, rateName}: UpdatedPolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, - deleteCustomUnitRate: ({customUnitName, rateName}: UpdatedPolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, + addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, + updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => + `actualizó la tasa del ${customUnitName} ${updatedField} "${customUnitRateName}" de "${oldValue}" a "${newValue}"`, + deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `añadió el campo de informe ${fieldType} "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `estableció el valor predeterminado del campo de informe "${fieldName}" en "${defaultValue}"`, diff --git a/src/languages/params.ts b/src/languages/params.ts index 4a1ec021d49a8..005075b2f12cb 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -307,7 +307,9 @@ type UpdatedPolicyTagFieldParams = {oldValue?: string; newValue: string; tagName type UpdatedPolicyCategoryNameParams = {oldName: string; newName?: string}; -type UpdatedPolicyCustomUnitRateParams = {customUnitName: string; rateName: string}; +type AddOrDeletePolicyCustomUnitRateParams = {customUnitName: string; rateName: string}; + +type UpdatedPolicyCustomUnitRateParams = {customUnitName: string; customUnitRateName: string; oldValue: string; newValue: string; updatedField: string}; type AddedOrDeletedPolicyReportFieldParams = {fieldType: string; fieldName?: string}; @@ -894,4 +896,5 @@ export type { NeedCategoryForExportToIntegrationParams, UpdatedPolicyAuditRateParams, UpdatedPolicyManualApprovalThresholdParams, + AddOrDeletePolicyCustomUnitRateParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index f8949ce702fdc..de66120f81f4f 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1940,6 +1940,23 @@ function getWorkspaceCustomUnitRateAddedMessage(action: ReportAction): string { return getReportActionText(action); } +function getWorkspaceCustomUnitRateUpdatedMessage(action: ReportAction): string { + const {customUnitName, customUnitRateName, updatedField, oldValue, newValue} = + getOriginalMessage(action as ReportAction) ?? {}; + + if (customUnitName && customUnitRateName && updatedField && typeof oldValue === 'string' && typeof newValue === 'string') { + return translateLocal('workspaceActions.updatedCustomUnitRate', { + customUnitName, + customUnitRateName, + updatedField, + oldValue, + newValue, + }); + } + + return getReportActionText(action); +} + function getWorkspaceCustomUnitRateDeletedMessage(action: ReportAction): string { const {customUnitName, rateName} = getOriginalMessage(action as ReportAction) ?? {}; if (customUnitName && rateName) { @@ -2385,6 +2402,7 @@ export { getUpdatedManualApprovalThresholdMessage, getWorkspaceCustomUnitRateDeletedMessage, getAddedConnectionMessage, + getWorkspaceCustomUnitRateUpdatedMessage, }; export type {LastVisibleMessage}; diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 24287a2ceb863..766255670809e 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -47,6 +47,7 @@ import { getWorkspaceCurrencyUpdateMessage, getWorkspaceCustomUnitRateAddedMessage, getWorkspaceCustomUnitRateDeletedMessage, + getWorkspaceCustomUnitRateUpdatedMessage, getWorkspaceDescriptionUpdatedMessage, getWorkspaceFrequencyUpdateMessage, getWorkspaceReportFieldAddMessage, @@ -584,6 +585,8 @@ function getOptionData({ result.alternateText = getCleanedTagName(getWorkspaceTagUpdateMessage(lastAction) ?? ''); } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CUSTOM_UNIT_RATE)) { result.alternateText = getWorkspaceCustomUnitRateAddedMessage(lastAction); + } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE)) { + result.alternateText = getWorkspaceCustomUnitRateUpdatedMessage(lastAction); } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CUSTOM_UNIT_RATE)) { result.alternateText = getWorkspaceCustomUnitRateDeletedMessage(lastAction); } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_REPORT_FIELD)) { diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 49e06f4e9b74c..50ef6cd987353 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -47,6 +47,7 @@ import { getWorkspaceCurrencyUpdateMessage, getWorkspaceCustomUnitRateAddedMessage, getWorkspaceCustomUnitRateDeletedMessage, + getWorkspaceCustomUnitRateUpdatedMessage, getWorkspaceDescriptionUpdatedMessage, getWorkspaceFrequencyUpdateMessage, getWorkspaceReportFieldAddMessage, @@ -518,6 +519,8 @@ const ContextMenuActions: ContextMenuAction[] = [ Clipboard.setString(getCleanedTagName(getWorkspaceTagUpdateMessage(reportAction))); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CUSTOM_UNIT_RATE) { Clipboard.setString(getWorkspaceCustomUnitRateAddedMessage(reportAction)); + } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE) { + Clipboard.setString(getWorkspaceCustomUnitRateUpdatedMessage(reportAction)); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CUSTOM_UNIT_RATE) { Clipboard.setString(getWorkspaceCustomUnitRateDeletedMessage(reportAction)); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_REPORT_FIELD) { diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index b3df733cd9625..fa11bd67822ea 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -74,6 +74,7 @@ import { getWorkspaceCurrencyUpdateMessage, getWorkspaceCustomUnitRateAddedMessage, getWorkspaceCustomUnitRateDeletedMessage, + getWorkspaceCustomUnitRateUpdatedMessage, getWorkspaceDescriptionUpdatedMessage, getWorkspaceFrequencyUpdateMessage, getWorkspaceReportFieldAddMessage, @@ -906,6 +907,8 @@ function PureReportActionItem({ children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CUSTOM_UNIT_RATE) { children = ; + } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE) { + children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CUSTOM_UNIT_RATE) { children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_REPORT_FIELD) { diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 66bfaccdf34ef..d671fd56651fe 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -378,6 +378,9 @@ type OriginalMessagePolicyChangeLog = { /** Custom unit name */ customUnitName?: string; + /** Rate name of the custom unit */ + customUnitRateName?: string; + /** Custom unit name */ rateName?: string; From adbb89b5ebff9fa991d5a9dd6ebc7bb2952393b5 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Fri, 14 Mar 2025 03:19:35 +0530 Subject: [PATCH 06/40] add translation for POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT action. Signed-off-by: krishna2323 --- src/languages/en.ts | 3 +++ src/languages/es.ts | 3 +++ src/languages/params.ts | 3 +++ src/libs/ReportActionsUtils.ts | 16 ++++++++++++++++ src/libs/SidebarUtils.ts | 3 +++ .../report/ContextMenu/ContextMenuActions.tsx | 3 +++ src/pages/home/report/PureReportActionItem.tsx | 3 +++ 7 files changed, 34 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index 5ddf78d6a3d75..ae08cc8ea5b65 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -198,6 +198,7 @@ import type { UpdatedPolicyTagParams, UpdatedTheDistanceMerchantParams, UpdatedTheRequestParams, + UpdatePolicyCustomUnitParams, UpdateRoleParams, UsePlusButtonParams, UserIsAlreadyMemberParams, @@ -4903,6 +4904,8 @@ const translations = { } return `updated the tag "${tagName}" on the list "${tagListName}" by adding a ${updatedField} of "${newValue}"`; }, + updateCustomUnit: ({customUnitName, newValue, oldValue, updatedField}: UpdatePolicyCustomUnitParams) => + `updated the ${customUnitName} ${updatedField} from "${oldValue}" to "${newValue}"`, addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `added a new "${customUnitName}" rate "${rateName}"`, updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => `updated the rate of the ${customUnitName} ${updatedField} "${customUnitRateName}" from "${oldValue}" to "${newValue}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 7e86a669f7cc2..86d501c9004a2 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -197,6 +197,7 @@ import type { UpdatedPolicyTagParams, UpdatedTheDistanceMerchantParams, UpdatedTheRequestParams, + UpdatePolicyCustomUnitParams, UpdateRoleParams, UsePlusButtonParams, UserIsAlreadyMemberParams, @@ -4955,6 +4956,8 @@ const translations = { } return `actualizó la etiqueta "${tagName}" en la lista "${tagListName}" añadiendo un ${updatedField} de "${newValue}"`; }, + updateCustomUnit: ({customUnitName, newValue, oldValue, updatedField}: UpdatePolicyCustomUnitParams) => + `actualizó el ${customUnitName} ${updatedField} de "${oldValue}" a "${newValue}"`, addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => `actualizó la tasa del ${customUnitName} ${updatedField} "${customUnitRateName}" de "${oldValue}" a "${newValue}"`, diff --git a/src/languages/params.ts b/src/languages/params.ts index bcbac188b0589..70cb2d2763c5a 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -309,6 +309,8 @@ type UpdatedPolicyTagFieldParams = {oldValue?: string; newValue: string; tagName type UpdatedPolicyCategoryNameParams = {oldName: string; newName?: string}; +type UpdatePolicyCustomUnitParams = {oldValue: string; newValue: string; customUnitName: string; updatedField: string}; + type AddOrDeletePolicyCustomUnitRateParams = {customUnitName: string; rateName: string}; type UpdatedPolicyCustomUnitRateParams = {customUnitName: string; customUnitRateName: string; oldValue: string; newValue: string; updatedField: string}; @@ -899,5 +901,6 @@ export type { NeedCategoryForExportToIntegrationParams, UpdatedPolicyAuditRateParams, UpdatedPolicyManualApprovalThresholdParams, + UpdatePolicyCustomUnitParams, AddOrDeletePolicyCustomUnitRateParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 3031694d421d6..7bc07fc7bc6bc 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1900,6 +1900,21 @@ function getWorkspaceTagUpdateMessage(action: ReportAction): string { return getReportActionText(action); } +function getWorkspaceCustomUnitUpdatedMessage(action: ReportAction): string { + const {oldValue, newValue, customUnitName, updatedField} = getOriginalMessage(action as ReportAction) ?? {}; + + if (customUnitName && typeof oldValue === 'string' && typeof newValue === 'string' && updatedField) { + return translateLocal('workspaceActions.updateCustomUnit', { + customUnitName, + newValue, + oldValue, + updatedField, + }); + } + + return getReportActionText(action); +} + function getWorkspaceCustomUnitRateAddedMessage(action: ReportAction): string { const {customUnitName, rateName} = getOriginalMessage(action as ReportAction) ?? {}; @@ -2401,6 +2416,7 @@ export { getWorkspaceCustomUnitRateDeletedMessage, getAddedConnectionMessage, getWorkspaceCustomUnitRateUpdatedMessage, + getWorkspaceCustomUnitUpdatedMessage, getReportActions, }; diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index f3e9fdc304aef..faa9e31541192 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -48,6 +48,7 @@ import { getWorkspaceCustomUnitRateAddedMessage, getWorkspaceCustomUnitRateDeletedMessage, getWorkspaceCustomUnitRateUpdatedMessage, + getWorkspaceCustomUnitUpdatedMessage, getWorkspaceDescriptionUpdatedMessage, getWorkspaceFrequencyUpdateMessage, getWorkspaceReportFieldAddMessage, @@ -597,6 +598,8 @@ function getOptionData({ result.alternateText = getWorkspaceCategoryUpdateMessage(lastAction); } else if (isTagModificationAction(lastAction?.actionName)) { result.alternateText = getCleanedTagName(getWorkspaceTagUpdateMessage(lastAction) ?? ''); + } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT)) { + result.alternateText = getWorkspaceCustomUnitUpdatedMessage(lastAction); } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CUSTOM_UNIT_RATE)) { result.alternateText = getWorkspaceCustomUnitRateAddedMessage(lastAction); } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE)) { diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 77b04d4319cc2..338ceddb60926 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -48,6 +48,7 @@ import { getWorkspaceCustomUnitRateAddedMessage, getWorkspaceCustomUnitRateDeletedMessage, getWorkspaceCustomUnitRateUpdatedMessage, + getWorkspaceCustomUnitUpdatedMessage, getWorkspaceDescriptionUpdatedMessage, getWorkspaceFrequencyUpdateMessage, getWorkspaceReportFieldAddMessage, @@ -516,6 +517,8 @@ const ContextMenuActions: ContextMenuAction[] = [ Clipboard.setString(getWorkspaceCategoryUpdateMessage(reportAction)); } else if (isTagModificationAction(reportAction.actionName)) { Clipboard.setString(getCleanedTagName(getWorkspaceTagUpdateMessage(reportAction))); + } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT) { + Clipboard.setString(getWorkspaceCustomUnitUpdatedMessage(reportAction)); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CUSTOM_UNIT_RATE) { Clipboard.setString(getWorkspaceCustomUnitRateAddedMessage(reportAction)); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE) { diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 1228fb32ca8e4..28a01046f4a8f 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -75,6 +75,7 @@ import { getWorkspaceCustomUnitRateAddedMessage, getWorkspaceCustomUnitRateDeletedMessage, getWorkspaceCustomUnitRateUpdatedMessage, + getWorkspaceCustomUnitUpdatedMessage, getWorkspaceDescriptionUpdatedMessage, getWorkspaceFrequencyUpdateMessage, getWorkspaceReportFieldAddMessage, @@ -906,6 +907,8 @@ function PureReportActionItem({ children = ; } else if (isTagModificationAction(action.actionName)) { children = ; + } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT) { + children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CUSTOM_UNIT_RATE) { children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE) { From 1e9f8d5108a8c22fcf91da8810ba149450dc11ad Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Fri, 14 Mar 2025 03:39:06 +0530 Subject: [PATCH 07/40] add translation for UPDATE_CUSTOM_UNIT - updateCustomUnitTaxEnabled. Signed-off-by: krishna2323 --- src/languages/en.ts | 2 ++ src/languages/es.ts | 2 ++ src/languages/params.ts | 3 +++ src/libs/ReportActionsUtils.ts | 8 +++++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index ae08cc8ea5b65..bda6831fad224 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -199,6 +199,7 @@ import type { UpdatedTheDistanceMerchantParams, UpdatedTheRequestParams, UpdatePolicyCustomUnitParams, + UpdatePolicyCustomUnitTaxEnabledParams, UpdateRoleParams, UsePlusButtonParams, UserIsAlreadyMemberParams, @@ -4906,6 +4907,7 @@ const translations = { }, updateCustomUnit: ({customUnitName, newValue, oldValue, updatedField}: UpdatePolicyCustomUnitParams) => `updated the ${customUnitName} ${updatedField} from "${oldValue}" to "${newValue}"`, + updateCustomUnitTaxEnabled: ({newValue}: UpdatePolicyCustomUnitTaxEnabledParams) => `${newValue ? 'enabled' : 'disabled'} tax tracking on distance rates`, addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `added a new "${customUnitName}" rate "${rateName}"`, updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => `updated the rate of the ${customUnitName} ${updatedField} "${customUnitRateName}" from "${oldValue}" to "${newValue}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 86d501c9004a2..dfb16835d4407 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -198,6 +198,7 @@ import type { UpdatedTheDistanceMerchantParams, UpdatedTheRequestParams, UpdatePolicyCustomUnitParams, + UpdatePolicyCustomUnitTaxEnabledParams, UpdateRoleParams, UsePlusButtonParams, UserIsAlreadyMemberParams, @@ -4958,6 +4959,7 @@ const translations = { }, updateCustomUnit: ({customUnitName, newValue, oldValue, updatedField}: UpdatePolicyCustomUnitParams) => `actualizó el ${customUnitName} ${updatedField} de "${oldValue}" a "${newValue}"`, + updateCustomUnitTaxEnabled: ({newValue}: UpdatePolicyCustomUnitTaxEnabledParams) => `${newValue ? 'habilitó' : 'deshabilitó'} el seguimiento de impuestos en las tasas de distancia`, addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => `actualizó la tasa del ${customUnitName} ${updatedField} "${customUnitRateName}" de "${oldValue}" a "${newValue}"`, diff --git a/src/languages/params.ts b/src/languages/params.ts index 70cb2d2763c5a..e050b73d966bd 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -309,6 +309,8 @@ type UpdatedPolicyTagFieldParams = {oldValue?: string; newValue: string; tagName type UpdatedPolicyCategoryNameParams = {oldName: string; newName?: string}; +type UpdatePolicyCustomUnitTaxEnabledParams = {newValue: boolean}; + type UpdatePolicyCustomUnitParams = {oldValue: string; newValue: string; customUnitName: string; updatedField: string}; type AddOrDeletePolicyCustomUnitRateParams = {customUnitName: string; rateName: string}; @@ -901,6 +903,7 @@ export type { NeedCategoryForExportToIntegrationParams, UpdatedPolicyAuditRateParams, UpdatedPolicyManualApprovalThresholdParams, + UpdatePolicyCustomUnitTaxEnabledParams, UpdatePolicyCustomUnitParams, AddOrDeletePolicyCustomUnitRateParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 7bc07fc7bc6bc..3c13d6824497e 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1901,7 +1901,13 @@ function getWorkspaceTagUpdateMessage(action: ReportAction): string { } function getWorkspaceCustomUnitUpdatedMessage(action: ReportAction): string { - const {oldValue, newValue, customUnitName, updatedField} = getOriginalMessage(action as ReportAction) ?? {}; + const {oldValue, newValue, customUnitName, updatedField} = getOriginalMessage(action as ReportAction) ?? {}; + + if (customUnitName === 'Distance' && updatedField === 'taxEnabled' && typeof newValue === 'boolean') { + return translateLocal('workspaceActions.updateCustomUnitTaxEnabled', { + newValue, + }); + } if (customUnitName && typeof oldValue === 'string' && typeof newValue === 'string' && updatedField) { return translateLocal('workspaceActions.updateCustomUnit', { From 501c0fda9e089f500bbe0b8e62e8ce23fe6e0c94 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Fri, 14 Mar 2025 04:14:21 +0530 Subject: [PATCH 08/40] add translation for POLICYCHANGELOG_ADD_APPROVER_RULE. Signed-off-by: krishna2323 --- src/languages/en.ts | 2 ++ src/languages/es.ts | 3 +++ src/languages/params.ts | 3 +++ src/libs/ReportActionsUtils.ts | 17 +++++++++++++++++ src/libs/SidebarUtils.ts | 3 +++ .../report/ContextMenu/ContextMenuActions.tsx | 3 +++ src/pages/home/report/PureReportActionItem.tsx | 3 +++ src/types/onyx/OriginalMessage.ts | 15 +++++++++++++++ 8 files changed, 49 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index bda6831fad224..8965ae70ea394 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -6,6 +6,7 @@ import type { AccountOwnerParams, ActionsAreCurrentlyRestricted, AddedOrDeletedPolicyReportFieldParams, + AddedPolicyApprovalRuleParams, AddEmployeeParams, AddOrDeletePolicyCustomUnitRateParams, AddressLineParams, @@ -4891,6 +4892,7 @@ const translations = { billcom: 'BILLCOM', }, workspaceActions: { + addApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => `added ${approverName} (${approverEmail}) as an approver for the ${field} "${name}"`, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `added the category "${categoryName}"`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `removed the category "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'disabled' : 'enabled'} the category "${categoryName}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index dfb16835d4407..ddfbaad4d4222 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -5,6 +5,7 @@ import type { AccountOwnerParams, ActionsAreCurrentlyRestricted, AddedOrDeletedPolicyReportFieldParams, + AddedPolicyApprovalRuleParams, AddEmployeeParams, AddOrDeletePolicyCustomUnitRateParams, AddressLineParams, @@ -4943,6 +4944,8 @@ const translations = { billcom: 'BILLCOM', }, workspaceActions: { + addApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => + `agregó a ${approverName} (${approverEmail}) como aprobador para el/la ${field} "${name}"`, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `añadió la categoría "${categoryName}""`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `eliminó la categoría "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'deshabilitó' : 'habilitó'} la categoría "${categoryName}"`, diff --git a/src/languages/params.ts b/src/languages/params.ts index e050b73d966bd..499f8d055979f 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -321,6 +321,8 @@ type AddedOrDeletedPolicyReportFieldParams = {fieldType: string; fieldName?: str type UpdatedPolicyReportFieldDefaultValueParams = {fieldName?: string; defaultValue?: string}; +type AddedPolicyApprovalRuleParams = {approverEmail: string; approverName: string; field: string; name: string}; + type UpdatedPolicyPreventSelfApprovalParams = {oldValue: string; newValue: string}; type UpdatedPolicyFieldWithNewAndOldValueParams = {oldValue: string; newValue: string}; @@ -906,4 +908,5 @@ export type { UpdatePolicyCustomUnitTaxEnabledParams, UpdatePolicyCustomUnitParams, AddOrDeletePolicyCustomUnitRateParams, + AddedPolicyApprovalRuleParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 3c13d6824497e..957748ff0dbd2 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2144,6 +2144,22 @@ function getRenamedAction(reportAction: OnyxEntry) { + const {name, approverAccountID, approverEmail, field, approverName} = + getOriginalMessage(reportAction as ReportAction) ?? {}; + + if (name && approverAccountID && approverEmail && field && approverName) { + return translateLocal('workspaceActions.addApprovalRule', { + approverEmail, + approverName, + field, + name, + }); + } + + return getReportActionText(reportAction); +} + function getRemovedFromApprovalChainMessage(reportAction: OnyxEntry>) { const originalMessage = getOriginalMessage(reportAction); const submittersNames = getPersonalDetailsByIDs({ @@ -2313,6 +2329,7 @@ export { getNumberOfMoneyRequests, getOneTransactionThreadReportID, getOriginalMessage, + getAddedApprovaRulelMessage, getRemovedFromApprovalChainMessage, getDemotedFromWorkspaceMessage, getReportAction, diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index faa9e31541192..26da571480ced 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -22,6 +22,7 @@ import Parser from './Parser'; import Performance from './Performance'; import {getCleanedTagName, getPolicy} from './PolicyUtils'; import { + getAddedApprovaRulelMessage, getAddedConnectionMessage, getCardIssuedMessage, getLastVisibleMessage, @@ -644,6 +645,8 @@ function getOptionData({ result.alternateText = getRemovedConnectionMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE) { result.alternateText = getUpdatedAuditRateMessage(lastAction); + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE) { + result.alternateText = getAddedApprovaRulelMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD) { result.alternateText = getUpdatedManualApprovalThresholdMessage(lastAction); } else { diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 338ceddb60926..83d09e82fa8ee 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -23,6 +23,7 @@ import {getCleanedTagName} from '@libs/PolicyUtils'; import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager'; import { getActionableMentionWhisperMessage, + getAddedApprovaRulelMessage, getAddedConnectionMessage, getCardIssuedMessage, getExportIntegrationMessageHTML, @@ -619,6 +620,8 @@ const ContextMenuActions: ContextMenuAction[] = [ setClipboardMessage(getRemovedConnectionMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUDIT_RATE)) { setClipboardMessage(getUpdatedAuditRateMessage(reportAction)); + } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE)) { + setClipboardMessage(getAddedApprovaRulelMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD)) { setClipboardMessage(getUpdatedManualApprovalThresholdMessage(reportAction)); } else if (content) { diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 28a01046f4a8f..5baf3785f1de7 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -49,6 +49,7 @@ import {getDisplayNameOrDefault} from '@libs/PersonalDetailsUtils'; import {getCleanedTagName} from '@libs/PolicyUtils'; import { extractLinksFromMessageHtml, + getAddedApprovaRulelMessage, getAddedConnectionMessage, getAllReportActions, getDemotedFromWorkspaceMessage, @@ -937,6 +938,8 @@ function PureReportActionItem({ children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_EMPLOYEE) { children = ; + } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE)) { + children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REMOVED_FROM_APPROVAL_CHAIN)) { children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.DEMOTED_FROM_WORKSPACE)) { diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index c7190ef6583af..e2578eea3691e 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -419,6 +419,21 @@ type OriginalMessagePolicyChangeLog = { /** New limit of manual approval threshold */ newLimit?: number; + + /** Name for the field of which approver has been updated */ + name?: string; + + /** Account ID of the approver */ + approverAccountID?: string; + + /** Email of the approver */ + approverEmail?: string; + + /** Name of the approver */ + approverName?: string; + + /** Field of which approver has been updated */ + field?: string; }; /** Model of `join policy` report action */ From eb1babe424b03b373fa2d99af8f56c1c55db097f Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Fri, 14 Mar 2025 04:27:31 +0530 Subject: [PATCH 09/40] add translation for UPDATE_TAG_LIST_NAME. Signed-off-by: krishna2323 --- src/languages/en.ts | 1 + src/languages/es.ts | 1 + src/libs/ReportActionsUtils.ts | 12 ++++++++++++ src/libs/SidebarUtils.ts | 3 +++ .../home/report/ContextMenu/ContextMenuActions.tsx | 3 +++ src/pages/home/report/PureReportActionItem.tsx | 3 +++ 6 files changed, 23 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index 8965ae70ea394..de232b83a0462 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4897,6 +4897,7 @@ const translations = { deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `removed the category "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'disabled' : 'enabled'} the category "${categoryName}"`, setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renamed the category "${oldName}" to "${newName}"`, + updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `updated the name of the tag list "${oldName}" to be "${newName}"`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `added the tag "${tagName}" to the list "${tagListName}"`, updateTagName: ({tagListName, newName, oldName}: UpdatedPolicyTagNameParams) => `updated the tag list "${tagListName}" by changing the tag "${oldName}" to "${newName}`, updateTagEnabled: ({tagListName, tagName, enabled}: UpdatedPolicyTagParams) => `${enabled ? 'enabled' : 'disabled'} the tag "${tagName}" on the list "${tagListName}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index ddfbaad4d4222..36af3e71f8a1e 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -4950,6 +4950,7 @@ const translations = { deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `eliminó la categoría "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'deshabilitó' : 'habilitó'} la categoría "${categoryName}"`, setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renombró la categoría "${oldName}" a "${newName}`, + updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `actualizó el nombre de la lista de etiquetas de "${oldName}" a "${newName}"`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `añadió la etiqueta "${tagName}" a la lista "${tagListName}"`, updateTagName: ({tagListName, newName, oldName}: UpdatedPolicyTagNameParams) => `actualizó la lista de etiquetas "${tagListName}" cambiando la etiqueta "${oldName}" a "${newName}"`, updateTagEnabled: ({tagListName, tagName, enabled}: UpdatedPolicyTagParams) => `${enabled ? 'habilitó' : 'deshabilitó'} la etiqueta "${tagName}" en la lista "${tagListName}"`, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 957748ff0dbd2..e74a7fa9c6fff 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1900,6 +1900,17 @@ function getWorkspaceTagUpdateMessage(action: ReportAction): string { return getReportActionText(action); } +function getTagListNameUpdatedMessage(action: ReportAction): string { + const {oldName, newName} = getOriginalMessage(action as ReportAction) ?? {}; + if (newName && oldName) { + return translateLocal('workspaceActions.updateTagListName', { + oldName, + newName, + }); + } + return getReportActionText(action); +} + function getWorkspaceCustomUnitUpdatedMessage(action: ReportAction): string { const {oldValue, newValue, customUnitName, updatedField} = getOriginalMessage(action as ReportAction) ?? {}; @@ -2439,6 +2450,7 @@ export { getWorkspaceCustomUnitRateDeletedMessage, getAddedConnectionMessage, getWorkspaceCustomUnitRateUpdatedMessage, + getTagListNameUpdatedMessage, getWorkspaceCustomUnitUpdatedMessage, getReportActions, }; diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 26da571480ced..ef46a7d2e6d15 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -41,6 +41,7 @@ import { getReportAction, getReportActionMessageText, getSortedReportActions, + getTagListNameUpdatedMessage, getUpdatedAuditRateMessage, getUpdatedManualApprovalThresholdMessage, getUpdateRoomDescriptionMessage, @@ -597,6 +598,8 @@ function getOptionData({ isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.SET_CATEGORY_NAME) ) { result.alternateText = getWorkspaceCategoryUpdateMessage(lastAction); + } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG_LIST_NAME)) { + result.alternateText = getCleanedTagName(getTagListNameUpdatedMessage(lastAction) ?? ''); } else if (isTagModificationAction(lastAction?.actionName)) { result.alternateText = getCleanedTagName(getWorkspaceTagUpdateMessage(lastAction) ?? ''); } else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT)) { diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 83d09e82fa8ee..dff7f3c4fc836 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -41,6 +41,7 @@ import { getRemovedConnectionMessage, getRenamedAction, getReportActionMessageText, + getTagListNameUpdatedMessage, getUpdatedAuditRateMessage, getUpdatedManualApprovalThresholdMessage, getUpdateRoomDescriptionMessage, @@ -516,6 +517,8 @@ const ContextMenuActions: ContextMenuAction[] = [ reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.SET_CATEGORY_NAME ) { Clipboard.setString(getWorkspaceCategoryUpdateMessage(reportAction)); + } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG_LIST_NAME) { + Clipboard.setString(getCleanedTagName(getTagListNameUpdatedMessage(reportAction))); } else if (isTagModificationAction(reportAction.actionName)) { Clipboard.setString(getCleanedTagName(getWorkspaceTagUpdateMessage(reportAction))); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT) { diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 5baf3785f1de7..43ae74958f321 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -68,6 +68,7 @@ import { getRenamedAction, getReportActionMessage, getReportActionText, + getTagListNameUpdatedMessage, getUpdatedAuditRateMessage, getUpdatedManualApprovalThresholdMessage, getWhisperedTo, @@ -906,6 +907,8 @@ function PureReportActionItem({ action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.SET_CATEGORY_NAME ) { children = ; + } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG_LIST_NAME) { + children = ; } else if (isTagModificationAction(action.actionName)) { children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT) { From 7c33d45948124b3ad1f8463fe84485bfc9edf9a0 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Sun, 16 Mar 2025 19:03:26 +0530 Subject: [PATCH 10/40] add translation for UPDATE_REPORT_FIELD - Added option. Signed-off-by: krishna2323 --- src/languages/en.ts | 2 ++ src/languages/es.ts | 2 ++ src/languages/params.ts | 3 +++ src/libs/ReportActionsUtils.ts | 9 ++++++++- src/types/onyx/OriginalMessage.ts | 3 +++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index f0613c1821187..01229d031a3a5 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -128,6 +128,7 @@ import type { PayerPaidParams, PayerSettledParams, PaySomeoneParams, + PolicyAddedReportFieldOptionParams, PolicyExpenseChatNameParams, ReconciliationWorksParams, RemovedFromApprovalWorkflowParams, @@ -4902,6 +4903,7 @@ const translations = { deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `removed the "${customUnitName}" rate "${rateName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `added ${fieldType} Report Field "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `set the default value of report field "${fieldName}" to "${defaultValue}"`, + updateReportFieldAddedOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `updated Report Field "${fieldName}"; Added the option "${optionName}"`, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `removed ${fieldType} Report Field "${fieldName}"`, preventSelfApproval: ({oldValue, newValue}: UpdatedPolicyPreventSelfApprovalParams) => `updated "Prevent self-approval" to "${newValue === 'true' ? 'Enabled' : 'Disabled'}" (previously "${oldValue === 'true' ? 'Enabled' : 'Disabled'}")`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 4243a53bf1bbd..3439187c1ea7b 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -127,6 +127,7 @@ import type { PayerPaidParams, PayerSettledParams, PaySomeoneParams, + PolicyAddedReportFieldOptionParams, PolicyExpenseChatNameParams, ReconciliationWorksParams, RemovedFromApprovalWorkflowParams, @@ -4956,6 +4957,7 @@ const translations = { addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `añadió el campo de informe ${fieldType} "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `estableció el valor predeterminado del campo de informe "${fieldName}" en "${defaultValue}"`, + updateReportFieldAddedOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `actualizó el campo de informe "${fieldName}"; agregó la opción "${optionName}"`, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `eliminó el campo de informe ${fieldType} "${fieldName}"`, preventSelfApproval: ({oldValue, newValue}: UpdatedPolicyPreventSelfApprovalParams) => `actualizó "Evitar la autoaprobación" a "${newValue === 'true' ? 'Habilitada' : 'Deshabilitada'}" (previamente "${oldValue === 'true' ? 'Habilitada' : 'Deshabilitada'}")`, diff --git a/src/languages/params.ts b/src/languages/params.ts index 499f8d055979f..d1482f2a4fa35 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -321,6 +321,8 @@ type AddedOrDeletedPolicyReportFieldParams = {fieldType: string; fieldName?: str type UpdatedPolicyReportFieldDefaultValueParams = {fieldName?: string; defaultValue?: string}; +type PolicyAddedReportFieldOptionParams = {fieldName?: string; optionName: string}; + type AddedPolicyApprovalRuleParams = {approverEmail: string; approverName: string; field: string; name: string}; type UpdatedPolicyPreventSelfApprovalParams = {oldValue: string; newValue: string}; @@ -899,6 +901,7 @@ export type { UpdatedPolicyTagNameParams, UpdatedPolicyTagFieldParams, UpdatedPolicyReportFieldDefaultValueParams, + PolicyAddedReportFieldOptionParams, SubmitsToParams, SettlementDateParams, PolicyExpenseChatNameParams, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index bf5dd4788a604..91086dbd720fe 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1993,7 +1993,7 @@ function getWorkspaceReportFieldAddMessage(action: ReportAction): string { } function getWorkspaceReportFieldUpdateMessage(action: ReportAction): string { - const {updateType, fieldName, defaultValue} = getOriginalMessage(action as ReportAction) ?? {}; + const {updateType, fieldName, defaultValue, optionName} = getOriginalMessage(action as ReportAction) ?? {}; if (updateType === 'updatedDefaultValue' && fieldName && defaultValue) { return translateLocal('workspaceActions.updateReportFieldDefaultValue', { @@ -2002,6 +2002,13 @@ function getWorkspaceReportFieldUpdateMessage(action: ReportAction): string { }); } + if (updateType === 'addedOption' && fieldName && optionName) { + return translateLocal('workspaceActions.updateReportFieldAddedOption', { + fieldName, + optionName, + }); + } + return getReportActionText(action); } diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 4dd961d9284eb..65504ed844fd5 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -434,6 +434,9 @@ type OriginalMessagePolicyChangeLog = { /** Field of which approver has been updated */ field?: string; + + /** Option name of a list report field */ + optionName?: string; }; /** Model of `join policy` report action */ From a18de2f6755d5a0153b7186d55c95777a039db9b Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Sun, 16 Mar 2025 19:28:38 +0530 Subject: [PATCH 11/40] add translation for UPDATE_REPORT_FIELD - changedOptionDisabled. Signed-off-by: krishna2323 --- src/languages/en.ts | 3 +++ src/languages/es.ts | 3 +++ src/languages/params.ts | 3 +++ src/libs/ReportActionsUtils.ts | 14 ++++++++++++++ 4 files changed, 23 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index 01229d031a3a5..72112180bab2e 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -129,6 +129,7 @@ import type { PayerSettledParams, PaySomeoneParams, PolicyAddedReportFieldOptionParams, + PolicyDisabledReportFieldOptionParams, PolicyExpenseChatNameParams, ReconciliationWorksParams, RemovedFromApprovalWorkflowParams, @@ -4904,6 +4905,8 @@ const translations = { addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `added ${fieldType} Report Field "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `set the default value of report field "${fieldName}" to "${defaultValue}"`, updateReportFieldAddedOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `updated Report Field "${fieldName}"; Added the option "${optionName}"`, + updateReportFieldOptionDisabled: ({fieldName, optionName, optionEnabled}: PolicyDisabledReportFieldOptionParams) => + `updated Report Field "${fieldName}"; Set the option "${optionName}" to be ${optionEnabled ? 'Enabled' : 'Disabled'}`, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `removed ${fieldType} Report Field "${fieldName}"`, preventSelfApproval: ({oldValue, newValue}: UpdatedPolicyPreventSelfApprovalParams) => `updated "Prevent self-approval" to "${newValue === 'true' ? 'Enabled' : 'Disabled'}" (previously "${oldValue === 'true' ? 'Enabled' : 'Disabled'}")`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 3439187c1ea7b..2a5326784e75e 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -128,6 +128,7 @@ import type { PayerSettledParams, PaySomeoneParams, PolicyAddedReportFieldOptionParams, + PolicyDisabledReportFieldOptionParams, PolicyExpenseChatNameParams, ReconciliationWorksParams, RemovedFromApprovalWorkflowParams, @@ -4958,6 +4959,8 @@ const translations = { updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `estableció el valor predeterminado del campo de informe "${fieldName}" en "${defaultValue}"`, updateReportFieldAddedOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `actualizó el campo de informe "${fieldName}"; agregó la opción "${optionName}"`, + updateReportFieldOptionDisabled: ({fieldName, optionName, optionEnabled}: PolicyDisabledReportFieldOptionParams) => + `actualizó el campo de informe "${fieldName}"; estableció la opción "${optionName}" como ${optionEnabled ? 'Habilitada' : 'Deshabilitada'}`, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `eliminó el campo de informe ${fieldType} "${fieldName}"`, preventSelfApproval: ({oldValue, newValue}: UpdatedPolicyPreventSelfApprovalParams) => `actualizó "Evitar la autoaprobación" a "${newValue === 'true' ? 'Habilitada' : 'Deshabilitada'}" (previamente "${oldValue === 'true' ? 'Habilitada' : 'Deshabilitada'}")`, diff --git a/src/languages/params.ts b/src/languages/params.ts index d1482f2a4fa35..739a918bc2a36 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -323,6 +323,8 @@ type UpdatedPolicyReportFieldDefaultValueParams = {fieldName?: string; defaultVa type PolicyAddedReportFieldOptionParams = {fieldName?: string; optionName: string}; +type PolicyDisabledReportFieldOptionParams = {fieldName: string; optionName: string; optionEnabled: boolean}; + type AddedPolicyApprovalRuleParams = {approverEmail: string; approverName: string; field: string; name: string}; type UpdatedPolicyPreventSelfApprovalParams = {oldValue: string; newValue: string}; @@ -902,6 +904,7 @@ export type { UpdatedPolicyTagFieldParams, UpdatedPolicyReportFieldDefaultValueParams, PolicyAddedReportFieldOptionParams, + PolicyDisabledReportFieldOptionParams, SubmitsToParams, SettlementDateParams, PolicyExpenseChatNameParams, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 91086dbd720fe..2860b3336436c 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2009,6 +2009,20 @@ function getWorkspaceReportFieldUpdateMessage(action: ReportAction): string { }); } + if (updateType === 'changedOptionDisabled' && fieldName && optionName) { + return translateLocal('workspaceActions.updateReportFieldAddedOption', { + fieldName, + optionName, + }); + } + + if (updateType === 'updatedAllDisabled' && fieldName && optionName) { + return translateLocal('workspaceActions.updateReportFieldAddedOption', { + fieldName, + optionName, + }); + } + return getReportActionText(action); } From 5b5be612e613c443e5be2ec39b4505b9f628eae4 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Sun, 16 Mar 2025 19:49:18 +0530 Subject: [PATCH 12/40] add translation for UPDATE_REPORT_FIELD - updatedAllDisabled. Signed-off-by: krishna2323 --- src/languages/en.ts | 3 +++ src/languages/es.ts | 5 +++++ src/languages/params.ts | 3 +++ src/libs/ReportActionsUtils.ts | 6 ++++-- src/types/onyx/OriginalMessage.ts | 3 +++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 72112180bab2e..fc427c4c40fca 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -129,6 +129,7 @@ import type { PayerSettledParams, PaySomeoneParams, PolicyAddedReportFieldOptionParams, + PolicyDisabledReportFieldAllOptionsParams, PolicyDisabledReportFieldOptionParams, PolicyExpenseChatNameParams, ReconciliationWorksParams, @@ -4907,6 +4908,8 @@ const translations = { updateReportFieldAddedOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `updated Report Field "${fieldName}"; Added the option "${optionName}"`, updateReportFieldOptionDisabled: ({fieldName, optionName, optionEnabled}: PolicyDisabledReportFieldOptionParams) => `updated Report Field "${fieldName}"; Set the option "${optionName}" to be ${optionEnabled ? 'Enabled' : 'Disabled'}`, + updateReportFieldAllOptionsDisabled: ({fieldName, optionName, allEnabled}: PolicyDisabledReportFieldAllOptionsParams) => + `updated Report Field "${fieldName}"; Set the option "${optionName}" to be ${allEnabled ? 'Enabled' : 'Disabled'} making all options ${allEnabled ? 'Enabled' : 'Disabled'}`, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `removed ${fieldType} Report Field "${fieldName}"`, preventSelfApproval: ({oldValue, newValue}: UpdatedPolicyPreventSelfApprovalParams) => `updated "Prevent self-approval" to "${newValue === 'true' ? 'Enabled' : 'Disabled'}" (previously "${oldValue === 'true' ? 'Enabled' : 'Disabled'}")`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 2a5326784e75e..64f698aea538c 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -128,6 +128,7 @@ import type { PayerSettledParams, PaySomeoneParams, PolicyAddedReportFieldOptionParams, + PolicyDisabledReportFieldAllOptionsParams, PolicyDisabledReportFieldOptionParams, PolicyExpenseChatNameParams, ReconciliationWorksParams, @@ -4961,6 +4962,10 @@ const translations = { updateReportFieldAddedOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `actualizó el campo de informe "${fieldName}"; agregó la opción "${optionName}"`, updateReportFieldOptionDisabled: ({fieldName, optionName, optionEnabled}: PolicyDisabledReportFieldOptionParams) => `actualizó el campo de informe "${fieldName}"; estableció la opción "${optionName}" como ${optionEnabled ? 'Habilitada' : 'Deshabilitada'}`, + updateReportFieldAllOptionsDisabled: ({fieldName, optionName, allEnabled}: PolicyDisabledReportFieldAllOptionsParams) => + `actualizó el campo de informe "${fieldName}"; estableció la opción "${optionName}" como ${allEnabled ? 'Habilitada' : 'Deshabilitada'}, haciendo que todas las opciones estén ${ + allEnabled ? 'Habilitadas' : 'Deshabilitadas' + }`, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `eliminó el campo de informe ${fieldType} "${fieldName}"`, preventSelfApproval: ({oldValue, newValue}: UpdatedPolicyPreventSelfApprovalParams) => `actualizó "Evitar la autoaprobación" a "${newValue === 'true' ? 'Habilitada' : 'Deshabilitada'}" (previamente "${oldValue === 'true' ? 'Habilitada' : 'Deshabilitada'}")`, diff --git a/src/languages/params.ts b/src/languages/params.ts index 739a918bc2a36..cbda37c874133 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -325,6 +325,8 @@ type PolicyAddedReportFieldOptionParams = {fieldName?: string; optionName: strin type PolicyDisabledReportFieldOptionParams = {fieldName: string; optionName: string; optionEnabled: boolean}; +type PolicyDisabledReportFieldAllOptionsParams = {fieldName: string; optionName: string; allEnabled: boolean}; + type AddedPolicyApprovalRuleParams = {approverEmail: string; approverName: string; field: string; name: string}; type UpdatedPolicyPreventSelfApprovalParams = {oldValue: string; newValue: string}; @@ -905,6 +907,7 @@ export type { UpdatedPolicyReportFieldDefaultValueParams, PolicyAddedReportFieldOptionParams, PolicyDisabledReportFieldOptionParams, + PolicyDisabledReportFieldAllOptionsParams, SubmitsToParams, SettlementDateParams, PolicyExpenseChatNameParams, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 2860b3336436c..274f027fd88fd 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1993,7 +1993,8 @@ function getWorkspaceReportFieldAddMessage(action: ReportAction): string { } function getWorkspaceReportFieldUpdateMessage(action: ReportAction): string { - const {updateType, fieldName, defaultValue, optionName} = getOriginalMessage(action as ReportAction) ?? {}; + const {updateType, fieldName, defaultValue, optionName, allEnabled} = + getOriginalMessage(action as ReportAction) ?? {}; if (updateType === 'updatedDefaultValue' && fieldName && defaultValue) { return translateLocal('workspaceActions.updateReportFieldDefaultValue', { @@ -2017,9 +2018,10 @@ function getWorkspaceReportFieldUpdateMessage(action: ReportAction): string { } if (updateType === 'updatedAllDisabled' && fieldName && optionName) { - return translateLocal('workspaceActions.updateReportFieldAddedOption', { + return translateLocal('workspaceActions.updateReportFieldAllOptionsDisabled', { fieldName, optionName, + allEnabled: !!allEnabled, }); } diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 65504ed844fd5..d4b541367f021 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -437,6 +437,9 @@ type OriginalMessagePolicyChangeLog = { /** Option name of a list report field */ optionName?: string; + + /** Are all allEnabled report field options enabled */ + allEnabled?: string; }; /** Model of `join policy` report action */ From 26ac2efeaaef8391d330be6f8990562214d8a3f9 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Mon, 17 Mar 2025 03:08:32 +0530 Subject: [PATCH 13/40] add translation for UPDATE_REPORT_FIELD - Removed option. Signed-off-by: krishna2323 --- src/languages/en.ts | 3 ++- src/languages/es.ts | 3 ++- src/libs/ReportActionsUtils.ts | 14 +++++++++++--- src/types/onyx/OriginalMessage.ts | 3 +++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index fc427c4c40fca..c109609807a4b 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4905,7 +4905,8 @@ const translations = { deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `removed the "${customUnitName}" rate "${rateName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `added ${fieldType} Report Field "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `set the default value of report field "${fieldName}" to "${defaultValue}"`, - updateReportFieldAddedOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `updated Report Field "${fieldName}"; Added the option "${optionName}"`, + addedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `updated Report Field "${fieldName}"; Added the option "${optionName}"`, + removedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `updated Report Field "${fieldName}"; Removed the option "${optionName}"`, updateReportFieldOptionDisabled: ({fieldName, optionName, optionEnabled}: PolicyDisabledReportFieldOptionParams) => `updated Report Field "${fieldName}"; Set the option "${optionName}" to be ${optionEnabled ? 'Enabled' : 'Disabled'}`, updateReportFieldAllOptionsDisabled: ({fieldName, optionName, allEnabled}: PolicyDisabledReportFieldAllOptionsParams) => diff --git a/src/languages/es.ts b/src/languages/es.ts index 64f698aea538c..def33fd513b62 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -4959,7 +4959,8 @@ const translations = { addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `añadió el campo de informe ${fieldType} "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `estableció el valor predeterminado del campo de informe "${fieldName}" en "${defaultValue}"`, - updateReportFieldAddedOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `actualizó el campo de informe "${fieldName}"; agregó la opción "${optionName}"`, + addedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `actualizó el campo de informe "${fieldName}"; agregó la opción "${optionName}"`, + removedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `actualizó el campo de informe "${fieldName}"; eliminó la opción "${optionName}"`, updateReportFieldOptionDisabled: ({fieldName, optionName, optionEnabled}: PolicyDisabledReportFieldOptionParams) => `actualizó el campo de informe "${fieldName}"; estableció la opción "${optionName}" como ${optionEnabled ? 'Habilitada' : 'Deshabilitada'}`, updateReportFieldAllOptionsDisabled: ({fieldName, optionName, allEnabled}: PolicyDisabledReportFieldAllOptionsParams) => diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 274f027fd88fd..66f7020213f08 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1993,7 +1993,7 @@ function getWorkspaceReportFieldAddMessage(action: ReportAction): string { } function getWorkspaceReportFieldUpdateMessage(action: ReportAction): string { - const {updateType, fieldName, defaultValue, optionName, allEnabled} = + const {updateType, fieldName, defaultValue, optionName, allEnabled, optionEnabled} = getOriginalMessage(action as ReportAction) ?? {}; if (updateType === 'updatedDefaultValue' && fieldName && defaultValue) { @@ -2004,16 +2004,17 @@ function getWorkspaceReportFieldUpdateMessage(action: ReportAction): string { } if (updateType === 'addedOption' && fieldName && optionName) { - return translateLocal('workspaceActions.updateReportFieldAddedOption', { + return translateLocal('workspaceActions.addedReportFieldOption', { fieldName, optionName, }); } if (updateType === 'changedOptionDisabled' && fieldName && optionName) { - return translateLocal('workspaceActions.updateReportFieldAddedOption', { + return translateLocal('workspaceActions.updateReportFieldOptionDisabled', { fieldName, optionName, + optionEnabled: !!optionEnabled, }); } @@ -2025,6 +2026,13 @@ function getWorkspaceReportFieldUpdateMessage(action: ReportAction): string { }); } + if (updateType === 'removedOption' && fieldName && optionName) { + return translateLocal('workspaceActions.removedReportFieldOption', { + fieldName, + optionName, + }); + } + return getReportActionText(action); } diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index d4b541367f021..0ee1022f716bf 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -438,6 +438,9 @@ type OriginalMessagePolicyChangeLog = { /** Option name of a list report field */ optionName?: string; + /** Option enabled state of a list report field */ + optionEnabled?: string; + /** Are all allEnabled report field options enabled */ allEnabled?: string; }; From da57fc92f2e43d3268ee5387e45fbe1a1fdd6e2b Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Mon, 17 Mar 2025 03:24:34 +0530 Subject: [PATCH 14/40] fix UPDATE_REPORT_FIELD - updateReportFieldAllOptionsDisabled action. Signed-off-by: krishna2323 --- src/languages/en.ts | 11 +++++++++-- src/languages/es.ts | 12 ++++++++---- src/languages/params.ts | 2 +- src/libs/ReportActionsUtils.ts | 3 ++- src/types/onyx/OriginalMessage.ts | 3 +++ 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index c109609807a4b..2b66e7b1cd930 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4904,13 +4904,20 @@ const translations = { `updated the rate of the ${customUnitName} ${updatedField} "${customUnitRateName}" from "${oldValue}" to "${newValue}"`, deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `removed the "${customUnitName}" rate "${rateName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `added ${fieldType} Report Field "${fieldName}"`, + updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `set the default value of report field "${fieldName}" to "${defaultValue}"`, addedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `updated Report Field "${fieldName}"; Added the option "${optionName}"`, removedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `updated Report Field "${fieldName}"; Removed the option "${optionName}"`, updateReportFieldOptionDisabled: ({fieldName, optionName, optionEnabled}: PolicyDisabledReportFieldOptionParams) => `updated Report Field "${fieldName}"; Set the option "${optionName}" to be ${optionEnabled ? 'Enabled' : 'Disabled'}`, - updateReportFieldAllOptionsDisabled: ({fieldName, optionName, allEnabled}: PolicyDisabledReportFieldAllOptionsParams) => - `updated Report Field "${fieldName}"; Set the option "${optionName}" to be ${allEnabled ? 'Enabled' : 'Disabled'} making all options ${allEnabled ? 'Enabled' : 'Disabled'}`, + updateReportFieldAllOptionsDisabled: ({fieldName, optionName, allEnabled, toggledOptionsCount}: PolicyDisabledReportFieldAllOptionsParams) => { + if (toggledOptionsCount && toggledOptionsCount > 1) { + return `updated Report Field "${fieldName}"; Set all options to be ${allEnabled ? 'Enabled' : 'Disabled'}`; + } + return `updated Report Field "${fieldName}"; Set the option "${optionName}" to be ${allEnabled ? 'Enabled' : 'Disabled'} making all options ${ + allEnabled ? 'Enabled' : 'Disabled' + }`; + }, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `removed ${fieldType} Report Field "${fieldName}"`, preventSelfApproval: ({oldValue, newValue}: UpdatedPolicyPreventSelfApprovalParams) => `updated "Prevent self-approval" to "${newValue === 'true' ? 'Enabled' : 'Disabled'}" (previously "${oldValue === 'true' ? 'Enabled' : 'Disabled'}")`, diff --git a/src/languages/es.ts b/src/languages/es.ts index def33fd513b62..4f85eb730b6aa 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -4963,10 +4963,14 @@ const translations = { removedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `actualizó el campo de informe "${fieldName}"; eliminó la opción "${optionName}"`, updateReportFieldOptionDisabled: ({fieldName, optionName, optionEnabled}: PolicyDisabledReportFieldOptionParams) => `actualizó el campo de informe "${fieldName}"; estableció la opción "${optionName}" como ${optionEnabled ? 'Habilitada' : 'Deshabilitada'}`, - updateReportFieldAllOptionsDisabled: ({fieldName, optionName, allEnabled}: PolicyDisabledReportFieldAllOptionsParams) => - `actualizó el campo de informe "${fieldName}"; estableció la opción "${optionName}" como ${allEnabled ? 'Habilitada' : 'Deshabilitada'}, haciendo que todas las opciones estén ${ - allEnabled ? 'Habilitadas' : 'Deshabilitadas' - }`, + updateReportFieldAllOptionsDisabled: ({fieldName, optionName, allEnabled, toggledOptionsCount}: PolicyDisabledReportFieldAllOptionsParams) => { + if (toggledOptionsCount && toggledOptionsCount > 1) { + return `actualizó el campo de informe "${fieldName}"; estableció todas las opciones como ${allEnabled ? 'Habilitadas' : 'Deshabilitadas'}`; + } + return `actualizó el campo de informe "${fieldName}"; estableció la opción "${optionName}" como ${ + allEnabled ? 'Habilitada' : 'Deshabilitada' + }, haciendo que todas las opciones estén ${allEnabled ? 'Habilitadas' : 'Deshabilitadas'}`; + }, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `eliminó el campo de informe ${fieldType} "${fieldName}"`, preventSelfApproval: ({oldValue, newValue}: UpdatedPolicyPreventSelfApprovalParams) => `actualizó "Evitar la autoaprobación" a "${newValue === 'true' ? 'Habilitada' : 'Deshabilitada'}" (previamente "${oldValue === 'true' ? 'Habilitada' : 'Deshabilitada'}")`, diff --git a/src/languages/params.ts b/src/languages/params.ts index cbda37c874133..5b08ba753dcc4 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -325,7 +325,7 @@ type PolicyAddedReportFieldOptionParams = {fieldName?: string; optionName: strin type PolicyDisabledReportFieldOptionParams = {fieldName: string; optionName: string; optionEnabled: boolean}; -type PolicyDisabledReportFieldAllOptionsParams = {fieldName: string; optionName: string; allEnabled: boolean}; +type PolicyDisabledReportFieldAllOptionsParams = {fieldName: string; optionName: string; allEnabled: boolean; toggledOptionsCount?: number}; type AddedPolicyApprovalRuleParams = {approverEmail: string; approverName: string; field: string; name: string}; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 66f7020213f08..00754c2b3b064 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1993,7 +1993,7 @@ function getWorkspaceReportFieldAddMessage(action: ReportAction): string { } function getWorkspaceReportFieldUpdateMessage(action: ReportAction): string { - const {updateType, fieldName, defaultValue, optionName, allEnabled, optionEnabled} = + const {updateType, fieldName, defaultValue, optionName, allEnabled, optionEnabled, toggledOptionsCount} = getOriginalMessage(action as ReportAction) ?? {}; if (updateType === 'updatedDefaultValue' && fieldName && defaultValue) { @@ -2023,6 +2023,7 @@ function getWorkspaceReportFieldUpdateMessage(action: ReportAction): string { fieldName, optionName, allEnabled: !!allEnabled, + toggledOptionsCount, }); } diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 0ee1022f716bf..4a8d87e26a3b1 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -441,6 +441,9 @@ type OriginalMessagePolicyChangeLog = { /** Option enabled state of a list report field */ optionEnabled?: string; + /** Number of report field options updated */ + toggledOptionsCount?: number; + /** Are all allEnabled report field options enabled */ allEnabled?: string; }; From f1274f96761ee1a77805f5b72ec9d2abbbe87f90 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Mon, 17 Mar 2025 04:26:59 +0530 Subject: [PATCH 15/40] fix UPDATE_CATEGORY - updateCategoryGLCode action. Signed-off-by: krishna2323 --- src/languages/en.ts | 10 ++++++++++ src/languages/es.ts | 10 ++++++++++ src/languages/params.ts | 3 +++ src/libs/ReportActionsUtils.ts | 21 ++++++++++++++++----- 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 2b66e7b1cd930..6b22393e97b7a 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -186,6 +186,7 @@ import type { UnshareParams, UntilTimeParams, UpdatedPolicyAuditRateParams, + UpdatedPolicyCategoryGLCodeParams, UpdatedPolicyCategoryNameParams, UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, @@ -4884,6 +4885,15 @@ const translations = { addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `added the category "${categoryName}"`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `removed the category "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'disabled' : 'enabled'} the category "${categoryName}"`, + updateCategoryGLCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { + if (!oldValue) { + return `updated the category "${categoryName}" by adding a GL Code of "${newValue}"`; + } + if (!newValue && oldValue) { + return `updated the category "${categoryName}" by removing the GL Code which was previously "${oldValue}"`; + } + return `actualizó la categoría "${categoryName}" cambiando el código GL de "${oldValue}" a "${newValue}"`; + }, setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renamed the category "${oldName}" to "${newName}"`, updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `updated the name of the tag list "${oldName}" to be "${newName}"`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `added the tag "${tagName}" to the list "${tagListName}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 4f85eb730b6aa..ec3a5c692796f 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -185,6 +185,7 @@ import type { UnshareParams, UntilTimeParams, UpdatedPolicyAuditRateParams, + UpdatedPolicyCategoryGLCodeParams, UpdatedPolicyCategoryNameParams, UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, @@ -4937,6 +4938,15 @@ const translations = { addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `añadió la categoría "${categoryName}""`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `eliminó la categoría "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'deshabilitó' : 'habilitó'} la categoría "${categoryName}"`, + updateCategoryGLCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { + if (!oldValue) { + return `actualizó la categoría "${categoryName}" agregando un código GL de "${newValue}"`; + } + if (!newValue && oldValue) { + return `actualizó la categoría "${categoryName}" eliminando el código GL que anteriormente era "${oldValue}"`; + } + return `updated the category "${categoryName}" by changing the GL Code from "${oldValue}" to "${newValue}"`; + }, setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renombró la categoría "${oldName}" a "${newName}`, updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `actualizó el nombre de la lista de etiquetas de "${oldName}" a "${newName}"`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `añadió la etiqueta "${tagName}" a la lista "${tagListName}"`, diff --git a/src/languages/params.ts b/src/languages/params.ts index 5b08ba753dcc4..2fdfc60ffb4d2 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -301,6 +301,8 @@ type UpdatedPolicyCurrencyParams = {oldCurrency: string; newCurrency: string}; type UpdatedPolicyCategoryParams = {categoryName: string; oldValue?: boolean}; +type UpdatedPolicyCategoryGLCodeParams = {categoryName: string; oldValue?: string; newValue?: string}; + type UpdatedPolicyTagParams = {tagListName: string; tagName: string; enabled?: boolean}; type UpdatedPolicyTagNameParams = {oldName: string; newName: string; tagListName: string}; @@ -918,4 +920,5 @@ export type { UpdatePolicyCustomUnitParams, AddOrDeletePolicyCustomUnitRateParams, AddedPolicyApprovalRuleParams, + UpdatedPolicyCategoryGLCodeParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 00754c2b3b064..88e5cf4f0bcb3 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1820,7 +1820,8 @@ function getWorkspaceFrequencyUpdateMessage(action: ReportAction): string { } function getWorkspaceCategoryUpdateMessage(action: ReportAction): string { - const {categoryName, oldValue, newName, oldName} = getOriginalMessage(action as ReportAction) ?? {}; + const {categoryName, oldValue, newName, oldName, updatedField, newValue} = + getOriginalMessage(action as ReportAction) ?? {}; if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CATEGORY && categoryName) { return translateLocal('workspaceActions.addCategory', { @@ -1835,10 +1836,20 @@ function getWorkspaceCategoryUpdateMessage(action: ReportAction): string { } if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CATEGORY && categoryName) { - return translateLocal('workspaceActions.updateCategory', { - oldValue: !!oldValue, - categoryName, - }); + if (updatedField === 'enabled') { + return translateLocal('workspaceActions.updateCategory', { + oldValue: !!oldValue, + categoryName, + }); + } + + if (updatedField === 'GL Code' && typeof oldValue === 'string' && typeof newValue === 'string') { + return translateLocal('workspaceActions.updateCategoryGLCode', { + oldValue, + categoryName, + newValue, + }); + } } if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.SET_CATEGORY_NAME && oldName && newName) { From d06e79047e2c691b3935e9065a9d6ea044d5e6be Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Tue, 25 Mar 2025 02:46:23 +0530 Subject: [PATCH 16/40] add translation for POLICY_CHANGE_LOG.UPDATE_CATEGORY -- updateCategoryMaxExpenseAmount. Signed-off-by: krishna2323 --- src/languages/en.ts | 12 +++++++++++- src/languages/es.ts | 12 +++++++++++- src/languages/params.ts | 3 +++ src/libs/ReportActionsUtils.ts | 12 ++++++++++-- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 40b44bb29534d..6d1cf7f214266 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -187,6 +187,7 @@ import type { UntilTimeParams, UpdatedPolicyAuditRateParams, UpdatedPolicyCategoryGLCodeParams, + UpdatedPolicyCategoryMaxExpenseAmountParams, UpdatedPolicyCategoryNameParams, UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, @@ -4951,7 +4952,16 @@ const translations = { if (!newValue && oldValue) { return `updated the category "${categoryName}" by removing the GL Code which was previously "${oldValue}"`; } - return `actualizó la categoría "${categoryName}" cambiando el código GL de "${oldValue}" a "${newValue}"`; + return `updated the category "${categoryName}" by changing the GL Code from "${oldValue}" to "${newValue}"`; + }, + updateCategoryMaxExpenseAmount: ({categoryName, oldAmount, newAmount}: UpdatedPolicyCategoryMaxExpenseAmountParams) => { + if (newAmount && !oldAmount) { + return `updated the category "${categoryName}" by adding a Max Amount of ${newAmount}`; + } + if (oldAmount && !newAmount) { + return `updated the category "${categoryName}" by removing the Max Amount which was previously ${oldAmount}`; + } + return `updated the category "${categoryName}" by changing the Max Amount from ${oldAmount} to ${newAmount}`; }, setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renamed the category "${oldName}" to "${newName}"`, updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `updated the name of the tag list "${oldName}" to be "${newName}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 9360b551561fa..5847b4ad04e04 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -186,6 +186,7 @@ import type { UntilTimeParams, UpdatedPolicyAuditRateParams, UpdatedPolicyCategoryGLCodeParams, + UpdatedPolicyCategoryMaxExpenseAmountParams, UpdatedPolicyCategoryNameParams, UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, @@ -5003,7 +5004,16 @@ const translations = { if (!newValue && oldValue) { return `actualizó la categoría "${categoryName}" eliminando el código GL que anteriormente era "${oldValue}"`; } - return `updated the category "${categoryName}" by changing the GL Code from "${oldValue}" to "${newValue}"`; + return `actualizó la categoría "${categoryName}" cambiando el código GL de "${oldValue}" a "${newValue}"`; + }, + updateCategoryMaxExpenseAmount: ({categoryName, oldAmount, newAmount}: UpdatedPolicyCategoryMaxExpenseAmountParams) => { + if (newAmount && !oldAmount) { + return `actualizó la categoría "${categoryName}" añadiendo un Monto Máximo de ${newAmount}`; + } + if (oldAmount && !newAmount) { + return `actualizó la categoría "${categoryName}" eliminando el Monto Máximo que anteriormente era de ${oldAmount}`; + } + return `actualizó la categoría "${categoryName}" cambiando el Monto Máximo de ${oldAmount} a ${newAmount}`; }, setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renombró la categoría "${oldName}" a "${newName}`, updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `actualizó el nombre de la lista de etiquetas de "${oldName}" a "${newName}"`, diff --git a/src/languages/params.ts b/src/languages/params.ts index e63690fc2e5c3..609a0521021bd 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -305,6 +305,8 @@ type UpdatedPolicyCategoryParams = {categoryName: string; oldValue?: boolean}; type UpdatedPolicyCategoryGLCodeParams = {categoryName: string; oldValue?: string; newValue?: string}; +type UpdatedPolicyCategoryMaxExpenseAmountParams = {categoryName: string; oldAmount?: string; newAmount?: string}; + type UpdatedPolicyTagParams = {tagListName: string; tagName: string; enabled?: boolean}; type UpdatedPolicyTagNameParams = {oldName: string; newName: string; tagListName: string}; @@ -925,4 +927,5 @@ export type { AddOrDeletePolicyCustomUnitRateParams, AddedPolicyApprovalRuleParams, UpdatedPolicyCategoryGLCodeParams, + UpdatedPolicyCategoryMaxExpenseAmountParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 374287c163dad..97fc4fc37bb2e 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -18,7 +18,7 @@ import type {Message, OldDotReportAction, OriginalMessage, ReportActions} from ' import type ReportActionName from '@src/types/onyx/ReportActionName'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -import {convertToDisplayString} from './CurrencyUtils'; +import {convertAmountToDisplayString, convertToDisplayString} from './CurrencyUtils'; import DateUtils from './DateUtils'; import {getEnvironmentURL} from './Environment/Environment'; import getBase62ReportID from './getBase62ReportID'; @@ -1892,7 +1892,7 @@ function getWorkspaceFrequencyUpdateMessage(action: ReportAction): string { } function getWorkspaceCategoryUpdateMessage(action: ReportAction): string { - const {categoryName, oldValue, newName, oldName, updatedField, newValue} = + const {categoryName, oldValue, newName, oldName, updatedField, newValue, currency} = getOriginalMessage(action as ReportAction) ?? {}; if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CATEGORY && categoryName) { @@ -1922,6 +1922,14 @@ function getWorkspaceCategoryUpdateMessage(action: ReportAction): string { newValue, }); } + + if (updatedField === 'maxExpenseAmount' && (typeof oldValue === 'string' || typeof oldValue === 'number') && typeof newValue === 'number') { + return translateLocal('workspaceActions.updateCategoryMaxExpenseAmount', { + oldAmount: Number(oldValue) ? convertAmountToDisplayString(Number(oldValue), currency) : undefined, + newAmount: Number(newValue) ? convertAmountToDisplayString(Number(newValue), currency) : undefined, + categoryName, + }); + } } if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.SET_CATEGORY_NAME && oldName && newName) { From 0d6d84bb998109344762060078dc3ffbade5b937 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Tue, 25 Mar 2025 02:52:46 +0530 Subject: [PATCH 17/40] minor fix. Signed-off-by: krishna2323 --- src/libs/ReportActionsUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 97fc4fc37bb2e..544180937f789 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1923,10 +1923,10 @@ function getWorkspaceCategoryUpdateMessage(action: ReportAction): string { }); } - if (updatedField === 'maxExpenseAmount' && (typeof oldValue === 'string' || typeof oldValue === 'number') && typeof newValue === 'number') { + if (updatedField === 'maxExpenseAmount' && (typeof oldValue === 'string' || typeof oldValue === 'number')) { return translateLocal('workspaceActions.updateCategoryMaxExpenseAmount', { oldAmount: Number(oldValue) ? convertAmountToDisplayString(Number(oldValue), currency) : undefined, - newAmount: Number(newValue) ? convertAmountToDisplayString(Number(newValue), currency) : undefined, + newAmount: Number(newValue ?? 0) ? convertAmountToDisplayString(Number(newValue), currency) : undefined, categoryName, }); } From 6b0a6de5578a82c3b6e079b9c7c723a39aef89d5 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Tue, 25 Mar 2025 03:06:12 +0530 Subject: [PATCH 18/40] add translation for POLICY_CHANGE_LOG.UPDATE_CATEGORY -- updateAreCommentsRequired. Signed-off-by: krishna2323 --- src/languages/en.ts | 3 +++ src/languages/es.ts | 3 +++ src/libs/ReportActionsUtils.ts | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index 6d1cf7f214266..ace7a355683a2 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4954,6 +4954,9 @@ const translations = { } return `updated the category "${categoryName}" by changing the GL Code from "${oldValue}" to "${newValue}"`; }, + updateAreCommentsRequired: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => { + return `updated the category "${categoryName}" by changing the Description from ${!oldValue ? 'Not Required' : 'Required'} to ${!oldValue ? 'Required' : 'Not Required'}`; + }, updateCategoryMaxExpenseAmount: ({categoryName, oldAmount, newAmount}: UpdatedPolicyCategoryMaxExpenseAmountParams) => { if (newAmount && !oldAmount) { return `updated the category "${categoryName}" by adding a Max Amount of ${newAmount}`; diff --git a/src/languages/es.ts b/src/languages/es.ts index 5847b4ad04e04..2b8ccfb4bd4c3 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -5006,6 +5006,9 @@ const translations = { } return `actualizó la categoría "${categoryName}" cambiando el código GL de "${oldValue}" a "${newValue}"`; }, + updateAreCommentsRequired: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => { + return `actualizó la categoría "${categoryName}" cambiando la descripción de "${!oldValue ? 'No requerida' : 'Requerida'}" a "${!oldValue ? 'Requerida' : 'No requerida'}"`; + }, updateCategoryMaxExpenseAmount: ({categoryName, oldAmount, newAmount}: UpdatedPolicyCategoryMaxExpenseAmountParams) => { if (newAmount && !oldAmount) { return `actualizó la categoría "${categoryName}" añadiendo un Monto Máximo de ${newAmount}`; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 544180937f789..0b9911b3e3752 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1915,6 +1915,13 @@ function getWorkspaceCategoryUpdateMessage(action: ReportAction): string { }); } + if (updatedField === 'areCommentsRequired' && typeof oldValue === 'boolean') { + return translateLocal('workspaceActions.updateAreCommentsRequired', { + oldValue, + categoryName, + }); + } + if (updatedField === 'GL Code' && typeof oldValue === 'string' && typeof newValue === 'string') { return translateLocal('workspaceActions.updateCategoryGLCode', { oldValue, From c91a25ccc373d29d98d4f1f80eaceadb55bfdf95 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Tue, 25 Mar 2025 03:16:31 +0530 Subject: [PATCH 19/40] add translation for POLICY_CHANGE_LOG.UPDATE_CATEGORY -- updateCategoryPayrollCode. Signed-off-by: krishna2323 --- src/languages/en.ts | 9 +++++++++ src/languages/es.ts | 9 +++++++++ src/libs/ReportActionsUtils.ts | 8 ++++++++ 3 files changed, 26 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index ace7a355683a2..0cba61bfcc016 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4945,6 +4945,15 @@ const translations = { addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `added the category "${categoryName}"`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `removed the category "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'disabled' : 'enabled'} the category "${categoryName}"`, + updateCategoryPayrollCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { + if (!oldValue) { + return `updated the category "${categoryName}" by adding a Payroll Code of ${newValue}`; + } + if (!newValue && oldValue) { + return `updated the category "${categoryName}" by removing the Payroll Code which was previously ${oldValue}`; + } + return `updated the category "${categoryName}" by changing the Payroll Code from ${oldValue} to ${newValue}`; + }, updateCategoryGLCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { if (!oldValue) { return `updated the category "${categoryName}" by adding a GL Code of "${newValue}"`; diff --git a/src/languages/es.ts b/src/languages/es.ts index 2b8ccfb4bd4c3..6300930450741 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -4997,6 +4997,15 @@ const translations = { addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `añadió la categoría "${categoryName}""`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `eliminó la categoría "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'deshabilitó' : 'habilitó'} la categoría "${categoryName}"`, + updateCategoryPayrollCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { + if (!oldValue) { + return `actualizó la categoría "${categoryName}" añadiendo un Código de Nómina de ${newValue}`; + } + if (!newValue && oldValue) { + return `actualizó la categoría "${categoryName}" eliminando el Código de Nómina que anteriormente era ${oldValue}`; + } + return `actualizó la categoría "${categoryName}" cambiando el Código de Nómina de ${oldValue} a ${newValue}`; + }, updateCategoryGLCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { if (!oldValue) { return `actualizó la categoría "${categoryName}" agregando un código GL de "${newValue}"`; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 0b9911b3e3752..0c9d22c9b30c0 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1922,6 +1922,14 @@ function getWorkspaceCategoryUpdateMessage(action: ReportAction): string { }); } + if (updatedField === 'Payroll Code' && typeof oldValue === 'string' && typeof newValue === 'string') { + return translateLocal('workspaceActions.updateCategoryPayrollCode', { + oldValue, + categoryName, + newValue, + }); + } + if (updatedField === 'GL Code' && typeof oldValue === 'string' && typeof newValue === 'string') { return translateLocal('workspaceActions.updateCategoryGLCode', { oldValue, From ddb20f97109570c5e76d22c5599ee4da82482db7 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Tue, 25 Mar 2025 07:16:25 +0530 Subject: [PATCH 20/40] add translation for POLICY_CHANGE_LOG.UPDATE_APPROVER_RULE. Signed-off-by: krishna2323 --- src/languages/en.ts | 3 +++ src/languages/es.ts | 3 +++ src/languages/params.ts | 3 +++ src/libs/ReportActionsUtils.ts | 18 ++++++++++++++++++ src/libs/SidebarUtils.ts | 3 +++ .../report/ContextMenu/ContextMenuActions.tsx | 3 +++ src/pages/home/report/PureReportActionItem.tsx | 3 +++ src/types/onyx/OriginalMessage.ts | 12 ++++++++++++ 8 files changed, 48 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index 0cba61bfcc016..3df55600efb48 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -185,6 +185,7 @@ import type { UnapproveWithIntegrationWarningParams, UnshareParams, UntilTimeParams, + UpdatedPolicyApprovalRuleParams, UpdatedPolicyAuditRateParams, UpdatedPolicyCategoryGLCodeParams, UpdatedPolicyCategoryMaxExpenseAmountParams, @@ -4942,6 +4943,8 @@ const translations = { }, workspaceActions: { addApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => `added ${approverName} (${approverEmail}) as an approver for the ${field} "${name}"`, + updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => + `updated the approver for the ${field} "${name}" from ${oldApproverName} (${oldApproverEmail}) to ${newApproverName} (${newApproverEmail})`, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `added the category "${categoryName}"`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `removed the category "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'disabled' : 'enabled'} the category "${categoryName}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 6300930450741..a38dd1a53fae5 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -184,6 +184,7 @@ import type { UnapproveWithIntegrationWarningParams, UnshareParams, UntilTimeParams, + UpdatedPolicyApprovalRuleParams, UpdatedPolicyAuditRateParams, UpdatedPolicyCategoryGLCodeParams, UpdatedPolicyCategoryMaxExpenseAmountParams, @@ -4994,6 +4995,8 @@ const translations = { workspaceActions: { addApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => `agregó a ${approverName} (${approverEmail}) como aprobador para el/la ${field} "${name}"`, + updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => + `actualizó el aprobador para el campo ${field} "${name}" de ${oldApproverName} (${oldApproverEmail}) a ${newApproverName} (${newApproverEmail})`, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `añadió la categoría "${categoryName}""`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `eliminó la categoría "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'deshabilitó' : 'habilitó'} la categoría "${categoryName}"`, diff --git a/src/languages/params.ts b/src/languages/params.ts index 609a0521021bd..800a4176facc6 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -335,6 +335,8 @@ type PolicyDisabledReportFieldAllOptionsParams = {fieldName: string; optionName: type AddedPolicyApprovalRuleParams = {approverEmail: string; approverName: string; field: string; name: string}; +type UpdatedPolicyApprovalRuleParams = {oldApproverEmail: string; oldApproverName: string; newApproverEmail: string; newApproverName: string; field: string; name: string}; + type UpdatedPolicyPreventSelfApprovalParams = {oldValue: string; newValue: string}; type UpdatedPolicyFieldWithNewAndOldValueParams = {oldValue: string; newValue: string}; @@ -926,6 +928,7 @@ export type { UpdatePolicyCustomUnitParams, AddOrDeletePolicyCustomUnitRateParams, AddedPolicyApprovalRuleParams, + UpdatedPolicyApprovalRuleParams, UpdatedPolicyCategoryGLCodeParams, UpdatedPolicyCategoryMaxExpenseAmountParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 0c9d22c9b30c0..8c31591e74135 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2314,6 +2314,23 @@ function getAddedApprovaRulelMessage(reportAction: OnyxEntry) { return getReportActionText(reportAction); } +function getUpdatedApprovalRuleMessage(reportAction: OnyxEntry) { + const {field, oldApproverEmail, oldApproverName, newApproverEmail, newApproverName, name} = + getOriginalMessage(reportAction as ReportAction) ?? {}; + + if (field && oldApproverEmail && oldApproverName && newApproverEmail && newApproverName && name) { + return translateLocal('workspaceActions.updateApprovalRule', { + field, + name, + newApproverEmail, + newApproverName, + oldApproverEmail, + oldApproverName, + }); + } + return getReportActionText(reportAction); +} + function getRemovedFromApprovalChainMessage(reportAction: OnyxEntry>) { const originalMessage = getOriginalMessage(reportAction); const submittersNames = getPersonalDetailsByIDs({ @@ -2477,6 +2494,7 @@ export { getOneTransactionThreadReportID, getOriginalMessage, getAddedApprovaRulelMessage, + getUpdatedApprovalRuleMessage, getRemovedFromApprovalChainMessage, getDemotedFromWorkspaceMessage, getReportAction, diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 22940f72cbec6..e5614e1119693 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -43,6 +43,7 @@ import { getReportActionMessageText, getSortedReportActions, getTagListNameUpdatedMessage, + getUpdatedApprovalRuleMessage, getUpdatedAuditRateMessage, getUpdatedManualApprovalThresholdMessage, getUpdateRoomDescriptionMessage, @@ -653,6 +654,8 @@ function getOptionData({ result.alternateText = getUpdatedAuditRateMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE) { result.alternateText = getAddedApprovaRulelMessage(lastAction); + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_APPROVER_RULE) { + result.alternateText = getUpdatedApprovalRuleMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD) { result.alternateText = getUpdatedManualApprovalThresholdMessage(lastAction); } else { diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index babdad03677c9..18131d355e35b 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -42,6 +42,7 @@ import { getRenamedAction, getReportActionMessageText, getTagListNameUpdatedMessage, + getUpdatedApprovalRuleMessage, getUpdatedAuditRateMessage, getUpdatedManualApprovalThresholdMessage, getUpdateRoomDescriptionMessage, @@ -636,6 +637,8 @@ const ContextMenuActions: ContextMenuAction[] = [ setClipboardMessage(getUpdatedAuditRateMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE)) { setClipboardMessage(getAddedApprovaRulelMessage(reportAction)); + } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_APPROVER_RULE)) { + setClipboardMessage(getUpdatedApprovalRuleMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD)) { setClipboardMessage(getUpdatedManualApprovalThresholdMessage(reportAction)); } else if (content) { diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index c883609cfac37..5e0ead398f6f7 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -70,6 +70,7 @@ import { getReportActionMessage, getReportActionText, getTagListNameUpdatedMessage, + getUpdatedApprovalRuleMessage, getUpdatedAuditRateMessage, getUpdatedManualApprovalThresholdMessage, getWhisperedTo, @@ -954,6 +955,8 @@ function PureReportActionItem({ children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE)) { children = ; + } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_APPROVER_RULE)) { + children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REMOVED_FROM_APPROVAL_CHAIN)) { children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.DEMOTED_FROM_WORKSPACE)) { diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index d52a6d6ece340..57dbdaee03a3c 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -426,6 +426,18 @@ type OriginalMessagePolicyChangeLog = { /** Account ID of the approver */ approverAccountID?: string; + /** Email of the new approver */ + newApproverEmail?: string; + + /** Name of the new approver */ + newApproverName?: string; + + /** Email of the old approver */ + oldApproverEmail?: string; + + /** Name of the old approver */ + oldApproverName?: string; + /** Email of the approver */ approverEmail?: string; From 6839de2f7a9ed4a018f067ad144344f890a6ecde Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Tue, 25 Mar 2025 07:43:12 +0530 Subject: [PATCH 21/40] add translation for POLICY_CHANGE_LOG.UPDATE_CATEGORY -- updateCategoryExpenseLimitType. Signed-off-by: krishna2323 --- src/languages/en.ts | 7 +++++++ src/languages/es.ts | 8 ++++++++ src/languages/params.ts | 3 +++ src/libs/ReportActionsUtils.ts | 7 +++++++ 4 files changed, 25 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index 3df55600efb48..af5c3a66784d2 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -187,6 +187,7 @@ import type { UntilTimeParams, UpdatedPolicyApprovalRuleParams, UpdatedPolicyAuditRateParams, + UpdatedPolicyCategoryExpenseLimitTypeParams, UpdatedPolicyCategoryGLCodeParams, UpdatedPolicyCategoryMaxExpenseAmountParams, UpdatedPolicyCategoryNameParams, @@ -4978,6 +4979,12 @@ const translations = { } return `updated the category "${categoryName}" by changing the Max Amount from ${oldAmount} to ${newAmount}`; }, + updateCategoryExpenseLimitType: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryExpenseLimitTypeParams) => { + if (!oldValue) { + return `updated the category "${categoryName}" by adding a Limit Type of ${newValue}`; + } + return `updated the category "${categoryName}" by changing the Limit Type from ${oldValue} to ${newValue}`; + }, setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renamed the category "${oldName}" to "${newName}"`, updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `updated the name of the tag list "${oldName}" to be "${newName}"`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `added the tag "${tagName}" to the list "${tagListName}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index a38dd1a53fae5..9c07923a7c1e1 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -186,6 +186,7 @@ import type { UntilTimeParams, UpdatedPolicyApprovalRuleParams, UpdatedPolicyAuditRateParams, + UpdatedPolicyCategoryExpenseLimitTypeParams, UpdatedPolicyCategoryGLCodeParams, UpdatedPolicyCategoryMaxExpenseAmountParams, UpdatedPolicyCategoryNameParams, @@ -5030,6 +5031,13 @@ const translations = { } return `actualizó la categoría "${categoryName}" cambiando el Monto Máximo de ${oldAmount} a ${newAmount}`; }, + updateCategoryExpenseLimitType: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryExpenseLimitTypeParams) => { + if (!oldValue) { + return `actualizó la categoría "${categoryName}" añadiendo un Tipo de Límite de ${newValue}`; + } + return `actualizó la categoría "${categoryName}" cambiando el Tipo de Límite de ${oldValue} a ${newValue}`; + }, + setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renombró la categoría "${oldName}" a "${newName}`, updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `actualizó el nombre de la lista de etiquetas de "${oldName}" a "${newName}"`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `añadió la etiqueta "${tagName}" a la lista "${tagListName}"`, diff --git a/src/languages/params.ts b/src/languages/params.ts index 800a4176facc6..b81c7a16755fb 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -307,6 +307,8 @@ type UpdatedPolicyCategoryGLCodeParams = {categoryName: string; oldValue?: strin type UpdatedPolicyCategoryMaxExpenseAmountParams = {categoryName: string; oldAmount?: string; newAmount?: string}; +type UpdatedPolicyCategoryExpenseLimitTypeParams = {categoryName: string; oldValue?: string; newValue: string}; + type UpdatedPolicyTagParams = {tagListName: string; tagName: string; enabled?: boolean}; type UpdatedPolicyTagNameParams = {oldName: string; newName: string; tagListName: string}; @@ -931,4 +933,5 @@ export type { UpdatedPolicyApprovalRuleParams, UpdatedPolicyCategoryGLCodeParams, UpdatedPolicyCategoryMaxExpenseAmountParams, + UpdatedPolicyCategoryExpenseLimitTypeParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 8c31591e74135..b997504ec7b79 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1945,6 +1945,13 @@ function getWorkspaceCategoryUpdateMessage(action: ReportAction): string { categoryName, }); } + if (updatedField === 'expenseLimitType' && typeof newValue === 'string' && typeof oldValue === 'string') { + return translateLocal('workspaceActions.updateCategoryExpenseLimitType', { + categoryName, + oldValue: oldValue ? translateLocal(`workspace.rules.categoryRules.expenseLimitTypes.${oldValue}` as TranslationPaths) : undefined, + newValue: translateLocal(`workspace.rules.categoryRules.expenseLimitTypes.${newValue}` as TranslationPaths), + }); + } } if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.SET_CATEGORY_NAME && oldName && newName) { From 6c858a85f6b43875ce798b66e1b7be504fea1e32 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Tue, 25 Mar 2025 09:34:05 +0530 Subject: [PATCH 22/40] add translation for POLICY_CHANGE_LOG.UPDATE_CATEGORY -- maxExpenseAmountNoReceipt. Signed-off-by: krishna2323 --- src/languages/en.ts | 9 +++ src/languages/params.ts | 3 + src/libs/ReportActionsUtils.ts | 59 ++++++++++++++++++- .../home/report/PureReportActionItem.tsx | 2 +- 4 files changed, 70 insertions(+), 3 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index af5c3a66784d2..55d527e8b7cba 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -189,6 +189,7 @@ import type { UpdatedPolicyAuditRateParams, UpdatedPolicyCategoryExpenseLimitTypeParams, UpdatedPolicyCategoryGLCodeParams, + UpdatedPolicyCategoryMaxAmountNoReceiptParams, UpdatedPolicyCategoryMaxExpenseAmountParams, UpdatedPolicyCategoryNameParams, UpdatedPolicyCategoryParams, @@ -4985,6 +4986,14 @@ const translations = { } return `updated the category "${categoryName}" by changing the Limit Type from ${oldValue} to ${newValue}`; }, + + updateCategoryMaxAmountNoReceipt: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryMaxAmountNoReceiptParams) => { + if (!oldValue) { + return `updated the category "${categoryName}" by changing Receipts from ${oldValue} to ${newValue}`; + } + return `updated the category ""A" by changing Receipts from ${oldValue} to ${newValue}`; + }, + setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renamed the category "${oldName}" to "${newName}"`, updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `updated the name of the tag list "${oldName}" to be "${newName}"`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `added the tag "${tagName}" to the list "${tagListName}"`, diff --git a/src/languages/params.ts b/src/languages/params.ts index b81c7a16755fb..6b30e458711e2 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -309,6 +309,8 @@ type UpdatedPolicyCategoryMaxExpenseAmountParams = {categoryName: string; oldAmo type UpdatedPolicyCategoryExpenseLimitTypeParams = {categoryName: string; oldValue?: string; newValue: string}; +type UpdatedPolicyCategoryMaxAmountNoReceiptParams = {categoryName: string; oldValue?: string; newValue: string}; + type UpdatedPolicyTagParams = {tagListName: string; tagName: string; enabled?: boolean}; type UpdatedPolicyTagNameParams = {oldName: string; newName: string; tagListName: string}; @@ -934,4 +936,5 @@ export type { UpdatedPolicyCategoryGLCodeParams, UpdatedPolicyCategoryMaxExpenseAmountParams, UpdatedPolicyCategoryExpenseLimitTypeParams, + UpdatedPolicyCategoryMaxAmountNoReceiptParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index b997504ec7b79..a14c87f37f696 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -18,7 +18,7 @@ import type {Message, OldDotReportAction, OriginalMessage, ReportActions} from ' import type ReportActionName from '@src/types/onyx/ReportActionName'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -import {convertAmountToDisplayString, convertToDisplayString} from './CurrencyUtils'; +import {convertAmountToDisplayString, convertToDisplayString, convertToShortDisplayString} from './CurrencyUtils'; import DateUtils from './DateUtils'; import {getEnvironmentURL} from './Environment/Environment'; import getBase62ReportID from './getBase62ReportID'; @@ -1891,7 +1891,7 @@ function getWorkspaceFrequencyUpdateMessage(action: ReportAction): string { }); } -function getWorkspaceCategoryUpdateMessage(action: ReportAction): string { +function getWorkspaceCategoryUpdateMessage(action: ReportAction, policyID?: string): string { const {categoryName, oldValue, newName, oldName, updatedField, newValue, currency} = getOriginalMessage(action as ReportAction) ?? {}; @@ -1945,6 +1945,7 @@ function getWorkspaceCategoryUpdateMessage(action: ReportAction): string { categoryName, }); } + if (updatedField === 'expenseLimitType' && typeof newValue === 'string' && typeof oldValue === 'string') { return translateLocal('workspaceActions.updateCategoryExpenseLimitType', { categoryName, @@ -1952,6 +1953,60 @@ function getWorkspaceCategoryUpdateMessage(action: ReportAction): string { newValue: translateLocal(`workspace.rules.categoryRules.expenseLimitTypes.${newValue}` as TranslationPaths), }); } + + // if (updatedField === 'maxAmountNoReceipt') { + // const policy = getPolicy(policyID); + // console.log(policy); + // const maxExpenseAmountToDisplay = policy?.maxExpenseAmountNoReceipt === CONST.DISABLED_MAX_EXPENSE_VALUE ? 0 : policy?.maxExpenseAmountNoReceipt; + + // return translateLocal('workspaceActions.updateCategoryMaxAmountNoReceipt', { + // categoryName, + // oldValue: + // typeof oldValue === 'number' && oldValue === CONST.DISABLED_MAX_EXPENSE_VALUE + // ? translateLocal(`workspace.rules.categoryRules.requireReceiptsOverList.never`) + // : oldValue === 0 + // ? translateLocal(`workspace.rules.categoryRules.requireReceiptsOverList.always`, { + // defaultAmount: convertToShortDisplayString(maxExpenseAmountToDisplay, policy?.outputCurrency ?? CONST.CURRENCY.USD), + // }) + // : translateLocal(`workspace.rules.categoryRules.requireReceiptsOverList.default`, { + // defaultAmount: convertToShortDisplayString(maxExpenseAmountToDisplay, policy?.outputCurrency ?? CONST.CURRENCY.USD), + // }), + // newValue: + // typeof newValue === 'number' && newValue === CONST.DISABLED_MAX_EXPENSE_VALUE + // ? translateLocal(`workspace.rules.categoryRules.requireReceiptsOverList.never`) + // : newValue === 0 + // ? translateLocal(`workspace.rules.categoryRules.requireReceiptsOverList.always`, { + // defaultAmount: convertToShortDisplayString(maxExpenseAmountToDisplay, policy?.outputCurrency ?? CONST.CURRENCY.USD), + // }) + // : translateLocal(`workspace.rules.categoryRules.requireReceiptsOverList.default`, { + // defaultAmount: convertToShortDisplayString(maxExpenseAmountToDisplay, policy?.outputCurrency ?? CONST.CURRENCY.USD), + // }), + // }); + // } + + if (updatedField === 'maxAmountNoReceipt' && typeof oldValue !== 'boolean' && typeof newValue !== 'boolean') { + const policy = getPolicy(policyID); + + const maxExpenseAmountToDisplay = policy?.maxExpenseAmountNoReceipt === CONST.DISABLED_MAX_EXPENSE_VALUE ? 0 : policy?.maxExpenseAmountNoReceipt; + + const formatAmount = () => convertToShortDisplayString(maxExpenseAmountToDisplay, policy?.outputCurrency ?? CONST.CURRENCY.USD); + const getTranslation = (value?: number | string) => { + if (value === CONST.DISABLED_MAX_EXPENSE_VALUE) { + return translateLocal('workspace.rules.categoryRules.requireReceiptsOverList.never'); + } + if (value === 0) { + return translateLocal('workspace.rules.categoryRules.requireReceiptsOverList.always'); + } + + return translateLocal('workspace.rules.categoryRules.requireReceiptsOverList.default', {defaultAmount: formatAmount()}); + }; + + return translateLocal('workspaceActions.updateCategoryMaxAmountNoReceipt', { + categoryName, + oldValue: getTranslation(oldValue), + newValue: getTranslation(newValue), + }); + } } if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.SET_CATEGORY_NAME && oldName && newName) { diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 5e0ead398f6f7..254c8e5a5cddd 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -918,7 +918,7 @@ function PureReportActionItem({ action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CATEGORY || action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.SET_CATEGORY_NAME ) { - children = ; + children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG_LIST_NAME) { children = ; } else if (isTagModificationAction(action.actionName)) { From cb1e775c4035589228e84a3c97edf18031a0eff8 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Tue, 25 Mar 2025 09:35:29 +0530 Subject: [PATCH 23/40] add spanish translation and cleanup code. Signed-off-by: krishna2323 --- src/languages/en.ts | 2 -- src/languages/es.ts | 8 +++++++- src/libs/ReportActionsUtils.ts | 30 ------------------------------ 3 files changed, 7 insertions(+), 33 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 55d527e8b7cba..8fcf479564082 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4986,14 +4986,12 @@ const translations = { } return `updated the category "${categoryName}" by changing the Limit Type from ${oldValue} to ${newValue}`; }, - updateCategoryMaxAmountNoReceipt: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryMaxAmountNoReceiptParams) => { if (!oldValue) { return `updated the category "${categoryName}" by changing Receipts from ${oldValue} to ${newValue}`; } return `updated the category ""A" by changing Receipts from ${oldValue} to ${newValue}`; }, - setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renamed the category "${oldName}" to "${newName}"`, updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `updated the name of the tag list "${oldName}" to be "${newName}"`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `added the tag "${tagName}" to the list "${tagListName}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 9c07923a7c1e1..b4273ac27e9ae 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -188,6 +188,7 @@ import type { UpdatedPolicyAuditRateParams, UpdatedPolicyCategoryExpenseLimitTypeParams, UpdatedPolicyCategoryGLCodeParams, + UpdatedPolicyCategoryMaxAmountNoReceiptParams, UpdatedPolicyCategoryMaxExpenseAmountParams, UpdatedPolicyCategoryNameParams, UpdatedPolicyCategoryParams, @@ -5037,7 +5038,12 @@ const translations = { } return `actualizó la categoría "${categoryName}" cambiando el Tipo de Límite de ${oldValue} a ${newValue}`; }, - + updateCategoryMaxAmountNoReceipt: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryMaxAmountNoReceiptParams) => { + if (!oldValue) { + return `actualizó la categoría "${categoryName}" cambiando Recibos de ${oldValue} a ${newValue}`; + } + return `actualizó la categoría "${categoryName}" cambiando Recibos de ${oldValue} a ${newValue}`; + }, setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renombró la categoría "${oldName}" a "${newName}`, updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `actualizó el nombre de la lista de etiquetas de "${oldName}" a "${newName}"`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `añadió la etiqueta "${tagName}" a la lista "${tagListName}"`, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index a14c87f37f696..b275315ac6a9f 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1954,36 +1954,6 @@ function getWorkspaceCategoryUpdateMessage(action: ReportAction, policyID?: stri }); } - // if (updatedField === 'maxAmountNoReceipt') { - // const policy = getPolicy(policyID); - // console.log(policy); - // const maxExpenseAmountToDisplay = policy?.maxExpenseAmountNoReceipt === CONST.DISABLED_MAX_EXPENSE_VALUE ? 0 : policy?.maxExpenseAmountNoReceipt; - - // return translateLocal('workspaceActions.updateCategoryMaxAmountNoReceipt', { - // categoryName, - // oldValue: - // typeof oldValue === 'number' && oldValue === CONST.DISABLED_MAX_EXPENSE_VALUE - // ? translateLocal(`workspace.rules.categoryRules.requireReceiptsOverList.never`) - // : oldValue === 0 - // ? translateLocal(`workspace.rules.categoryRules.requireReceiptsOverList.always`, { - // defaultAmount: convertToShortDisplayString(maxExpenseAmountToDisplay, policy?.outputCurrency ?? CONST.CURRENCY.USD), - // }) - // : translateLocal(`workspace.rules.categoryRules.requireReceiptsOverList.default`, { - // defaultAmount: convertToShortDisplayString(maxExpenseAmountToDisplay, policy?.outputCurrency ?? CONST.CURRENCY.USD), - // }), - // newValue: - // typeof newValue === 'number' && newValue === CONST.DISABLED_MAX_EXPENSE_VALUE - // ? translateLocal(`workspace.rules.categoryRules.requireReceiptsOverList.never`) - // : newValue === 0 - // ? translateLocal(`workspace.rules.categoryRules.requireReceiptsOverList.always`, { - // defaultAmount: convertToShortDisplayString(maxExpenseAmountToDisplay, policy?.outputCurrency ?? CONST.CURRENCY.USD), - // }) - // : translateLocal(`workspace.rules.categoryRules.requireReceiptsOverList.default`, { - // defaultAmount: convertToShortDisplayString(maxExpenseAmountToDisplay, policy?.outputCurrency ?? CONST.CURRENCY.USD), - // }), - // }); - // } - if (updatedField === 'maxAmountNoReceipt' && typeof oldValue !== 'boolean' && typeof newValue !== 'boolean') { const policy = getPolicy(policyID); From 646b893774df601865160e001d771e5abb1d029a Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Fri, 28 Mar 2025 14:53:45 +0530 Subject: [PATCH 24/40] fix translation condition for UPDATE_TAG. Signed-off-by: krishna2323 --- src/libs/ReportActionsUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 1bd0085a0857b..fb64e8ce1dda6 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2032,7 +2032,7 @@ function getWorkspaceTagUpdateMessage(action: ReportAction): string { if ( action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_TAG && tagListName && - typeof oldValue === 'string' && + (typeof oldValue === 'string' || typeof oldValue === 'undefined') && typeof newValue === 'string' && tagName && updatedField From ac51dc853563552bcc1588ec1f78e17c907155b6 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Fri, 28 Mar 2025 15:04:53 +0530 Subject: [PATCH 25/40] fix report field action translations. Signed-off-by: krishna2323 --- src/libs/ReportActionsUtils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index fb64e8ce1dda6..d53f48d5f8217 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -34,7 +34,7 @@ import {getPolicy, isPolicyAdmin as isPolicyAdminPolicyUtils} from './PolicyUtil import type {getReportName, OptimisticIOUReportAction, PartialReportAction} from './ReportUtils'; import StringUtils from './StringUtils'; import {isOnHoldByTransactionID} from './TransactionUtils'; -import {getReportFieldAlternativeTextTranslationKey} from './WorkspaceReportFieldUtils'; +import {getReportFieldTypeTranslationKey} from './WorkspaceReportFieldUtils'; type LastVisibleMessage = { lastMessageText: string; @@ -2129,7 +2129,7 @@ function getWorkspaceReportFieldAddMessage(action: ReportAction): string { if (fieldName && fieldType) { return translateLocal('workspaceActions.addedReportField', { fieldName, - fieldType: translateLocal(getReportFieldAlternativeTextTranslationKey(fieldType as PolicyReportFieldType)), + fieldType: translateLocal(getReportFieldTypeTranslationKey(fieldType as PolicyReportFieldType)).toLowerCase(), }); } @@ -2187,7 +2187,7 @@ function getWorkspaceReportFieldDeleteMessage(action: ReportAction): string { if (fieldType && fieldName) { return translateLocal('workspaceActions.deleteReportField', { fieldName, - fieldType: translateLocal(getReportFieldAlternativeTextTranslationKey(fieldType as PolicyReportFieldType)), + fieldType: translateLocal(getReportFieldTypeTranslationKey(fieldType as PolicyReportFieldType)).toLowerCase(), }); } From 6bb3e7ce72e9a8fa2db62cfe165fd3ff35fcdda4 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Mon, 31 Mar 2025 11:36:12 +0530 Subject: [PATCH 26/40] add translation for POLICY_CHANGE_LOG.DELETE_APPROVER_RULE. Signed-off-by: krishna2323 --- src/languages/en.ts | 2 ++ src/languages/es.ts | 2 ++ src/libs/ReportActionsUtils.ts | 19 ++++++++++++++++++- src/libs/SidebarUtils.ts | 3 +++ .../report/ContextMenu/ContextMenuActions.tsx | 3 +++ .../home/report/PureReportActionItem.tsx | 3 +++ 6 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 4d0322b2da393..aa91e0791ec23 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4952,6 +4952,8 @@ const translations = { }, workspaceActions: { addApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => `added ${approverName} (${approverEmail}) as an approver for the ${field} "${name}"`, + deleteApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => + `removed ${approverName} (${approverEmail}) as an approver for the ${field} "${name}"`, updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => `updated the approver for the ${field} "${name}" from ${oldApproverName} (${oldApproverEmail}) to ${newApproverName} (${newApproverEmail})`, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `added the category "${categoryName}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 825a0a9941423..21c47f1874e0f 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -5004,6 +5004,8 @@ const translations = { workspaceActions: { addApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => `agregó a ${approverName} (${approverEmail}) como aprobador para el/la ${field} "${name}"`, + deleteApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => + `eliminó a ${approverName} (${approverEmail}) como aprobador para el campo ${field} "${name}"`, updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => `actualizó el aprobador para el campo ${field} "${name}" de ${oldApproverName} (${oldApproverEmail}) a ${newApproverName} (${newApproverEmail})`, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `añadió la categoría "${categoryName}""`, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index d53f48d5f8217..f8277384564a9 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2338,7 +2338,7 @@ function getRenamedAction(reportAction: OnyxEntry) { const {name, approverAccountID, approverEmail, field, approverName} = - getOriginalMessage(reportAction as ReportAction) ?? {}; + getOriginalMessage(reportAction as ReportAction) ?? {}; if (name && approverAccountID && approverEmail && field && approverName) { return translateLocal('workspaceActions.addApprovalRule', { @@ -2352,6 +2352,22 @@ function getAddedApprovaRulelMessage(reportAction: OnyxEntry) { return getReportActionText(reportAction); } +function getDeletedApprovaRulelMessage(reportAction: OnyxEntry) { + const {name, approverAccountID, approverEmail, field, approverName} = + getOriginalMessage(reportAction as ReportAction) ?? {}; + + if (name && approverAccountID && approverEmail && field && approverName) { + return translateLocal('workspaceActions.deleteApprovalRule', { + approverEmail, + approverName, + field, + name, + }); + } + + return getReportActionText(reportAction); +} + function getUpdatedApprovalRuleMessage(reportAction: OnyxEntry) { const {field, oldApproverEmail, oldApproverName, newApproverEmail, newApproverName, name} = getOriginalMessage(reportAction as ReportAction) ?? {}; @@ -2532,6 +2548,7 @@ export { getOneTransactionThreadReportID, getOriginalMessage, getAddedApprovaRulelMessage, + getDeletedApprovaRulelMessage, getUpdatedApprovalRuleMessage, getRemovedFromApprovalChainMessage, getDemotedFromWorkspaceMessage, diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index e5614e1119693..2cc5fada48711 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -26,6 +26,7 @@ import { getAddedApprovaRulelMessage, getAddedConnectionMessage, getCardIssuedMessage, + getDeletedApprovaRulelMessage, getLastVisibleMessage, getMessageOfOldDotReportAction, getOriginalMessage, @@ -654,6 +655,8 @@ function getOptionData({ result.alternateText = getUpdatedAuditRateMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE) { result.alternateText = getAddedApprovaRulelMessage(lastAction); + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_APPROVER_RULE) { + result.alternateText = getDeletedApprovaRulelMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_APPROVER_RULE) { result.alternateText = getUpdatedApprovalRuleMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD) { diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 33566e32efa46..e9ffe88a4d9ea 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -26,6 +26,7 @@ import { getAddedApprovaRulelMessage, getAddedConnectionMessage, getCardIssuedMessage, + getDeletedApprovaRulelMessage, getExportIntegrationMessageHTML, getIOUReportIDFromReportActionPreview, getMemberChangeMessageFragment, @@ -639,6 +640,8 @@ const ContextMenuActions: ContextMenuAction[] = [ setClipboardMessage(getUpdatedAuditRateMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE)) { setClipboardMessage(getAddedApprovaRulelMessage(reportAction)); + } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_APPROVER_RULE)) { + setClipboardMessage(getDeletedApprovaRulelMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_APPROVER_RULE)) { setClipboardMessage(getUpdatedApprovalRuleMessage(reportAction)); } else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MANUAL_APPROVAL_THRESHOLD)) { diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index a4c3cbea9d92d..7dd8693c8d1c9 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -53,6 +53,7 @@ import { extractLinksFromMessageHtml, getAddedApprovaRulelMessage, getAddedConnectionMessage, + getDeletedApprovaRulelMessage, getDemotedFromWorkspaceMessage, getDismissedViolationMessageText, getIOUReportIDFromReportActionPreview, @@ -957,6 +958,8 @@ function PureReportActionItem({ children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_APPROVER_RULE)) { children = ; + } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_APPROVER_RULE)) { + children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_APPROVER_RULE)) { children = ; } else if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REMOVED_FROM_APPROVAL_CHAIN)) { From 457c648360abc2af48e0631012b6c58e11b58853 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Mon, 31 Mar 2025 14:58:20 +0530 Subject: [PATCH 27/40] add translation for POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE - updatedCustomUnitTaxRateExternalID add. Signed-off-by: krishna2323 --- src/languages/en.ts | 3 +++ src/languages/es.ts | 3 +++ src/languages/params.ts | 3 +++ src/libs/ReportActionsUtils.ts | 12 ++++++++++-- src/types/onyx/OriginalMessage.ts | 3 +++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index aa91e0791ec23..f36300728a12b 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -195,6 +195,7 @@ import type { UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, UpdatedPolicyCustomUnitRateParams, + UpdatedPolicyCustomUnitTaxRateExternalIDParams, UpdatedPolicyDescriptionParams, UpdatedPolicyFieldWithNewAndOldValueParams, UpdatedPolicyFieldWithValueParam, @@ -5019,6 +5020,8 @@ const translations = { addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `added a new "${customUnitName}" rate "${rateName}"`, updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => `updated the rate of the ${customUnitName} ${updatedField} "${customUnitRateName}" from "${oldValue}" to "${newValue}"`, + updatedCustomUnitTaxRateExternalID: ({customUnitRateName, newValue, newTaxPercentage}: UpdatedPolicyCustomUnitTaxRateExternalIDParams) => + `added the tax rate "${newValue} (${newTaxPercentage})" to the distance rate "${customUnitRateName}"`, deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `removed the "${customUnitName}" rate "${rateName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `added ${fieldType} Report Field "${fieldName}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 21c47f1874e0f..8e80defac7902 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -194,6 +194,7 @@ import type { UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, UpdatedPolicyCustomUnitRateParams, + UpdatedPolicyCustomUnitTaxRateExternalIDParams, UpdatedPolicyDescriptionParams, UpdatedPolicyFieldWithNewAndOldValueParams, UpdatedPolicyFieldWithValueParam, @@ -5071,6 +5072,8 @@ const translations = { addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => `actualizó la tasa del ${customUnitName} ${updatedField} "${customUnitRateName}" de "${oldValue}" a "${newValue}"`, + updatedCustomUnitTaxRateExternalID: ({customUnitRateName, newValue, newTaxPercentage}: UpdatedPolicyCustomUnitTaxRateExternalIDParams) => + `añadió la tasa de impuesto "${newValue} (${newTaxPercentage})" a la tasa de distancia "${customUnitRateName}"`, deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `añadió el campo de informe ${fieldType} "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => diff --git a/src/languages/params.ts b/src/languages/params.ts index 6b30e458711e2..1c81b54d08e1e 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -327,6 +327,8 @@ type AddOrDeletePolicyCustomUnitRateParams = {customUnitName: string; rateName: type UpdatedPolicyCustomUnitRateParams = {customUnitName: string; customUnitRateName: string; oldValue: string; newValue: string; updatedField: string}; +type UpdatedPolicyCustomUnitTaxRateExternalIDParams = {customUnitRateName: string; newValue: string; newTaxPercentage: string}; + type AddedOrDeletedPolicyReportFieldParams = {fieldType: string; fieldName?: string}; type UpdatedPolicyReportFieldDefaultValueParams = {fieldName?: string; defaultValue?: string}; @@ -915,6 +917,7 @@ export type { NewWorkspaceNameParams, AddedOrDeletedPolicyReportFieldParams, UpdatedPolicyCustomUnitRateParams, + UpdatedPolicyCustomUnitTaxRateExternalIDParams, UpdatedPolicyTagParams, UpdatedPolicyTagNameParams, UpdatedPolicyTagFieldParams, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index f8277384564a9..f1cc0c3875ec5 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2095,10 +2095,10 @@ function getWorkspaceCustomUnitRateAddedMessage(action: ReportAction): string { } function getWorkspaceCustomUnitRateUpdatedMessage(action: ReportAction): string { - const {customUnitName, customUnitRateName, updatedField, oldValue, newValue} = + const {customUnitName, customUnitRateName, updatedField, oldValue, newValue, newTaxPercentage} = getOriginalMessage(action as ReportAction) ?? {}; - if (customUnitName && customUnitRateName && updatedField && typeof oldValue === 'string' && typeof newValue === 'string') { + if (customUnitName && customUnitRateName && updatedField === 'rate' && typeof oldValue === 'string' && typeof newValue === 'string') { return translateLocal('workspaceActions.updatedCustomUnitRate', { customUnitName, customUnitRateName, @@ -2108,6 +2108,14 @@ function getWorkspaceCustomUnitRateUpdatedMessage(action: ReportAction): string }); } + if (customUnitRateName && updatedField === 'taxRateExternalID' && typeof newValue === 'string' && newTaxPercentage) { + return translateLocal('workspaceActions.updatedCustomUnitTaxRateExternalID', { + customUnitRateName, + newValue, + newTaxPercentage, + }); + } + return getReportActionText(action); } diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index edfaae84ffc26..cd20a7ea0b64c 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -384,6 +384,9 @@ type OriginalMessagePolicyChangeLog = { /** Custom unit name */ rateName?: string; + /** Tax percentage of the new tax rate linked to distance rate */ + newTaxPercentage?: string; + /** Added/Updated tag name */ tagName?: string; From 8c594d576169f97de9cc6d2cfd537e9aea021390 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Mon, 31 Mar 2025 15:08:49 +0530 Subject: [PATCH 28/40] add translation for POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE - updatedCustomUnitTaxRateExternalID update. Signed-off-by: krishna2323 --- src/languages/en.ts | 8 ++++++-- src/languages/es.ts | 8 ++++++-- src/languages/params.ts | 2 +- src/libs/ReportActionsUtils.ts | 4 +++- src/types/onyx/OriginalMessage.ts | 3 +++ 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index f36300728a12b..4e2178d85422d 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -5020,8 +5020,12 @@ const translations = { addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `added a new "${customUnitName}" rate "${rateName}"`, updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => `updated the rate of the ${customUnitName} ${updatedField} "${customUnitRateName}" from "${oldValue}" to "${newValue}"`, - updatedCustomUnitTaxRateExternalID: ({customUnitRateName, newValue, newTaxPercentage}: UpdatedPolicyCustomUnitTaxRateExternalIDParams) => - `added the tax rate "${newValue} (${newTaxPercentage})" to the distance rate "${customUnitRateName}"`, + updatedCustomUnitTaxRateExternalID: ({customUnitRateName, newValue, newTaxPercentage, oldTaxPercentage, oldValue}: UpdatedPolicyCustomUnitTaxRateExternalIDParams) => { + if (oldTaxPercentage && oldValue) { + return `changed the tax rate from "${oldValue} (${oldTaxPercentage})" to "${newValue} (${newTaxPercentage})" on the distance rate "${customUnitRateName}"`; + } + return `added the tax rate "${newValue} (${newTaxPercentage})" to the distance rate "${customUnitRateName}"`; + }, deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `removed the "${customUnitName}" rate "${rateName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `added ${fieldType} Report Field "${fieldName}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 8e80defac7902..4269952c3e037 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -5072,8 +5072,12 @@ const translations = { addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => `actualizó la tasa del ${customUnitName} ${updatedField} "${customUnitRateName}" de "${oldValue}" a "${newValue}"`, - updatedCustomUnitTaxRateExternalID: ({customUnitRateName, newValue, newTaxPercentage}: UpdatedPolicyCustomUnitTaxRateExternalIDParams) => - `añadió la tasa de impuesto "${newValue} (${newTaxPercentage})" a la tasa de distancia "${customUnitRateName}"`, + updatedCustomUnitTaxRateExternalID: ({customUnitRateName, newValue, newTaxPercentage, oldTaxPercentage, oldValue}: UpdatedPolicyCustomUnitTaxRateExternalIDParams) => { + if (oldTaxPercentage && oldValue) { + return `cambió la tasa de impuesto de "${oldValue} (${oldTaxPercentage})" a "${newValue} (${newTaxPercentage})" en la tasa de distancia "${customUnitRateName}"`; + } + return `añadió la tasa de impuesto "${newValue} (${newTaxPercentage})" a la tasa de distancia "${customUnitRateName}"`; + }, deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `añadió el campo de informe ${fieldType} "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => diff --git a/src/languages/params.ts b/src/languages/params.ts index 1c81b54d08e1e..1ffa82ce899b8 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -327,7 +327,7 @@ type AddOrDeletePolicyCustomUnitRateParams = {customUnitName: string; rateName: type UpdatedPolicyCustomUnitRateParams = {customUnitName: string; customUnitRateName: string; oldValue: string; newValue: string; updatedField: string}; -type UpdatedPolicyCustomUnitTaxRateExternalIDParams = {customUnitRateName: string; newValue: string; newTaxPercentage: string}; +type UpdatedPolicyCustomUnitTaxRateExternalIDParams = {customUnitRateName: string; newValue: string; newTaxPercentage: string; oldValue?: string; oldTaxPercentage?: string}; type AddedOrDeletedPolicyReportFieldParams = {fieldType: string; fieldName?: string}; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index f1cc0c3875ec5..ec8e23125760e 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2095,7 +2095,7 @@ function getWorkspaceCustomUnitRateAddedMessage(action: ReportAction): string { } function getWorkspaceCustomUnitRateUpdatedMessage(action: ReportAction): string { - const {customUnitName, customUnitRateName, updatedField, oldValue, newValue, newTaxPercentage} = + const {customUnitName, customUnitRateName, updatedField, oldValue, newValue, newTaxPercentage, oldTaxPercentage} = getOriginalMessage(action as ReportAction) ?? {}; if (customUnitName && customUnitRateName && updatedField === 'rate' && typeof oldValue === 'string' && typeof newValue === 'string') { @@ -2113,6 +2113,8 @@ function getWorkspaceCustomUnitRateUpdatedMessage(action: ReportAction): string customUnitRateName, newValue, newTaxPercentage, + oldTaxPercentage, + oldValue: oldValue as string | undefined, }); } diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index cd20a7ea0b64c..1d690991124fa 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -387,6 +387,9 @@ type OriginalMessagePolicyChangeLog = { /** Tax percentage of the new tax rate linked to distance rate */ newTaxPercentage?: string; + /** Tax percentage of the old tax rate linked to distance rate */ + oldTaxPercentage?: string; + /** Added/Updated tag name */ tagName?: string; From 48d1b6b40a3eb3f49fc0996f71d673cd3900f5b7 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Mon, 31 Mar 2025 16:46:55 +0530 Subject: [PATCH 29/40] add translation for POLICY_CHANGE_LOG.UPDATE_CUSTOM_UNIT_RATE - updatedCustomUnitTaxClaimablePercentage add & update action. Signed-off-by: krishna2323 --- src/languages/en.ts | 7 +++++++ src/languages/es.ts | 7 +++++++ src/languages/params.ts | 3 +++ src/libs/ReportActionsUtils.ts | 8 ++++++++ 4 files changed, 25 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index 4e2178d85422d..b50c93371cae1 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -195,6 +195,7 @@ import type { UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, UpdatedPolicyCustomUnitRateParams, + UpdatedPolicyCustomUnitTaxClaimablePercentageParams, UpdatedPolicyCustomUnitTaxRateExternalIDParams, UpdatedPolicyDescriptionParams, UpdatedPolicyFieldWithNewAndOldValueParams, @@ -5026,6 +5027,12 @@ const translations = { } return `added the tax rate "${newValue} (${newTaxPercentage})" to the distance rate "${customUnitRateName}"`; }, + updatedCustomUnitTaxClaimablePercentage: ({customUnitRateName, newValue, oldValue}: UpdatedPolicyCustomUnitTaxClaimablePercentageParams) => { + if (oldValue) { + return `changed the tax reclaimable portion from "${oldValue}" to "${newValue}" on the distance rate "${customUnitRateName}"`; + } + return `added the tax reclaimable portion "${newValue}" to the distance rate "${customUnitRateName}"`; + }, deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `removed the "${customUnitName}" rate "${rateName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `added ${fieldType} Report Field "${fieldName}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 4269952c3e037..9f114399bd096 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -194,6 +194,7 @@ import type { UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, UpdatedPolicyCustomUnitRateParams, + UpdatedPolicyCustomUnitTaxClaimablePercentageParams, UpdatedPolicyCustomUnitTaxRateExternalIDParams, UpdatedPolicyDescriptionParams, UpdatedPolicyFieldWithNewAndOldValueParams, @@ -5078,6 +5079,12 @@ const translations = { } return `añadió la tasa de impuesto "${newValue} (${newTaxPercentage})" a la tasa de distancia "${customUnitRateName}"`; }, + updatedCustomUnitTaxClaimablePercentage: ({customUnitRateName, newValue, oldValue}: UpdatedPolicyCustomUnitTaxClaimablePercentageParams) => { + if (oldValue) { + return `cambió la parte recuperable de impuestos de "${oldValue}" a "${newValue}" en la tasa de distancia "${customUnitRateName}"`; + } + return `añadió la parte recuperable de impuestos "${newValue}" a la tasa de distancia "${customUnitRateName}"`; + }, deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `añadió el campo de informe ${fieldType} "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => diff --git a/src/languages/params.ts b/src/languages/params.ts index 1ffa82ce899b8..0cdd61a5b2a60 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -329,6 +329,8 @@ type UpdatedPolicyCustomUnitRateParams = {customUnitName: string; customUnitRate type UpdatedPolicyCustomUnitTaxRateExternalIDParams = {customUnitRateName: string; newValue: string; newTaxPercentage: string; oldValue?: string; oldTaxPercentage?: string}; +type UpdatedPolicyCustomUnitTaxClaimablePercentageParams = {customUnitRateName: string; newValue: number; oldValue?: number}; + type AddedOrDeletedPolicyReportFieldParams = {fieldType: string; fieldName?: string}; type UpdatedPolicyReportFieldDefaultValueParams = {fieldName?: string; defaultValue?: string}; @@ -918,6 +920,7 @@ export type { AddedOrDeletedPolicyReportFieldParams, UpdatedPolicyCustomUnitRateParams, UpdatedPolicyCustomUnitTaxRateExternalIDParams, + UpdatedPolicyCustomUnitTaxClaimablePercentageParams, UpdatedPolicyTagParams, UpdatedPolicyTagNameParams, UpdatedPolicyTagFieldParams, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index ec8e23125760e..ac0a8db38d219 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2118,6 +2118,14 @@ function getWorkspaceCustomUnitRateUpdatedMessage(action: ReportAction): string }); } + if (customUnitRateName && updatedField === 'taxClaimablePercentage' && typeof newValue === 'number' && customUnitRateName) { + return translateLocal('workspaceActions.updatedCustomUnitTaxClaimablePercentage', { + customUnitRateName, + newValue: parseFloat(parseFloat(newValue ?? 0).toFixed(2)), + oldValue: typeof oldValue === 'number' ? parseFloat(parseFloat(oldValue ?? 0).toFixed(2)) : undefined, + }); + } + return getReportActionText(action); } From c54a7f07a477be47fc78f649f459884f110f8136 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Tue, 22 Apr 2025 13:21:45 +0530 Subject: [PATCH 30/40] fix: ESLint. Signed-off-by: krishna2323 --- src/libs/SidebarUtils.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 75fa3bcc224c6..200813a4c7f68 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -662,6 +662,8 @@ function getOptionData({ result.alternateText = formatReportLastMessageText(Parser.htmlToText(`${lastActorDisplayName}: ${lastMessageText}`)); } else if (lastAction && isOldDotReportAction(lastAction)) { result.alternateText = getMessageOfOldDotReportAction(lastAction); + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.UPDATE_ROOM_DESCRIPTION) { + result.alternateText = getUpdateRoomDescriptionMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_EMPLOYEE) { result.alternateText = getPolicyChangeLogAddEmployeeMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_EMPLOYEE) { From 4d86b99a597e4cc31436d0c37f4bd5a5da3c6b83 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Tue, 22 Apr 2025 13:38:28 +0530 Subject: [PATCH 31/40] update translations using the new pattern. Signed-off-by: krishna2323 --- src/languages/en.ts | 10 +++++----- src/languages/es.ts | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 5dc0aa6627c87..1653cbd088de8 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -5055,7 +5055,7 @@ const translations = { deleteApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => `removed ${approverName} (${approverEmail}) as an approver for the ${field} "${name}"`, updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => - `updated the approver for the ${field} "${name}" from ${oldApproverName} (${oldApproverEmail}) to ${newApproverName} (${newApproverEmail})`, + `updated the approver for the ${field} "${name}" to ${newApproverName} (${newApproverEmail}) (previously ${oldApproverName} (${oldApproverEmail}))`, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `added the category "${categoryName}"`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `removed the category "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'disabled' : 'enabled'} the category "${categoryName}"`, @@ -5064,18 +5064,18 @@ const translations = { return `updated the category "${categoryName}" by adding a Payroll Code of ${newValue}`; } if (!newValue && oldValue) { - return `updated the category "${categoryName}" by removing the Payroll Code which was previously ${oldValue}`; + return `updated the category "${categoryName}" by removing the Payroll Code (previously ${oldValue})`; } - return `updated the category "${categoryName}" by changing the Payroll Code from ${oldValue} to ${newValue}`; + return `updated the category "${categoryName}" by changing the Payroll Code to ${newValue} (previously ${oldValue})`; }, updateCategoryGLCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { if (!oldValue) { return `updated the category "${categoryName}" by adding a GL Code of "${newValue}"`; } if (!newValue && oldValue) { - return `updated the category "${categoryName}" by removing the GL Code which was previously "${oldValue}"`; + return `updated the category "${categoryName}" by removing the GL Code (previously "${oldValue}")`; } - return `updated the category "${categoryName}" by changing the GL Code from "${oldValue}" to "${newValue}"`; + return `updated the category "${categoryName}" by changing the GL Code to "${newValue}" (previously "${oldValue}")`; }, updateAreCommentsRequired: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => { return `updated the category "${categoryName}" by changing the Description from ${!oldValue ? 'Not Required' : 'Required'} to ${!oldValue ? 'Required' : 'Not Required'}`; diff --git a/src/languages/es.ts b/src/languages/es.ts index 304fb777f7d49..26b1765c25cac 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -5109,7 +5109,7 @@ const translations = { deleteApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => `eliminó a ${approverName} (${approverEmail}) como aprobador para el campo ${field} "${name}"`, updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => - `actualizó el aprobador para el campo ${field} "${name}" de ${oldApproverName} (${oldApproverEmail}) a ${newApproverName} (${newApproverEmail})`, + `actualizó el aprobador para el campo ${field} "${name}" a ${newApproverName} (${newApproverEmail}) (previamente ${oldApproverName} (${oldApproverEmail}))`, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `añadió la categoría "${categoryName}""`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `eliminó la categoría "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'deshabilitó' : 'habilitó'} la categoría "${categoryName}"`, @@ -5118,18 +5118,18 @@ const translations = { return `actualizó la categoría "${categoryName}" añadiendo un Código de Nómina de ${newValue}`; } if (!newValue && oldValue) { - return `actualizó la categoría "${categoryName}" eliminando el Código de Nómina que anteriormente era ${oldValue}`; + return `actualizó la categoría "${categoryName}" eliminando el código de nómina (previamente ${oldValue})`; } - return `actualizó la categoría "${categoryName}" cambiando el Código de Nómina de ${oldValue} a ${newValue}`; + return `actualizó la categoría "${categoryName}" cambiando el código de nómina a ${newValue} (previamente ${oldValue})`; }, updateCategoryGLCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { if (!oldValue) { - return `actualizó la categoría "${categoryName}" agregando un código GL de "${newValue}"`; + return `actualizó la categoría "${categoryName}" añadiendo un código GL de ${newValue}`; } if (!newValue && oldValue) { - return `actualizó la categoría "${categoryName}" eliminando el código GL que anteriormente era "${oldValue}"`; + return `actualizó la categoría "${categoryName}" eliminando el código GL (previamente ${oldValue})`; } - return `actualizó la categoría "${categoryName}" cambiando el código GL de "${oldValue}" a "${newValue}"`; + return `actualizó la categoría "${categoryName}" cambiando el código GL a ${newValue} (previamente ${oldValue})`; }, updateAreCommentsRequired: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => { return `actualizó la categoría "${categoryName}" cambiando la descripción de "${!oldValue ? 'No requerida' : 'Requerida'}" a "${!oldValue ? 'Requerida' : 'No requerida'}"`; From 8ba41e270a1cf7f2348e1eb3adb201d6f18ee915 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Tue, 22 Apr 2025 13:48:28 +0530 Subject: [PATCH 32/40] update translations using the new pattern. Signed-off-by: krishna2323 --- src/languages/en.ts | 8 ++++---- src/languages/es.ts | 12 +++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 1653cbd088de8..ec21268d295f6 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -5078,22 +5078,22 @@ const translations = { return `updated the category "${categoryName}" by changing the GL Code to "${newValue}" (previously "${oldValue}")`; }, updateAreCommentsRequired: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => { - return `updated the category "${categoryName}" by changing the Description from ${!oldValue ? 'Not Required' : 'Required'} to ${!oldValue ? 'Required' : 'Not Required'}`; + return `updated the category "${categoryName}" by changing the Description to ${!oldValue ? 'Required' : 'Not Required'} (previously ${!oldValue ? 'Not Required' : 'Required'})`; }, updateCategoryMaxExpenseAmount: ({categoryName, oldAmount, newAmount}: UpdatedPolicyCategoryMaxExpenseAmountParams) => { if (newAmount && !oldAmount) { return `updated the category "${categoryName}" by adding a Max Amount of ${newAmount}`; } if (oldAmount && !newAmount) { - return `updated the category "${categoryName}" by removing the Max Amount which was previously ${oldAmount}`; + return `updated the category "${categoryName}" by removing the Max Amount (previously ${oldAmount})`; } - return `updated the category "${categoryName}" by changing the Max Amount from ${oldAmount} to ${newAmount}`; + return `updated the category "${categoryName}" by changing the Max Amount to ${newAmount} (previously ${oldAmount})`; }, updateCategoryExpenseLimitType: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryExpenseLimitTypeParams) => { if (!oldValue) { return `updated the category "${categoryName}" by adding a Limit Type of ${newValue}`; } - return `updated the category "${categoryName}" by changing the Limit Type from ${oldValue} to ${newValue}`; + return `updated the category "${categoryName}" by changing the Limit Type to ${newValue} (previously ${oldValue})`; }, updateCategoryMaxAmountNoReceipt: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryMaxAmountNoReceiptParams) => { if (!oldValue) { diff --git a/src/languages/es.ts b/src/languages/es.ts index 26b1765c25cac..b840eef29b8cf 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -5132,22 +5132,24 @@ const translations = { return `actualizó la categoría "${categoryName}" cambiando el código GL a ${newValue} (previamente ${oldValue})`; }, updateAreCommentsRequired: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => { - return `actualizó la categoría "${categoryName}" cambiando la descripción de "${!oldValue ? 'No requerida' : 'Requerida'}" a "${!oldValue ? 'Requerida' : 'No requerida'}"`; + return `actualizó la categoría "${categoryName}" cambiando la descripción a ${!oldValue ? 'Obligatoria' : 'No obligatoria'} (previamente ${ + !oldValue ? 'No obligatoria' : 'Obligatoria' + })`; }, updateCategoryMaxExpenseAmount: ({categoryName, oldAmount, newAmount}: UpdatedPolicyCategoryMaxExpenseAmountParams) => { if (newAmount && !oldAmount) { - return `actualizó la categoría "${categoryName}" añadiendo un Monto Máximo de ${newAmount}`; + return `actualizó la categoría "${categoryName}" añadiendo un importe máximo de ${newAmount}`; } if (oldAmount && !newAmount) { - return `actualizó la categoría "${categoryName}" eliminando el Monto Máximo que anteriormente era de ${oldAmount}`; + return `actualizó la categoría "${categoryName}" eliminando el importe máximo (previamente ${oldAmount})`; } - return `actualizó la categoría "${categoryName}" cambiando el Monto Máximo de ${oldAmount} a ${newAmount}`; + return `actualizó la categoría "${categoryName}" cambiando el importe máximo a ${newAmount} (previamente ${oldAmount})`; }, updateCategoryExpenseLimitType: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryExpenseLimitTypeParams) => { if (!oldValue) { return `actualizó la categoría "${categoryName}" añadiendo un Tipo de Límite de ${newValue}`; } - return `actualizó la categoría "${categoryName}" cambiando el Tipo de Límite de ${oldValue} a ${newValue}`; + return `actualizó la categoría "${categoryName}" cambiando el Tipo de Límite a ${newValue} (previamente ${oldValue})`; }, updateCategoryMaxAmountNoReceipt: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryMaxAmountNoReceiptParams) => { if (!oldValue) { From a28351dbbd54f44cb27833a5083366aa49a4b31a Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Fri, 25 Apr 2025 01:07:21 +0530 Subject: [PATCH 33/40] update trasnlations to use the correct pattern. Signed-off-by: krishna2323 --- src/languages/en.ts | 18 +++++++++--------- src/languages/es.ts | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 1f85571fbf4f2..e9302ef628a82 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -5084,9 +5084,9 @@ const translations = { return `updated the category "${categoryName}" by adding a Payroll Code of ${newValue}`; } if (!newValue && oldValue) { - return `updated the category "${categoryName}" by removing the Payroll Code (previously ${oldValue})`; + return `updated the category "${categoryName}" by removing the Payroll Code (previously "${oldValue}")`; } - return `updated the category "${categoryName}" by changing the Payroll Code to ${newValue} (previously ${oldValue})`; + return `updated the category "${categoryName}" by changing the Payroll Code to ${newValue} (previously "${oldValue}")`; }, updateCategoryGLCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { if (!oldValue) { @@ -5105,24 +5105,24 @@ const translations = { return `updated the category "${categoryName}" by adding a Max Amount of ${newAmount}`; } if (oldAmount && !newAmount) { - return `updated the category "${categoryName}" by removing the Max Amount (previously ${oldAmount})`; + return `updated the category "${categoryName}" by removing the Max Amount (previously "${oldAmount}")`; } - return `updated the category "${categoryName}" by changing the Max Amount to ${newAmount} (previously ${oldAmount})`; + return `updated the category "${categoryName}" by changing the Max Amount to ${newAmount} (previously "${oldAmount}")`; }, updateCategoryExpenseLimitType: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryExpenseLimitTypeParams) => { if (!oldValue) { return `updated the category "${categoryName}" by adding a Limit Type of ${newValue}`; } - return `updated the category "${categoryName}" by changing the Limit Type to ${newValue} (previously ${oldValue})`; + return `updated the category "${categoryName}" by changing the Limit Type to ${newValue} (previously "${oldValue}")`; }, updateCategoryMaxAmountNoReceipt: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryMaxAmountNoReceiptParams) => { if (!oldValue) { - return `updated the category "${categoryName}" by changing Receipts from ${oldValue} to ${newValue}`; + return `updated the category "${categoryName}" by changing Receipts to ${newValue}`; } - return `updated the category ""A" by changing Receipts from ${oldValue} to ${newValue}`; + return `updated the category "${categoryName}" by changing Receipts to ${newValue} (previously ${oldValue})`; }, setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renamed the category "${oldName}" to "${newName}"`, - updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `updated the name of the tag list "${oldName}" to be "${newName}"`, + updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `updated the name of the tag list to "${newName}" (previously "${oldName}")`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `added the tag "${tagName}" to the list "${tagListName}"`, updateTagName: ({tagListName, newName, oldName}: UpdatedPolicyTagNameParams) => `updated the tag list "${tagListName}" by changing the tag "${oldName}" to "${newName}`, updateTagEnabled: ({tagListName, tagName, enabled}: UpdatedPolicyTagParams) => `${enabled ? 'enabled' : 'disabled'} the tag "${tagName}" on the list "${tagListName}"`, @@ -5135,7 +5135,7 @@ const translations = { return `updated the tag "${tagName}" on the list "${tagListName}" by adding a ${updatedField} of "${newValue}"`; }, updateCustomUnit: ({customUnitName, newValue, oldValue, updatedField}: UpdatePolicyCustomUnitParams) => - `updated the ${customUnitName} ${updatedField} from "${oldValue}" to "${newValue}"`, + `updated the ${customUnitName} ${updatedField} to "${newValue}" (previously "${oldValue}")`, updateCustomUnitTaxEnabled: ({newValue}: UpdatePolicyCustomUnitTaxEnabledParams) => `${newValue ? 'enabled' : 'disabled'} tax tracking on distance rates`, addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `added a new "${customUnitName}" rate "${rateName}"`, updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => diff --git a/src/languages/es.ts b/src/languages/es.ts index ccd5f09d1ef8d..3729e52cf5953 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -5140,18 +5140,18 @@ const translations = { return `actualizó la categoría "${categoryName}" añadiendo un Código de Nómina de ${newValue}`; } if (!newValue && oldValue) { - return `actualizó la categoría "${categoryName}" eliminando el código de nómina (previamente ${oldValue})`; + return `actualizó la categoría "${categoryName}" eliminando el código de nómina (previamente "${oldValue}")`; } - return `actualizó la categoría "${categoryName}" cambiando el código de nómina a ${newValue} (previamente ${oldValue})`; + return `actualizó la categoría "${categoryName}" cambiando el código de nómina a ${newValue} (previamente "${oldValue}")`; }, updateCategoryGLCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { if (!oldValue) { return `actualizó la categoría "${categoryName}" añadiendo un código GL de ${newValue}`; } if (!newValue && oldValue) { - return `actualizó la categoría "${categoryName}" eliminando el código GL (previamente ${oldValue})`; + return `actualizó la categoría "${categoryName}" eliminando el código GL (previamente "${oldValue}")`; } - return `actualizó la categoría "${categoryName}" cambiando el código GL a ${newValue} (previamente ${oldValue})`; + return `actualizó la categoría "${categoryName}" cambiando el código GL a ${newValue} (previamente "${oldValue}")`; }, updateAreCommentsRequired: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => { return `actualizó la categoría "${categoryName}" cambiando la descripción a ${!oldValue ? 'Obligatoria' : 'No obligatoria'} (previamente ${ @@ -5171,16 +5171,16 @@ const translations = { if (!oldValue) { return `actualizó la categoría "${categoryName}" añadiendo un Tipo de Límite de ${newValue}`; } - return `actualizó la categoría "${categoryName}" cambiando el Tipo de Límite a ${newValue} (previamente ${oldValue})`; + return `actualizó la categoría "${categoryName}" cambiando el Tipo de Límite a ${newValue} (previamente "${oldValue}")`; }, updateCategoryMaxAmountNoReceipt: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryMaxAmountNoReceiptParams) => { if (!oldValue) { - return `actualizó la categoría "${categoryName}" cambiando Recibos de ${oldValue} a ${newValue}`; + return `actualizó la categoría "${categoryName}" cambiando Recibos a ${newValue}`; } - return `actualizó la categoría "${categoryName}" cambiando Recibos de ${oldValue} a ${newValue}`; + return `actualizó la categoría "${categoryName}" cambiando Recibos a ${newValue} (previamente "${oldValue}")`; }, setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renombró la categoría "${oldName}" a "${newName}`, - updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `actualizó el nombre de la lista de etiquetas de "${oldName}" a "${newName}"`, + updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `actualizó el nombre de la lista de etiquetas a "${newName}" (previamente "${oldName}")`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `añadió la etiqueta "${tagName}" a la lista "${tagListName}"`, updateTagName: ({tagListName, newName, oldName}: UpdatedPolicyTagNameParams) => `actualizó la lista de etiquetas "${tagListName}" cambiando la etiqueta "${oldName}" a "${newName}"`, updateTagEnabled: ({tagListName, tagName, enabled}: UpdatedPolicyTagParams) => `${enabled ? 'habilitó' : 'deshabilitó'} la etiqueta "${tagName}" en la lista "${tagListName}"`, @@ -5193,7 +5193,7 @@ const translations = { return `actualizó la etiqueta "${tagName}" en la lista "${tagListName}" añadiendo un ${updatedField} de "${newValue}"`; }, updateCustomUnit: ({customUnitName, newValue, oldValue, updatedField}: UpdatePolicyCustomUnitParams) => - `actualizó el ${customUnitName} ${updatedField} de "${oldValue}" a "${newValue}"`, + `actualizó el ${updatedField} de ${customUnitName} a "${newValue}" (previamente "${oldValue}")`, updateCustomUnitTaxEnabled: ({newValue}: UpdatePolicyCustomUnitTaxEnabledParams) => `${newValue ? 'habilitó' : 'deshabilitó'} el seguimiento de impuestos en las tasas de distancia`, addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => From 44c3f0e264c5fe0d5c53b1983143cf796c701f1b Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Fri, 25 Apr 2025 01:14:18 +0530 Subject: [PATCH 34/40] update trasnlations to use the correct pattern. Signed-off-by: krishna2323 --- src/languages/en.ts | 10 +++++----- src/languages/es.ts | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index e9302ef628a82..813957f44d190 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -5139,16 +5139,16 @@ const translations = { updateCustomUnitTaxEnabled: ({newValue}: UpdatePolicyCustomUnitTaxEnabledParams) => `${newValue ? 'enabled' : 'disabled'} tax tracking on distance rates`, addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `added a new "${customUnitName}" rate "${rateName}"`, updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => - `updated the rate of the ${customUnitName} ${updatedField} "${customUnitRateName}" from "${oldValue}" to "${newValue}"`, + `updated the rate of the ${customUnitName} ${updatedField} "${customUnitRateName}" to "${newValue}" (previously "${oldValue}")`, updatedCustomUnitTaxRateExternalID: ({customUnitRateName, newValue, newTaxPercentage, oldTaxPercentage, oldValue}: UpdatedPolicyCustomUnitTaxRateExternalIDParams) => { if (oldTaxPercentage && oldValue) { - return `changed the tax rate from "${oldValue} (${oldTaxPercentage})" to "${newValue} (${newTaxPercentage})" on the distance rate "${customUnitRateName}"`; + return `updated the tax rate to "${newValue} (${newTaxPercentage})" on the distance rate "${customUnitRateName}" (previously "${oldValue} (${oldTaxPercentage})")`; } return `added the tax rate "${newValue} (${newTaxPercentage})" to the distance rate "${customUnitRateName}"`; }, updatedCustomUnitTaxClaimablePercentage: ({customUnitRateName, newValue, oldValue}: UpdatedPolicyCustomUnitTaxClaimablePercentageParams) => { if (oldValue) { - return `changed the tax reclaimable portion from "${oldValue}" to "${newValue}" on the distance rate "${customUnitRateName}"`; + return `updated the tax reclaimable portion to "${newValue}" on the distance rate "${customUnitRateName}" (previously "${oldValue}")`; } return `added the tax reclaimable portion "${newValue}" to the distance rate "${customUnitRateName}"`; }, @@ -5213,9 +5213,9 @@ const translations = { upgradedWorkspace: 'upgraded this workspace to the Control plan', downgradedWorkspace: 'downgraded this workspace to the Collect plan', updatedAuditRate: ({oldAuditRate, newAuditRate}: UpdatedPolicyAuditRateParams) => - `changed the rate of reports randomly routed for manual approval from ${Math.round(oldAuditRate * 100)}% to ${Math.round(newAuditRate * 100)}%`, + `updated the rate of reports randomly routed for manual approval to ${Math.round(newAuditRate * 100)}% (previously ${Math.round(oldAuditRate * 100)}%)`, updatedManualApprovalThreshold: ({oldLimit, newLimit}: UpdatedPolicyManualApprovalThresholdParams) => - `changed the limit for manual approval of all expenses from ${oldLimit} to ${newLimit}`, + `updated the limit for manual approval of all expenses to ${newLimit} (previously ${oldLimit})`, }, roomMembersPage: { memberNotFound: 'Member not found.', diff --git a/src/languages/es.ts b/src/languages/es.ts index 3729e52cf5953..1a053ec90c742 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -5197,16 +5197,16 @@ const translations = { updateCustomUnitTaxEnabled: ({newValue}: UpdatePolicyCustomUnitTaxEnabledParams) => `${newValue ? 'habilitó' : 'deshabilitó'} el seguimiento de impuestos en las tasas de distancia`, addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => - `actualizó la tasa del ${customUnitName} ${updatedField} "${customUnitRateName}" de "${oldValue}" a "${newValue}"`, + `actualizó la tasa de ${customUnitName} ${updatedField} "${customUnitRateName}" a "${newValue}" (previamente "${oldValue}")`, updatedCustomUnitTaxRateExternalID: ({customUnitRateName, newValue, newTaxPercentage, oldTaxPercentage, oldValue}: UpdatedPolicyCustomUnitTaxRateExternalIDParams) => { if (oldTaxPercentage && oldValue) { - return `cambió la tasa de impuesto de "${oldValue} (${oldTaxPercentage})" a "${newValue} (${newTaxPercentage})" en la tasa de distancia "${customUnitRateName}"`; + return `actualizó la tasa de impuesto a "${newValue} (${newTaxPercentage})" en la tarifa de distancia "${customUnitRateName}" (previamente "${oldValue} (${oldTaxPercentage})")`; } return `añadió la tasa de impuesto "${newValue} (${newTaxPercentage})" a la tasa de distancia "${customUnitRateName}"`; }, updatedCustomUnitTaxClaimablePercentage: ({customUnitRateName, newValue, oldValue}: UpdatedPolicyCustomUnitTaxClaimablePercentageParams) => { if (oldValue) { - return `cambió la parte recuperable de impuestos de "${oldValue}" a "${newValue}" en la tasa de distancia "${customUnitRateName}"`; + return `añadió la porción recuperable de impuestos a "${newValue}" en la tarifa de distancia "${customUnitRateName}" (previamente "${oldValue}")`; } return `añadió la parte recuperable de impuestos "${newValue}" a la tasa de distancia "${customUnitRateName}"`; }, @@ -5272,9 +5272,9 @@ const translations = { upgradedWorkspace: 'mejoró este espacio de trabajo al plan Controlar', downgradedWorkspace: 'bajó de categoría este espacio de trabajo al plan Recopilar', updatedAuditRate: ({oldAuditRate, newAuditRate}: UpdatedPolicyAuditRateParams) => - `cambió la tasa de informes asignados aleatoriamente para aprobación manual de ${Math.round(oldAuditRate * 100)}% a ${Math.round(newAuditRate * 100)}%`, + `actualizó la tasa de informes enrutados aleatoriamente para aprobación manual a ${Math.round(newAuditRate * 100)}% (previamente ${Math.round(oldAuditRate * 100)}%)`, updatedManualApprovalThreshold: ({oldLimit, newLimit}: UpdatedPolicyManualApprovalThresholdParams) => - `cambió el límite para la aprobación manual de todos los gastos de ${oldLimit} a ${newLimit}`, + `actualizó el límite para aprobación manual de todos los gastos a ${newLimit} (previamente ${oldLimit})`, }, roomMembersPage: { memberNotFound: 'Miembro no encontrado.', From 5b7681b9ece600819c67459e14336175bacffe51 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Fri, 25 Apr 2025 01:19:25 +0530 Subject: [PATCH 35/40] minor update. Signed-off-by: krishna2323 --- src/languages/es.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 1a053ec90c742..a11f5375cc506 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -5140,9 +5140,9 @@ const translations = { return `actualizó la categoría "${categoryName}" añadiendo un Código de Nómina de ${newValue}`; } if (!newValue && oldValue) { - return `actualizó la categoría "${categoryName}" eliminando el código de nómina (previamente "${oldValue}")`; + return `actualizó la categoría "${categoryName}" eliminando el código de Nómina (previamente "${oldValue}")`; } - return `actualizó la categoría "${categoryName}" cambiando el código de nómina a ${newValue} (previamente "${oldValue}")`; + return `actualizó la categoría "${categoryName}" cambiando el código de Nómina a ${newValue} (previamente "${oldValue}")`; }, updateCategoryGLCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { if (!oldValue) { From b55059ca0145eb55d2073a6215e0f280f9da6cdf Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Sun, 27 Apr 2025 01:53:57 +0530 Subject: [PATCH 36/40] Style/Clarity Improvements. Signed-off-by: krishna2323 --- src/languages/es.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index a11f5375cc506..954d89dec912f 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -5126,12 +5126,11 @@ const translations = { billcom: 'BILLCOM', }, workspaceActions: { - addApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => - `agregó a ${approverName} (${approverEmail}) como aprobador para el/la ${field} "${name}"`, + addApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => `agregó a ${approverName} (${approverEmail}) como aprobador de ${field} "${name}"`, deleteApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => - `eliminó a ${approverName} (${approverEmail}) como aprobador para el campo ${field} "${name}"`, + `eliminó a ${approverName} (${approverEmail}) como aprobador de ${field} "${name}"`, updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => - `actualizó el aprobador para el campo ${field} "${name}" a ${newApproverName} (${newApproverEmail}) (previamente ${oldApproverName} (${oldApproverEmail}))`, + `actualizó el aprobador de ${field} "${name}" a ${newApproverName} (${newApproverEmail}) (previamente ${oldApproverName} (${oldApproverEmail}))`, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `añadió la categoría "${categoryName}""`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `eliminó la categoría "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'deshabilitó' : 'habilitó'} la categoría "${categoryName}"`, @@ -5140,18 +5139,18 @@ const translations = { return `actualizó la categoría "${categoryName}" añadiendo un Código de Nómina de ${newValue}`; } if (!newValue && oldValue) { - return `actualizó la categoría "${categoryName}" eliminando el código de Nómina (previamente "${oldValue}")`; + return `actualizó la categoría "${categoryName}" eliminando el Código de Nómina (previamente "${oldValue}")`; } - return `actualizó la categoría "${categoryName}" cambiando el código de Nómina a ${newValue} (previamente "${oldValue}")`; + return `actualizó la categoría "${categoryName}" cambiando el Código de Nómina a ${newValue} (previamente "${oldValue}")`; }, updateCategoryGLCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { if (!oldValue) { - return `actualizó la categoría "${categoryName}" añadiendo un código GL de ${newValue}`; + return `actualizó la categoría "${categoryName}" añadiendo un Código GL de ${newValue}`; } if (!newValue && oldValue) { - return `actualizó la categoría "${categoryName}" eliminando el código GL (previamente "${oldValue}")`; + return `actualizó la categoría "${categoryName}" eliminando el Código GL (previamente "${oldValue}")`; } - return `actualizó la categoría "${categoryName}" cambiando el código GL a ${newValue} (previamente "${oldValue}")`; + return `actualizó la categoría "${categoryName}" cambiando el Código GL a ${newValue} (previamente "${oldValue}")`; }, updateAreCommentsRequired: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => { return `actualizó la categoría "${categoryName}" cambiando la descripción a ${!oldValue ? 'Obligatoria' : 'No obligatoria'} (previamente ${ @@ -5210,7 +5209,7 @@ const translations = { } return `añadió la parte recuperable de impuestos "${newValue}" a la tasa de distancia "${customUnitRateName}"`; }, - deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, + deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `eliminó una nueva tasa de "${rateName}" para "${customUnitName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `añadió el campo de informe ${fieldType} "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `estableció el valor predeterminado del campo de informe "${fieldName}" en "${defaultValue}"`, @@ -5579,7 +5578,7 @@ const translations = { leftWorkspace: ({nameOrEmail}: LeftWorkspaceParams) => `${nameOrEmail} salió del espacio de trabajo`, removeMember: ({email, role}: AddEmployeeParams) => `eliminado ${role} ${email}`, removedConnection: ({connectionName}: ConnectionNameParams) => `eliminó la conexión a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, - addedConnection: ({connectionName}: ConnectionNameParams) => `conectado a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, + addedConnection: ({connectionName}: ConnectionNameParams) => `se conectó a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, }, }, }, From 505dfafea3c74a42e8d81863be9e7158a45ef2f4 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Mon, 19 May 2025 12:07:29 +0530 Subject: [PATCH 37/40] update translations. Signed-off-by: krishna2323 --- src/languages/en.ts | 59 ++++++++++++++++++------------------- src/languages/es.ts | 71 ++++++++++++++++++++++----------------------- 2 files changed, 63 insertions(+), 67 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index bea4383cf80a9..7a8d2b1b97557 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -194,13 +194,13 @@ import type { UnreportedTransactionParams, UnshareParams, UntilTimeParams, + UpdatedCustomFieldParams, UpdatedPolicyApprovalRuleParams, UpdatedPolicyAuditRateParams, UpdatedPolicyCategoryExpenseLimitTypeParams, UpdatedPolicyCategoryGLCodeParams, UpdatedPolicyCategoryMaxAmountNoReceiptParams, UpdatedPolicyCategoryMaxExpenseAmountParams, - UpdatedCustomFieldParams, UpdatedPolicyCategoryNameParams, UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, @@ -5124,54 +5124,54 @@ const translations = { deleteApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => `removed ${approverName} (${approverEmail}) as an approver for the ${field} "${name}"`, updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => - `updated the approver for the ${field} "${name}" to ${newApproverName} (${newApproverEmail}) (previously ${oldApproverName} (${oldApproverEmail}))`, + `changed the approver for the ${field} "${name}" to ${newApproverName} (${newApproverEmail}) (previously ${oldApproverName} (${oldApproverEmail}))`, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `added the category "${categoryName}"`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `removed the category "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'disabled' : 'enabled'} the category "${categoryName}"`, updateCategoryPayrollCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { if (!oldValue) { - return `updated the category "${categoryName}" by adding a Payroll Code of ${newValue}`; + return `added the payroll code "${newValue}" to the category "${categoryName}"`; } if (!newValue && oldValue) { - return `updated the category "${categoryName}" by removing the Payroll Code (previously "${oldValue}")`; + return `removed the payroll code "${oldValue}" from the category "${categoryName}"`; } - return `updated the category "${categoryName}" by changing the Payroll Code to ${newValue} (previously "${oldValue}")`; + return `changed the "${categoryName}" category payroll code to “${newValue}” (previously “${oldValue}”)`; }, updateCategoryGLCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { if (!oldValue) { - return `updated the category "${categoryName}" by adding a GL Code of "${newValue}"`; + return `added the GL code "${newValue}” to the category "${categoryName}"`; } if (!newValue && oldValue) { - return `updated the category "${categoryName}" by removing the GL Code (previously "${oldValue}")`; + return `removed the GL code "${oldValue}" from the category "${categoryName}"`; } - return `updated the category "${categoryName}" by changing the GL Code to "${newValue}" (previously "${oldValue}")`; + return `changed the “${categoryName}” category GL code to “${newValue}” (previously “${oldValue}“)`; }, updateAreCommentsRequired: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => { - return `updated the category "${categoryName}" by changing the Description to ${!oldValue ? 'Required' : 'Not Required'} (previously ${!oldValue ? 'Not Required' : 'Required'})`; + return `changed the "${categoryName}" category description to ${!oldValue ? 'required' : 'not required'} (previously ${!oldValue ? 'not required' : 'required'})`; }, updateCategoryMaxExpenseAmount: ({categoryName, oldAmount, newAmount}: UpdatedPolicyCategoryMaxExpenseAmountParams) => { if (newAmount && !oldAmount) { - return `updated the category "${categoryName}" by adding a Max Amount of ${newAmount}`; + return `added a ${newAmount} max amount to the category "${categoryName}"`; } if (oldAmount && !newAmount) { - return `updated the category "${categoryName}" by removing the Max Amount (previously "${oldAmount}")`; + return `removed the ${oldAmount} max amount from the category "${categoryName}"`; } - return `updated the category "${categoryName}" by changing the Max Amount to ${newAmount} (previously "${oldAmount}")`; + return `changed the "${categoryName}" category max amount to ${newAmount} (previously ${oldAmount})`; }, updateCategoryExpenseLimitType: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryExpenseLimitTypeParams) => { if (!oldValue) { - return `updated the category "${categoryName}" by adding a Limit Type of ${newValue}`; + return `added a limit type of ${newValue} to the category "${categoryName}"`; } - return `updated the category "${categoryName}" by changing the Limit Type to ${newValue} (previously "${oldValue}")`; + return `changed the "${categoryName}" category limit type to ${newValue} (previously ${oldValue})`; }, updateCategoryMaxAmountNoReceipt: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryMaxAmountNoReceiptParams) => { if (!oldValue) { return `updated the category "${categoryName}" by changing Receipts to ${newValue}`; } - return `updated the category "${categoryName}" by changing Receipts to ${newValue} (previously ${oldValue})`; + return `changed the "${categoryName}" category to ${newValue} (previously ${oldValue})`; }, setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renamed the category "${oldName}" to "${newName}"`, - updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `updated the name of the tag list to "${newName}" (previously "${oldName}")`, + updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `changed the tag list name to "${newName}" (previously "${oldName}")`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `added the tag "${tagName}" to the list "${tagListName}"`, updateTagName: ({tagListName, newName, oldName}: UpdatedPolicyTagNameParams) => `updated the tag list "${tagListName}" by changing the tag "${oldName}" to "${newName}`, updateTagEnabled: ({tagListName, tagName, enabled}: UpdatedPolicyTagParams) => `${enabled ? 'enabled' : 'disabled'} the tag "${tagName}" on the list "${tagListName}"`, @@ -5184,38 +5184,35 @@ const translations = { return `updated the tag "${tagName}" on the list "${tagListName}" by adding a ${updatedField} of "${newValue}"`; }, updateCustomUnit: ({customUnitName, newValue, oldValue, updatedField}: UpdatePolicyCustomUnitParams) => - `updated the ${customUnitName} ${updatedField} to "${newValue}" (previously "${oldValue}")`, + `changed the ${customUnitName} ${updatedField} to "${newValue}" (previously "${oldValue}")`, updateCustomUnitTaxEnabled: ({newValue}: UpdatePolicyCustomUnitTaxEnabledParams) => `${newValue ? 'enabled' : 'disabled'} tax tracking on distance rates`, addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `added a new "${customUnitName}" rate "${rateName}"`, updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => - `updated the rate of the ${customUnitName} ${updatedField} "${customUnitRateName}" to "${newValue}" (previously "${oldValue}")`, + `changed the rate of the ${customUnitName} ${updatedField} "${customUnitRateName}" to "${newValue}" (previously "${oldValue}")`, updatedCustomUnitTaxRateExternalID: ({customUnitRateName, newValue, newTaxPercentage, oldTaxPercentage, oldValue}: UpdatedPolicyCustomUnitTaxRateExternalIDParams) => { if (oldTaxPercentage && oldValue) { - return `updated the tax rate to "${newValue} (${newTaxPercentage})" on the distance rate "${customUnitRateName}" (previously "${oldValue} (${oldTaxPercentage})")`; + return `changed the tax rate on the distance rate "${customUnitRateName}" to "${newValue} (${newTaxPercentage})" (previously "${oldValue} (${oldTaxPercentage})")`; } return `added the tax rate "${newValue} (${newTaxPercentage})" to the distance rate "${customUnitRateName}"`; }, updatedCustomUnitTaxClaimablePercentage: ({customUnitRateName, newValue, oldValue}: UpdatedPolicyCustomUnitTaxClaimablePercentageParams) => { if (oldValue) { - return `updated the tax reclaimable portion to "${newValue}" on the distance rate "${customUnitRateName}" (previously "${oldValue}")`; + return `changed the tax reclaimable portion on the distance rate "${customUnitRateName}" to "${newValue}" (previously "${oldValue}")`; } - return `added the tax reclaimable portion "${newValue}" to the distance rate "${customUnitRateName}"`; + return `added a tax reclaimable portion of "${newValue}" to the distance rate "${customUnitRateName}`; }, deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `removed the "${customUnitName}" rate "${rateName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `added ${fieldType} Report Field "${fieldName}"`, - updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `set the default value of report field "${fieldName}" to "${defaultValue}"`, - addedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `updated Report Field "${fieldName}"; Added the option "${optionName}"`, - removedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `updated Report Field "${fieldName}"; Removed the option "${optionName}"`, + addedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `added the option "${optionName}" to the report field "${fieldName}"`, + removedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `removed the option "${optionName}" from the report field "${fieldName}"`, updateReportFieldOptionDisabled: ({fieldName, optionName, optionEnabled}: PolicyDisabledReportFieldOptionParams) => - `updated Report Field "${fieldName}"; Set the option "${optionName}" to be ${optionEnabled ? 'Enabled' : 'Disabled'}`, + `${optionEnabled ? 'enabled' : 'disabled'} the option "${optionName}" for the report field "${fieldName}"`, updateReportFieldAllOptionsDisabled: ({fieldName, optionName, allEnabled, toggledOptionsCount}: PolicyDisabledReportFieldAllOptionsParams) => { if (toggledOptionsCount && toggledOptionsCount > 1) { - return `updated Report Field "${fieldName}"; Set all options to be ${allEnabled ? 'Enabled' : 'Disabled'}`; + return `${allEnabled ? 'enabled' : 'disabled'} all "${fieldName}" report field options`; } - return `updated Report Field "${fieldName}"; Set the option "${optionName}" to be ${allEnabled ? 'Enabled' : 'Disabled'} making all options ${ - allEnabled ? 'Enabled' : 'Disabled' - }`; + return `${allEnabled ? 'enabled' : 'disabled'} the option "${optionName}" for the report field "${fieldName}", making all options ${allEnabled ? 'enabled' : 'disabled'}`; }, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `removed ${fieldType} Report Field "${fieldName}"`, preventSelfApproval: ({oldValue, newValue}: UpdatedPolicyPreventSelfApprovalParams) => @@ -5262,9 +5259,9 @@ const translations = { upgradedWorkspace: 'upgraded this workspace to the Control plan', downgradedWorkspace: 'downgraded this workspace to the Collect plan', updatedAuditRate: ({oldAuditRate, newAuditRate}: UpdatedPolicyAuditRateParams) => - `updated the rate of reports randomly routed for manual approval to ${Math.round(newAuditRate * 100)}% (previously ${Math.round(oldAuditRate * 100)}%)`, + `changed the rate of reports randomly routed for manual approval to ${Math.round(newAuditRate * 100)}% (previously ${Math.round(oldAuditRate * 100)}%)`, updatedManualApprovalThreshold: ({oldLimit, newLimit}: UpdatedPolicyManualApprovalThresholdParams) => - `updated the limit for manual approval of all expenses to ${newLimit} (previously ${oldLimit})`, + `changed the manual approval limit for all expenses to ${newLimit} (previously ${oldLimit})`, }, roomMembersPage: { memberNotFound: 'Member not found.', diff --git a/src/languages/es.ts b/src/languages/es.ts index 569bf4561a491..2bc35dff29c5e 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -193,13 +193,13 @@ import type { UnreportedTransactionParams, UnshareParams, UntilTimeParams, + UpdatedCustomFieldParams, UpdatedPolicyApprovalRuleParams, UpdatedPolicyAuditRateParams, UpdatedPolicyCategoryExpenseLimitTypeParams, UpdatedPolicyCategoryGLCodeParams, UpdatedPolicyCategoryMaxAmountNoReceiptParams, UpdatedPolicyCategoryMaxExpenseAmountParams, - UpdatedCustomFieldParams, UpdatedPolicyCategoryNameParams, UpdatedPolicyCategoryParams, UpdatedPolicyCurrencyParams, @@ -5171,49 +5171,48 @@ const translations = { billcom: 'BILLCOM', }, workspaceActions: { - addApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => `agregó a ${approverName} (${approverEmail}) como aprobador de ${field} "${name}"`, + addApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => + `añadió a ${approverName} (${approverEmail}) como aprobador para la ${field} "${name}"`, deleteApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => - `eliminó a ${approverName} (${approverEmail}) como aprobador de ${field} "${name}"`, + `eliminó a ${approverName} (${approverEmail}) como aprobador para la ${field} "${name}"`, updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => - `actualizó el aprobador de ${field} "${name}" a ${newApproverName} (${newApproverEmail}) (previamente ${oldApproverName} (${oldApproverEmail}))`, + `cambió el aprobador para la ${field} "${name}" a ${newApproverName} (${newApproverEmail}) (previamente ${oldApproverName} (${oldApproverEmail}))`, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `añadió la categoría "${categoryName}""`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `eliminó la categoría "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'deshabilitó' : 'habilitó'} la categoría "${categoryName}"`, updateCategoryPayrollCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { if (!oldValue) { - return `actualizó la categoría "${categoryName}" añadiendo un Código de Nómina de ${newValue}`; + return `añadió el código de nómina "${newValue}" a la categoría "${categoryName}"`; } if (!newValue && oldValue) { - return `actualizó la categoría "${categoryName}" eliminando el Código de Nómina (previamente "${oldValue}")`; + return `eliminó el código de nómina "${oldValue}" de la categoría "${categoryName}"`; } - return `actualizó la categoría "${categoryName}" cambiando el Código de Nómina a ${newValue} (previamente "${oldValue}")`; + return `cambió el código de nómina de la categoría "${categoryName}" a “${newValue}” (previamente “${oldValue}”)`; }, updateCategoryGLCode: ({oldValue, categoryName, newValue}: UpdatedPolicyCategoryGLCodeParams) => { if (!oldValue) { - return `actualizó la categoría "${categoryName}" añadiendo un Código GL de ${newValue}`; + return `añadió el código GL "${newValue}" a la categoría "${categoryName}"`; } if (!newValue && oldValue) { - return `actualizó la categoría "${categoryName}" eliminando el Código GL (previamente "${oldValue}")`; + return `eliminó el código GL "${oldValue}" de la categoría "${categoryName}"`; } - return `actualizó la categoría "${categoryName}" cambiando el Código GL a ${newValue} (previamente "${oldValue}")`; + return `cambió el código GL de la categoría “${categoryName}” a “${newValue}” (previamente “${oldValue}”)`; }, updateAreCommentsRequired: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => { - return `actualizó la categoría "${categoryName}" cambiando la descripción a ${!oldValue ? 'Obligatoria' : 'No obligatoria'} (previamente ${ - !oldValue ? 'No obligatoria' : 'Obligatoria' - })`; + return `cambió la descripción de la categoría "${categoryName}" a ${!oldValue ? 'requerida' : 'no requerida'} (previamente ${!oldValue ? 'no requerida' : 'requerida'})`; }, updateCategoryMaxExpenseAmount: ({categoryName, oldAmount, newAmount}: UpdatedPolicyCategoryMaxExpenseAmountParams) => { if (newAmount && !oldAmount) { - return `actualizó la categoría "${categoryName}" añadiendo un importe máximo de ${newAmount}`; + return `añadió un importe máximo de ${newAmount} a la categoría "${categoryName}"`; } if (oldAmount && !newAmount) { - return `actualizó la categoría "${categoryName}" eliminando el importe máximo (previamente ${oldAmount})`; + return `eliminó el importe máximo de ${oldAmount} de la categoría "${categoryName}"`; } - return `actualizó la categoría "${categoryName}" cambiando el importe máximo a ${newAmount} (previamente ${oldAmount})`; + return `cambió el importe máximo de la categoría "${categoryName}" a ${newAmount} (previamente ${oldAmount})`; }, updateCategoryExpenseLimitType: ({categoryName, oldValue, newValue}: UpdatedPolicyCategoryExpenseLimitTypeParams) => { if (!oldValue) { - return `actualizó la categoría "${categoryName}" añadiendo un Tipo de Límite de ${newValue}`; + return `añadió un tipo de límite de ${newValue} a la categoría "${categoryName}"`; } return `actualizó la categoría "${categoryName}" cambiando el Tipo de Límite a ${newValue} (previamente "${oldValue}")`; }, @@ -5221,10 +5220,10 @@ const translations = { if (!oldValue) { return `actualizó la categoría "${categoryName}" cambiando Recibos a ${newValue}`; } - return `actualizó la categoría "${categoryName}" cambiando Recibos a ${newValue} (previamente "${oldValue}")`; + return `cambió la categoría "${categoryName}" a ${newValue} (previamente ${oldValue})`; }, - setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renombró la categoría "${oldName}" a "${newName}`, - updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `actualizó el nombre de la lista de etiquetas a "${newName}" (previamente "${oldName}")`, + setCategoryName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `renombró la categoría "${oldName}" a "${newName}"`, + updateTagListName: ({oldName, newName}: UpdatedPolicyCategoryNameParams) => `cambió el nombre de la lista de etiquetas a "${newName}" (previamente "${oldName}")`, addTag: ({tagListName, tagName}: UpdatedPolicyTagParams) => `añadió la etiqueta "${tagName}" a la lista "${tagListName}"`, updateTagName: ({tagListName, newName, oldName}: UpdatedPolicyTagNameParams) => `actualizó la lista de etiquetas "${tagListName}" cambiando la etiqueta "${oldName}" a "${newName}"`, updateTagEnabled: ({tagListName, tagName, enabled}: UpdatedPolicyTagParams) => `${enabled ? 'habilitó' : 'deshabilitó'} la etiqueta "${tagName}" en la lista "${tagListName}"`, @@ -5237,38 +5236,38 @@ const translations = { return `actualizó la etiqueta "${tagName}" en la lista "${tagListName}" añadiendo un ${updatedField} de "${newValue}"`; }, updateCustomUnit: ({customUnitName, newValue, oldValue, updatedField}: UpdatePolicyCustomUnitParams) => - `actualizó el ${updatedField} de ${customUnitName} a "${newValue}" (previamente "${oldValue}")`, - updateCustomUnitTaxEnabled: ({newValue}: UpdatePolicyCustomUnitTaxEnabledParams) => `${newValue ? 'habilitó' : 'deshabilitó'} el seguimiento de impuestos en las tasas de distancia`, + `cambió el ${customUnitName} ${updatedField} a "${newValue}" (previamente "${oldValue}")`, + updateCustomUnitTaxEnabled: ({newValue}: UpdatePolicyCustomUnitTaxEnabledParams) => `${newValue ? 'habilitó' : 'deshabilitó'} el seguimiento de impuestos en tasas de distancia`, addCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `añadió una nueva tasa de "${rateName}" para "${customUnitName}"`, updatedCustomUnitRate: ({customUnitName, customUnitRateName, newValue, oldValue, updatedField}: UpdatedPolicyCustomUnitRateParams) => - `actualizó la tasa de ${customUnitName} ${updatedField} "${customUnitRateName}" a "${newValue}" (previamente "${oldValue}")`, + `cambió la tasa de ${customUnitName} ${updatedField} "${customUnitRateName}" a "${newValue}" (previamente "${oldValue}")`, updatedCustomUnitTaxRateExternalID: ({customUnitRateName, newValue, newTaxPercentage, oldTaxPercentage, oldValue}: UpdatedPolicyCustomUnitTaxRateExternalIDParams) => { if (oldTaxPercentage && oldValue) { - return `actualizó la tasa de impuesto a "${newValue} (${newTaxPercentage})" en la tarifa de distancia "${customUnitRateName}" (previamente "${oldValue} (${oldTaxPercentage})")`; + return `cambió la tasa de impuesto en la tasa por distancia "${customUnitRateName}" a "${newValue} (${newTaxPercentage})" (previamente "${oldValue} (${oldTaxPercentage})")`; } return `añadió la tasa de impuesto "${newValue} (${newTaxPercentage})" a la tasa de distancia "${customUnitRateName}"`; }, updatedCustomUnitTaxClaimablePercentage: ({customUnitRateName, newValue, oldValue}: UpdatedPolicyCustomUnitTaxClaimablePercentageParams) => { if (oldValue) { - return `añadió la porción recuperable de impuestos a "${newValue}" en la tarifa de distancia "${customUnitRateName}" (previamente "${oldValue}")`; + return `cambió la parte recuperable de impuestos en la tasa por distancia "${customUnitRateName}" a "${newValue}" (previamente "${oldValue}")`; } - return `añadió la parte recuperable de impuestos "${newValue}" a la tasa de distancia "${customUnitRateName}"`; + return `añadió una parte recuperable de impuestos de "${newValue}" a la tasa por distancia "${customUnitRateName}`; }, - deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `eliminó una nueva tasa de "${rateName}" para "${customUnitName}"`, + deleteCustomUnitRate: ({customUnitName, rateName}: AddOrDeletePolicyCustomUnitRateParams) => `eliminó la tasa "${rateName}" de "${customUnitName}"`, addedReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `añadió el campo de informe ${fieldType} "${fieldName}"`, updateReportFieldDefaultValue: ({defaultValue, fieldName}: UpdatedPolicyReportFieldDefaultValueParams) => `estableció el valor predeterminado del campo de informe "${fieldName}" en "${defaultValue}"`, - addedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `actualizó el campo de informe "${fieldName}"; agregó la opción "${optionName}"`, - removedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `actualizó el campo de informe "${fieldName}"; eliminó la opción "${optionName}"`, + addedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `añadió la opción "${optionName}" al campo de informe "${fieldName}"`, + removedReportFieldOption: ({fieldName, optionName}: PolicyAddedReportFieldOptionParams) => `eliminó la opción "${optionName}" del campo de informe "${fieldName}"`, updateReportFieldOptionDisabled: ({fieldName, optionName, optionEnabled}: PolicyDisabledReportFieldOptionParams) => - `actualizó el campo de informe "${fieldName}"; estableció la opción "${optionName}" como ${optionEnabled ? 'Habilitada' : 'Deshabilitada'}`, + `${optionEnabled ? 'habilitó' : 'deshabilitó'} la opción "${optionName}" para el campo de informe "${fieldName}"`, updateReportFieldAllOptionsDisabled: ({fieldName, optionName, allEnabled, toggledOptionsCount}: PolicyDisabledReportFieldAllOptionsParams) => { if (toggledOptionsCount && toggledOptionsCount > 1) { - return `actualizó el campo de informe "${fieldName}"; estableció todas las opciones como ${allEnabled ? 'Habilitadas' : 'Deshabilitadas'}`; + return `${allEnabled ? 'habilitó' : 'deshabilitó'} todas las opciones del campo de informe "${fieldName}"`; } - return `actualizó el campo de informe "${fieldName}"; estableció la opción "${optionName}" como ${ - allEnabled ? 'Habilitada' : 'Deshabilitada' - }, haciendo que todas las opciones estén ${allEnabled ? 'Habilitadas' : 'Deshabilitadas'}`; + return `${allEnabled ? 'habilitó' : 'deshabilitó'} la opción "${optionName}" para el campo de informe "${fieldName}", haciendo que todas las opciones queden ${ + allEnabled ? 'habilitadas' : 'deshabilitadas' + }`; }, deleteReportField: ({fieldType, fieldName}: AddedOrDeletedPolicyReportFieldParams) => `eliminó el campo de informe ${fieldType} "${fieldName}"`, preventSelfApproval: ({oldValue, newValue}: UpdatedPolicyPreventSelfApprovalParams) => @@ -5316,9 +5315,9 @@ const translations = { upgradedWorkspace: 'mejoró este espacio de trabajo al plan Controlar', downgradedWorkspace: 'bajó de categoría este espacio de trabajo al plan Recopilar', updatedAuditRate: ({oldAuditRate, newAuditRate}: UpdatedPolicyAuditRateParams) => - `actualizó la tasa de informes enrutados aleatoriamente para aprobación manual a ${Math.round(newAuditRate * 100)}% (previamente ${Math.round(oldAuditRate * 100)}%)`, + `cambió la tasa de informes enviados aleatoriamente para aprobación manual a ${Math.round(newAuditRate * 100)}% (previamente ${Math.round(oldAuditRate * 100)}%)`, updatedManualApprovalThreshold: ({oldLimit, newLimit}: UpdatedPolicyManualApprovalThresholdParams) => - `actualizó el límite para aprobación manual de todos los gastos a ${newLimit} (previamente ${oldLimit})`, + `cambió el límite de aprobación manual para todos los gastos a ${newLimit} (previamente ${oldLimit})`, }, roomMembersPage: { memberNotFound: 'Miembro no encontrado.', From 782a95fbd0e98b3d1ca50ac4086f72497f3e3daa Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Mon, 19 May 2025 13:24:23 +0530 Subject: [PATCH 38/40] fix updateApprovalRule logic. Signed-off-by: krishna2323 --- src/languages/en.ts | 10 ++++++++-- src/languages/es.ts | 7 +++++-- src/languages/params.ts | 2 +- src/libs/ReportActionsUtils.ts | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 7a8d2b1b97557..e2c8d2fa22218 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -5123,8 +5123,14 @@ const translations = { addApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => `added ${approverName} (${approverEmail}) as an approver for the ${field} "${name}"`, deleteApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => `removed ${approverName} (${approverEmail}) as an approver for the ${field} "${name}"`, - updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => - `changed the approver for the ${field} "${name}" to ${newApproverName} (${newApproverEmail}) (previously ${oldApproverName} (${oldApproverEmail}))`, + updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => { + const formatApprover = (displayName?: string, email?: string) => (displayName ? `${displayName} (${email})` : email); + + return `changed the approver for the ${field} "${name}" to ${formatApprover(newApproverName, newApproverEmail)} (previously ${formatApprover( + oldApproverName, + oldApproverEmail, + )})`; + }, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `added the category "${categoryName}"`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `removed the category "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'disabled' : 'enabled'} the category "${categoryName}"`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 2bc35dff29c5e..809ebd1cebe43 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -5175,8 +5175,11 @@ const translations = { `añadió a ${approverName} (${approverEmail}) como aprobador para la ${field} "${name}"`, deleteApprovalRule: ({approverEmail, approverName, field, name}: AddedPolicyApprovalRuleParams) => `eliminó a ${approverName} (${approverEmail}) como aprobador para la ${field} "${name}"`, - updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => - `cambió el aprobador para la ${field} "${name}" a ${newApproverName} (${newApproverEmail}) (previamente ${oldApproverName} (${oldApproverEmail}))`, + updateApprovalRule: ({field, name, newApproverEmail, newApproverName, oldApproverEmail, oldApproverName}: UpdatedPolicyApprovalRuleParams) => { + const formatApprover = (displayName?: string, email?: string) => (displayName ? `${displayName} (${email})` : email); + + return `cambió el aprobador para la ${field} "${name}" a ${formatApprover(newApproverName, newApproverEmail)} (previamente ${formatApprover(oldApproverName, oldApproverEmail)})`; + }, addCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `añadió la categoría "${categoryName}""`, deleteCategory: ({categoryName}: UpdatedPolicyCategoryParams) => `eliminó la categoría "${categoryName}"`, updateCategory: ({oldValue, categoryName}: UpdatedPolicyCategoryParams) => `${oldValue ? 'deshabilitó' : 'habilitó'} la categoría "${categoryName}"`, diff --git a/src/languages/params.ts b/src/languages/params.ts index 572991c1d7a4f..346220fdc8f13 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -357,7 +357,7 @@ type PolicyDisabledReportFieldAllOptionsParams = {fieldName: string; optionName: type AddedPolicyApprovalRuleParams = {approverEmail: string; approverName: string; field: string; name: string}; -type UpdatedPolicyApprovalRuleParams = {oldApproverEmail: string; oldApproverName: string; newApproverEmail: string; newApproverName: string; field: string; name: string}; +type UpdatedPolicyApprovalRuleParams = {oldApproverEmail: string; oldApproverName?: string; newApproverEmail: string; newApproverName?: string; field: string; name: string}; type UpdatedPolicyPreventSelfApprovalParams = {oldValue: string; newValue: string}; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 087bc84b499c2..932137fa55b33 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2495,7 +2495,7 @@ function getUpdatedApprovalRuleMessage(reportAction: OnyxEntry) { const {field, oldApproverEmail, oldApproverName, newApproverEmail, newApproverName, name} = getOriginalMessage(reportAction as ReportAction) ?? {}; - if (field && oldApproverEmail && oldApproverName && newApproverEmail && newApproverName && name) { + if (field && oldApproverEmail && newApproverEmail && name) { return translateLocal('workspaceActions.updateApprovalRule', { field, name, From f02b01b6167810f12a7d0e28a1da31612b6d8dc8 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Wed, 21 May 2025 13:17:46 +0530 Subject: [PATCH 39/40] remove duplicate field. Signed-off-by: krishna2323 --- src/types/onyx/OriginalMessage.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index b82fbd42930a9..417ee0bcbde40 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -445,9 +445,6 @@ type OriginalMessagePolicyChangeLog = { /** Name of the approver */ approverName?: string; - /** Field of which approver has been updated */ - field?: string; - /** Option name of a list report field */ optionName?: string; From 464a768ccbdcdd8706f69898ce48ce227d068ecf Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Fri, 23 May 2025 00:50:29 +0530 Subject: [PATCH 40/40] minor update. Signed-off-by: krishna2323 --- src/languages/en.ts | 2 +- src/languages/es.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 8111470231923..59cfee54c0bb3 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -5245,7 +5245,7 @@ const translations = { `${optionEnabled ? 'enabled' : 'disabled'} the option "${optionName}" for the report field "${fieldName}"`, updateReportFieldAllOptionsDisabled: ({fieldName, optionName, allEnabled, toggledOptionsCount}: PolicyDisabledReportFieldAllOptionsParams) => { if (toggledOptionsCount && toggledOptionsCount > 1) { - return `${allEnabled ? 'enabled' : 'disabled'} all "${fieldName}" report field options`; + return `${allEnabled ? 'enabled' : 'disabled'} all options for the report field "${fieldName}" `; } return `${allEnabled ? 'enabled' : 'disabled'} the option "${optionName}" for the report field "${fieldName}", making all options ${allEnabled ? 'enabled' : 'disabled'}`; }, diff --git a/src/languages/es.ts b/src/languages/es.ts index 062138f602807..acba3539fcffd 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -5296,7 +5296,7 @@ const translations = { `${optionEnabled ? 'habilitó' : 'deshabilitó'} la opción "${optionName}" para el campo de informe "${fieldName}"`, updateReportFieldAllOptionsDisabled: ({fieldName, optionName, allEnabled, toggledOptionsCount}: PolicyDisabledReportFieldAllOptionsParams) => { if (toggledOptionsCount && toggledOptionsCount > 1) { - return `${allEnabled ? 'habilitó' : 'deshabilitó'} todas las opciones del campo de informe "${fieldName}"`; + return `${allEnabled ? 'habilitó' : 'deshabilitó'} todas las opciones para el campo de informe "${fieldName}"`; } return `${allEnabled ? 'habilitó' : 'deshabilitó'} la opción "${optionName}" para el campo de informe "${fieldName}", haciendo que todas las opciones queden ${ allEnabled ? 'habilitadas' : 'deshabilitadas'