Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Tags - Add GL Code #43155

Merged
merged 38 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2cd42f9
add route
rushatgabhane Jun 6, 2024
b09cd8c
add screen and lang
rushatgabhane Jun 6, 2024
96f2aa3
add gl tag api params
rushatgabhane Jun 6, 2024
3752df9
add gl tag api params
rushatgabhane Jun 6, 2024
847c5d0
add gl tag api types
rushatgabhane Jun 6, 2024
220699a
add gl tag to modal
rushatgabhane Jun 6, 2024
1eaf84d
add glcode to full screen mapping
rushatgabhane Jun 6, 2024
323da13
add linking config
rushatgabhane Jun 6, 2024
0be74b5
add linking config
rushatgabhane Jun 6, 2024
9591bbf
add api type
rushatgabhane Jun 6, 2024
5108e1f
add gl code type for tag to onyx
rushatgabhane Jun 6, 2024
0ef733b
add gl code api def
rushatgabhane Jun 6, 2024
9f16aa9
add form types for gl code
rushatgabhane Jun 6, 2024
af0e638
merge main and add order weight
rushatgabhane Jun 26, 2024
dcc22bb
get taglist name by order weight
rushatgabhane Jun 26, 2024
02ea77d
add base gl code tag page
rushatgabhane Jun 26, 2024
ad4fea1
Merge branch 'main' of github.com:rushatgabhane/exfy into gl-code-tags
rushatgabhane Jul 2, 2024
2460c73
show glcode as menu item
rushatgabhane Jul 2, 2024
2d6f859
fix lang and add navigate
rushatgabhane Jul 2, 2024
a7f2879
fix lint
rushatgabhane Jul 2, 2024
b4ba920
fix type
rushatgabhane Jul 2, 2024
7a0b738
fix form type
rushatgabhane Jul 2, 2024
baced46
fix form handling
rushatgabhane Jul 2, 2024
d277034
rename to index
rushatgabhane Jul 2, 2024
4258d80
rm console
rushatgabhane Jul 2, 2024
8da2107
fix merge
rushatgabhane Jul 9, 2024
265e93f
fix spanish
rushatgabhane Jul 9, 2024
18637b3
fix meerge
rushatgabhane Jul 9, 2024
2024f7a
add access check for control policy
rushatgabhane Jul 9, 2024
8e942f7
Update src/pages/workspace/tags/TagGLCodePage.tsx
rushatgabhane Jul 9, 2024
c449bb9
rename to GL Code
rushatgabhane Jul 9, 2024
411dbfb
Merge branch 'gl-code-tags' of github.com:rushatgabhane/exfy into gl-…
rushatgabhane Jul 9, 2024
c70e156
rename to GL Code
rushatgabhane Jul 9, 2024
e206329
Merge branch 'main' into gl-code-tags
rushatgabhane Jul 9, 2024
02d6a1c
Apply suggestions from code review
rushatgabhane Jul 9, 2024
9d0fba2
Update src/types/onyx/PolicyTag.ts
rushatgabhane Jul 9, 2024
9f7f234
merge
rushatgabhane Jul 10, 2024
bb8c08f
Merge branch 'gl-code-tags' of github.com:rushatgabhane/exfy into gl-…
rushatgabhane Jul 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2145,6 +2145,7 @@ const CONST = {
ACCESS_VARIANTS: {
PAID: 'paid',
ADMIN: 'admin',
CONTROL: 'control',
},
DEFAULT_MAX_EXPENSE_AGE: 90,
DEFAULT_MAX_EXPENSE_AMOUNT: 200000,
Expand Down Expand Up @@ -5238,6 +5239,7 @@ const CONST = {
},
},

