From 9907ba5ad35dad0fe951197dbac2473e835abdfe Mon Sep 17 00:00:00 2001 From: war-in Date: Tue, 30 Jul 2024 14:37:21 +0200 Subject: [PATCH 01/38] fix error placement in subsidiary selection --- .../netsuite/NetSuiteSubsidiarySelector.tsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteSubsidiarySelector.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteSubsidiarySelector.tsx index 21a3cadb95fb..8131fdc75e3c 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteSubsidiarySelector.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteSubsidiarySelector.tsx @@ -1,7 +1,7 @@ import React, {useMemo} from 'react'; +import {View} from 'react-native'; import BlockingView from '@components/BlockingViews/BlockingView'; import * as Illustrations from '@components/Icon/Illustrations'; -import OfflineWithFeedback from '@components/OfflineWithFeedback'; import RadioListItem from '@components/SelectionList/RadioListItem'; import SelectionScreen from '@components/SelectionScreen'; import type {SelectorType} from '@components/SelectionScreen'; @@ -11,6 +11,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {updateNetSuiteSubsidiary} from '@libs/actions/connections/NetSuiteCommands'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import {xeroSettingsPendingAction} from '@libs/PolicyUtils'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import variables from '@styles/variables'; @@ -70,15 +71,11 @@ function NetSuiteSubsidiarySelector({policy}: WithPolicyConnectionsProps) { const listHeaderComponent = useMemo( () => ( - Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SUBSIDIARY)} - > - {translate('workspace.netsuite.subsidiarySelectDescription')} - + + {translate('workspace.netsuite.subsidiarySelectDescription')} + ), - [netsuiteConfig, styles.ph5, styles.mt2, styles.pb5, styles.mb4, translate, policyID], + [styles.pb2, styles.ph5, styles.textNormal, translate], ); return ( @@ -96,6 +93,10 @@ function NetSuiteSubsidiarySelector({policy}: WithPolicyConnectionsProps) { onBackButtonPress={() => Navigation.goBack()} title="workspace.netsuite.subsidiary" listEmptyContent={listEmptyContent} + pendingAction={xeroSettingsPendingAction([CONST.NETSUITE_CONFIG.SUBSIDIARY], netsuiteConfig?.pendingFields)} + errors={ErrorUtils.getLatestErrorField(netsuiteConfig ?? {}, CONST.NETSUITE_CONFIG.SUBSIDIARY)} + errorRowStyles={[styles.ph5, styles.pv3]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SUBSIDIARY)} /> ); } From 3135e77b091f9a343583e04f55d5010e214b86d5 Mon Sep 17 00:00:00 2001 From: war-in Date: Tue, 30 Jul 2024 14:51:19 +0200 Subject: [PATCH 02/38] fix error in mappings --- .../netsuite/import/NetSuiteImportMappingPage.tsx | 7 +++++++ .../accounting/netsuite/import/NetSuiteImportPage.tsx | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportMappingPage.tsx b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportMappingPage.tsx index 073fe63f4c10..6330f635d627 100644 --- a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportMappingPage.tsx +++ b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportMappingPage.tsx @@ -9,10 +9,13 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import {updateNetSuiteImportMapping} from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import Parser from '@libs/Parser'; +import {xeroSettingsPendingAction} from '@libs/PolicyUtils'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import ROUTES from '@src/ROUTES'; @@ -105,6 +108,10 @@ function NetSuiteImportMappingPage({ onBackButtonPress={() => Navigation.goBack(ROUTES.POLICY_ACCOUNTING_NETSUITE_IMPORT.getRoute(policyID))} title={titleKey} listFooterContent={listFooterContent} + pendingAction={xeroSettingsPendingAction([importField], netsuiteConfig?.syncOptions?.mapping?.pendingFields)} + errors={ErrorUtils.getLatestErrorField(netsuiteConfig ?? {}, importField)} + errorRowStyles={[styles.ph5]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, importField)} /> ); } diff --git a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportPage.tsx b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportPage.tsx index c3d77b656b50..97aa72d37251 100644 --- a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportPage.tsx +++ b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportPage.tsx @@ -53,10 +53,7 @@ function NetSuiteImportPage({policy}: WithPolicyConnectionsProps) { {CONST.NETSUITE_CONFIG.IMPORT_FIELDS.map((importField) => ( Policy.clearNetSuiteErrorField(policyID, importField)} > Date: Tue, 30 Jul 2024 15:22:51 +0200 Subject: [PATCH 03/38] fix error in mappings --- ...uiteImportCustomersOrProjectSelectPage.tsx | 18 ++++++++++++++ .../NetSuiteImportCustomersOrProjectsPage.tsx | 24 ++++++++++--------- .../netsuite/import/NetSuiteImportPage.tsx | 17 ++++++------- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomersOrProjectSelectPage.tsx b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomersOrProjectSelectPage.tsx index dba0c516cf4a..61788e9407cc 100644 --- a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomersOrProjectSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomersOrProjectSelectPage.tsx @@ -3,10 +3,14 @@ import RadioListItem from '@components/SelectionList/RadioListItem'; import type {SelectorType} from '@components/SelectionScreen'; import SelectionScreen from '@components/SelectionScreen'; import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; import {updateNetSuiteCustomersJobsMapping} from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import {xeroSettingsPendingAction} from '@libs/PolicyUtils'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type {NetSuiteMappingValues} from '@src/types/onyx/Policy'; @@ -18,6 +22,7 @@ type ImportListItem = SelectorType & { function NetSuiteImportCustomersOrProjectSelectPage({policy}: WithPolicyConnectionsProps) { const policyID = policy?.id ?? '-1'; const {translate} = useLocalize(); + const styles = useThemeStyles(); const netsuiteConfig = policy?.connections?.netsuite?.options?.config; const importMappings = netsuiteConfig?.syncOptions?.mapping; @@ -69,6 +74,19 @@ function NetSuiteImportCustomersOrProjectSelectPage({policy}: WithPolicyConnecti initiallyFocusedOptionKey={inputSectionData.find((inputOption) => inputOption.isSelected)?.keyForList} onBackButtonPress={() => Navigation.goBack(ROUTES.POLICY_ACCOUNTING_NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS.getRoute(policyID))} title="workspace.common.displayedAs" + errors={ + ErrorUtils.getLatestErrorField(netsuiteConfig ?? {}, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.CUSTOMER_MAPPINGS.CUSTOMERS) ?? + ErrorUtils.getLatestErrorField(netsuiteConfig ?? {}, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.CUSTOMER_MAPPINGS.JOBS) + } + errorRowStyles={[styles.ph5, styles.pv3]} + pendingAction={xeroSettingsPendingAction( + [CONST.NETSUITE_CONFIG.SYNC_OPTIONS.CUSTOMER_MAPPINGS.CUSTOMERS, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.CUSTOMER_MAPPINGS.JOBS], + netsuiteConfig?.syncOptions?.mapping?.pendingFields, + )} + onClose={() => { + Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.CUSTOMER_MAPPINGS.CUSTOMERS); + Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.CUSTOMER_MAPPINGS.JOBS); + }} /> ); } diff --git a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomersOrProjectsPage.tsx b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomersOrProjectsPage.tsx index cb9436fa082c..802a2dc360e0 100644 --- a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomersOrProjectsPage.tsx +++ b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomersOrProjectsPage.tsx @@ -10,6 +10,7 @@ import {updateNetSuiteCrossSubsidiaryCustomersConfiguration, updateNetSuiteImpor import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import Parser from '@libs/Parser'; +import {areXeroSettingsInErrorFields, xeroSettingsPendingAction} from '@libs/PolicyUtils'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import ToggleSettingOptionRow from '@pages/workspace/workflows/ToggleSettingsOptionRow'; @@ -110,16 +111,10 @@ function NetSuiteImportCustomersOrProjectsPage({policy}: WithPolicyConnectionsPr {importedValue !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NETSUITE_DEFAULT && ( { - Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.CUSTOMER_MAPPINGS.CUSTOMERS); - Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.CUSTOMER_MAPPINGS.JOBS); - }} + pendingAction={xeroSettingsPendingAction( + [CONST.NETSUITE_CONFIG.SYNC_OPTIONS.CUSTOMER_MAPPINGS.CUSTOMERS, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.CUSTOMER_MAPPINGS.JOBS], + config?.syncOptions?.mapping?.pendingFields, + )} > { Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS_SELECT.getRoute(policyID)); }} - brickRoadIndicator={!!config?.errorFields?.customers || !!config?.errorFields?.jobs ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} + brickRoadIndicator={ + areXeroSettingsInErrorFields( + [CONST.NETSUITE_CONFIG.SYNC_OPTIONS.CUSTOMER_MAPPINGS.CUSTOMERS, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.CUSTOMER_MAPPINGS.JOBS], + config?.errorFields, + ) + ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR + : undefined + } /> )} diff --git a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportPage.tsx b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportPage.tsx index 97aa72d37251..156a26b5ae78 100644 --- a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportPage.tsx +++ b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportPage.tsx @@ -9,7 +9,7 @@ import {updateNetSuiteSyncTaxConfiguration} from '@libs/actions/connections/NetS import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as PolicyUtils from '@libs/PolicyUtils'; -import {canUseTaxNetSuite} from '@libs/PolicyUtils'; +import {canUseTaxNetSuite, xeroSettingsPendingAction} from '@libs/PolicyUtils'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import ToggleSettingOptionRow from '@pages/workspace/workflows/ToggleSettingsOptionRow'; @@ -68,16 +68,13 @@ function NetSuiteImportPage({policy}: WithPolicyConnectionsProps) { ))} { - Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.CUSTOMER_MAPPINGS.CUSTOMERS); - Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.CUSTOMER_MAPPINGS.JOBS); - }} > Date: Tue, 30 Jul 2024 15:41:11 +0200 Subject: [PATCH 04/38] fix errors in import page --- .../accounting/netsuite/import/NetSuiteImportPage.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportPage.tsx b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportPage.tsx index 156a26b5ae78..b350723700fb 100644 --- a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportPage.tsx +++ b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportPage.tsx @@ -108,9 +108,7 @@ function NetSuiteImportPage({policy}: WithPolicyConnectionsProps) { {Object.values(CONST.NETSUITE_CONFIG.IMPORT_CUSTOM_FIELDS).map((importField) => ( Policy.clearNetSuiteErrorField(policyID, importField)} + pendingAction={xeroSettingsPendingAction([importField], config?.syncOptions?.pendingFields)} > Date: Tue, 30 Jul 2024 17:53:42 +0200 Subject: [PATCH 05/38] update export page --- .../export/NetSuiteDateSelectPage.tsx | 7 ++ .../NetSuiteExportConfigurationPage.tsx | 79 +++++++------------ ...iteExportExpensesDestinationSelectPage.tsx | 12 ++- ...nsesJournalPostingPreferenceSelectPage.tsx | 9 +++ .../export/NetSuiteExportExpensesPage.tsx | 12 +-- ...ExportExpensesPayableAccountSelectPage.tsx | 11 ++- ...NetSuiteExportExpensesVendorSelectPage.tsx | 8 +- .../NetSuitePreferredExporterSelectPage.tsx | 8 +- 8 files changed, 78 insertions(+), 68 deletions(-) diff --git a/src/pages/workspace/accounting/netsuite/export/NetSuiteDateSelectPage.tsx b/src/pages/workspace/accounting/netsuite/export/NetSuiteDateSelectPage.tsx index 42d014ed4299..2fd77c7b4fc8 100644 --- a/src/pages/workspace/accounting/netsuite/export/NetSuiteDateSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteDateSelectPage.tsx @@ -9,9 +9,12 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; +import {xeroSettingsPendingAction} from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -66,6 +69,10 @@ function NetSuiteDateSelectPage({policy}: WithPolicyConnectionsProps) { featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED} onBackButtonPress={() => Navigation.goBack(ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT.getRoute(policyID))} connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} + pendingAction={xeroSettingsPendingAction([CONST.NETSUITE_CONFIG.EXPORT_DATE], config?.pendingFields)} + errors={ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.EXPORT_DATE)} + errorRowStyles={[styles.ph5, styles.pv3]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.EXPORT_DATE)} /> ); } diff --git a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx index 648ec7d77a64..a2ef8c96d631 100644 --- a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx @@ -10,11 +10,13 @@ import * as Connections from '@libs/actions/connections/NetSuiteCommands'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import { + areXeroSettingsInErrorFields, canUseProvincialTaxNetSuite, canUseTaxNetSuite, findSelectedBankAccountWithDefaultSelect, findSelectedInvoiceItemWithDefaultSelect, findSelectedTaxAccountWithDefaultSelect, + xeroSettingsPendingAction, } from '@libs/PolicyUtils'; import type {DividerLineItem, MenuItem, ToggleItem} from '@pages/workspace/accounting/netsuite/types'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; @@ -24,6 +26,8 @@ import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; +type MenuItemWithSubscribedSettings = Pick & {subscribedSettings?: string[]}; + function NetSuiteExportConfigurationPage({policy}: WithPolicyConnectionsProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); @@ -60,18 +64,15 @@ function NetSuiteExportConfigurationPage({policy}: WithPolicyConnectionsProps) { [taxAccountsList, config?.provincialTaxPostingAccount], ); - const menuItems: Array = [ + const menuItems: Array = [ { type: 'menuitem', + title: config?.exporter ?? policyOwner, description: translate('workspace.accounting.preferredExporter'), onPress: () => { Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_PREFERRED_EXPORTER_SELECT.getRoute(policyID)); }, - brickRoadIndicator: config?.errorFields?.exporter ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, - title: config?.exporter ?? policyOwner, - pendingAction: config?.pendingFields?.exporter, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.EXPORTER), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.EXPORTER), + subscribedSettings: [CONST.NETSUITE_CONFIG.EXPORTER], }, { type: 'divider', @@ -79,37 +80,28 @@ function NetSuiteExportConfigurationPage({policy}: WithPolicyConnectionsProps) { }, { type: 'menuitem', - description: translate('workspace.accounting.exportDate'), - onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_DATE_SELECT.getRoute(policyID)), - brickRoadIndicator: config?.errorFields?.exportDate ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: config?.exportDate ? translate(`workspace.netsuite.exportDate.values.${config.exportDate}.label`) : translate(`workspace.netsuite.exportDate.values.${CONST.NETSUITE_EXPORT_DATE.LAST_EXPENSE}.label`), - pendingAction: config?.pendingFields?.exportDate, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.EXPORT_DATE), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.EXPORT_DATE), + description: translate('workspace.accounting.exportDate'), + onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_DATE_SELECT.getRoute(policyID)), + subscribedSettings: [CONST.NETSUITE_CONFIG.EXPORT_DATE], }, { type: 'menuitem', + title: config?.reimbursableExpensesExportDestination ? translate(`workspace.netsuite.exportDestination.values.${config.reimbursableExpensesExportDestination}.label`) : undefined, description: translate('workspace.accounting.exportOutOfPocket'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT_EXPENSES.getRoute(policyID, CONST.NETSUITE_EXPENSE_TYPE.REIMBURSABLE)), - brickRoadIndicator: config?.errorFields?.reimbursableExpensesExportDestination ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, - title: config?.reimbursableExpensesExportDestination ? translate(`workspace.netsuite.exportDestination.values.${config.reimbursableExpensesExportDestination}.label`) : undefined, - pendingAction: config?.pendingFields?.reimbursableExpensesExportDestination, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.REIMBURSABLE_EXPENSES_EXPORT_DESTINATION), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.REIMBURSABLE_EXPENSES_EXPORT_DESTINATION), + subscribedSettings: [CONST.NETSUITE_CONFIG.REIMBURSABLE_EXPENSES_EXPORT_DESTINATION], }, { type: 'menuitem', - description: translate('workspace.accounting.exportCompanyCard'), - onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT_EXPENSES.getRoute(policyID, CONST.NETSUITE_EXPENSE_TYPE.NON_REIMBURSABLE)), - brickRoadIndicator: config?.errorFields?.nonreimbursableExpensesExportDestination ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: config?.nonreimbursableExpensesExportDestination ? translate(`workspace.netsuite.exportDestination.values.${config.nonreimbursableExpensesExportDestination}.label`) : undefined, - pendingAction: config?.pendingFields?.nonreimbursableExpensesExportDestination, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.NON_REIMBURSABLE_EXPENSES_EXPORT_DESTINATION), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.NON_REIMBURSABLE_EXPENSES_EXPORT_DESTINATION), + description: translate('workspace.accounting.exportCompanyCard'), + onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT_EXPENSES.getRoute(policyID, CONST.NETSUITE_EXPENSE_TYPE.NON_REIMBURSABLE)), + subscribedSettings: [CONST.NETSUITE_CONFIG.NON_REIMBURSABLE_EXPENSES_EXPORT_DESTINATION], }, { type: 'divider', @@ -117,23 +109,17 @@ function NetSuiteExportConfigurationPage({policy}: WithPolicyConnectionsProps) { }, { type: 'menuitem', + title: selectedReceivable ? selectedReceivable.name : undefined, description: translate('workspace.netsuite.exportInvoices'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_RECEIVABLE_ACCOUNT_SELECT.getRoute(policyID)), - brickRoadIndicator: config?.errorFields?.receivableAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, - title: selectedReceivable ? selectedReceivable.name : undefined, - pendingAction: config?.pendingFields?.receivableAccount, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.RECEIVABLE_ACCOUNT), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.RECEIVABLE_ACCOUNT), + subscribedSettings: [CONST.NETSUITE_CONFIG.RECEIVABLE_ACCOUNT], }, { type: 'menuitem', + title: invoiceItemValue, description: translate('workspace.netsuite.invoiceItem.label'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_INVOICE_ITEM_PREFERENCE_SELECT.getRoute(policyID)), - brickRoadIndicator: config?.errorFields?.invoiceItemPreference ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, - title: invoiceItemValue, - pendingAction: config?.pendingFields?.invoiceItemPreference, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.INVOICE_ITEM_PREFERENCE), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.INVOICE_ITEM_PREFERENCE), + subscribedSettings: [CONST.NETSUITE_CONFIG.INVOICE_ITEM_PREFERENCE], }, { type: 'divider', @@ -141,24 +127,18 @@ function NetSuiteExportConfigurationPage({policy}: WithPolicyConnectionsProps) { }, { type: 'menuitem', + title: selectedProvTaxPostingAccount ? selectedProvTaxPostingAccount.name : undefined, description: translate('workspace.netsuite.journalEntriesProvTaxPostingAccount'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_PROVINCIAL_TAX_POSTING_ACCOUNT_SELECT.getRoute(policyID)), - brickRoadIndicator: config?.errorFields?.provincialTaxPostingAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, - title: selectedProvTaxPostingAccount ? selectedProvTaxPostingAccount.name : undefined, - pendingAction: config?.pendingFields?.provincialTaxPostingAccount, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.PROVINCIAL_TAX_POSTING_ACCOUNT), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.PROVINCIAL_TAX_POSTING_ACCOUNT), + subscribedSettings: [CONST.NETSUITE_CONFIG.PROVINCIAL_TAX_POSTING_ACCOUNT], shouldHide: !!config?.suiteTaxEnabled || !config?.syncOptions.syncTax || !canUseProvincialTaxNetSuite(selectedSubsidiary?.country), }, { type: 'menuitem', + title: selectedTaxPostingAccount ? selectedTaxPostingAccount.name : undefined, description: translate('workspace.netsuite.journalEntriesTaxPostingAccount'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_TAX_POSTING_ACCOUNT_SELECT.getRoute(policyID)), - brickRoadIndicator: config?.errorFields?.taxPostingAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, - title: selectedTaxPostingAccount ? selectedTaxPostingAccount.name : undefined, - pendingAction: config?.pendingFields?.taxPostingAccount, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.TAX_POSTING_ACCOUNT), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.TAX_POSTING_ACCOUNT), + subscribedSettings: [CONST.NETSUITE_CONFIG.TAX_POSTING_ACCOUNT], shouldHide: !!config?.suiteTaxEnabled || !config?.syncOptions.syncTax || !canUseTaxNetSuite(canUseNetSuiteUSATax, selectedSubsidiary?.country), }, { @@ -168,7 +148,7 @@ function NetSuiteExportConfigurationPage({policy}: WithPolicyConnectionsProps) { switchAccessibilityLabel: translate('workspace.netsuite.foreignCurrencyAmount'), onToggle: () => Connections.updateNetSuiteAllowForeignCurrency(policyID, !config?.allowForeignCurrency, config?.allowForeignCurrency), onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.ALLOW_FOREIGN_CURRENCY), - pendingAction: config?.pendingFields?.allowForeignCurrency, + pendingAction: xeroSettingsPendingAction([CONST.NETSUITE_CONFIG.ALLOW_FOREIGN_CURRENCY], config?.pendingFields), errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.ALLOW_FOREIGN_CURRENCY), shouldHide: config?.reimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT && @@ -181,7 +161,7 @@ function NetSuiteExportConfigurationPage({policy}: WithPolicyConnectionsProps) { switchAccessibilityLabel: translate('workspace.netsuite.exportToNextOpenPeriod'), onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.EXPORT_TO_NEXT_OPEN_PERIOD), onToggle: () => Connections.updateNetSuiteExportToNextOpenPeriod(policyID, !config?.exportToNextOpenPeriod, config?.exportToNextOpenPeriod ?? false), - pendingAction: config?.pendingFields?.exportToNextOpenPeriod, + pendingAction: xeroSettingsPendingAction([CONST.NETSUITE_CONFIG.EXPORT_TO_NEXT_OPEN_PERIOD], config?.pendingFields), errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.EXPORT_TO_NEXT_OPEN_PERIOD), }, ]; @@ -225,19 +205,14 @@ function NetSuiteExportConfigurationPage({policy}: WithPolicyConnectionsProps) { return ( ); diff --git a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesDestinationSelectPage.tsx b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesDestinationSelectPage.tsx index 535951a51f87..05ac66ffde52 100644 --- a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesDestinationSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesDestinationSelectPage.tsx @@ -6,11 +6,15 @@ import type {ListItem} from '@components/SelectionList/types'; import SelectionScreen from '@components/SelectionScreen'; import type {SelectorType} from '@components/SelectionScreen'; import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; +import {xeroSettingsPendingAction} from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {ExpenseRouteParams} from '@pages/workspace/accounting/netsuite/types'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -20,6 +24,7 @@ type MenuListItem = ListItem & { function NetSuiteExportExpensesDestinationSelectPage({policy}: WithPolicyConnectionsProps) { const {translate} = useLocalize(); + const styles = useThemeStyles(); const policyID = policy?.id ?? '-1'; const config = policy?.connections?.netsuite.options.config; @@ -27,7 +32,8 @@ function NetSuiteExportExpensesDestinationSelectPage({policy}: WithPolicyConnect const params = route.params as ExpenseRouteParams; const isReimbursable = params.expenseType === CONST.NETSUITE_EXPENSE_TYPE.REIMBURSABLE; - const currentDestination = isReimbursable ? config?.reimbursableExpensesExportDestination : config?.nonreimbursableExpensesExportDestination; + const currentSettingName = isReimbursable ? CONST.NETSUITE_CONFIG.REIMBURSABLE_EXPENSES_EXPORT_DESTINATION : CONST.NETSUITE_CONFIG.NON_REIMBURSABLE_EXPENSES_EXPORT_DESTINATION; + const currentDestination = config?.[currentSettingName]; const data: MenuListItem[] = Object.values(CONST.NETSUITE_EXPORT_DESTINATION).map((dateType) => ({ value: dateType, @@ -63,6 +69,10 @@ function NetSuiteExportExpensesDestinationSelectPage({policy}: WithPolicyConnect featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED} onBackButtonPress={() => Navigation.goBack(ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT_EXPENSES.getRoute(policyID, params.expenseType))} connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} + pendingAction={xeroSettingsPendingAction([currentSettingName], config?.pendingFields)} + errors={ErrorUtils.getLatestErrorField(config, currentSettingName)} + errorRowStyles={[styles.ph5, styles.pv3]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, currentSettingName)} /> ); } diff --git a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesJournalPostingPreferenceSelectPage.tsx b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesJournalPostingPreferenceSelectPage.tsx index 544cd0cc20cd..059fe570a763 100644 --- a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesJournalPostingPreferenceSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesJournalPostingPreferenceSelectPage.tsx @@ -6,11 +6,15 @@ import type {ListItem} from '@components/SelectionList/types'; import SelectionScreen from '@components/SelectionScreen'; import type {SelectorType} from '@components/SelectionScreen'; import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; +import {xeroSettingsPendingAction} from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {ExpenseRouteParams} from '@pages/workspace/accounting/netsuite/types'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -20,6 +24,7 @@ type MenuListItem = ListItem & { function NetSuiteExportExpensesJournalPostingPreferenceSelectPage({policy}: WithPolicyConnectionsProps) { const {translate} = useLocalize(); + const styles = useThemeStyles(); const policyID = policy?.id ?? '-1'; const config = policy?.connections?.netsuite.options.config; @@ -66,6 +71,10 @@ function NetSuiteExportExpensesJournalPostingPreferenceSelectPage({policy}: With ? config?.reimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY : config?.nonreimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY } + pendingAction={xeroSettingsPendingAction([CONST.NETSUITE_CONFIG.JOURNAL_POSTING_PREFERENCE], config?.pendingFields)} + errors={ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.JOURNAL_POSTING_PREFERENCE)} + errorRowStyles={[styles.ph5, styles.pv3]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.JOURNAL_POSTING_PREFERENCE)} /> ); } diff --git a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesPage.tsx b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesPage.tsx index c3ffe000e1e5..601ad3a59dae 100644 --- a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesPage.tsx +++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesPage.tsx @@ -5,7 +5,6 @@ import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; import OfflineWithFeedback from '@components/OfflineWithFeedback'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import {findSelectedBankAccountWithDefaultSelect, findSelectedVendorWithDefaultSelect} from '@libs/PolicyUtils'; import type {ExpenseRouteParams, MenuItem} from '@pages/workspace/accounting/netsuite/types'; @@ -15,7 +14,7 @@ import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; -type MenuItemWithoutType = Omit; +type MenuItemWithoutType = Omit; function NetSuiteExportExpensesPage({policy}: WithPolicyConnectionsProps) { const {translate} = useLocalize(); @@ -51,7 +50,6 @@ function NetSuiteExportExpensesPage({policy}: WithPolicyConnectionsProps) { brickRoadIndicator: exportDestinationError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportDestination ? translate(`workspace.netsuite.exportDestination.values.${exportDestination}.label`) : undefined, pendingAction: exportDestinationPending, - errors: ErrorUtils.getLatestErrorField(config, configType), onCloseError: () => Policy.clearNetSuiteErrorField(policyID, configType), helperText: exportDestination ? translate(`workspace.netsuite.exportDestination.values.${exportDestination}.${helperTextType}`) : undefined, shouldParseHelperText: true, @@ -62,7 +60,6 @@ function NetSuiteExportExpensesPage({policy}: WithPolicyConnectionsProps) { brickRoadIndicator: config?.errorFields?.defaultVendor ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: defaultVendor ? defaultVendor.name : undefined, pendingAction: config?.pendingFields?.defaultVendor, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.DEFAULT_VENDOR), onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.DEFAULT_VENDOR), shouldHide: isReimbursable || exportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILL, }, @@ -72,7 +69,6 @@ function NetSuiteExportExpensesPage({policy}: WithPolicyConnectionsProps) { brickRoadIndicator: config?.errorFields?.payableAcct ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: selectedPayableAccount ? selectedPayableAccount.name : undefined, pendingAction: config?.pendingFields?.payableAcct, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.PAYABLE_ACCT), onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.PAYABLE_ACCT), shouldHide: isReimbursable || exportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY, }, @@ -82,7 +78,6 @@ function NetSuiteExportExpensesPage({policy}: WithPolicyConnectionsProps) { brickRoadIndicator: config?.errorFields?.reimbursablePayableAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: selectedReimbursablePayableAccount ? selectedReimbursablePayableAccount.name : undefined, pendingAction: config?.pendingFields?.reimbursablePayableAccount, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.REIMBURSABLE_PAYABLE_ACCOUNT), onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.REIMBURSABLE_PAYABLE_ACCOUNT), shouldHide: !isReimbursable || exportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY, }, @@ -94,7 +89,6 @@ function NetSuiteExportExpensesPage({policy}: WithPolicyConnectionsProps) { ? translate(`workspace.netsuite.journalPostingPreference.values.${config.journalPostingPreference}`) : translate(`workspace.netsuite.journalPostingPreference.values.${CONST.NETSUITE_JOURNAL_POSTING_PREFERENCE.JOURNALS_POSTING_INDIVIDUAL_LINE}`), pendingAction: config?.pendingFields?.journalPostingPreference, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.JOURNAL_POSTING_PREFERENCE), onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.JOURNAL_POSTING_PREFERENCE), shouldHide: exportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY, }, @@ -118,9 +112,6 @@ function NetSuiteExportExpensesPage({policy}: WithPolicyConnectionsProps) { diff --git a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesPayableAccountSelectPage.tsx b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesPayableAccountSelectPage.tsx index 0461171920d4..14bb5f2c71a0 100644 --- a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesPayableAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesPayableAccountSelectPage.tsx @@ -8,12 +8,14 @@ import SelectionScreen from '@components/SelectionScreen'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; -import {getNetSuitePayableAccountOptions} from '@libs/PolicyUtils'; +import {getNetSuitePayableAccountOptions, xeroSettingsPendingAction} from '@libs/PolicyUtils'; import type {ExpenseRouteParams} from '@pages/workspace/accounting/netsuite/types'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import variables from '@styles/variables'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -28,7 +30,8 @@ function NetSuiteExportExpensesPayableAccountSelectPage({policy}: WithPolicyConn const isReimbursable = params.expenseType === CONST.NETSUITE_EXPENSE_TYPE.REIMBURSABLE; const config = policy?.connections?.netsuite.options.config; - const currentPayableAccountID = isReimbursable ? config?.reimbursablePayableAccount : config?.payableAcct; + const currentSettingName = isReimbursable ? CONST.NETSUITE_CONFIG.REIMBURSABLE_PAYABLE_ACCOUNT : CONST.NETSUITE_CONFIG.PAYABLE_ACCT; + const currentPayableAccountID = config?.[currentSettingName]; const netsuitePayableAccountOptions = useMemo(() => getNetSuitePayableAccountOptions(policy ?? undefined, currentPayableAccountID), [currentPayableAccountID, policy]); const initiallyFocusedOptionKey = useMemo(() => netsuitePayableAccountOptions?.find((mode) => mode.isSelected)?.keyForList, [netsuitePayableAccountOptions]); @@ -80,6 +83,10 @@ function NetSuiteExportExpensesPayableAccountSelectPage({policy}: WithPolicyConn ? config?.reimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY : config?.nonreimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY } + pendingAction={xeroSettingsPendingAction([currentSettingName], config?.pendingFields)} + errors={ErrorUtils.getLatestErrorField(config, currentSettingName)} + errorRowStyles={[styles.ph5, styles.pv3]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, currentSettingName)} /> ); } diff --git a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesVendorSelectPage.tsx b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesVendorSelectPage.tsx index b6034a29a949..cc40002c9307 100644 --- a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesVendorSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportExpensesVendorSelectPage.tsx @@ -8,12 +8,14 @@ import SelectionScreen from '@components/SelectionScreen'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; -import {getNetSuiteVendorOptions} from '@libs/PolicyUtils'; +import {getNetSuiteVendorOptions, xeroSettingsPendingAction} from '@libs/PolicyUtils'; import type {ExpenseRouteParams} from '@pages/workspace/accounting/netsuite/types'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import variables from '@styles/variables'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -71,6 +73,10 @@ function NetSuiteExportExpensesVendorSelectPage({policy}: WithPolicyConnectionsP listEmptyContent={listEmptyContent} connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} shouldBeBlocked={isReimbursable || config?.nonreimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILL} + pendingAction={xeroSettingsPendingAction([CONST.NETSUITE_CONFIG.DEFAULT_VENDOR], config?.pendingFields)} + errors={ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.DEFAULT_VENDOR)} + errorRowStyles={[styles.ph5, styles.pv3]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.DEFAULT_VENDOR)} /> ); } diff --git a/src/pages/workspace/accounting/netsuite/export/NetSuitePreferredExporterSelectPage.tsx b/src/pages/workspace/accounting/netsuite/export/NetSuitePreferredExporterSelectPage.tsx index fb2fb3521ee7..31b98a00b1da 100644 --- a/src/pages/workspace/accounting/netsuite/export/NetSuitePreferredExporterSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/export/NetSuitePreferredExporterSelectPage.tsx @@ -9,10 +9,12 @@ import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; -import {getAdminEmployees, isExpensifyTeam} from '@libs/PolicyUtils'; +import * as ErrorUtils from '@libs/ErrorUtils'; +import {getAdminEmployees, isExpensifyTeam, xeroSettingsPendingAction} from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -95,6 +97,10 @@ function NetSuitePreferredExporterSelectPage({policy}: WithPolicyConnectionsProp onBackButtonPress={() => Navigation.goBack(ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT.getRoute(policyID))} title="workspace.accounting.preferredExporter" connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} + pendingAction={xeroSettingsPendingAction([CONST.NETSUITE_CONFIG.EXPORTER], config?.pendingFields)} + errors={ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.EXPORTER)} + errorRowStyles={[styles.ph5, styles.pv3]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.EXPORTER)} /> ); } From d11260058a19f43f3c72371608bb9a298dd8cbf2 Mon Sep 17 00:00:00 2001 From: war-in Date: Tue, 30 Jul 2024 18:30:34 +0200 Subject: [PATCH 06/38] update invoice config pages --- ...etSuiteInvoiceItemPreferenceSelectPage.tsx | 65 ++++++++++--------- .../export/NetSuiteInvoiceItemSelectPage.tsx | 8 ++- .../NetSuiteReceivableAccountSelectPage.tsx | 8 ++- 3 files changed, 48 insertions(+), 33 deletions(-) diff --git a/src/pages/workspace/accounting/netsuite/export/NetSuiteInvoiceItemPreferenceSelectPage.tsx b/src/pages/workspace/accounting/netsuite/export/NetSuiteInvoiceItemPreferenceSelectPage.tsx index fe8e9b7e4d70..27bdb67fdade 100644 --- a/src/pages/workspace/accounting/netsuite/export/NetSuiteInvoiceItemPreferenceSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteInvoiceItemPreferenceSelectPage.tsx @@ -1,13 +1,13 @@ import React, {useCallback, useMemo} from 'react'; import {View} from 'react-native'; import type {ValueOf} from 'type-fest'; +import ConnectionLayout from '@components/ConnectionLayout'; import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; import OfflineWithFeedback from '@components/OfflineWithFeedback'; +import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; import type {ListItem} from '@components/SelectionList/types'; -import SelectionScreen from '@components/SelectionScreen'; import type {SelectorType} from '@components/SelectionScreen'; -import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; @@ -54,39 +54,42 @@ function NetSuiteInvoiceItemPreferenceSelectPage({policy}: WithPolicyConnections [config?.invoiceItemPreference, policyID], ); - const headerContent = useMemo( - () => ( - - - {translate(`workspace.netsuite.invoiceItem.values.${config?.invoiceItemPreference ?? CONST.NETSUITE_INVOICE_ITEM_PREFERENCE.CREATE}.description`)} - - - ), - [styles.pb2, styles.ph5, styles.textNormal, translate, config?.invoiceItemPreference], - ); - return ( - selectInvoicePreference(selection as MenuListItem)} - initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - policyID={policyID} + Navigation.goBack(ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT.getRoute(policyID))} accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]} featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED} - onBackButtonPress={() => Navigation.goBack(ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT.getRoute(policyID))} + displayName={NetSuiteInvoiceItemPreferenceSelectPage.displayName} + policyID={policyID} connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} - listFooterContent={ - config?.invoiceItemPreference === CONST.NETSUITE_INVOICE_ITEM_PREFERENCE.SELECT ? ( + shouldUseScrollView={false} + shouldIncludeSafeAreaPaddingBottom + > + Policy.clearSageIntacctErrorField(policyID, CONST.NETSUITE_CONFIG.INVOICE_ITEM_PREFERENCE)} + style={[styles.flexGrow1, styles.flexShrink1]} + contentContainerStyle={[styles.flexGrow1, styles.flexShrink1]} + > + selectInvoicePreference(selection as MenuListItem)} + sections={[{data}]} + ListItem={RadioListItem} + showScrollIndicator + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + containerStyle={[styles.flexReset, styles.flexGrow1, styles.flexShrink1, styles.pb0]} + /> + + {config?.invoiceItemPreference === CONST.NETSUITE_INVOICE_ITEM_PREFERENCE.SELECT && ( + Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.INVOICE_ITEM)} > - ) : null - } - /> + + )} + ); } diff --git a/src/pages/workspace/accounting/netsuite/export/NetSuiteInvoiceItemSelectPage.tsx b/src/pages/workspace/accounting/netsuite/export/NetSuiteInvoiceItemSelectPage.tsx index 26af047a3ef4..20974f0eea10 100644 --- a/src/pages/workspace/accounting/netsuite/export/NetSuiteInvoiceItemSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteInvoiceItemSelectPage.tsx @@ -7,11 +7,13 @@ import SelectionScreen from '@components/SelectionScreen'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; -import {getNetSuiteInvoiceItemOptions} from '@libs/PolicyUtils'; +import {getNetSuiteInvoiceItemOptions, xeroSettingsPendingAction} from '@libs/PolicyUtils'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import variables from '@styles/variables'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -65,6 +67,10 @@ function NetSuiteInvoiceItemSelectPage({policy}: WithPolicyConnectionsProps) { listEmptyContent={listEmptyContent} connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} shouldBeBlocked={config?.invoiceItemPreference !== CONST.NETSUITE_INVOICE_ITEM_PREFERENCE.SELECT} + pendingAction={xeroSettingsPendingAction([CONST.NETSUITE_CONFIG.INVOICE_ITEM], config?.pendingFields)} + errors={ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.INVOICE_ITEM)} + errorRowStyles={[styles.ph5, styles.pv3]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.INVOICE_ITEM)} /> ); } diff --git a/src/pages/workspace/accounting/netsuite/export/NetSuiteReceivableAccountSelectPage.tsx b/src/pages/workspace/accounting/netsuite/export/NetSuiteReceivableAccountSelectPage.tsx index 4c1e62d66674..cd04adb3c08d 100644 --- a/src/pages/workspace/accounting/netsuite/export/NetSuiteReceivableAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteReceivableAccountSelectPage.tsx @@ -7,11 +7,13 @@ import SelectionScreen from '@components/SelectionScreen'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; -import {getNetSuiteReceivableAccountOptions} from '@libs/PolicyUtils'; +import {getNetSuiteReceivableAccountOptions, xeroSettingsPendingAction} from '@libs/PolicyUtils'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import variables from '@styles/variables'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -67,6 +69,10 @@ function NetSuiteReceivableAccountSelectPage({policy}: WithPolicyConnectionsProp title="workspace.netsuite.exportInvoices" listEmptyContent={listEmptyContent} connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} + pendingAction={xeroSettingsPendingAction([CONST.NETSUITE_CONFIG.RECEIVABLE_ACCOUNT], config?.pendingFields)} + errors={ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.RECEIVABLE_ACCOUNT)} + errorRowStyles={[styles.ph5, styles.pv3]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.RECEIVABLE_ACCOUNT)} /> ); } From 9776986b99828b8fb6bc6c3d8ef7324cbce87a41 Mon Sep 17 00:00:00 2001 From: war-in Date: Wed, 31 Jul 2024 15:29:30 +0200 Subject: [PATCH 07/38] add errors in export -> tax posting account --- .../export/NetSuiteTaxPostingAccountSelectPage.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/netsuite/export/NetSuiteTaxPostingAccountSelectPage.tsx b/src/pages/workspace/accounting/netsuite/export/NetSuiteTaxPostingAccountSelectPage.tsx index f7b7295e3a3a..4781e76b63ee 100644 --- a/src/pages/workspace/accounting/netsuite/export/NetSuiteTaxPostingAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteTaxPostingAccountSelectPage.tsx @@ -8,11 +8,13 @@ import useLocalize from '@hooks/useLocalize'; import usePermissions from '@hooks/usePermissions'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; -import {canUseTaxNetSuite, getNetSuiteTaxAccountOptions} from '@libs/PolicyUtils'; +import {canUseTaxNetSuite, getNetSuiteTaxAccountOptions, xeroSettingsPendingAction} from '@libs/PolicyUtils'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import variables from '@styles/variables'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -73,6 +75,10 @@ function NetSuiteTaxPostingAccountSelectPage({policy}: WithPolicyConnectionsProp listEmptyContent={listEmptyContent} connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} shouldBeBlocked={!!config?.suiteTaxEnabled || !config?.syncOptions.syncTax || !canUseTaxNetSuite(canUseNetSuiteUSATax, selectedSubsidiary?.country)} + pendingAction={xeroSettingsPendingAction([CONST.NETSUITE_CONFIG.TAX_POSTING_ACCOUNT], config?.pendingFields)} + errors={ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.TAX_POSTING_ACCOUNT)} + errorRowStyles={[styles.ph5, styles.pv3]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.TAX_POSTING_ACCOUNT)} /> ); } From cf2d6022493f615f9d9050f568325aa0fe8fcbdc Mon Sep 17 00:00:00 2001 From: war-in Date: Wed, 31 Jul 2024 17:08:21 +0200 Subject: [PATCH 08/38] move sync options errors and pending fields to the top --- src/CONST.ts | 1 + .../actions/connections/NetSuiteCommands.ts | 74 +++--- .../advanced/NetSuiteAdvancedPage.tsx | 72 +++--- .../NetSuiteApprovalAccountSelectPage.tsx | 5 + .../NetSuiteCollectionAccountSelectPage.tsx | 6 + .../advanced/NetSuiteCustomFormIDPage.tsx | 31 ++- ...teExpenseReportApprovalLevelSelectPage.tsx | 5 + ...iteJournalEntryApprovalLevelSelectPage.tsx | 6 + ...NetSuiteReimbursementAccountSelectPage.tsx | 6 + ...SuiteVendorBillApprovalLevelSelectPage.tsx | 6 + .../import/NetSuiteImportCustomFieldEdit.tsx | 4 +- .../NetSuiteImportAddCustomListPage.tsx | 2 +- .../NetSuiteImportAddCustomSegmentPage.tsx | 2 +- .../import/NetSuiteImportCustomFieldPage.tsx | 4 +- .../import/NetSuiteImportCustomFieldView.tsx | 6 +- .../NetSuiteImportCustomersOrProjectsPage.tsx | 2 +- .../netsuite/import/NetSuiteImportPage.tsx | 6 +- src/types/onyx/Policy.ts | 216 +++++++++--------- 18 files changed, 252 insertions(+), 202 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 79eaea4e14a2..404dd114d8e7 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1483,6 +1483,7 @@ const CONST = { }, CUSTOM_SEGMENT_FIELDS: ['segmentName', 'internalID', 'scriptID', 'mapping'], CUSTOM_LIST_FIELDS: ['listName', 'internalID', 'transactionFieldID', 'mapping'], + CUSTOM_FORM_ID_ENABLED: 'enabled', CUSTOM_FORM_ID_TYPE: { REIMBURSABLE: 'reimbursable', NON_REIMBURSABLE: 'nonReimbursable', diff --git a/src/libs/actions/connections/NetSuiteCommands.ts b/src/libs/actions/connections/NetSuiteCommands.ts index 8be8d2cb077a..c850d5352f60 100644 --- a/src/libs/actions/connections/NetSuiteCommands.ts +++ b/src/libs/actions/connections/NetSuiteCommands.ts @@ -1,3 +1,4 @@ +import isObject from 'lodash/isObject'; import type {OnyxUpdate} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; @@ -7,6 +8,7 @@ import {WRITE_COMMANDS} from '@libs/API/types'; import * as ErrorUtils from '@libs/ErrorUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; +import type * as OnyxCommon from '@src/types/onyx/OnyxCommon'; import type {Connections, NetSuiteCustomFormID, NetSuiteCustomList, NetSuiteCustomSegment, NetSuiteMappingValues} from '@src/types/onyx/Policy'; import type {OnyxData} from '@src/types/onyx/Request'; @@ -34,6 +36,36 @@ function connectPolicyToNetSuite(policyID: string, credentials: Omit( + settingName: TSettingName, + settingValue: Partial, + pendingValue: OnyxCommon.PendingAction, +) { + if (!isObject(settingValue)) { + return {[settingName]: pendingValue}; + } + + return Object.keys(settingValue).reduce>((acc, setting) => { + acc[setting] = pendingValue; + return acc; + }, {}); +} + +function createErrorFields( + settingName: TSettingName, + settingValue: Partial, + errorValue: OnyxCommon.Errors | null, +) { + if (!isObject(settingValue)) { + return {[settingName]: errorValue}; + } + + return Object.keys(settingValue).reduce((acc, setting) => { + acc[setting] = errorValue; + return acc; + }, {}); +} + function updateNetSuiteOnyxData( policyID: string, settingName: TSettingName, @@ -50,12 +82,8 @@ function updateNetSuiteOnyxData & {subscribedSettings?: string[]}; + function NetSuiteAdvancedPage({policy}: WithPolicyConnectionsProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); @@ -45,7 +54,7 @@ function NetSuiteAdvancedPage({policy}: WithPolicyConnectionsProps) { return findSelectedBankAccountWithDefaultSelect(getFilteredApprovalAccountOptions(payableList), config?.approvalAccount); }, [config?.approvalAccount, payableList, translate]); - const menuItems: Array = [ + const menuItems: Array = [ { type: 'toggle', title: translate('workspace.accounting.autoSync'), @@ -71,7 +80,7 @@ function NetSuiteAdvancedPage({policy}: WithPolicyConnectionsProps) { shouldPlaceSubtitleBelowSwitch: true, onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.SYNC_REIMBURSED_REPORTS), onToggle: (isEnabled) => Connections.updateNetSuiteSyncReimbursedReports(policyID, isEnabled), - pendingAction: config?.syncOptions.pendingFields?.syncReimbursedReports, + pendingAction: config?.pendingFields?.syncReimbursedReports, errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.SYNC_REIMBURSED_REPORTS), shouldHide: config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY, }, @@ -79,22 +88,16 @@ function NetSuiteAdvancedPage({policy}: WithPolicyConnectionsProps) { type: 'menuitem', description: translate('workspace.netsuite.advancedConfig.reimbursementsAccount'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_REIMBURSEMENT_ACCOUNT_SELECT.getRoute(policyID)), - brickRoadIndicator: config?.errorFields?.reimbursementAccountID ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: selectedReimbursementAccount ? selectedReimbursementAccount.name : undefined, - pendingAction: config?.pendingFields?.reimbursementAccountID, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.REIMBURSEMENT_ACCOUNT_ID), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.REIMBURSEMENT_ACCOUNT_ID), + subscribedSettings: [CONST.NETSUITE_CONFIG.REIMBURSEMENT_ACCOUNT_ID], shouldHide: config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY, }, { type: 'menuitem', description: translate('workspace.netsuite.advancedConfig.collectionsAccount'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_COLLECTION_ACCOUNT_SELECT.getRoute(policyID)), - brickRoadIndicator: config?.errorFields?.collectionAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: selectedCollectionAccount ? selectedCollectionAccount.name : undefined, - pendingAction: config?.pendingFields?.collectionAccount, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.COLLECTION_ACCOUNT), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.COLLECTION_ACCOUNT), + subscribedSettings: [CONST.NETSUITE_CONFIG.COLLECTION_ACCOUNT], shouldHide: config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY, }, { @@ -112,7 +115,7 @@ function NetSuiteAdvancedPage({policy}: WithPolicyConnectionsProps) { shouldParseSubtitle: true, onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.SYNC_PEOPLE), onToggle: (isEnabled) => Connections.updateNetSuiteSyncPeople(policyID, isEnabled), - pendingAction: config?.syncOptions.pendingFields?.syncPeople, + pendingAction: config?.pendingFields?.syncPeople, errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.SYNC_PEOPLE), }, { @@ -136,7 +139,7 @@ function NetSuiteAdvancedPage({policy}: WithPolicyConnectionsProps) { switchAccessibilityLabel: translate('workspace.netsuite.advancedConfig.enableCategories'), onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.ENABLE_NEW_CATEGORIES), onToggle: (isEnabled) => Connections.updateNetSuiteEnableNewCategories(policyID, isEnabled), - pendingAction: config?.syncOptions.pendingFields?.enableNewCategories, + pendingAction: config?.pendingFields?.enableNewCategories, errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.ENABLE_NEW_CATEGORIES), }, { @@ -147,22 +150,16 @@ function NetSuiteAdvancedPage({policy}: WithPolicyConnectionsProps) { type: 'menuitem', description: translate('workspace.netsuite.advancedConfig.exportReportsTo.label'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPENSE_REPORT_APPROVAL_LEVEL_SELECT.getRoute(policyID)), - brickRoadIndicator: config?.errorFields?.exportReportsTo ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: config?.syncOptions.exportReportsTo ? translate(`workspace.netsuite.advancedConfig.exportReportsTo.values.${config.syncOptions.exportReportsTo}`) : undefined, - pendingAction: config?.syncOptions.pendingFields?.exportReportsTo, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_REPORTS_TO), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_REPORTS_TO), + subscribedSettings: [CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_REPORTS_TO], shouldHide: config?.reimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT, }, { type: 'menuitem', description: translate('workspace.netsuite.advancedConfig.exportVendorBillsTo.label'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_VENDOR_BILL_APPROVAL_LEVEL_SELECT.getRoute(policyID)), - brickRoadIndicator: config?.errorFields?.exportVendorBillsTo ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: config?.syncOptions.exportVendorBillsTo ? translate(`workspace.netsuite.advancedConfig.exportVendorBillsTo.values.${config.syncOptions.exportVendorBillsTo}`) : undefined, - pendingAction: config?.syncOptions.pendingFields?.exportVendorBillsTo, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_VENDOR_BILLS_TO), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_VENDOR_BILLS_TO), + subscribedSettings: [CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_VENDOR_BILLS_TO], shouldHide: config?.reimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILL && config?.nonreimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILL, @@ -171,11 +168,8 @@ function NetSuiteAdvancedPage({policy}: WithPolicyConnectionsProps) { type: 'menuitem', description: translate('workspace.netsuite.advancedConfig.exportJournalsTo.label'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_JOURNAL_ENTRY_APPROVAL_LEVEL_SELECT.getRoute(policyID)), - brickRoadIndicator: config?.errorFields?.exportJournalsTo ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: config?.syncOptions.exportJournalsTo ? translate(`workspace.netsuite.advancedConfig.exportJournalsTo.values.${config.syncOptions.exportJournalsTo}`) : undefined, - pendingAction: config?.syncOptions.pendingFields?.exportJournalsTo, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_JOURNALS_TO), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_JOURNALS_TO), + subscribedSettings: [CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_JOURNALS_TO], shouldHide: config?.reimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY && config?.nonreimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY, @@ -184,11 +178,8 @@ function NetSuiteAdvancedPage({policy}: WithPolicyConnectionsProps) { type: 'menuitem', description: translate('workspace.netsuite.advancedConfig.approvalAccount'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_APPROVAL_ACCOUNT_SELECT.getRoute(policyID)), - brickRoadIndicator: config?.errorFields?.approvalAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: selectedApprovalAccount ? selectedApprovalAccount.name : undefined, - pendingAction: config?.pendingFields?.approvalAccount, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.APPROVAL_ACCOUNT), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.APPROVAL_ACCOUNT), + subscribedSettings: [CONST.NETSUITE_CONFIG.APPROVAL_ACCOUNT], }, { type: 'divider', @@ -201,31 +192,25 @@ function NetSuiteAdvancedPage({policy}: WithPolicyConnectionsProps) { isActive: !!config?.customFormIDOptions?.enabled, switchAccessibilityLabel: translate('workspace.netsuite.advancedConfig.customFormIDDescription'), shouldPlaceSubtitleBelowSwitch: true, - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.CUSTOM_FORM_ID_OPTIONS), + onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.CUSTOM_FORM_ID_ENABLED), onToggle: (isEnabled) => Connections.updateNetSuiteCustomFormIDOptionsEnabled(policyID, isEnabled), pendingAction: config?.pendingFields?.customFormIDOptions, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.CUSTOM_FORM_ID_OPTIONS), + errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.CUSTOM_FORM_ID_ENABLED), }, { type: 'menuitem', description: translate('workspace.netsuite.advancedConfig.customFormIDReimbursable'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_CUSTOM_FORM_ID.getRoute(policyID, CONST.NETSUITE_EXPENSE_TYPE.REIMBURSABLE)), - brickRoadIndicator: config?.errorFields?.customFormIDOptions ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: config?.customFormIDOptions?.reimbursable?.[CONST.NETSUITE_MAP_EXPORT_DESTINATION[config.reimbursableExpensesExportDestination]], - pendingAction: config?.pendingFields?.customFormIDOptions, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.CUSTOM_FORM_ID_OPTIONS), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.CUSTOM_FORM_ID_OPTIONS), + subscribedSettings: [CONST.NETSUITE_CONFIG.CUSTOM_FORM_ID_TYPE.REIMBURSABLE], shouldHide: !config?.customFormIDOptions?.enabled, }, { type: 'menuitem', description: translate('workspace.netsuite.advancedConfig.customFormIDNonReimbursable'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_CUSTOM_FORM_ID.getRoute(policyID, CONST.NETSUITE_EXPENSE_TYPE.NON_REIMBURSABLE)), - brickRoadIndicator: config?.errorFields?.customFormIDOptions ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: config?.customFormIDOptions?.nonReimbursable?.[CONST.NETSUITE_MAP_EXPORT_DESTINATION[config.nonreimbursableExpensesExportDestination]], - pendingAction: config?.pendingFields?.customFormIDOptions, - errors: ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.CUSTOM_FORM_ID_OPTIONS), - onCloseError: () => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.CUSTOM_FORM_ID_OPTIONS), + subscribedSettings: [CONST.NETSUITE_CONFIG.CUSTOM_FORM_ID_TYPE.NON_REIMBURSABLE], shouldHide: !config?.customFormIDOptions?.enabled, }, ]; @@ -268,19 +253,14 @@ function NetSuiteAdvancedPage({policy}: WithPolicyConnectionsProps) { return ( ); diff --git a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteApprovalAccountSelectPage.tsx b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteApprovalAccountSelectPage.tsx index 98cf607e30ab..9a79c91c1eb6 100644 --- a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteApprovalAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteApprovalAccountSelectPage.tsx @@ -9,11 +9,13 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import {getNetSuiteApprovalAccountOptions} from '@libs/PolicyUtils'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import variables from '@styles/variables'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -81,6 +83,9 @@ function NetSuiteApprovalAccountSelectPage({policy}: WithPolicyConnectionsProps) title="workspace.netsuite.advancedConfig.approvalAccount" listEmptyContent={listEmptyContent} connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} + pendingAction={config?.pendingFields?.approvalAccount} + errors={ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.APPROVAL_ACCOUNT)} + onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.APPROVAL_ACCOUNT)} /> ); } diff --git a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteCollectionAccountSelectPage.tsx b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteCollectionAccountSelectPage.tsx index a8ad5cff5895..95ae163e264a 100644 --- a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteCollectionAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteCollectionAccountSelectPage.tsx @@ -9,11 +9,13 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import {getNetSuiteCollectionAccountOptions} from '@libs/PolicyUtils'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import variables from '@styles/variables'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -80,6 +82,10 @@ function NetSuiteCollectionAccountSelectPage({policy}: WithPolicyConnectionsProp listEmptyContent={listEmptyContent} connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} shouldBeBlocked={config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY} + pendingAction={config?.pendingFields?.collectionAccount} + errors={ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.COLLECTION_ACCOUNT)} + errorRowStyles={[styles.ph5, styles.pv3]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.COLLECTION_ACCOUNT)} /> ); } diff --git a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteCustomFormIDPage.tsx b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteCustomFormIDPage.tsx index 9a4635dd17bb..46b051636416 100644 --- a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteCustomFormIDPage.tsx +++ b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteCustomFormIDPage.tsx @@ -5,6 +5,7 @@ import ConnectionLayout from '@components/ConnectionLayout'; import FormProvider from '@components/Form/FormProvider'; import InputWrapper from '@components/Form/InputWrapper'; import type {FormInputErrors, FormOnyxValues} from '@components/Form/types'; +import OfflineWithFeedback from '@components/OfflineWithFeedback'; import TextInput from '@components/TextInput'; import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; @@ -16,6 +17,7 @@ import * as ValidationUtils from '@libs/ValidationUtils'; import type {ExpenseRouteParams} from '@pages/workspace/accounting/netsuite/types'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; @@ -84,17 +86,24 @@ function NetSuiteCustomFormIDPage({policy}: WithPolicyConnectionsProps) { shouldValidateOnBlur shouldValidateOnChange > - + Policy.clearNetSuiteErrorField(policyID, customFormIDKey)} + > + + diff --git a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteExpenseReportApprovalLevelSelectPage.tsx b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteExpenseReportApprovalLevelSelectPage.tsx index ed70da6f1608..342692e0b382 100644 --- a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteExpenseReportApprovalLevelSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteExpenseReportApprovalLevelSelectPage.tsx @@ -9,9 +9,11 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@navigation/Navigation'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -65,6 +67,9 @@ function NetSuiteExpenseReportApprovalLevelSelectPage({policy}: WithPolicyConnec onBackButtonPress={() => Navigation.goBack(ROUTES.POLICY_ACCOUNTING_NETSUITE_ADVANCED.getRoute(policyID))} connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} shouldBeBlocked={config?.reimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT} + pendingAction={config?.pendingFields?.exportReportsTo} + errors={ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_REPORTS_TO)} + onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_REPORTS_TO)} /> ); } diff --git a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteJournalEntryApprovalLevelSelectPage.tsx b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteJournalEntryApprovalLevelSelectPage.tsx index ee1d1108ffd6..10966764d538 100644 --- a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteJournalEntryApprovalLevelSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteJournalEntryApprovalLevelSelectPage.tsx @@ -9,9 +9,11 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@navigation/Navigation'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -68,6 +70,10 @@ function NetSuiteJournalEntryApprovalLevelSelectPage({policy}: WithPolicyConnect config?.reimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY && config?.nonreimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY } + pendingAction={config?.pendingFields?.exportJournalsTo} + errors={ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_JOURNALS_TO)} + errorRowStyles={[styles.ph5, styles.pv3]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_JOURNALS_TO)} /> ); } diff --git a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteReimbursementAccountSelectPage.tsx b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteReimbursementAccountSelectPage.tsx index 4ad1a1b62633..fea085fab3e5 100644 --- a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteReimbursementAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteReimbursementAccountSelectPage.tsx @@ -9,11 +9,13 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import {getNetSuiteReimbursableAccountOptions} from '@libs/PolicyUtils'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import variables from '@styles/variables'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -80,6 +82,10 @@ function NetSuiteReimbursementAccountSelectPage({policy}: WithPolicyConnectionsP listEmptyContent={listEmptyContent} connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} shouldBeBlocked={config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY} + pendingAction={config?.pendingFields?.reimbursementAccountID} + errors={ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.REIMBURSEMENT_ACCOUNT_ID)} + errorRowStyles={[styles.ph5, styles.pv3]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.REIMBURSEMENT_ACCOUNT_ID)} /> ); } diff --git a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteVendorBillApprovalLevelSelectPage.tsx b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteVendorBillApprovalLevelSelectPage.tsx index ecbaacd46bad..f4971b6b4270 100644 --- a/src/pages/workspace/accounting/netsuite/advanced/NetSuiteVendorBillApprovalLevelSelectPage.tsx +++ b/src/pages/workspace/accounting/netsuite/advanced/NetSuiteVendorBillApprovalLevelSelectPage.tsx @@ -9,9 +9,11 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections/NetSuiteCommands'; +import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@navigation/Navigation'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; +import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -72,6 +74,10 @@ function NetSuiteVendorBillApprovalLevelSelectPage({policy}: WithPolicyConnectio config?.reimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILL && config?.nonreimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILL } + pendingAction={config?.pendingFields?.exportVendorBillsTo} + errors={ErrorUtils.getLatestErrorField(config, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_VENDOR_BILLS_TO)} + errorRowStyles={[styles.ph5, styles.pv3]} + onClose={() => Policy.clearNetSuiteErrorField(policyID, CONST.NETSUITE_CONFIG.SYNC_OPTIONS.EXPORT_VENDOR_BILLS_TO)} /> ); } diff --git a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldEdit.tsx b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldEdit.tsx index d3f5082d47cb..1bea3a613fd1 100644 --- a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldEdit.tsx +++ b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldEdit.tsx @@ -115,7 +115,7 @@ function NetSuiteImportCustomFieldEdit({ submitButtonText={translate('common.save')} shouldValidateOnBlur shouldValidateOnChange - isSubmitDisabled={!!config?.syncOptions?.pendingFields?.[importCustomField]} + isSubmitDisabled={!!config?.pendingFields?.[importCustomField]} > ), - [config?.syncOptions?.pendingFields, customField, fieldName, fieldValue, importCustomField, inputCallbackRef, styles.flexGrow1, styles.ph5, translate, updateRecord, validate], + [config?.pendingFields, customField, fieldName, fieldValue, importCustomField, inputCallbackRef, styles.flexGrow1, styles.ph5, translate, updateRecord, validate], ); const renderSelection = useMemo( diff --git a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldNew/NetSuiteImportAddCustomListPage.tsx b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldNew/NetSuiteImportAddCustomListPage.tsx index e08cf4dac6c4..27f9c084e415 100644 --- a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldNew/NetSuiteImportAddCustomListPage.tsx +++ b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldNew/NetSuiteImportAddCustomListPage.tsx @@ -153,7 +153,7 @@ function NetSuiteImportAddCustomListPage({policy}: WithPolicyConnectionsProps) { submitButtonStyles={[styles.ph5, styles.mb0]} shouldUseScrollView={!selectionListForm} enabledWhenOffline - isSubmitDisabled={!!config?.syncOptions?.pendingFields?.customLists} + isSubmitDisabled={!!config?.pendingFields?.customLists} submitFlexEnabled={submitFlexAllowed} > {renderSubStepContent} diff --git a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldPage.tsx b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldPage.tsx index 0a749b01399f..989a19a26f59 100644 --- a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldPage.tsx +++ b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldPage.tsx @@ -126,7 +126,7 @@ function NetSuiteImportCustomFieldPage({ Policy.clearNetSuiteErrorField(policyID, importCustomField)} > {data.map((record, index) => ( @@ -145,7 +145,7 @@ function NetSuiteImportCustomFieldPage({