-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Feature: "When to export" selector for auto-sync for NetSuite #51949
Changes from 5 commits
1f8b718
9be1a90
b394302
08bfaab
6f229fc
2b10591
7a604a9
88abfb1
1fd9e9f
7040eec
5a77bfb
96208e2
33dc114
357da49
205ff74
06f1170
4d1245b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -451,6 +451,7 @@ const translations = { | |
dropTitle: 'Suéltalo', | ||
dropMessage: 'Suelta tu archivo aquí', | ||
enabled: 'Habilitado', | ||
disabled: 'Desactivada', | ||
ignore: 'Ignorar', | ||
import: 'Importar', | ||
offlinePrompt: 'No puedes realizar esta acción ahora mismo.', | ||
|
@@ -2871,6 +2872,18 @@ const translations = { | |
[CONST.NETSUITE_REPORTS_APPROVAL_LEVEL.REPORTS_APPROVED_BOTH]: 'Aprobado por supervisor y contabilidad', | ||
}, | ||
}, | ||
accountingMethods: { | ||
label: 'Cuándo Exportar', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aimane-chnaif can you please confirm these translations, I'm yet to be added in the open source channel There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @twilight2294 Here's updated copies: English: (- added in out of pocket)
Spanish:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the help, it's late here, I will update tomorrow |
||
description: 'Elige cuándo exportar los gastos:', | ||
values: { | ||
[CONST.NETSUITE_ACCOUNTING_METHODS.ACCRUAL]: 'Devengo', | ||
[CONST.NETSUITE_ACCOUNTING_METHODS.CASH]: 'Efectivo', | ||
}, | ||
alternateText: { | ||
[CONST.NETSUITE_ACCOUNTING_METHODS.ACCRUAL]: 'Los gastos por cuenta propia se exportarán cuando estén aprobados definitivamente', | ||
[CONST.NETSUITE_ACCOUNTING_METHODS.CASH]: 'Los gastos por cuenta propia se exportarán cuando estén pagados', | ||
}, | ||
}, | ||
exportVendorBillsTo: { | ||
label: 'Nivel de aprobación de facturas de proveedores', | ||
description: | ||
|
@@ -3837,6 +3850,7 @@ const translations = { | |
exportDate: 'Fecha de exportación', | ||
defaultVendor: 'Proveedor predeterminado', | ||
autoSync: 'Autosincronización', | ||
autoSyncDescription: 'Sincroniza NetSuite y Expensify automáticamente, todos los días. Exporta el informe finalizado en tiempo real', | ||
reimbursedReports: 'Sincronizar informes reembolsados', | ||
cardReconciliation: 'Conciliación de tarjetas', | ||
reconciliationAccount: 'Cuenta de conciliación', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type {ValueOf} from 'type-fest'; | ||
import type CONST from '@src/CONST'; | ||
|
||
type UpdateNetSuiteAccountingMethodParams = { | ||
policyID: string; | ||
accountingMethod: ValueOf<typeof CONST.NETSUITE_ACCOUNTING_METHODS>; | ||
}; | ||
|
||
export default UpdateNetSuiteAccountingMethodParams; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import React, {useCallback, useMemo} from 'react'; | ||
import {View} from 'react-native'; | ||
import type {ValueOf} from 'type-fest'; | ||
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'; | ||
import Navigation from '@navigation/Navigation'; | ||
import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; | ||
import withPolicyConnections from '@pages/workspace/withPolicyConnections'; | ||
import CONST from '@src/CONST'; | ||
import ROUTES from '@src/ROUTES'; | ||
|
||
type MenuListItem = ListItem & { | ||
value: ValueOf<typeof CONST.NETSUITE_ACCOUNTING_METHODS>; | ||
}; | ||
|
||
function NetSuiteAccountingMethodPage({policy}: WithPolicyConnectionsProps) { | ||
const {translate} = useLocalize(); | ||
const policyID = policy?.id ?? '-1'; | ||
const styles = useThemeStyles(); | ||
const config = policy?.connections?.netsuite.options.config; | ||
twilight2294 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const accountingMehtod = config?.accountingMethod ?? CONST.NETSUITE_ACCOUNTING_METHODS.CASH; | ||
twilight2294 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const data: MenuListItem[] = Object.values(CONST.NETSUITE_ACCOUNTING_METHODS).map((accountingMehtodType) => ({ | ||
twilight2294 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
value: accountingMehtodType, | ||
text: translate(`workspace.netsuite.advancedConfig.accountingMethods.values.${accountingMehtodType}`), | ||
alternateText: translate(`workspace.netsuite.advancedConfig.accountingMethods.alternateText.${accountingMehtodType}`), | ||
keyForList: accountingMehtodType, | ||
isSelected: accountingMehtod === accountingMehtodType, | ||
})); | ||
|
||
const headerContent = useMemo( | ||
() => ( | ||
<View> | ||
<Text style={[styles.ph5, styles.pb5]}>{translate('workspace.netsuite.advancedConfig.accountingMethods.description')}</Text> | ||
</View> | ||
), | ||
[translate, styles.pb5, styles.ph5], | ||
); | ||
|
||
const selectExpenseReportApprovalLevel = useCallback( | ||
(row: MenuListItem) => { | ||
if (row.value !== config?.accountingMethod) { | ||
Connections.updateNetSuiteAccountingMethod(policyID, row.value, config?.accountingMethod ?? CONST.NETSUITE_ACCOUNTING_METHODS.CASH); | ||
} | ||
Navigation.goBack(ROUTES.POLICY_ACCOUNTING_NETSUITE_AUTO_SYNC.getRoute(policyID)); | ||
}, | ||
[config?.accountingMethod, policyID], | ||
); | ||
|
||
return ( | ||
<SelectionScreen | ||
displayName={NetSuiteAccountingMethodPage.displayName} | ||
title="workspace.netsuite.advancedConfig.accountingMethods.label" | ||
headerContent={headerContent} | ||
sections={[{data}]} | ||
listItem={RadioListItem} | ||
onSelectRow={(selection: SelectorType) => selectExpenseReportApprovalLevel(selection as MenuListItem)} | ||
initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} | ||
policyID={policyID} | ||
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]} | ||
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED} | ||
onBackButtonPress={() => Navigation.goBack(ROUTES.POLICY_ACCOUNTING_NETSUITE_AUTO_SYNC.getRoute(policyID))} | ||
connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} | ||
/> | ||
); | ||
} | ||
|
||
NetSuiteAccountingMethodPage.displayName = 'NetSuiteExpenseReportApprovalLevelSelectPage'; | ||
|
||
export default withPolicyConnections(NetSuiteAccountingMethodPage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in the OP of the issue mentioned above, let us make use of the consts from there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yuwenmemon do we want to use CONST from the common repo ? I think it's better to define it here in App repo, but let me know if there is a reason to use it from upstream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it is already defined in
expensify-common
, let us use it as we should only have a single source of truth.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rojiphil we already import a CONST in that same file, how do we import the new consts from the upstream repo ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not use this?
App/src/languages/en.ts
Line 1 in 2ef91b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh i was unaware of that updating now, thanks for the help