-
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
Tags - Add GL Code #43155
Merged
Merged
Tags - Add GL Code #43155
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
2cd42f9
add route
rushatgabhane b09cd8c
add screen and lang
rushatgabhane 96f2aa3
add gl tag api params
rushatgabhane 3752df9
add gl tag api params
rushatgabhane 847c5d0
add gl tag api types
rushatgabhane 220699a
add gl tag to modal
rushatgabhane 1eaf84d
add glcode to full screen mapping
rushatgabhane 323da13
add linking config
rushatgabhane 0be74b5
add linking config
rushatgabhane 9591bbf
add api type
rushatgabhane 5108e1f
add gl code type for tag to onyx
rushatgabhane 0ef733b
add gl code api def
rushatgabhane 9f16aa9
add form types for gl code
rushatgabhane af0e638
merge main and add order weight
rushatgabhane dcc22bb
get taglist name by order weight
rushatgabhane 02ea77d
add base gl code tag page
rushatgabhane ad4fea1
Merge branch 'main' of github.com:rushatgabhane/exfy into gl-code-tags
rushatgabhane 2460c73
show glcode as menu item
rushatgabhane 2d6f859
fix lang and add navigate
rushatgabhane a7f2879
fix lint
rushatgabhane b4ba920
fix type
rushatgabhane 7a0b738
fix form type
rushatgabhane baced46
fix form handling
rushatgabhane d277034
rename to index
rushatgabhane 4258d80
rm console
rushatgabhane 8da2107
fix merge
rushatgabhane 265e93f
fix spanish
rushatgabhane 18637b3
fix meerge
rushatgabhane 2024f7a
add access check for control policy
rushatgabhane 8e942f7
Update src/pages/workspace/tags/TagGLCodePage.tsx
rushatgabhane c449bb9
rename to GL Code
rushatgabhane 411dbfb
Merge branch 'gl-code-tags' of github.com:rushatgabhane/exfy into gl-…
rushatgabhane c70e156
rename to GL Code
rushatgabhane e206329
Merge branch 'main' into gl-code-tags
rushatgabhane 02d6a1c
Apply suggestions from code review
rushatgabhane 9d0fba2
Update src/types/onyx/PolicyTag.ts
rushatgabhane 9f7f234
merge
rushatgabhane bb8c08f
Merge branch 'gl-code-tags' of github.com:rushatgabhane/exfy into gl-…
rushatgabhane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
GL code should not be editable when there are accounting enabled for the account. Fixed here #49629.