From 744523ea6271ac4e6a28111960cbe5080e2135db Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Sun, 28 Jul 2024 21:47:23 +0530 Subject: [PATCH 1/5] fix: [Wave Control] Update the Report field list type creation flow. Signed-off-by: krishna2323 --- .../reportFields/CreateReportFieldsPage.tsx | 18 +++++++++------- .../reportFields/ReportFieldsSettingsPage.tsx | 21 +++++++++++-------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx b/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx index 783434bd8d96..2c5239c3b67b 100644 --- a/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx +++ b/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx @@ -144,6 +144,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 && ( + 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 && ( )} - - {inputValues[INPUT_IDS.TYPE] === CONST.REPORT_FIELD_TYPES.LIST && ( - Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS_LIST_VALUES.getRoute(policyID))} - /> - )} )} diff --git a/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx b/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx index 58f8f96bdb78..a6ff122510ec 100644 --- a/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx +++ b/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx @@ -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]); @@ -83,6 +84,17 @@ function ReportFieldsSettingsPage({ description={translate('common.type')} interactive={false} /> + {isListFieldType && ( + Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS_LIST_VALUES.getRoute(policyID, reportFieldID))} + title={listValues.join(', ')} + numberOfLinesTitle={5} + /> + )} {!isListFieldEmpty && ( Navigation.navigate(ROUTES.WORKSPACE_EDIT_REPORT_FIELDS_INITIAL_VALUE.getRoute(policyID, reportFieldID))} /> )} - {isListFieldType && ( - Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS_LIST_VALUES.getRoute(policyID, reportFieldID))} - /> - )} {!hasAccountingConnections && ( Date: Mon, 5 Aug 2024 15:24:12 +0530 Subject: [PATCH 2/5] fix: merge conflicts. Signed-off-by: krishna2323 --- .../reportFields/ReportFieldsSettingsPage.tsx | 92 ++++++++++--------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx b/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx index a6ff122510ec..347993b1b96b 100644 --- a/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx +++ b/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx @@ -70,51 +70,6 @@ function ReportFieldsSettingsPage({ title={reportField.name} shouldSetModalVisibility={false} /> - - - {isListFieldType && ( - Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS_LIST_VALUES.getRoute(policyID, reportFieldID))} - title={listValues.join(', ')} - numberOfLinesTitle={5} - /> - )} - {!isListFieldEmpty && ( - Navigation.navigate(ROUTES.WORKSPACE_EDIT_REPORT_FIELDS_INITIAL_VALUE.getRoute(policyID, reportFieldID))} - /> - )} - {!hasAccountingConnections && ( - - setIsDeleteModalVisible(true)} - /> - - )} + + + + {isListFieldType && ( + Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS_LIST_VALUES.getRoute(policyID, reportFieldID))} + title={listValues.join(', ')} + numberOfLinesTitle={5} + /> + )} + {!isListFieldEmpty && ( + Navigation.navigate(ROUTES.WORKSPACE_EDIT_REPORT_FIELDS_INITIAL_VALUE.getRoute(policyID, reportFieldID))} + /> + )} + {!hasAccountingConnections && ( + + setIsDeleteModalVisible(true)} + /> + + )} + ); From fc09fd760c806a7eda83d4dcd6d99c9fe590e010 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Mon, 5 Aug 2024 15:25:13 +0530 Subject: [PATCH 3/5] remove view component. Signed-off-by: krishna2323 --- .../reportFields/ReportFieldsSettingsPage.tsx | 74 +++++++++---------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx b/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx index 347993b1b96b..6cbf453da9a3 100644 --- a/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx +++ b/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx @@ -81,53 +81,51 @@ function ReportFieldsSettingsPage({ cancelText={translate('common.cancel')} danger /> - + + + {isListFieldType && ( Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS_LIST_VALUES.getRoute(policyID, reportFieldID))} + title={listValues.join(', ')} + numberOfLinesTitle={5} /> + )} + {!isListFieldEmpty && ( Navigation.navigate(ROUTES.WORKSPACE_EDIT_REPORT_FIELDS_INITIAL_VALUE.getRoute(policyID, reportFieldID))} /> - {isListFieldType && ( - Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS_LIST_VALUES.getRoute(policyID, reportFieldID))} - title={listValues.join(', ')} - numberOfLinesTitle={5} - /> - )} - {!isListFieldEmpty && ( - Navigation.navigate(ROUTES.WORKSPACE_EDIT_REPORT_FIELDS_INITIAL_VALUE.getRoute(policyID, reportFieldID))} + )} + {!hasAccountingConnections && ( + + setIsDeleteModalVisible(true)} /> - )} - {!hasAccountingConnections && ( - - setIsDeleteModalVisible(true)} - /> - - )} - + + )} ); From f4c0bbc0d0aa87ab3191756f646c70515cb54a36 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Mon, 5 Aug 2024 15:26:09 +0530 Subject: [PATCH 4/5] move ConfirmModal at the bottom. Signed-off-by: krishna2323 --- .../reportFields/ReportFieldsSettingsPage.tsx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx b/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx index 6cbf453da9a3..a6ff122510ec 100644 --- a/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx +++ b/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx @@ -70,17 +70,6 @@ function ReportFieldsSettingsPage({ title={reportField.name} shouldSetModalVisibility={false} /> - setIsDeleteModalVisible(false)} - shouldSetModalVisibility={false} - prompt={translate('workspace.reportFields.deleteConfirmation')} - confirmText={translate('common.delete')} - cancelText={translate('common.cancel')} - danger - /> )} + setIsDeleteModalVisible(false)} + shouldSetModalVisibility={false} + prompt={translate('workspace.reportFields.deleteConfirmation')} + confirmText={translate('common.delete')} + cancelText={translate('common.cancel')} + danger + /> ); From 3c15a2fcdd7a14a608dcf611a78f9cea55bae632 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Mon, 5 Aug 2024 15:30:06 +0530 Subject: [PATCH 5/5] merge conflicts. Signed-off-by: krishna2323 --- .../reportFields/ReportFieldsSettingsPage.tsx | 92 ++++++++++--------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx b/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx index a6ff122510ec..347993b1b96b 100644 --- a/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx +++ b/src/pages/workspace/reportFields/ReportFieldsSettingsPage.tsx @@ -70,51 +70,6 @@ function ReportFieldsSettingsPage({ title={reportField.name} shouldSetModalVisibility={false} /> - - - {isListFieldType && ( - Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS_LIST_VALUES.getRoute(policyID, reportFieldID))} - title={listValues.join(', ')} - numberOfLinesTitle={5} - /> - )} - {!isListFieldEmpty && ( - Navigation.navigate(ROUTES.WORKSPACE_EDIT_REPORT_FIELDS_INITIAL_VALUE.getRoute(policyID, reportFieldID))} - /> - )} - {!hasAccountingConnections && ( - - setIsDeleteModalVisible(true)} - /> - - )} + + + + {isListFieldType && ( + Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS_LIST_VALUES.getRoute(policyID, reportFieldID))} + title={listValues.join(', ')} + numberOfLinesTitle={5} + /> + )} + {!isListFieldEmpty && ( + Navigation.navigate(ROUTES.WORKSPACE_EDIT_REPORT_FIELDS_INITIAL_VALUE.getRoute(policyID, reportFieldID))} + /> + )} + {!hasAccountingConnections && ( + + setIsDeleteModalVisible(true)} + /> + + )} + );