From d005e2d27b2c9e8e704dde5227c8513c09e3d20a Mon Sep 17 00:00:00 2001 From: Tomasz Misiukiewicz Date: Tue, 16 Apr 2024 12:06:34 +0200 Subject: [PATCH 001/924] filter options in share log --- .../ShareLogList/BaseShareLogList.tsx | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/pages/settings/AboutPage/ShareLogList/BaseShareLogList.tsx b/src/pages/settings/AboutPage/ShareLogList/BaseShareLogList.tsx index 578efbe5317b..6eaa3bdd7c0e 100644 --- a/src/pages/settings/AboutPage/ShareLogList/BaseShareLogList.tsx +++ b/src/pages/settings/AboutPage/ShareLogList/BaseShareLogList.tsx @@ -23,31 +23,38 @@ function BaseShareLogList({onAttachLogToReport}: BaseShareLogListProps) { const betas = useBetas(); const {options, areOptionsInitialized} = useOptionsList(); - const searchOptions = useMemo(() => { + const defaultOptions = useMemo(() => { if (!areOptionsInitialized) { return { recentReports: [], personalDetails: [], - userToInvite: undefined, + userToInvite: null, + currentUserOption: null, + categoryOptions: [], + tagOptions: [], + taxRatesOptions: [], headerMessage: '', }; } - const { - recentReports: localRecentReports, - personalDetails: localPersonalDetails, - userToInvite: localUserToInvite, - } = OptionsListUtils.getShareLogOptions(options, debouncedSearchValue.trim(), betas ?? []); - - const header = OptionsListUtils.getHeaderMessage((localRecentReports?.length || 0) + (localPersonalDetails?.length || 0) !== 0, Boolean(localUserToInvite), debouncedSearchValue); + const shareLogOptions = OptionsListUtils.getShareLogOptions(options, debouncedSearchValue.trim(), betas ?? []); - return { - recentReports: localRecentReports, - personalDetails: localPersonalDetails, - userToInvite: localUserToInvite, - headerMessage: header, - }; + return {...shareLogOptions, headerMessage: ''}; }, [areOptionsInitialized, options, debouncedSearchValue, betas]); + const searchOptions = useMemo(() => { + if (debouncedSearchValue.trim() === '') { + return defaultOptions; + } + const filteredOptions = OptionsListUtils.filterOptions(defaultOptions, debouncedSearchValue); + const headerMessage = OptionsListUtils.getHeaderMessage( + (filteredOptions.recentReports?.length || 0) + (filteredOptions.personalDetails?.length || 0) !== 0, + Boolean(filteredOptions.userToInvite), + debouncedSearchValue.trim(), + ); + + return {...filteredOptions, headerMessage}; + }, [debouncedSearchValue, defaultOptions]); + const sections = useMemo(() => { const sectionsList = []; From 7ce22422688c7a8dc0329f2969fa9fc42589cc02 Mon Sep 17 00:00:00 2001 From: usman-ghani564 Date: Fri, 3 May 2024 19:43:18 +0500 Subject: [PATCH 002/924] enable view photo for group chat --- src/pages/ReportAvatar.tsx | 8 ++++---- src/pages/ReportDetailsPage.tsx | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/ReportAvatar.tsx b/src/pages/ReportAvatar.tsx index 121b238012bf..ec24ac6b4d46 100644 --- a/src/pages/ReportAvatar.tsx +++ b/src/pages/ReportAvatar.tsx @@ -22,12 +22,12 @@ type ReportAvatarProps = ReportAvatarOnyxProps & StackScreenProps { @@ -35,7 +35,7 @@ function ReportAvatar({report = {} as Report, policies, isLoadingApp = true}: Re }} isWorkspaceAvatar maybeIcon - originalFileName={policy?.originalFileName ?? policyName} + originalFileName={policy?.originalFileName ?? title} shouldShowNotFoundPage={!report?.reportID && !isLoadingApp} isLoading={(!report?.reportID || !policy?.id) && !!isLoadingApp} /> diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index fa939be4e63d..c88aaa45400c 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -237,7 +237,6 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD isUsingDefaultAvatar={!report.avatarUrl} size={CONST.AVATAR_SIZE.XLARGE} avatarStyle={styles.avatarXLarge} - shouldDisableViewPhoto onImageRemoved={() => { // Calling this without a file will remove the avatar Report.updateGroupChatAvatar(report.reportID ?? ''); @@ -249,6 +248,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD errors={report.errorFields?.avatar ?? null} errorRowStyles={styles.mt6} onErrorClose={() => Report.clearAvatarErrors(report.reportID ?? '')} + onViewPhotoPress={() => Navigation.navigate(ROUTES.REPORT_AVATAR.getRoute(report.reportID))} /> ) : ( Date: Sun, 5 May 2024 04:32:26 +0530 Subject: [PATCH 003/924] fix: [Violations] Distance - Incorrect error message when distance amount is changed to smaller amount. Signed-off-by: Krishna Gupta --- src/CONST.ts | 4 ++-- src/components/ReceiptAudit.tsx | 13 ++++++++++--- .../ReportActionItem/MoneyRequestView.tsx | 11 ++++++----- src/hooks/useViolations.ts | 16 +++++++++++----- 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 566d5179f86a..e0dd65fb2ef1 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -3619,9 +3619,9 @@ const CONST = { SMARTSCAN_FAILED: 'smartscanFailed', SOME_TAG_LEVELS_REQUIRED: 'someTagLevelsRequired', TAG_OUT_OF_POLICY: 'tagOutOfPolicy', - TAX_AMOUNT_CHANGED: 'taxAmountChanged', + // TAX_AMOUNT_CHANGED: 'taxAmountChanged', + // TAX_RATE_CHANGED: 'taxRateChanged', TAX_OUT_OF_POLICY: 'taxOutOfPolicy', - TAX_RATE_CHANGED: 'taxRateChanged', TAX_REQUIRED: 'taxRequired', }, diff --git a/src/components/ReceiptAudit.tsx b/src/components/ReceiptAudit.tsx index ac1b36c6bf32..2adf3c2601d5 100644 --- a/src/components/ReceiptAudit.tsx +++ b/src/components/ReceiptAudit.tsx @@ -7,17 +7,24 @@ import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; import Text from './Text'; -function ReceiptAuditHeader({notes, shouldShowAuditMessage}: {notes: string[]; shouldShowAuditMessage: boolean}) { +function ReceiptAuditHeader({notes, shouldShowAuditSuccess, shouldShowAuditFailure}: {notes: string[]; shouldShowAuditSuccess?: boolean; shouldShowAuditFailure?: boolean}) { const styles = useThemeStyles(); const theme = useTheme(); const {translate} = useLocalize(); - const auditText = notes.length > 0 ? translate('iou.receiptIssuesFound', notes.length) : translate('common.verified'); + let auditText = ''; + + if (notes.length > 0 && shouldShowAuditFailure) { + auditText = translate('iou.receiptIssuesFound', notes.length); + } else if (!notes.length && shouldShowAuditSuccess) { + auditText = translate('common.verified'); + } + return ( {translate('common.receipt')} - {shouldShowAuditMessage && ( + {auditText && ( <> {` • ${auditText}`} !!canUseViolations && getViolationsForField(field, data).length > 0, [canUseViolations, getViolationsForField], @@ -330,7 +330,7 @@ function MoneyRequestView({ const shouldShowMapOrReceipt = showMapAsImage || hasReceipt; const shouldShowReceiptEmptyState = !hasReceipt && !isInvoice && (canEditReceipt || isAdmin || isApprover); const noticeTypeViolations = transactionViolations?.filter((violation) => violation.type === 'notice').map((v) => ViolationsUtils.getViolationTranslation(v, translate)) ?? []; - const shouldShowNotesViolations = !isReceiptBeingScanned && canUseViolations && ReportUtils.isPaidGroupPolicy(report); + const shouldShowAuditMessage = !isReceiptBeingScanned && canUseViolations && ReportUtils.isPaidGroupPolicy(report); return ( @@ -339,7 +339,8 @@ function MoneyRequestView({ {!isInvoice && ( )} {shouldShowMapOrReceipt && ( @@ -393,7 +394,7 @@ function MoneyRequestView({ /> )} {!shouldShowReceiptEmptyState && !shouldShowMapOrReceipt && } - {shouldShowNotesViolations && } + {/* {shouldShowNotesViolations && } */} {canUseViolations && } = { smartscanFailed: 'receipt', someTagLevelsRequired: 'tag', tagOutOfPolicy: 'tag', - taxAmountChanged: 'tax', + // taxAmountChanged: 'tax', + // taxRateChanged: 'tax', taxOutOfPolicy: 'tax', - taxRateChanged: 'tax', taxRequired: 'tax', }; type ViolationsMap = Map; -function useViolations(violations: TransactionViolation[]) { +function useViolations(violations: TransactionViolation[], shouldIncludeNoticeViolations?: boolean) { const violationsByField = useMemo((): ViolationsMap => { - const filteredViolations = violations.filter((violation) => violation.type === CONST.VIOLATION_TYPES.VIOLATION); + const filteredViolations = violations.filter((violation) => { + if (!shouldIncludeNoticeViolations) { + return violation.type === CONST.VIOLATION_TYPES.VIOLATION; + } + return violation.type === CONST.VIOLATION_TYPES.VIOLATION || violation.type === CONST.VIOLATION_TYPES.NOTICE; + }); + const violationGroups = new Map(); for (const violation of filteredViolations) { const field = violationFields[violation.name]; @@ -58,7 +64,7 @@ function useViolations(violations: TransactionViolation[]) { violationGroups.set(field, [...existingViolations, violation]); } return violationGroups ?? new Map(); - }, [violations]); + }, [violations, shouldIncludeNoticeViolations]); const getViolationsForField = useCallback( (field: ViolationField, data?: TransactionViolation['data']) => { From bac54f14cff9ca95447ea7c4ac5aa17b5925721a Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Sun, 5 May 2024 04:41:51 +0530 Subject: [PATCH 004/924] remove tax rate changed violation. Signed-off-by: Krishna Gupta --- src/CONST.ts | 3 +-- src/hooks/useViolations.ts | 3 +-- src/libs/Violations/ViolationsUtils.ts | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index e0dd65fb2ef1..97a7c551da5a 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -3619,8 +3619,7 @@ const CONST = { SMARTSCAN_FAILED: 'smartscanFailed', SOME_TAG_LEVELS_REQUIRED: 'someTagLevelsRequired', TAG_OUT_OF_POLICY: 'tagOutOfPolicy', - // TAX_AMOUNT_CHANGED: 'taxAmountChanged', - // TAX_RATE_CHANGED: 'taxRateChanged', + TAX_AMOUNT_CHANGED: 'taxAmountChanged', TAX_OUT_OF_POLICY: 'taxOutOfPolicy', TAX_REQUIRED: 'taxRequired', }, diff --git a/src/hooks/useViolations.ts b/src/hooks/useViolations.ts index bf2e8315194a..125a38e48220 100644 --- a/src/hooks/useViolations.ts +++ b/src/hooks/useViolations.ts @@ -40,8 +40,7 @@ const violationFields: Record = { smartscanFailed: 'receipt', someTagLevelsRequired: 'tag', tagOutOfPolicy: 'tag', - // taxAmountChanged: 'tax', - // taxRateChanged: 'tax', + taxAmountChanged: 'tax', taxOutOfPolicy: 'tax', taxRequired: 'tax', }; diff --git a/src/libs/Violations/ViolationsUtils.ts b/src/libs/Violations/ViolationsUtils.ts index 42f58be1d699..5e38d213edaa 100644 --- a/src/libs/Violations/ViolationsUtils.ts +++ b/src/libs/Violations/ViolationsUtils.ts @@ -276,8 +276,6 @@ const ViolationsUtils = { return translate('violations.taxAmountChanged'); case 'taxOutOfPolicy': return translate('violations.taxOutOfPolicy', {taxName}); - case 'taxRateChanged': - return translate('violations.taxRateChanged'); case 'taxRequired': return translate('violations.taxRequired'); default: From d3994531be44330e015fd1d43c628b8f0ba0643f Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Sun, 5 May 2024 04:43:44 +0530 Subject: [PATCH 005/924] remove ReceiptAuditHeader. Signed-off-by: Krishna Gupta --- src/components/ReceiptAudit.tsx | 9 ++------- src/components/ReportActionItem/MoneyRequestView.tsx | 5 ++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/components/ReceiptAudit.tsx b/src/components/ReceiptAudit.tsx index 2adf3c2601d5..a5ccf543e0b7 100644 --- a/src/components/ReceiptAudit.tsx +++ b/src/components/ReceiptAudit.tsx @@ -7,7 +7,7 @@ import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; import Text from './Text'; -function ReceiptAuditHeader({notes, shouldShowAuditSuccess, shouldShowAuditFailure}: {notes: string[]; shouldShowAuditSuccess?: boolean; shouldShowAuditFailure?: boolean}) { +function ReceiptAudit({notes, shouldShowAuditSuccess, shouldShowAuditFailure}: {notes: string[]; shouldShowAuditSuccess?: boolean; shouldShowAuditFailure?: boolean}) { const styles = useThemeStyles(); const theme = useTheme(); const {translate} = useLocalize(); @@ -41,9 +41,4 @@ function ReceiptAuditHeader({notes, shouldShowAuditSuccess, shouldShowAuditFailu ); } -function ReceiptAuditMessages({notes = []}: {notes?: string[]}) { - const styles = useThemeStyles(); - return {notes.length > 0 && notes.map((message) => {message})}; -} - -export {ReceiptAuditHeader, ReceiptAuditMessages}; +export default ReceiptAudit; diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 0f9ffc2d2485..2b91b41e8cdc 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -7,7 +7,7 @@ import * as Expensicons from '@components/Icon/Expensicons'; import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; import OfflineWithFeedback from '@components/OfflineWithFeedback'; import {useSession} from '@components/OnyxProvider'; -import {ReceiptAuditHeader} from '@components/ReceiptAudit'; +import ReceiptAudit from '@components/ReceiptAudit'; import ReceiptEmptyState from '@components/ReceiptEmptyState'; import Switch from '@components/Switch'; import Text from '@components/Text'; @@ -337,7 +337,7 @@ function MoneyRequestView({ {shouldShowAnimatedBackground && } {!isInvoice && ( - )} {!shouldShowReceiptEmptyState && !shouldShowMapOrReceipt && } - {/* {shouldShowNotesViolations && } */} {canUseViolations && } Date: Mon, 6 May 2024 19:29:59 +0500 Subject: [PATCH 006/924] create variable for filename --- src/pages/ReportAvatar.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/ReportAvatar.tsx b/src/pages/ReportAvatar.tsx index ec24ac6b4d46..d20396e0a308 100644 --- a/src/pages/ReportAvatar.tsx +++ b/src/pages/ReportAvatar.tsx @@ -24,6 +24,7 @@ function ReportAvatar({report = {} as Report, policies, isLoadingApp = true}: Re const policy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID ?? '0'}`]; const title = policy ? ReportUtils.getPolicyName(report, false, policy) : report?.reportName; const avatarURL = policy ? ReportUtils.getWorkspaceAvatar(report) : report?.avatarUrl; + const fileName = policy?.originalFileName ?? title; return ( From 34d5e2e6b513dd080b398836e942fcd569e736c5 Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Fri, 10 May 2024 15:28:23 +0530 Subject: [PATCH 007/924] updated amountModified translation. Signed-off-by: Krishna Gupta --- src/CONST.ts | 1 + src/hooks/useViolations.ts | 4 ++++ src/languages/en.ts | 15 ++++++++++++++- src/languages/es.ts | 15 ++++++++++++++- src/languages/types.ts | 3 +++ src/libs/Violations/ViolationsUtils.ts | 2 +- 6 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index ce8e0dc8aeca..efb0463457b1 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -3651,6 +3651,7 @@ const CONST = { TAG_OUT_OF_POLICY: 'tagOutOfPolicy', TAX_AMOUNT_CHANGED: 'taxAmountChanged', TAX_OUT_OF_POLICY: 'taxOutOfPolicy', + TAX_RATE_CHANGED: 'taxRateChanged', TAX_REQUIRED: 'taxRequired', }, diff --git a/src/hooks/useViolations.ts b/src/hooks/useViolations.ts index 125a38e48220..4f35c6d27a73 100644 --- a/src/hooks/useViolations.ts +++ b/src/hooks/useViolations.ts @@ -40,6 +40,7 @@ const violationFields: Record = { smartscanFailed: 'receipt', someTagLevelsRequired: 'tag', tagOutOfPolicy: 'tag', + taxRateChanged: 'tax', taxAmountChanged: 'tax', taxOutOfPolicy: 'tax', taxRequired: 'tax', @@ -50,6 +51,9 @@ type ViolationsMap = Map; function useViolations(violations: TransactionViolation[], shouldIncludeNoticeViolations?: boolean) { const violationsByField = useMemo((): ViolationsMap => { const filteredViolations = violations.filter((violation) => { + if (violation.name === 'taxRateChanged' || violation.name === 'taxAmountChanged') { + return false; + } if (!shouldIncludeNoticeViolations) { return violation.type === CONST.VIOLATION_TYPES.VIOLATION; } diff --git a/src/languages/en.ts b/src/languages/en.ts index 75ef134a6175..7faa4ed1804c 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -88,6 +88,7 @@ import type { ViolationsInvoiceMarkupParams, ViolationsMaxAgeParams, ViolationsMissingTagParams, + ViolationsModifiedAmountParams, ViolationsOverCategoryLimitParams, ViolationsOverLimitParams, ViolationsPerDayLimitParams, @@ -2959,7 +2960,19 @@ export default { missingCategory: 'Missing category', missingComment: 'Description required for selected category', missingTag: ({tagName}: ViolationsMissingTagParams) => `Missing ${tagName ?? 'tag'}`, - modifiedAmount: 'Amount greater than scanned receipt', + modifiedAmount: ({type, displayPercentVariance}: ViolationsModifiedAmountParams): string => { + if (type === 'card' && displayPercentVariance) { + return `Amount ${displayPercentVariance}% greater than scanned receipt`; + } + switch (type) { + case 'distance': + return 'Amount differs from calculated distance'; + case 'card': + return 'Amount greater than card transaction'; + default: + return 'Amount greater than scanned receipt'; + } + }, modifiedDate: 'Date differs from scanned receipt', nonExpensiworksExpense: 'Non-Expensiworks expense', overAutoApprovalLimit: ({formattedLimit}: ViolationsOverLimitParams) => `Expense exceeds auto approval limit of ${formattedLimit}`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 55203ef32749..041160f9e0e5 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -86,6 +86,7 @@ import type { ViolationsInvoiceMarkupParams, ViolationsMaxAgeParams, ViolationsMissingTagParams, + ViolationsModifiedAmountParams, ViolationsOverAutoApprovalLimitParams, ViolationsOverCategoryLimitParams, ViolationsOverLimitParams, @@ -3460,7 +3461,19 @@ export default { missingCategory: 'Falta categoría', missingComment: 'Descripción obligatoria para la categoría seleccionada', missingTag: ({tagName}: ViolationsMissingTagParams) => `Falta ${tagName ?? 'etiqueta'}`, - modifiedAmount: 'Importe superior al del recibo escaneado', + modifiedAmount: ({type, displayPercentVariance}: ViolationsModifiedAmountParams) => { + if (type === 'card' && displayPercentVariance) { + return `Importe ${displayPercentVariance}% mayor al del recibo escaneado`; + } + switch (type) { + case 'distance': + return 'Importe difiere del calculado basado en distancia'; + case 'card': + return 'Importe mayor al de la transacción de la tarjeta'; + default: + return 'Importe mayor al del recibo escaneado'; + } + }, modifiedDate: 'Fecha difiere del recibo escaneado', nonExpensiworksExpense: 'Gasto no proviene de Expensiworks', overAutoApprovalLimit: ({formattedLimit}: ViolationsOverAutoApprovalLimitParams) => diff --git a/src/languages/types.ts b/src/languages/types.ts index e2e7e26e696b..665857c2efa5 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -222,6 +222,8 @@ type ViolationsMaxAgeParams = {maxAge: number}; type ViolationsMissingTagParams = {tagName?: string}; +type ViolationsModifiedAmountParams = {type: string; displayPercentVariance?: string}; + type ViolationsOverAutoApprovalLimitParams = {formattedLimit?: string}; type ViolationsOverCategoryLimitParams = {formattedLimit?: string}; @@ -382,6 +384,7 @@ export type { ViolationsInvoiceMarkupParams, ViolationsMaxAgeParams, ViolationsMissingTagParams, + ViolationsModifiedAmountParams, ViolationsOverAutoApprovalLimitParams, ViolationsOverCategoryLimitParams, ViolationsOverLimitParams, diff --git a/src/libs/Violations/ViolationsUtils.ts b/src/libs/Violations/ViolationsUtils.ts index 5e38d213edaa..c864747847d4 100644 --- a/src/libs/Violations/ViolationsUtils.ts +++ b/src/libs/Violations/ViolationsUtils.ts @@ -239,7 +239,7 @@ const ViolationsUtils = { case 'missingTag': return translate('violations.missingTag', {tagName}); case 'modifiedAmount': - return translate('violations.modifiedAmount'); + return translate('violations.modifiedAmount', {type: 'card'}); case 'modifiedDate': return translate('violations.modifiedDate'); case 'nonExpensiworksExpense': From 0549056529c2a89b7f765167eac237e107bf082b Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Fri, 10 May 2024 15:30:51 +0530 Subject: [PATCH 008/924] minor update. Signed-off-by: Krishna Gupta --- src/languages/en.ts | 6 +++--- src/languages/es.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 7faa4ed1804c..57082f98799e 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2961,13 +2961,13 @@ export default { missingComment: 'Description required for selected category', missingTag: ({tagName}: ViolationsMissingTagParams) => `Missing ${tagName ?? 'tag'}`, modifiedAmount: ({type, displayPercentVariance}: ViolationsModifiedAmountParams): string => { - if (type === 'card' && displayPercentVariance) { - return `Amount ${displayPercentVariance}% greater than scanned receipt`; - } switch (type) { case 'distance': return 'Amount differs from calculated distance'; case 'card': + if (displayPercentVariance) { + return `Amount ${displayPercentVariance}% greater than scanned receipt`; + } return 'Amount greater than card transaction'; default: return 'Amount greater than scanned receipt'; diff --git a/src/languages/es.ts b/src/languages/es.ts index 041160f9e0e5..1eee82369f1a 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3462,13 +3462,13 @@ export default { missingComment: 'Descripción obligatoria para la categoría seleccionada', missingTag: ({tagName}: ViolationsMissingTagParams) => `Falta ${tagName ?? 'etiqueta'}`, modifiedAmount: ({type, displayPercentVariance}: ViolationsModifiedAmountParams) => { - if (type === 'card' && displayPercentVariance) { - return `Importe ${displayPercentVariance}% mayor al del recibo escaneado`; - } switch (type) { case 'distance': return 'Importe difiere del calculado basado en distancia'; case 'card': + if (displayPercentVariance) { + return `Importe ${displayPercentVariance}% mayor al del recibo escaneado`; + } return 'Importe mayor al de la transacción de la tarjeta'; default: return 'Importe mayor al del recibo escaneado'; From faf6155bdc45576bbdfbaa87625572ee48914fac Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Thu, 16 May 2024 09:53:48 +0200 Subject: [PATCH 009/924] feat: add confirm screen --- src/ROUTES.ts | 8 +-- src/SCREENS.ts | 2 +- .../ModalStackNavigators/index.tsx | 1 + src/libs/Navigation/linkingConfig/config.ts | 5 +- src/pages/TransactionDuplicate/Confirm.tsx | 64 +++++++++++++++++++ 5 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 src/pages/TransactionDuplicate/Confirm.tsx diff --git a/src/ROUTES.ts b/src/ROUTES.ts index a5f35962b67e..fe1e08d208d1 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -815,10 +815,10 @@ const ROUTES = { route: 'r/:threadReportID/duplicates/review/billable', getRoute: (threadReportID: string) => `r/${threadReportID}/duplicates/review/billable` as const, }, - // TRANSACTION_DUPLICATE_CONFIRM: { - // route: 'r/:threadReportID/duplicates/review/description', - // getRoute: (threadReportID: string) => `r/${threadReportID}/duplicates/review/description` as const, - // }, + TRANSACTION_DUPLICATE_CONFIRM_PAGE: { + route: 'r/:threadReportID/duplicates/review/description', + getRoute: (threadReportID: string) => `r/${threadReportID}/duplicates/review/description` as const, + }, POLICY_ACCOUNTING_XERO_IMPORT: { route: 'settings/workspaces/:policyID/accounting/xero/import', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import` as const, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index fae7c11ba21c..7ccef9217635 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -186,7 +186,7 @@ const SCREENS = { TAX_CODE: 'Transaction_Duplicate_Tax_Code', REIMBURSABLE: 'Transaction_Duplicate_Reimburable', BILLABLE: 'Transaction_Duplicate_Billable', - // CONFIRM: 'Transaction_Duplicate_Confirm', + CONFIRM: 'Transaction_Duplicate_Confirm', }, IOU_SEND: { diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 0448c4ed9647..d50188343b87 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -375,6 +375,7 @@ const TransactionDuplicateStackNavigator = createModalStackNavigator require('../../../../pages/TransactionDuplicate/ReviewTaxCode').default as React.ComponentType, [SCREENS.TRANSACTION_DUPLICATE.BILLABLE]: () => require('../../../../pages/TransactionDuplicate/ReviewBillable').default as React.ComponentType, [SCREENS.TRANSACTION_DUPLICATE.REIMBURSABLE]: () => require('../../../../pages/TransactionDuplicate/ReviewReimbursable').default as React.ComponentType, + [SCREENS.TRANSACTION_DUPLICATE.CONFIRM]: () => require('../../../../pages/TransactionDuplicate/Confirm').default as React.ComponentType, }); const SearchReportModalStackNavigator = createModalStackNavigator({ diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 9da05b572b0d..03f2cc80f7e5 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -692,7 +692,10 @@ const config: LinkingOptions['config'] = { path: ROUTES.TRANSACTION_DUPLICATE_REVIEW_BILLABLE_PAGE.route, exact: true, }, - // [SCREENS.TRANSACTION_DUPLICATE.CONFIRM]: ROUTES.TRANSACTION_DUPLICATE_CONFIRM.route, + [SCREENS.TRANSACTION_DUPLICATE.CONFIRM]: { + path: ROUTES.TRANSACTION_DUPLICATE_CONFIRM_PAGE.route, + exact: true, + }, }, }, [SCREENS.RIGHT_MODAL.SPLIT_DETAILS]: { diff --git a/src/pages/TransactionDuplicate/Confirm.tsx b/src/pages/TransactionDuplicate/Confirm.tsx new file mode 100644 index 000000000000..b503abf45450 --- /dev/null +++ b/src/pages/TransactionDuplicate/Confirm.tsx @@ -0,0 +1,64 @@ +import type {RouteProp} from '@react-navigation/native'; +import {useRoute} from '@react-navigation/native'; +import React from 'react'; +import {View} from 'react-native'; +import {useOnyx} from 'react-native-onyx'; +import Button from '@components/Button'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import MoneyRequestView from '@components/ReportActionItem/MoneyRequestView'; +import ScreenWrapper from '@components/ScreenWrapper'; +import Text from '@components/Text'; +import useThemeStyles from '@hooks/useThemeStyles'; +import type {TransactionDuplicateNavigatorParamList} from '@libs/Navigation/types'; +import variables from '@styles/variables'; +import ONYXKEYS from '@src/ONYXKEYS'; +import type SCREENS from '@src/SCREENS'; +import type {Transaction} from '@src/types/onyx'; + +function Confirm() { + const styles = useThemeStyles(); + const route = useRoute>(); + const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${route.params.threadReportID}`); + const [reviewDuplicates] = useOnyx(ONYXKEYS.FORMS.REVIEW_DUPLICATES_FORM); + const [originalTransaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${reviewDuplicates?.transactionID}`); + const transaction: Transaction = { + ...originalTransaction, + category: reviewDuplicates?.category, + comment: {comment: reviewDuplicates?.description}, + billable: reviewDuplicates?.billable, + reimbursable: reviewDuplicates?.reimbursable, + tag: reviewDuplicates?.tag, + taxCode: reviewDuplicates?.taxCode, + }; + + return ( + + + + + Confirm the details you're keeping + + The duplicate requests you don't keep will be held for the member to delete + + +