Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hide reconciliation option if expensify card is not enabled #53073

Merged
merged 4 commits into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions src/pages/workspace/accounting/PolicyAccountingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
const currentXeroOrganization = findCurrentXeroOrganization(tenants, policy?.connections?.xero?.config?.tenantID);
const shouldShowSynchronizationError = !!synchronizationError;
const shouldShowReinstallConnectorMenuItem = shouldShowSynchronizationError && connectedIntegration === CONST.POLICY.CONNECTIONS.NAME.QBD;
const shouldShowCardReconciliationOption =
daledah marked this conversation as resolved.
Show resolved Hide resolved
policy?.achAccount?.bankAccountID && policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES && policy?.areExpensifyCardsEnabled;

const overflowMenu: ThreeDotsMenuProps['menuItems'] = useMemo(
() => [
Expand Down Expand Up @@ -306,14 +308,18 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
brickRoadIndicator: areSettingsInErrorFields(integrationData?.subscribedExportSettings, integrationData?.errorFields) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
pendingAction: settingsPendingAction(integrationData?.subscribedExportSettings, integrationData?.pendingFields),
},
{
icon: Expensicons.ExpensifyCard,
iconRight: Expensicons.ArrowRight,
shouldShowRightIcon: true,
title: translate('workspace.accounting.cardReconciliation'),
wrapperStyle: [styles.sectionMenuItemTopDescription],
onPress: integrationData?.onCardReconciliationPagePress,
},
...(shouldShowCardReconciliationOption
? [
{
icon: Expensicons.ExpensifyCard,
iconRight: Expensicons.ArrowRight,
shouldShowRightIcon: true,
title: translate('workspace.accounting.cardReconciliation'),
wrapperStyle: [styles.sectionMenuItemTopDescription],
onPress: integrationData?.onCardReconciliationPagePress,
},
]
: []),
{
icon: Expensicons.Gear,
iconRight: Expensicons.ArrowRight,
Expand All @@ -326,10 +332,6 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
},
];

if (!policy?.areExpensifyCardsEnabled) {
configurationOptions.splice(2, 1);
}

return [
{
...iconProps,
Expand Down Expand Up @@ -394,6 +396,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
startIntegrationFlow,
popoverAnchorRefs,
canUseNetSuiteUSATax,
shouldShowCardReconciliationOption,
]);

const otherIntegrationsItems = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function CardReconciliationPage({policy, route}: CardReconciliationPageProps) {
const {connection} = route.params;
const connectionName = AccountingUtils.getConnectionNameFromRouteParam(connection) as ConnectionName;
const autoSync = !!policy?.connections?.[connectionName]?.config?.autoSync?.enabled;
const shouldShow = policy?.achAccount?.bankAccountID && policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES && policy?.areExpensifyCardsEnabled;

const toggleContinuousReconciliation = (value: boolean) => {
Card.toggleContinuousReconciliation(workspaceAccountID, value, connectionName, currentConnectionName);
Expand Down Expand Up @@ -75,6 +76,7 @@ function CardReconciliationPage({policy, route}: CardReconciliationPageProps) {
policyID={policyID}
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
shouldBeBlocked={!shouldShow}
>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
Expand Down
Loading