From e0045fe78c60614cd0e2b579c13ffba52ac11b1f Mon Sep 17 00:00:00 2001 From: Shreeyash Shrestha Date: Mon, 30 Dec 2024 15:32:47 +0545 Subject: [PATCH] Add empty message and disable submit button while localUnitChangesFormField is empty --- .../LocalUnitsFormModal/LocalUnitsForm/i18n.json | 3 ++- .../LocalUnitsFormModal/LocalUnitsForm/index.tsx | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsFormModal/LocalUnitsForm/i18n.json b/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsFormModal/LocalUnitsForm/i18n.json index d5da2e4a0..c5e798b9d 100644 --- a/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsFormModal/LocalUnitsForm/i18n.json +++ b/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsFormModal/LocalUnitsForm/i18n.json @@ -86,6 +86,7 @@ "confirmChangesContentQuestion": "Are you sure you want to have these changes in this local unit?", "newLocalUnitDescription": "New local unit", "latitude": "Latitude", - "longitude": "Longitude" + "longitude": "Longitude", + "noChangesMessage": "You have made no changes to this local unit." } } diff --git a/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsFormModal/LocalUnitsForm/index.tsx b/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsFormModal/LocalUnitsForm/index.tsx index aeb31a29d..92b84c29b 100644 --- a/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsFormModal/LocalUnitsForm/index.tsx +++ b/app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsFormModal/LocalUnitsForm/index.tsx @@ -490,6 +490,9 @@ function LocalUnitsForm(props: Props) { const readOnly = readOnlyFromProps || localUnitDetailsResponse?.is_locked; + const emptyLocalUnitChangesFormFields = localUnitChangedFormFields + && localUnitChangedFormFields.length <= 0; + const { response: localUnitsOptions, pending: localUnitsOptionsPending, @@ -696,8 +699,11 @@ function LocalUnitsForm(props: Props) { @@ -1807,6 +1813,8 @@ function LocalUnitsForm(props: Props) { onClose={setShowChangesModalFalse} footerActions={submitButton} headerDescription={strings.confirmChangesContentQuestion} + empty={emptyLocalUnitChangesFormFields} + emptyMessage={strings.noChangesMessage} >