Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ function SageIntacctAdvancedPage({policy}: WithPolicyProps) {
description: translate('workspace.sageIntacct.inviteEmployeesDescription'),
isActive: !!importEmployees,
onToggle: (enabled: boolean) => {
if (!policyID) {
return;
}
updateSageIntacctImportEmployees(policyID, enabled);
updateSageIntacctApprovalMode(policyID, enabled);
},
Expand All @@ -62,6 +65,9 @@ function SageIntacctAdvancedPage({policy}: WithPolicyProps) {
description: translate('workspace.sageIntacct.syncReimbursedReportsDescription'),
isActive: !!sync?.syncReimbursedReports,
onToggle: (enabled: boolean) => {
if (!policyID) {
return;
}
updateSageIntacctSyncReimbursedReports(policyID, enabled);

if (enabled && !sync?.reimbursementAccountID) {
Expand Down Expand Up @@ -137,7 +143,7 @@ function SageIntacctAdvancedPage({policy}: WithPolicyProps) {
pendingAction={settingsPendingAction([CONST.SAGE_INTACCT_CONFIG.REIMBURSEMENT_ACCOUNT_ID], pendingFields)}
>
<MenuItemWithTopDescription
title={getReimbursedAccountName(data?.bankAccounts ?? [], sync?.reimbursementAccountID) ?? translate('workspace.sageIntacct.notConfigured')}
title={getReimbursedAccountName(data?.bankAccounts ?? [], sync?.reimbursementAccountID)}
description={translate('workspace.sageIntacct.paymentAccount')}
shouldShowRightIcon
onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_SAGE_INTACCT_PAYMENT_ACCOUNT.getRoute(policyID))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,25 @@ function SageIntacctExportPage({policy}: WithPolicyProps) {
{
description: translate('workspace.sageIntacct.preferredExporter'),
action: !policyID ? undefined : () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_SAGE_INTACCT_PREFERRED_EXPORTER.getRoute(policyID, Navigation.getActiveRoute())),
title: exportConfig?.exporter ?? translate('workspace.sageIntacct.notConfigured'),
title: exportConfig?.exporter,
subscribedSettings: [CONST.SAGE_INTACCT_CONFIG.EXPORTER],
},
{
description: translate('workspace.sageIntacct.exportDate.label'),
action: !policyID ? undefined : () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_SAGE_INTACCT_EXPORT_DATE.getRoute(policyID, Navigation.getActiveRoute())),
title: exportConfig?.exportDate ? translate(`workspace.sageIntacct.exportDate.values.${exportConfig.exportDate}.label`) : translate(`workspace.sageIntacct.notConfigured`),
title: exportConfig?.exportDate ? translate(`workspace.sageIntacct.exportDate.values.${exportConfig.exportDate}.label`) : undefined,
subscribedSettings: [CONST.SAGE_INTACCT_CONFIG.EXPORT_DATE],
},
{
description: translate('workspace.accounting.exportOutOfPocket'),
action: !policyID ? undefined : () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_SAGE_INTACCT_REIMBURSABLE_EXPENSES.getRoute(policyID, Navigation.getActiveRoute())),
title: exportConfig?.reimbursable
? translate(`workspace.sageIntacct.reimbursableExpenses.values.${exportConfig.reimbursable}`)
: translate('workspace.sageIntacct.notConfigured'),
title: exportConfig?.reimbursable ? translate(`workspace.sageIntacct.reimbursableExpenses.values.${exportConfig.reimbursable}`) : undefined,
subscribedSettings: [CONST.SAGE_INTACCT_CONFIG.REIMBURSABLE, CONST.SAGE_INTACCT_CONFIG.REIMBURSABLE_VENDOR],
},
{
description: translate('workspace.accounting.exportCompanyCard'),
action: !policyID ? undefined : () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_SAGE_INTACCT_NON_REIMBURSABLE_EXPENSES.getRoute(policyID, Navigation.getActiveRoute())),
title: exportConfig?.nonReimbursable
? translate(`workspace.sageIntacct.nonReimbursableExpenses.values.${exportConfig.nonReimbursable}`)
: translate('workspace.sageIntacct.notConfigured'),
title: exportConfig?.nonReimbursable ? translate(`workspace.sageIntacct.nonReimbursableExpenses.values.${exportConfig.nonReimbursable}`) : undefined,
subscribedSettings: [
CONST.SAGE_INTACCT_CONFIG.NON_REIMBURSABLE,
CONST.SAGE_INTACCT_CONFIG.NON_REIMBURSABLE_ACCOUNT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ function SageIntacctNonReimbursableExpensesPage({policy}: WithPolicyConnectionsP
const menuItems: ExtendedMenuItemWithSubscribedSettings[] = [
{
type: 'menuitem',
title: config?.export.nonReimbursable
? translate(`workspace.sageIntacct.nonReimbursableExpenses.values.${config?.export.nonReimbursable}`)
: translate('workspace.sageIntacct.notConfigured'),
title: config?.export.nonReimbursable ? translate(`workspace.sageIntacct.nonReimbursableExpenses.values.${config?.export.nonReimbursable}`) : undefined,
description: translate('workspace.accounting.exportAs'),
onPress: () => {
if (!policyID) {
Expand All @@ -75,7 +73,7 @@ function SageIntacctNonReimbursableExpensesPage({policy}: WithPolicyConnectionsP
},
{
type: 'menuitem',
title: config?.export.nonReimbursableAccount ? config.export.nonReimbursableAccount : translate('workspace.sageIntacct.notConfigured'),
title: config?.export.nonReimbursableAccount ? config.export.nonReimbursableAccount : undefined,
description: translate('workspace.sageIntacct.creditCardAccount'),
onPress: () => {
if (!policyID) {
Expand Down Expand Up @@ -118,7 +116,7 @@ function SageIntacctNonReimbursableExpensesPage({policy}: WithPolicyConnectionsP
children: [
{
type: 'menuitem',
title: defaultVendorName && defaultVendorName !== '' ? defaultVendorName : translate('workspace.sageIntacct.notConfigured'),
title: defaultVendorName && defaultVendorName !== '' ? defaultVendorName : undefined,
description: translate('workspace.sageIntacct.defaultVendor'),
onPress: () => {
if (!policyID) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function SageIntacctReimbursableExpensesPage({policy}: WithPolicyConnectionsProp
const menuItems: ExtendedMenuItemWithSubscribedSettings[] = [
{
type: 'menuitem',
title: reimbursable ? translate(`workspace.sageIntacct.reimbursableExpenses.values.${reimbursable}`) : translate('workspace.sageIntacct.notConfigured'),
title: reimbursable ? translate(`workspace.sageIntacct.reimbursableExpenses.values.${reimbursable}`) : undefined,
description: translate('workspace.accounting.exportAs'),
onPress: () => {
if (!policyID) {
Expand Down Expand Up @@ -94,7 +94,7 @@ function SageIntacctReimbursableExpensesPage({policy}: WithPolicyConnectionsProp
children: [
{
type: 'menuitem',
title: defaultVendorName && defaultVendorName !== '' ? defaultVendorName : translate('workspace.sageIntacct.notConfigured'),
title: defaultVendorName && defaultVendorName !== '' ? defaultVendorName : undefined,
description: translate('workspace.sageIntacct.defaultVendor'),
onPress: () => {
if (!policyID) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ function QuickbooksDesktopCompanyCardExpenseAccountPage({policy}: WithPolicyConn
const qbdReimbursableAccounts = getQBDReimbursableAccounts(policy?.connections?.quickbooksDesktop, nonReimbursable);
// We use the logical OR (||) here instead of ?? because `nonReimbursableAccount` can be an empty string
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
return qbdReimbursableAccounts.find(({id}) => nonReimbursableAccount === id)?.name || qbdReimbursableAccounts.at(0)?.name || translate('workspace.qbd.notConfigured');
}, [policy?.connections?.quickbooksDesktop, nonReimbursable, translate, nonReimbursableAccount]);
return qbdReimbursableAccounts.find(({id}) => nonReimbursableAccount === id)?.name || qbdReimbursableAccounts.at(0)?.name;
}, [policy?.connections?.quickbooksDesktop, nonReimbursable, nonReimbursableAccount]);

const {isAccordionExpanded, shouldAnimateAccordionSection} = useAccordionAnimation(!!qbdConfig?.shouldAutoCreateVendor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function QuickbooksDesktopOutOfPocketExpenseConfigurationPage({policy}: WithPoli
{
// We use the logical OR (||) here instead of ?? because `reimbursableAccount` can be an empty string
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
title: accountsList.find(({id}) => qbdConfig?.export.reimbursableAccount === id)?.name || accountsList.at(0)?.name || translate('workspace.qbd.notConfigured'),
title: accountsList.find(({id}) => qbdConfig?.export.reimbursableAccount === id)?.name || accountsList.at(0)?.name,
description: accountDescription,
onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_DESKTOP_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID, Navigation.getActiveRoute())),
subscribedSettings: account,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function QuickbooksCompanyCardExpenseAccountPage({policy}: WithPolicyConnections
subscribedSettings: [CONST.QUICKBOOKS_CONFIG.NON_REIMBURSABLE_EXPENSE_EXPORT_DESTINATION],
},
{
title: qboConfig?.nonReimbursableExpensesAccount?.name ?? translate('workspace.qbo.notConfigured'),
title: qboConfig?.nonReimbursableExpensesAccount?.name,
description: getQBONonReimbursableExportAccountType(qboConfig?.nonReimbursableExpensesExportDestination),
onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID, Navigation.getActiveRoute())),
subscribedSettings: [CONST.QUICKBOOKS_CONFIG.NON_REIMBURSABLE_EXPENSE_ACCOUNT],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyConne
brickRoadIndicator: areSettingsInErrorFields(accountOrExportDestination, qboConfig?.errorFields) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
},
{
title: qboConfig?.reimbursableExpensesAccount?.name ?? translate('workspace.qbo.notConfigured'),
title: qboConfig?.reimbursableExpensesAccount?.name,
description: accountDescription,
onPress: () => {
if (!policyID) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ function XeroAdvancedPage({policy}: WithPolicyConnectionsProps) {
}

const selectedAccount = (bankAccounts ?? []).find((bank) => bank.id === accountID);
return selectedAccount?.name ?? translate('workspace.xero.notConfigured');
return selectedAccount?.name;
},
[bankAccounts, translate],
[bankAccounts],
);

const selectedBankAccountName = getSelectedAccountName(invoiceCollectionsAccountID);
Expand Down Expand Up @@ -101,7 +101,7 @@ function XeroAdvancedPage({policy}: WithPolicyConnectionsProps) {
<OfflineWithFeedback pendingAction={settingsPendingAction([CONST.XERO_CONFIG.REIMBURSEMENT_ACCOUNT_ID], pendingFields)}>
<MenuItemWithTopDescription
shouldShowRightIcon
title={String(selectedBillPaymentAccountName)}
title={selectedBillPaymentAccountName ? String(selectedBillPaymentAccountName) : undefined}
description={translate('workspace.xero.advancedConfig.xeroBillPaymentAccount')}
key={translate('workspace.xero.advancedConfig.xeroBillPaymentAccount')}
wrapperStyle={[styles.sectionMenuItemTopDescription]}
Expand All @@ -112,7 +112,7 @@ function XeroAdvancedPage({policy}: WithPolicyConnectionsProps) {
<OfflineWithFeedback pendingAction={settingsPendingAction([CONST.XERO_CONFIG.INVOICE_COLLECTIONS_ACCOUNT_ID], pendingFields)}>
<MenuItemWithTopDescription
shouldShowRightIcon
title={String(selectedBankAccountName)}
title={selectedBankAccountName ? String(selectedBankAccountName) : undefined}
description={translate('workspace.xero.advancedConfig.xeroInvoiceCollectionAccount')}
key={translate('workspace.xero.advancedConfig.xeroInvoiceCollectionAccount')}
wrapperStyle={[styles.sectionMenuItemTopDescription]}
Expand Down
Loading