MAX_LENGTH_256: 256,
WORKSPACE_CARDS_LIST_LABEL_TYPE: {
CURRENT_BALANCE: 'currentBalance',
REMAINING_LIMIT: 'remainingLimit',
Expand Down
4 changes: 4 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,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,
Expand Down
1 change: 1 addition & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,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',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2800,6 +2800,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.',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2846,6 +2846,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: '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.',
Expand Down
9 changes: 9 additions & 0 deletions src/libs/API/parameters/UpdatePolicyTagGLCodeParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type UpdatePolicyTagGLCodeParams = {
policyID: string;
tagListName: string;
tagListIndex: number;
tagName: string;
glCode: string;
};

export default UpdatePolicyTagGLCodeParams;
1 change: 1 addition & 0 deletions src/libs/API/parameters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,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';
Expand Down
2 changes: 2 additions & 0 deletions src/libs/API/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,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',
Expand Down Expand Up @@ -432,6 +433,7 @@ type WriteCommandParameters = {
[WRITE_COMMANDS.RENAME_POLICY_TAG_LIST]: Parameters.RenamePolicyTaglistParams;
[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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.WORKSPACE.TAGS_EDIT]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/WorkspaceEditTagsPage').default,
[SCREENS.WORKSPACE.TAG_CREATE]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/WorkspaceCreateTagPage').default,
[SCREENS.WORKSPACE.TAG_EDIT]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/EditTagPage').default,
[SCREENS.WORKSPACE.TAG_GL_CODE]: () => require<ReactComponentModule>('../../../../pages/workspace/tags/TagGLCodePage').default,
[SCREENS.WORKSPACE.TAXES_SETTINGS]: () => require<ReactComponentModule>('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsPage').default,
[SCREENS.WORKSPACE.TAXES_SETTINGS_CUSTOM_TAX_NAME]: () => require<ReactComponentModule>('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default,
[SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require<ReactComponentModule>('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial<Record<FullScreenName, string[]>> = {
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]: [
Expand Down
7 changes: 7 additions & 0 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,13 @@ const config: LinkingOptions<RootStackParamList>['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: {
Expand Down
5 changes: 5 additions & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ type SettingsNavigatorParamList = {
orderWeight: number;
tagName: string;
};
[SCREENS.WORKSPACE.TAG_GL_CODE]: {
policyID: string;
orderWeight: number;
tagName: string;
};
[SCREENS.SETTINGS.SUBSCRIPTION.ROOT]: undefined;
[SCREENS.SETTINGS.SUBSCRIPTION.SIZE]: {
canChangeSize: 0 | 1;
Expand Down
5 changes: 5 additions & 0 deletions src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ function isPaidGroupPolicy(policy: OnyxEntry<Policy>): boolean {
return policy?.type === CONST.POLICY.TYPE.TEAM || policy?.type === CONST.POLICY.TYPE.CORPORATE;
}

function isControlPolicy(policy: OnyxEntry<Policy>): boolean {
return policy?.type === CONST.POLICY.TYPE.CORPORATE;
}

function isTaxTrackingEnabled(isPolicyExpenseChat: boolean, policy: OnyxEntry<Policy>, isDistanceRequest: boolean): boolean {
const distanceUnit = getCustomUnit(policy);
const customUnitID = distanceUnit?.customUnitID ?? 0;
Expand Down Expand Up @@ -806,6 +810,7 @@ export {
getIntegrationLastSuccessfulDate,
getCurrentConnectionName,
getCustomersOrJobsLabelNetSuite,
isControlPolicy,
isNetSuiteCustomSegmentRecord,
getNameFromNetSuiteCustomField,
isNetSuiteCustomFieldPropertyEditable,
Expand Down
86 changes: 85 additions & 1 deletion src/libs/actions/Policy/Tag.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import type {NullishDeep, OnyxCollection, OnyxEntry} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import * as API from '@libs/API';
import type {EnablePolicyTagsParams, OpenPolicyTagsPageParams, RenamePolicyTaglistParams, RenamePolicyTagsParams, SetPolicyTagsEnabled, SetPolicyTagsRequired} from '@libs/API/parameters';
import type {
EnablePolicyTagsParams,
OpenPolicyTagsPageParams,
RenamePolicyTaglistParams,
RenamePolicyTagsParams,
SetPolicyTagsEnabled,
SetPolicyTagsRequired,
UpdatePolicyTagGLCodeParams,
} from '@libs/API/parameters';
import {READ_COMMANDS, WRITE_COMMANDS} from '@libs/API/types';
import * as ErrorUtils from '@libs/ErrorUtils';
import getIsNarrowLayout from '@libs/getIsNarrowLayout';
Expand Down Expand Up @@ -733,6 +741,81 @@ function setPolicyTagsRequired(policyID: string, requiresTag: boolean, tagListIn
API.write(WRITE_COMMANDS.SET_POLICY_TAGS_REQUIRED, parameters, onyxData);
}

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: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`,
value: {
[tagListName]: {
tags: {
[tagName]: {
...policyTagToUpdate,
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
pendingFields: {
// eslint-disable-next-line @typescript-eslint/naming-convention
'GL Code': CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
},
// eslint-disable-next-line @typescript-eslint/naming-convention
'GL Code': glCode,
},
},
},
},
},
],
successData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`,
value: {
[tagListName]: {
tags: {
[tagName]: {
errors: null,
pendingAction: null,
pendingFields: {
// eslint-disable-next-line @typescript-eslint/naming-convention
'GL Code': null,
},
},
},
},
},
},
],
failureData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`,
value: {
[tagListName]: {
tags: {
[tagName]: {
...policyTagToUpdate,
errors: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('workspace.tags.updateGLCodeFailureMessage'),
},
},
},
},
},
],
};

const parameters: UpdatePolicyTagGLCodeParams = {
policyID,
tagName,
tagListName,
tagListIndex,
glCode,
};

API.write(WRITE_COMMANDS.UPDATE_POLICY_TAG_GL_CODE, parameters, onyxData);
}

export {
buildOptimisticPolicyRecentlyUsedTags,
setPolicyRequiresTag,
Expand All @@ -747,6 +830,7 @@ export {
renamePolicyTag,
renamePolicyTaglist,
setWorkspaceTagEnabled,
setPolicyTagGLCode,
};

export type {NewCustomUnit};
1 change: 1 addition & 0 deletions src/pages/workspace/AccessOrNotFoundWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject';
const ACCESS_VARIANTS = {
[CONST.POLICY.ACCESS_VARIANTS.PAID]: (policy: OnyxEntry<OnyxTypes.Policy>) => PolicyUtils.isPaidGroupPolicy(policy),
[CONST.POLICY.ACCESS_VARIANTS.ADMIN]: (policy: OnyxEntry<OnyxTypes.Policy>, login: string) => PolicyUtils.isPolicyAdmin(policy, login),
[CONST.POLICY.ACCESS_VARIANTS.CONTROL]: (policy: OnyxEntry<OnyxTypes.Policy>) => PolicyUtils.isControlPolicy(policy),
[CONST.IOU.ACCESS_VARIANTS.CREATE]: (
policy: OnyxEntry<OnyxTypes.Policy>,
login: string,
Expand Down
98 changes: 98 additions & 0 deletions src/pages/workspace/tags/TagGLCodePage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
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 * as PolicyUtils from '@libs/PolicyUtils';
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 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<PolicyTagList>;
};

type EditTagGLCodePageProps = WorkspaceEditTagGLCodePageOnyxProps & StackScreenProps<SettingsNavigatorParamList, typeof SCREENS.WORKSPACE.TAG_GL_CODE>;

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 {tags} = PolicyUtils.getTagList(policyTags, orderWeight);
const glCode = tags?.[route.params.tagName]?.['GL Code'];

const editGLCode = useCallback(
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.WORKSPACE_TAG_FORM>) => {
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 (
<AccessOrNotFoundWrapper
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.CONTROL]}
policyID={route.params.policyID}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CATEGORIES_ENABLED}
>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
style={[styles.defaultModalContainer]}
testID={TagGLCodePage.displayName}
shouldEnableMaxHeight
>
<HeaderWithBackButton
title={translate('workspace.tags.glCode')}
onBackButtonPress={() => Navigation.goBack()}
/>
<FormProvider
formID={ONYXKEYS.FORMS.WORKSPACE_TAG_FORM}
onSubmit={editGLCode}
submitButtonText={translate('common.save')}
style={[styles.mh5, styles.flex1]}
enabledWhenOffline
>
<InputWrapper
ref={inputCallbackRef}
InputComponent={TextInput}
defaultValue={glCode}
label={translate('workspace.tags.glCode')}
accessibilityLabel={translate('workspace.tags.glCode')}
inputID={INPUT_IDS.TAG_GL_CODE}
role={CONST.ROLE.PRESENTATION}
maxLength={CONST.MAX_LENGTH_256}
/>
</FormProvider>
</ScreenWrapper>
</AccessOrNotFoundWrapper>
);
}

TagGLCodePage.displayName = 'TagGLCodePage';

export default withOnyx<EditTagGLCodePageProps, WorkspaceEditTagGLCodePageOnyxProps>({
policyTags: {
key: ({route}) => `${ONYXKEYS.COLLECTION.POLICY_TAGS}${route?.params?.policyID}`,
},
})(TagGLCodePage);
12 changes: 12 additions & 0 deletions src/pages/workspace/tags/TagSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -127,6 +131,14 @@ function TagSettingsPage({route, policyTags, navigation}: TagSettingsPageProps)
shouldShowRightIcon
/>
</OfflineWithFeedback>
<OfflineWithFeedback pendingAction={currentPolicyTag.pendingFields?.['GL Code']}>
<MenuItemWithTopDescription
title={currentPolicyTag['GL Code']}
description={translate(`workspace.tags.glCode`)}
onPress={navigateToEditGlCode}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GL code should not be editable when there are accounting enabled for the account. Fixed here #49629.

shouldShowRightIcon
/>
</OfflineWithFeedback>
{shouldShowDeleteMenuItem && (
<MenuItem
icon={Expensicons.Trashcan}
Expand Down
Loading
Loading