Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 10 additions & 8 deletions src/pages/workspace/reportFields/CreateReportFieldsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,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 @@ -175,14 +185,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