Skip to content

Commit

Permalink
Merge pull request #46382 from Krishna2323/krishna2323/issue/45990
Browse files Browse the repository at this point in the history
fix: [Wave Control] Update the Report field list type creation flow.
  • Loading branch information
mountiny authored Aug 7, 2024
2 parents 8193c37 + 4c54aaf commit 0a33186
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
18 changes: 10 additions & 8 deletions src/pages/workspace/reportFields/CreateReportFieldsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ function CreateReportFieldsPage({
onTypeSelected={(type) => formRef.current?.resetForm({...inputValues, type, initialValue: type === CONST.REPORT_FIELD_TYPES.DATE ? defaultDate : ''})}
/>

{inputValues[INPUT_IDS.TYPE] === CONST.REPORT_FIELD_TYPES.LIST && (
<MenuItemWithTopDescription
description={translate('workspace.reportFields.listValues')}
shouldShowRightIcon
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS_LIST_VALUES.getRoute(policyID))}
title={formDraft?.[INPUT_IDS.LIST_VALUES]?.join(', ')}
numberOfLinesTitle={5}
/>
)}

{inputValues[INPUT_IDS.TYPE] === CONST.REPORT_FIELD_TYPES.TEXT && (
<InputWrapper
InputComponent={TextPicker}
Expand Down Expand Up @@ -178,14 +188,6 @@ function CreateReportFieldsPage({
rightLabel={translate('common.required')}
/>
)}

{inputValues[INPUT_IDS.TYPE] === CONST.REPORT_FIELD_TYPES.LIST && (
<MenuItemWithTopDescription
description={translate('workspace.reportFields.listValues')}
shouldShowRightIcon
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS_LIST_VALUES.getRoute(policyID))}
/>
)}
</View>
)}
</FormProvider>
Expand Down
21 changes: 12 additions & 9 deletions src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function ReportFieldsSettingsPage({
const isDateFieldType = reportField.type === CONST.REPORT_FIELD_TYPES.DATE;
const isListFieldType = reportField.type === CONST.REPORT_FIELD_TYPES.LIST;
const isListFieldEmpty = isListFieldType && reportField.values.length <= 0;
const listValues = Object.values(policy?.fieldList?.[reportFieldKey]?.values ?? {});

const deleteReportFieldAndHideModal = () => {
ReportField.deleteReportFields(policyID, [reportFieldKey]);
Expand Down Expand Up @@ -95,6 +96,17 @@ function ReportFieldsSettingsPage({
description={translate('common.type')}
interactive={false}
/>
{isListFieldType && (
<MenuItemWithTopDescription
style={[styles.moneyRequestMenuItem]}
titleStyle={styles.flex1}
description={translate('workspace.reportFields.listValues')}
shouldShowRightIcon
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS_LIST_VALUES.getRoute(policyID, reportFieldID))}
title={listValues.join(', ')}
numberOfLinesTitle={5}
/>
)}
{!isListFieldEmpty && (
<MenuItemWithTopDescription
style={[styles.moneyRequestMenuItem]}
Expand All @@ -106,15 +118,6 @@ function ReportFieldsSettingsPage({
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_EDIT_REPORT_FIELDS_INITIAL_VALUE.getRoute(policyID, reportFieldID))}
/>
)}
{isListFieldType && (
<MenuItemWithTopDescription
style={[styles.moneyRequestMenuItem]}
titleStyle={styles.flex1}
description={translate('workspace.reportFields.listValues')}
shouldShowRightIcon
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS_LIST_VALUES.getRoute(policyID, reportFieldID))}
/>
)}
{!hasAccountingConnections && (
<View style={styles.flexGrow1}>
<MenuItem
Expand Down

0 comments on commit 0a33186

Please sign in to comment.