From 2cd42f99305b6f160be5d92d976ac95271e756d5 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Thu, 6 Jun 2024 03:34:51 +0300 Subject: [PATCH 01/31] add route --- src/ROUTES.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 5a8f4a2cd4d0..dbfeb321c735 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -720,6 +720,10 @@ const ROUTES = { route: 'settings/workspaces/:policyID/tag-list/:orderWeight', getRoute: (policyID: string, orderWeight: number) => `settings/workspaces/${policyID}/tag-list/${orderWeight}` as const, }, + WORKSPACE_TAG_GL_CODE: { + route: 'settings/workspaces/:policyID/tag/:orderWeight/:tagName/gl-code', + getRoute: (policyID: string, orderWeight: number, tagName: string) => `settings/workspaces/${policyID}/tag/${orderWeight}/${encodeURIComponent(tagName)}/gl-code` as const, + }, WORKSPACE_TAXES: { route: 'settings/workspaces/:policyID/taxes', getRoute: (policyID: string) => `settings/workspaces/${policyID}/taxes` as const, From b09cd8cf89e76a57c46e8b4674d868c7733f848a Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Thu, 6 Jun 2024 03:38:40 +0300 Subject: [PATCH 02/31] add screen and lang --- src/SCREENS.ts | 1 + src/languages/en.ts | 2 ++ src/languages/es.ts | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/SCREENS.ts b/src/SCREENS.ts index fd7418aee1c5..b28bec9f4744 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -298,6 +298,7 @@ const SCREENS = { TAG_CREATE: 'Tag_Create', TAG_SETTINGS: 'Tag_Settings', TAG_LIST_VIEW: 'Tag_List_View', + TAG_GL_CODE: 'Tag_GL_Code', CURRENCY: 'Workspace_Profile_Currency', ADDRESS: 'Workspace_Profile_Address', WORKFLOWS: 'Workspace_Workflows', diff --git a/src/languages/en.ts b/src/languages/en.ts index 9a047178147e..e9a009ee565e 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2274,6 +2274,8 @@ export default { existingTagError: 'A tag with this name already exists.', genericFailureMessage: 'An error occurred while updating the tag, please try again.', importedFromAccountingSoftware: 'The tags below are imported from your', + glCode: 'GL code', + updateGLCodeFailureMessage: 'An error occurred while updating the GL code, please try again.', }, taxes: { subtitle: 'Add tax names, rates, and set defaults.', diff --git a/src/languages/es.ts b/src/languages/es.ts index c3fd2bc46849..1bd8948c1542 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2313,6 +2313,8 @@ export default { existingTagError: 'Ya existe una etiqueta con este nombre.', genericFailureMessage: 'Se produjo un error al actualizar la etiqueta, inténtelo nuevamente.', importedFromAccountingSoftware: 'Etiquetas importadas desde', + glCode: 'GL code', + updateGLCodeFailureMessage: 'An error occurred while updating the GL code, please try again.', }, taxes: { subtitle: 'Añade nombres, tasas y establezca valores por defecto para los impuestos.', From 96f2aa3e193fb93b6224ddd1df49ff486662be34 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Thu, 6 Jun 2024 03:40:07 +0300 Subject: [PATCH 03/31] add gl tag api params --- src/libs/API/parameters/UpdatePolicyTagGLCode.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/libs/API/parameters/UpdatePolicyTagGLCode.ts diff --git a/src/libs/API/parameters/UpdatePolicyTagGLCode.ts b/src/libs/API/parameters/UpdatePolicyTagGLCode.ts new file mode 100644 index 000000000000..f9d0d72577bd --- /dev/null +++ b/src/libs/API/parameters/UpdatePolicyTagGLCode.ts @@ -0,0 +1,7 @@ +type UpdatePolicyTagGLCodeParams = { + policyID: string; + categoryName: string; + glCode: string; +}; + +export default UpdatePolicyTagGLCodeParams; From 3752df96d775922b85d276c515e0bb40265aa879 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Thu, 6 Jun 2024 03:41:30 +0300 Subject: [PATCH 04/31] add gl tag api params --- .../{UpdatePolicyTagGLCode.ts => UpdatePolicyTagGLCodeParams.ts} | 0 src/libs/API/parameters/index.ts | 1 + 2 files changed, 1 insertion(+) rename src/libs/API/parameters/{UpdatePolicyTagGLCode.ts => UpdatePolicyTagGLCodeParams.ts} (100%) diff --git a/src/libs/API/parameters/UpdatePolicyTagGLCode.ts b/src/libs/API/parameters/UpdatePolicyTagGLCodeParams.ts similarity index 100% rename from src/libs/API/parameters/UpdatePolicyTagGLCode.ts rename to src/libs/API/parameters/UpdatePolicyTagGLCodeParams.ts diff --git a/src/libs/API/parameters/index.ts b/src/libs/API/parameters/index.ts index de8d6f55418b..301e44cfe838 100644 --- a/src/libs/API/parameters/index.ts +++ b/src/libs/API/parameters/index.ts @@ -205,6 +205,7 @@ export type {default as DeletePolicyTaxesParams} from './DeletePolicyTaxesParams export type {default as UpdatePolicyTaxValueParams} from './UpdatePolicyTaxValueParams'; export type {default as RenamePolicyTagsParams} from './RenamePolicyTagsParams'; export type {default as DeletePolicyTagsParams} from './DeletePolicyTagsParams'; +export type {default as UpdatePolicyTagGLCodeParams} from './UpdatePolicyTagGLCodeParams'; export type {default as AddSubscriptionPaymentCardParams} from './AddSubscriptionPaymentCardParams'; export type {default as SetPolicyCustomTaxNameParams} from './SetPolicyCustomTaxNameParams'; export type {default as SetPolicyForeignCurrencyDefaultParams} from './SetPolicyForeignCurrencyDefaultParams'; From 847c5d04e6ce1b873374ce73cba01e24aba069f5 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Thu, 6 Jun 2024 03:43:00 +0300 Subject: [PATCH 05/31] add gl tag api types --- src/libs/API/types.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/API/types.ts b/src/libs/API/types.ts index 3f1acaaed466..fc46be8cc685 100644 --- a/src/libs/API/types.ts +++ b/src/libs/API/types.ts @@ -136,6 +136,7 @@ const WRITE_COMMANDS = { SET_POLICY_REQUIRES_TAG: 'SetPolicyRequiresTag', RENAME_POLICY_TAG_LIST: 'RenamePolicyTaglist', DELETE_POLICY_TAGS: 'DeletePolicyTags', + UPDATE_POLICY_TAG_GL_CODE: 'UpdatePolicyTagGLCode', CREATE_TASK: 'CreateTask', CANCEL_TASK: 'CancelTask', EDIT_TASK_ASSIGNEE: 'EditTaskAssignee', @@ -346,6 +347,7 @@ type WriteCommandParameters = { [WRITE_COMMANDS.RENAME_POLICY_TAG_LIST]: Parameters.RenamePolicyTaglist; [WRITE_COMMANDS.CREATE_POLICY_TAG]: Parameters.CreatePolicyTagsParams; [WRITE_COMMANDS.RENAME_POLICY_TAG]: Parameters.RenamePolicyTagsParams; + [WRITE_COMMANDS.UPDATE_POLICY_TAG_GL_CODE]: Parameters.UpdatePolicyTagGLCodeParams; [WRITE_COMMANDS.SET_POLICY_TAGS_ENABLED]: Parameters.SetPolicyTagsEnabled; [WRITE_COMMANDS.DELETE_POLICY_TAGS]: Parameters.DeletePolicyTagsParams; [WRITE_COMMANDS.CREATE_TASK]: Parameters.CreateTaskParams; From 220699a0dc0a4544c8d73414b889a846fc821f60 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Thu, 6 Jun 2024 03:45:04 +0300 Subject: [PATCH 06/31] add gl tag to modal --- src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx | 1 + src/pages/workspace/tags/TagGLCodePage.tsx | 0 2 files changed, 1 insertion(+) create mode 100644 src/pages/workspace/tags/TagGLCodePage.tsx diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 9a391e386f15..fb9b1e399a89 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -256,6 +256,7 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/tags/WorkspaceEditTagsPage').default as React.ComponentType, [SCREENS.WORKSPACE.TAG_CREATE]: () => require('../../../../pages/workspace/tags/WorkspaceCreateTagPage').default as React.ComponentType, [SCREENS.WORKSPACE.TAG_EDIT]: () => require('../../../../pages/workspace/tags/EditTagPage').default as React.ComponentType, + [SCREENS.WORKSPACE.TAG_GL_CODE]: () => require('../../../../pages/workspace/tags/TagGLCodePage').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsPage').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_CUSTOM_TAX_NAME]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default as React.ComponentType, diff --git a/src/pages/workspace/tags/TagGLCodePage.tsx b/src/pages/workspace/tags/TagGLCodePage.tsx new file mode 100644 index 000000000000..e69de29bb2d1 From 1eaf84d37405de6d524826da3a1a0972c9aebca1 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Thu, 6 Jun 2024 03:45:50 +0300 Subject: [PATCH 07/31] add glcode to full screen mapping --- src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts index f91d290639ff..df55d54566a6 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -73,6 +73,7 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.TAG_SETTINGS, SCREENS.WORKSPACE.TAG_EDIT, SCREENS.WORKSPACE.TAG_LIST_VIEW, + SCREENS.WORKSPACE.TAG_GL_CODE, ], [SCREENS.WORKSPACE.CATEGORIES]: [SCREENS.WORKSPACE.CATEGORY_CREATE, SCREENS.WORKSPACE.CATEGORY_SETTINGS, SCREENS.WORKSPACE.CATEGORIES_SETTINGS, SCREENS.WORKSPACE.CATEGORY_EDIT], [SCREENS.WORKSPACE.DISTANCE_RATES]: [ From 323da139c2d6461b8fdc6bea34a1bf692ee9fca0 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Thu, 6 Jun 2024 03:47:35 +0300 Subject: [PATCH 08/31] add linking config --- src/libs/Navigation/linkingConfig/config.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index b3f27d422b4b..00d5952d0928 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -445,6 +445,13 @@ const config: LinkingOptions['config'] = { tagName: (tagName: string) => decodeURIComponent(tagName), }, }, + [SCREENS.WORKSPACE.TAG_GL_CODE]: { + path: ROUTES.WORKSPACE_TAG_GL_CODE.route, + parse: { + orderWeight: Number, + tagName: (tagName: string) => decodeURIComponent(tagName), + }, + }, [SCREENS.WORKSPACE.TAG_SETTINGS]: { path: ROUTES.WORKSPACE_TAG_SETTINGS.route, parse: { From 0be74b545e416532d3a3edeef6617ccd72ee07fa Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Thu, 6 Jun 2024 04:20:36 +0300 Subject: [PATCH 09/31] add linking config --- src/libs/Navigation/types.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 2267d2d38fb7..a88924778a2d 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -249,6 +249,11 @@ type SettingsNavigatorParamList = { orderWeight: number; tagName: string; }; + [SCREENS.WORKSPACE.TAG_GL_CODE]: { + policyID: string; + orderWeight: number; + tagName: string; + }; [SCREENS.SETTINGS.SUBSCRIPTION.ADD_PAYMENT_CARD]: undefined; [SCREENS.WORKSPACE.TAXES_SETTINGS]: { policyID: string; From 9591bbf012cf3e77f4ddf16b66afc46d93d9786f Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Thu, 6 Jun 2024 04:29:58 +0300 Subject: [PATCH 10/31] add api type --- src/libs/API/parameters/UpdatePolicyTagGLCodeParams.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/API/parameters/UpdatePolicyTagGLCodeParams.ts b/src/libs/API/parameters/UpdatePolicyTagGLCodeParams.ts index f9d0d72577bd..e1b03b697dc8 100644 --- a/src/libs/API/parameters/UpdatePolicyTagGLCodeParams.ts +++ b/src/libs/API/parameters/UpdatePolicyTagGLCodeParams.ts @@ -1,6 +1,6 @@ type UpdatePolicyTagGLCodeParams = { policyID: string; - categoryName: string; + tagName: string; glCode: string; }; From 5108e1f7b8cca6e8be454295059861a14fbc77f9 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Thu, 6 Jun 2024 04:30:10 +0300 Subject: [PATCH 11/31] add gl code type for tag to onyx --- src/types/onyx/PolicyTag.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/types/onyx/PolicyTag.ts b/src/types/onyx/PolicyTag.ts index 40bac23dc4f3..1d2336d8e519 100644 --- a/src/types/onyx/PolicyTag.ts +++ b/src/types/onyx/PolicyTag.ts @@ -11,8 +11,7 @@ type PolicyTag = OnyxCommon.OnyxValueWithOfflineFeedback<{ previousTagName?: string; /** "General Ledger code" that corresponds to this tag in an accounting system. Similar to an ID. */ - // eslint-disable-next-line @typescript-eslint/naming-convention - 'GL Code'?: string; + glCode?: string; /** A list of errors keyed by microtime */ errors?: OnyxCommon.Errors | null; From 0ef733b954257eabbb48220f21b82b0dedb8ac33 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Thu, 6 Jun 2024 04:30:21 +0300 Subject: [PATCH 12/31] add gl code api def --- src/libs/actions/Policy/Tag.ts | 71 ++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/src/libs/actions/Policy/Tag.ts b/src/libs/actions/Policy/Tag.ts index 8afaf29971ae..684fa6a67265 100644 --- a/src/libs/actions/Policy/Tag.ts +++ b/src/libs/actions/Policy/Tag.ts @@ -604,6 +604,76 @@ function setPolicyRequiresTag(policyID: string, requiresTag: boolean) { API.write(WRITE_COMMANDS.SET_POLICY_REQUIRES_TAG, parameters, onyxData); } +function setPolicyTagGLCode(policyID: string, tagName: string, glCode: string) { + const tagListName = Object.keys(allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`] ?? {})[0]; + const policyTagToUpdate = allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`]?.[tagListName]?.tags?.[tagName] ?? {}; + const onyxData: OnyxData = { + optimisticData: [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`, + value: { + [tagListName]: { + tags: { + [tagName]: { + ...policyTagToUpdate, + pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE, + pendingFields: { + glCode: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE, + }, + glCode, + }, + }, + }, + }, + }, + ], + successData: [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`, + value: { + [tagListName]: { + tags: { + [tagName]: { + errors: null, + pendingAction: null, + pendingFields: { + glCode: null, + }, + }, + }, + }, + }, + }, + ], + failureData: [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`, + value: { + [tagListName]: { + tags: { + [tagName]: { + ...policyTagToUpdate, + errors: ErrorUtils.getMicroSecondOnyxError('workspace.tags.updateGLCodeFailureMessage'), + }, + }, + }, + }, + }, + ], + }; + + const parameters = { + policyID, + tagName, + glCode, + }; + + API.write(WRITE_COMMANDS.UPDATE_POLICY_TAG_GL_CODE, parameters, onyxData); +} + export { openPolicyTagsPage, buildOptimisticPolicyRecentlyUsedTags, @@ -615,6 +685,7 @@ export { clearPolicyTagErrors, deletePolicyTags, setWorkspaceTagEnabled, + setPolicyTagGLCode, }; export type {NewCustomUnit}; From 9f16aa9807e523930a60de1736cf3c7f6b14c168 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Thu, 6 Jun 2024 04:42:22 +0300 Subject: [PATCH 13/31] add form types for gl code --- src/types/form/WorkspaceTagForm.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/types/form/WorkspaceTagForm.ts b/src/types/form/WorkspaceTagForm.ts index a6cc4c6c37cd..e797d237ab53 100644 --- a/src/types/form/WorkspaceTagForm.ts +++ b/src/types/form/WorkspaceTagForm.ts @@ -3,6 +3,7 @@ import type Form from './Form'; const INPUT_IDS = { TAG_NAME: 'tagName', + TAG_GL_CODE: 'tagGLCode', } as const; type InputID = ValueOf; @@ -11,6 +12,7 @@ type WorkspaceTagForm = Form< InputID, { [INPUT_IDS.TAG_NAME]: string; + [INPUT_IDS.TAG_GL_CODE]: string; } >; From dcc22bbdc99cd7eba18c6da9e0c1bf9804bb68a5 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Wed, 26 Jun 2024 16:39:30 +0300 Subject: [PATCH 14/31] get taglist name by order weight --- src/CONST.ts | 2 ++ src/libs/actions/Policy/Tag.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/CONST.ts b/src/CONST.ts index e71ad55a452c..6364391f72c3 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -4912,6 +4912,8 @@ const CONST = { }, }, + MAX_LENGTH_256: 256, + EXCLUDE_FROM_LAST_VISITED_PATH: [SCREENS.NOT_FOUND, SCREENS.SAML_SIGN_IN, SCREENS.VALIDATE_LOGIN] as string[], } as const; diff --git a/src/libs/actions/Policy/Tag.ts b/src/libs/actions/Policy/Tag.ts index d830cb36be9a..3ecd57e0fde9 100644 --- a/src/libs/actions/Policy/Tag.ts +++ b/src/libs/actions/Policy/Tag.ts @@ -728,7 +728,7 @@ function setPolicyTagsRequired(policyID: string, requiresTag: boolean, tagListIn } function setPolicyTagGLCode(policyID: string, tagName: string, tagListOrderWeight: number, glCode: string) { - const tagListName = Object.keys(allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`] ?? {})[0]; + const tagListName = Object.keys(allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`] ?? {})[tagListOrderWeight]; const policyTagToUpdate = allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`]?.[tagListName]?.tags?.[tagName] ?? {}; const onyxData: OnyxData = { optimisticData: [ From 02ea77d0955f4a1015ebd04ae29f3ff1471bdf79 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Wed, 26 Jun 2024 17:06:51 +0300 Subject: [PATCH 15/31] add base gl code tag page --- src/pages/workspace/tags/TagGLCodePage.tsx | 96 ++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/src/pages/workspace/tags/TagGLCodePage.tsx b/src/pages/workspace/tags/TagGLCodePage.tsx index e69de29bb2d1..c657f0d924c7 100644 --- a/src/pages/workspace/tags/TagGLCodePage.tsx +++ b/src/pages/workspace/tags/TagGLCodePage.tsx @@ -0,0 +1,96 @@ +import type {StackScreenProps} from '@react-navigation/stack'; +import React, {useCallback} from 'react'; +import {withOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; +import FormProvider from '@components/Form/FormProvider'; +import InputWrapper from '@components/Form/InputWrapper'; +import type {FormOnyxValues} from '@components/Form/types'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import ScreenWrapper from '@components/ScreenWrapper'; +import TextInput from '@components/TextInput'; +import useAutoFocusInput from '@hooks/useAutoFocusInput'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import Navigation from '@libs/Navigation/Navigation'; +import type {SettingsNavigatorParamList} from '@navigation/types'; +import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; +import * as Tag from '@userActions/Policy/Tag'; +import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; +import ROUTES from '@src/ROUTES'; +import type SCREENS from '@src/SCREENS'; +import INPUT_IDS from '@src/types/form/WorkspaceTagForm'; +import type {PolicyTagList} from '@src/types/onyx'; + +type WorkspaceEditTagGLCodePageOnyxProps = { + /** Collection of categories attached to a policy */ + policyTags: OnyxEntry; +}; + +type EditCategoryPageProps = WorkspaceEditTagGLCodePageOnyxProps & StackScreenProps; + +function TagGLCodePage({route, policyTags}: EditCategoryPageProps) { + const styles = useThemeStyles(); + const {translate} = useLocalize(); + const tagName = route.params.tagName; + const orderWeight = route.params.orderWeight; + const glCode = policyTags?.[tagName]; + const {inputCallbackRef} = useAutoFocusInput(); + + const editGLCode = useCallback( + (values: FormOnyxValues) => { + const newGLCode = values.glCode.trim(); + if (newGLCode !== glCode) { + Tag.setPolicyTagGLCode(route.params.policyID, tagName, orderWeight, newGLCode); + } + Navigation.goBack(); + }, + [glCode, route.params.policyID, tagName, orderWeight], + ); + + return ( + + + Navigation.goBack()} + /> + + + + + + ); +} + +TagGLCodePage.displayName = 'TagGLCodePage'; + +export default withOnyx({ + policyTags: { + key: ({route}) => `${ONYXKEYS.COLLECTION.POLICY_TAGS}${route?.params?.policyID}`, + }, +})(TagGLCodePage); From 2460c7342e1e83af16feb0dd9c04099c9d9ff123 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Tue, 2 Jul 2024 16:14:54 +0300 Subject: [PATCH 16/31] show glcode as menu item --- src/pages/workspace/tags/TagSettingsPage.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pages/workspace/tags/TagSettingsPage.tsx b/src/pages/workspace/tags/TagSettingsPage.tsx index 1e73267fec97..75cc0474aae8 100644 --- a/src/pages/workspace/tags/TagSettingsPage.tsx +++ b/src/pages/workspace/tags/TagSettingsPage.tsx @@ -127,6 +127,14 @@ function TagSettingsPage({route, policyTags, navigation}: TagSettingsPageProps) shouldShowRightIcon /> + + + {shouldShowDeleteMenuItem && ( Date: Tue, 2 Jul 2024 16:16:30 +0300 Subject: [PATCH 17/31] fix lang and add navigate --- src/pages/workspace/tags/TagSettingsPage.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/tags/TagSettingsPage.tsx b/src/pages/workspace/tags/TagSettingsPage.tsx index 75cc0474aae8..784e30bf2257 100644 --- a/src/pages/workspace/tags/TagSettingsPage.tsx +++ b/src/pages/workspace/tags/TagSettingsPage.tsx @@ -70,6 +70,10 @@ function TagSettingsPage({route, policyTags, navigation}: TagSettingsPageProps) Navigation.navigate(ROUTES.WORKSPACE_TAG_EDIT.getRoute(route.params.policyID, route.params.orderWeight, currentPolicyTag.name)); }; + const navigateToEditGlCode = () => { + Navigation.navigate(ROUTES.WORKSPACE_TAG_GL_CODE.getRoute(route.params.policyID, route.params.orderWeight, currentPolicyTag.name)); + }; + const isThereAnyAccountingConnection = Object.keys(policy?.connections ?? {}).length !== 0; const isMultiLevelTags = PolicyUtils.isMultiLevelTags(policyTags); @@ -130,8 +134,8 @@ function TagSettingsPage({route, policyTags, navigation}: TagSettingsPageProps) From a7f2879440e58b89857b3ef1d5d9d7cc1e59a1de Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Tue, 2 Jul 2024 16:17:23 +0300 Subject: [PATCH 18/31] fix lint --- src/pages/workspace/tags/TagGLCodePage.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/workspace/tags/TagGLCodePage.tsx b/src/pages/workspace/tags/TagGLCodePage.tsx index c657f0d924c7..ec6aeb5b0df1 100644 --- a/src/pages/workspace/tags/TagGLCodePage.tsx +++ b/src/pages/workspace/tags/TagGLCodePage.tsx @@ -17,7 +17,6 @@ import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Tag from '@userActions/Policy/Tag'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceTagForm'; import type {PolicyTagList} from '@src/types/onyx'; From b4ba920433bd65fc5b166809a76de624b6cf8e55 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Tue, 2 Jul 2024 16:21:46 +0300 Subject: [PATCH 19/31] fix type --- src/pages/workspace/tags/TagGLCodePage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/tags/TagGLCodePage.tsx b/src/pages/workspace/tags/TagGLCodePage.tsx index ec6aeb5b0df1..b8b705bc55b2 100644 --- a/src/pages/workspace/tags/TagGLCodePage.tsx +++ b/src/pages/workspace/tags/TagGLCodePage.tsx @@ -26,7 +26,7 @@ type WorkspaceEditTagGLCodePageOnyxProps = { policyTags: OnyxEntry; }; -type EditCategoryPageProps = WorkspaceEditTagGLCodePageOnyxProps & StackScreenProps; +type EditCategoryPageProps = WorkspaceEditTagGLCodePageOnyxProps & StackScreenProps; function TagGLCodePage({route, policyTags}: EditCategoryPageProps) { const styles = useThemeStyles(); From 7a0b73842e7d5ce753590ac1c2ddd257772850df Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Tue, 2 Jul 2024 16:24:27 +0300 Subject: [PATCH 20/31] fix form type --- src/pages/workspace/tags/TagGLCodePage.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/workspace/tags/TagGLCodePage.tsx b/src/pages/workspace/tags/TagGLCodePage.tsx index b8b705bc55b2..d6908a925fa0 100644 --- a/src/pages/workspace/tags/TagGLCodePage.tsx +++ b/src/pages/workspace/tags/TagGLCodePage.tsx @@ -26,9 +26,9 @@ type WorkspaceEditTagGLCodePageOnyxProps = { policyTags: OnyxEntry; }; -type EditCategoryPageProps = WorkspaceEditTagGLCodePageOnyxProps & StackScreenProps; +type EditTagGLCodePageProps = WorkspaceEditTagGLCodePageOnyxProps & StackScreenProps; -function TagGLCodePage({route, policyTags}: EditCategoryPageProps) { +function TagGLCodePage({route, policyTags}: EditTagGLCodePageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); const tagName = route.params.tagName; @@ -37,7 +37,7 @@ function TagGLCodePage({route, policyTags}: EditCategoryPageProps) { const {inputCallbackRef} = useAutoFocusInput(); const editGLCode = useCallback( - (values: FormOnyxValues) => { + (values: FormOnyxValues) => { const newGLCode = values.glCode.trim(); if (newGLCode !== glCode) { Tag.setPolicyTagGLCode(route.params.policyID, tagName, orderWeight, newGLCode); @@ -88,7 +88,7 @@ function TagGLCodePage({route, policyTags}: EditCategoryPageProps) { TagGLCodePage.displayName = 'TagGLCodePage'; -export default withOnyx({ +export default withOnyx({ policyTags: { key: ({route}) => `${ONYXKEYS.COLLECTION.POLICY_TAGS}${route?.params?.policyID}`, }, From baced460b427ca69b59e974d210e32ff8c02535b Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Tue, 2 Jul 2024 16:39:16 +0300 Subject: [PATCH 21/31] fix form handling --- src/pages/workspace/tags/TagGLCodePage.tsx | 10 +++++++--- src/types/form/WorkspaceTagForm.ts | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pages/workspace/tags/TagGLCodePage.tsx b/src/pages/workspace/tags/TagGLCodePage.tsx index d6908a925fa0..78ba024f067e 100644 --- a/src/pages/workspace/tags/TagGLCodePage.tsx +++ b/src/pages/workspace/tags/TagGLCodePage.tsx @@ -12,6 +12,7 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import * as PolicyUtils from '@libs/PolicyUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import * as Tag from '@userActions/Policy/Tag'; @@ -31,10 +32,13 @@ type EditTagGLCodePageProps = WorkspaceEditTagGLCodePageOnyxProps & StackScreenP function TagGLCodePage({route, policyTags}: EditTagGLCodePageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); + const {inputCallbackRef} = useAutoFocusInput(); + const tagName = route.params.tagName; const orderWeight = route.params.orderWeight; - const glCode = policyTags?.[tagName]; - const {inputCallbackRef} = useAutoFocusInput(); + const {tags} = PolicyUtils.getTagList(policyTags, orderWeight); + const glCode = tags?.[route.params.tagName]?.glCode; + console.log('[glCode]: ', glCode); const editGLCode = useCallback( (values: FormOnyxValues) => { @@ -73,7 +77,7 @@ function TagGLCodePage({route, policyTags}: EditTagGLCodePageProps) { ; From d27703406b4c91387de655e2e5f085b57304f03c Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Tue, 2 Jul 2024 16:49:49 +0300 Subject: [PATCH 22/31] rename to index --- src/libs/API/parameters/UpdatePolicyTagGLCodeParams.ts | 2 +- src/libs/actions/Policy/Tag.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/API/parameters/UpdatePolicyTagGLCodeParams.ts b/src/libs/API/parameters/UpdatePolicyTagGLCodeParams.ts index 6d3e488233f6..f720864a8f68 100644 --- a/src/libs/API/parameters/UpdatePolicyTagGLCodeParams.ts +++ b/src/libs/API/parameters/UpdatePolicyTagGLCodeParams.ts @@ -1,7 +1,7 @@ type UpdatePolicyTagGLCodeParams = { policyID: string; tagListName: string; - tagListOrderWeight: number; + tagListIndex: number; tagName: string; glCode: string; }; diff --git a/src/libs/actions/Policy/Tag.ts b/src/libs/actions/Policy/Tag.ts index 3ecd57e0fde9..08253ad80176 100644 --- a/src/libs/actions/Policy/Tag.ts +++ b/src/libs/actions/Policy/Tag.ts @@ -727,8 +727,8 @@ function setPolicyTagsRequired(policyID: string, requiresTag: boolean, tagListIn API.write(WRITE_COMMANDS.SET_POLICY_TAGS_REQUIRED, parameters, onyxData); } -function setPolicyTagGLCode(policyID: string, tagName: string, tagListOrderWeight: number, glCode: string) { - const tagListName = Object.keys(allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`] ?? {})[tagListOrderWeight]; +function setPolicyTagGLCode(policyID: string, tagName: string, tagListIndex: number, glCode: string) { + const tagListName = Object.keys(allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`] ?? {})[tagListIndex]; const policyTagToUpdate = allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`]?.[tagListName]?.tags?.[tagName] ?? {}; const onyxData: OnyxData = { optimisticData: [ @@ -792,7 +792,7 @@ function setPolicyTagGLCode(policyID: string, tagName: string, tagListOrderWeigh policyID, tagName, tagListName, - tagListOrderWeight, + tagListIndex, glCode, }; From 4258d80fc0a1f772ef66e1b5b29acc0ef731b2e2 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Tue, 2 Jul 2024 16:50:31 +0300 Subject: [PATCH 23/31] rm console --- src/pages/workspace/tags/TagGLCodePage.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/workspace/tags/TagGLCodePage.tsx b/src/pages/workspace/tags/TagGLCodePage.tsx index 78ba024f067e..113be6bb4d65 100644 --- a/src/pages/workspace/tags/TagGLCodePage.tsx +++ b/src/pages/workspace/tags/TagGLCodePage.tsx @@ -38,7 +38,6 @@ function TagGLCodePage({route, policyTags}: EditTagGLCodePageProps) { const orderWeight = route.params.orderWeight; const {tags} = PolicyUtils.getTagList(policyTags, orderWeight); const glCode = tags?.[route.params.tagName]?.glCode; - console.log('[glCode]: ', glCode); const editGLCode = useCallback( (values: FormOnyxValues) => { From 265e93fab9b69fb1dda8a547775b37c34667a34d Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Tue, 9 Jul 2024 16:02:39 +0300 Subject: [PATCH 24/31] fix spanish --- src/languages/es.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 89ff08d53db3..82b868066280 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2675,8 +2675,8 @@ export default { existingTagError: 'Ya existe una etiqueta con este nombre.', genericFailureMessage: 'Se produjo un error al actualizar la etiqueta. Por favor, inténtelo nuevamente.', importedFromAccountingSoftware: 'Etiquetas importadas desde', - glCode: 'GL code', - updateGLCodeFailureMessage: 'An error occurred while updating the GL code, please try again.', + glCode: 'Código GL', + updateGLCodeFailureMessage: 'Se produjo un error al actualizar el código GL. Por favor, inténtelo nuevamente.', }, taxes: { subtitle: 'Añade nombres, tasas y establezca valores por defecto para los impuestos.', From 18637b3c7056200c852db09dae5920150bcf2bf2 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Tue, 9 Jul 2024 16:07:33 +0300 Subject: [PATCH 25/31] fix meerge --- .../Navigation/AppNavigator/ModalStackNavigators/index.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 5421c5ba3cc1..4276fc00c981 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -250,11 +250,8 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/tags/WorkspaceEditTagsPage').default, [SCREENS.WORKSPACE.TAG_CREATE]: () => require('../../../../pages/workspace/tags/WorkspaceCreateTagPage').default, [SCREENS.WORKSPACE.TAG_EDIT]: () => require('../../../../pages/workspace/tags/EditTagPage').default, -<<<<<<< HEAD [SCREENS.WORKSPACE.TAG_GL_CODE]: () => require('../../../../pages/workspace/tags/TagGLCodePage').default, -======= [SCREENS.WORKSPACE.REPORT_FIELD_SETTINGS]: () => require('../../../../pages/workspace/reportFields/WorkspaceReportFieldSettingsPage').default, ->>>>>>> 9c32293ab6c0465eec38f1c573b8b5a09e1e112d [SCREENS.WORKSPACE.TAXES_SETTINGS]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsPage').default, [SCREENS.WORKSPACE.TAXES_SETTINGS_CUSTOM_TAX_NAME]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default, [SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default, From 2024f7aa47fcb861a8bb50b1d7fe88ea64a5ce9e Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Tue, 9 Jul 2024 16:09:20 +0300 Subject: [PATCH 26/31] add access check for control policy --- src/CONST.ts | 1 + src/libs/PolicyUtils.ts | 5 +++++ src/pages/workspace/AccessOrNotFoundWrapper.tsx | 1 + src/pages/workspace/tags/TagGLCodePage.tsx | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/CONST.ts b/src/CONST.ts index caf0b1453fae..c5953fb74a03 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -2048,6 +2048,7 @@ const CONST = { ACCESS_VARIANTS: { PAID: 'paid', ADMIN: 'admin', + CONTROL: 'control', }, DEFAULT_MAX_EXPENSE_AGE: 90, DEFAULT_MAX_EXPENSE_AMOUNT: 200000, diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index fc9a04e2507c..74709faedc9c 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -305,6 +305,10 @@ function isPaidGroupPolicy(policy: OnyxEntry): boolean { return policy?.type === CONST.POLICY.TYPE.TEAM || policy?.type === CONST.POLICY.TYPE.CORPORATE; } +function isControlPolicy(policy: OnyxEntry): boolean { + return policy?.type === CONST.POLICY.TYPE.CORPORATE; +} + function isTaxTrackingEnabled(isPolicyExpenseChat: boolean, policy: OnyxEntry, isDistanceRequest: boolean): boolean { const distanceUnit = getCustomUnit(policy); const customUnitID = distanceUnit?.customUnitID ?? 0; @@ -727,6 +731,7 @@ export { getIntegrationLastSuccessfulDate, getCurrentConnectionName, getCustomersOrJobsLabelNetSuite, + isControlPolicy, }; export type {MemberEmailsToAccountIDs}; diff --git a/src/pages/workspace/AccessOrNotFoundWrapper.tsx b/src/pages/workspace/AccessOrNotFoundWrapper.tsx index c7f89559fdda..770358335680 100644 --- a/src/pages/workspace/AccessOrNotFoundWrapper.tsx +++ b/src/pages/workspace/AccessOrNotFoundWrapper.tsx @@ -24,6 +24,7 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject'; const ACCESS_VARIANTS = { [CONST.POLICY.ACCESS_VARIANTS.PAID]: (policy: OnyxEntry) => PolicyUtils.isPaidGroupPolicy(policy), [CONST.POLICY.ACCESS_VARIANTS.ADMIN]: (policy: OnyxEntry, login: string) => PolicyUtils.isPolicyAdmin(policy, login), + [CONST.POLICY.ACCESS_VARIANTS.CONTROL]: (policy: OnyxEntry) => PolicyUtils.isControlPolicy(policy), [CONST.IOU.ACCESS_VARIANTS.CREATE]: ( policy: OnyxEntry, login: string, diff --git a/src/pages/workspace/tags/TagGLCodePage.tsx b/src/pages/workspace/tags/TagGLCodePage.tsx index 113be6bb4d65..97007293aec7 100644 --- a/src/pages/workspace/tags/TagGLCodePage.tsx +++ b/src/pages/workspace/tags/TagGLCodePage.tsx @@ -52,7 +52,7 @@ function TagGLCodePage({route, policyTags}: EditTagGLCodePageProps) { return ( From 8e942f72601be9023249727d6998d1592082d092 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Tue, 9 Jul 2024 19:01:10 +0300 Subject: [PATCH 27/31] Update src/pages/workspace/tags/TagGLCodePage.tsx --- src/pages/workspace/tags/TagGLCodePage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/tags/TagGLCodePage.tsx b/src/pages/workspace/tags/TagGLCodePage.tsx index 97007293aec7..ea54d58f27f6 100644 --- a/src/pages/workspace/tags/TagGLCodePage.tsx +++ b/src/pages/workspace/tags/TagGLCodePage.tsx @@ -76,7 +76,7 @@ function TagGLCodePage({route, policyTags}: EditTagGLCodePageProps) { Date: Tue, 9 Jul 2024 19:29:15 +0300 Subject: [PATCH 28/31] rename to GL Code --- src/types/onyx/PolicyTag.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/types/onyx/PolicyTag.ts b/src/types/onyx/PolicyTag.ts index e3de94a2b1ab..ec552515ec32 100644 --- a/src/types/onyx/PolicyTag.ts +++ b/src/types/onyx/PolicyTag.ts @@ -12,7 +12,8 @@ type PolicyTag = OnyxCommon.OnyxValueWithOfflineFeedback<{ previousTagName?: string; /** "General Ledger code" that corresponds to this tag in an accounting system. Similar to an ID. */ - glCode?: string; + // eslint-disable-next-line @typescript-eslint/naming-convention + 'GL Code'?: string; /** A list of errors keyed by microtime */ errors?: OnyxCommon.Errors | null; From c70e1566268480beba77c5eedced3f0d534bbb4f Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Tue, 9 Jul 2024 19:33:03 +0300 Subject: [PATCH 29/31] rename to GL Code --- src/libs/actions/Policy/Tag.ts | 9 ++++++--- src/pages/workspace/tags/TagGLCodePage.tsx | 2 +- src/pages/workspace/tags/TagSettingsPage.tsx | 4 ++-- src/types/onyx/PolicyTag.ts | 1 - 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/libs/actions/Policy/Tag.ts b/src/libs/actions/Policy/Tag.ts index 7f9464e1f691..f56b370e1276 100644 --- a/src/libs/actions/Policy/Tag.ts +++ b/src/libs/actions/Policy/Tag.ts @@ -756,9 +756,11 @@ function setPolicyTagGLCode(policyID: string, tagName: string, tagListIndex: num ...policyTagToUpdate, pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE, pendingFields: { - glCode: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE, + // eslint-disable-next-line @typescript-eslint/naming-convention + 'GL Code': CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE, }, - glCode, + // eslint-disable-next-line @typescript-eslint/naming-convention + 'GL Code': glCode, }, }, }, @@ -776,7 +778,8 @@ function setPolicyTagGLCode(policyID: string, tagName: string, tagListIndex: num errors: null, pendingAction: null, pendingFields: { - glCode: null, + // eslint-disable-next-line @typescript-eslint/naming-convention + 'GL Code': null, }, }, }, diff --git a/src/pages/workspace/tags/TagGLCodePage.tsx b/src/pages/workspace/tags/TagGLCodePage.tsx index ea54d58f27f6..5276e7e3b2d7 100644 --- a/src/pages/workspace/tags/TagGLCodePage.tsx +++ b/src/pages/workspace/tags/TagGLCodePage.tsx @@ -37,7 +37,7 @@ function TagGLCodePage({route, policyTags}: EditTagGLCodePageProps) { const tagName = route.params.tagName; const orderWeight = route.params.orderWeight; const {tags} = PolicyUtils.getTagList(policyTags, orderWeight); - const glCode = tags?.[route.params.tagName]?.glCode; + const glCode = tags?.[route.params.tagName]?.['GL Code']; const editGLCode = useCallback( (values: FormOnyxValues) => { diff --git a/src/pages/workspace/tags/TagSettingsPage.tsx b/src/pages/workspace/tags/TagSettingsPage.tsx index 784e30bf2257..a059fc4848c7 100644 --- a/src/pages/workspace/tags/TagSettingsPage.tsx +++ b/src/pages/workspace/tags/TagSettingsPage.tsx @@ -131,9 +131,9 @@ function TagSettingsPage({route, policyTags, navigation}: TagSettingsPageProps) shouldShowRightIcon /> - + Date: Tue, 9 Jul 2024 21:02:34 +0300 Subject: [PATCH 30/31] Apply suggestions from code review --- src/types/onyx/PolicyTag.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types/onyx/PolicyTag.ts b/src/types/onyx/PolicyTag.ts index 7d19d8a91bec..61ce9422e57c 100644 --- a/src/types/onyx/PolicyTag.ts +++ b/src/types/onyx/PolicyTag.ts @@ -12,6 +12,7 @@ type PolicyTag = OnyxCommon.OnyxValueWithOfflineFeedback<{ previousTagName?: string; /** "General Ledger code" that corresponds to this tag in an accounting system. Similar to an ID. */ + // eslint-disable-next-line @typescript-eslint/naming-convention 'GL Code'?: string; /** A list of errors keyed by microtime */ From 9d0fba21275c0ca6930eec36c5a9b9d21fdf0467 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Tue, 9 Jul 2024 21:05:53 +0300 Subject: [PATCH 31/31] Update src/types/onyx/PolicyTag.ts --- src/types/onyx/PolicyTag.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/onyx/PolicyTag.ts b/src/types/onyx/PolicyTag.ts index 61ce9422e57c..ec552515ec32 100644 --- a/src/types/onyx/PolicyTag.ts +++ b/src/types/onyx/PolicyTag.ts @@ -12,7 +12,7 @@ type PolicyTag = OnyxCommon.OnyxValueWithOfflineFeedback<{ previousTagName?: string; /** "General Ledger code" that corresponds to this tag in an accounting system. Similar to an ID. */ - // eslint-disable-next-line @typescript-eslint/naming-convention + // eslint-disable-next-line @typescript-eslint/naming-convention 'GL Code'?: string; /** A list of errors keyed by microtime */