diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 71f1217b..c94e4108 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -137,8 +137,8 @@ "AND_COUNT_MORE": "and {{count}} more", "RETURN_TO_LOGIN": "Return to Login", "NO_CENTER_FOUND": "No Center found", - "FILTER_BY":"Filter By", - "ALL":"All" + "FILTER_BY": "Filter By", + "ALL": "All" }, "LOGIN_PAGE": { "USERNAME": "Username", @@ -359,6 +359,7 @@ "UNIT_NAME": "Unit Name", "NOTE": "Note: This will be the center name", "CENTER_CREATED": "Center created successfully!", + "DUPLICATE_CENTER": "Cohort already exists", "RENAME_CENTER": "Rename Center", "REQUEST_TO_DELETE": "Request to Delete", "RENAME": "Rename", @@ -590,27 +591,24 @@ }, "OBSERVATION": { "OBSERVATION_START": "Start Observation", - "OBSERVATION_DETAILS":"Observation Details", - "ADD_ENTITY":"Add {{entityType}} in observation list", - "SEARCH_ENTITY":"Search {{entityType}} name", - "OBSERVATIONS":"{{name}} Observations", - "SEARCH_OBSERVATIONS":"Search Observations", - "CONTINUE":"Continue", - "SUBMITTED":"Submitted", - "FORM_SAVED_SUCCESSFULLY":"Form changes saved successfully", - "FORM_SUBMIT_SUCCESSFULLY":"Form submitted successfully", - "NOT_STARTED":"Not Started", - "COMPLETED":"Completed", - "INPROGRESS":"In-Progress", - "NO_DATA_FOUND":"No {{entity}} found", - "NO_RESULT_FOUND":"No Observations found for {{entity}}", - "NO_OBSERVATION_EXPIRED":"No observation expired for {{entity}}", - "DAYS_LEFT":"Days left", - "THIS_OBSERVATION_EXPIRED":"This observation is expired", - "DUE_DATE":"Due date", - "SURVEY_FORMS":"Survey forms" - - -} - + "OBSERVATION_DETAILS": "Observation Details", + "ADD_ENTITY": "Add {{entityType}} in observation list", + "SEARCH_ENTITY": "Search {{entityType}} name", + "OBSERVATIONS": "{{name}} Observations", + "SEARCH_OBSERVATIONS": "Search Observations", + "CONTINUE": "Continue", + "SUBMITTED": "Submitted", + "FORM_SAVED_SUCCESSFULLY": "Form changes saved successfully", + "FORM_SUBMIT_SUCCESSFULLY": "Form submitted successfully", + "NOT_STARTED": "Not Started", + "COMPLETED": "Completed", + "INPROGRESS": "In-Progress", + "NO_DATA_FOUND": "No {{entity}} found", + "NO_RESULT_FOUND": "No Observations found for {{entity}}", + "NO_OBSERVATION_EXPIRED": "No observation expired for {{entity}}", + "DAYS_LEFT": "Days left", + "THIS_OBSERVATION_EXPIRED": "This observation is expired", + "DUE_DATE": "Due date", + "SURVEY_FORMS": "Survey Forms" + } } diff --git a/src/components/center/CreateCenterModal.tsx b/src/components/center/CreateCenterModal.tsx index 45da03c1..f637504a 100644 --- a/src/components/center/CreateCenterModal.tsx +++ b/src/components/center/CreateCenterModal.tsx @@ -149,7 +149,7 @@ const CreateCenterModal: React.FC = ({ ).values() ); const cohortData = await createCohort(cohortDetails); - if (cohortData) { + if (cohortData.hasOwnProperty('cohortId')) { showToastMessage(t('CENTERS.CENTER_CREATED'), 'success'); const telemetryInteract = { context: { @@ -157,7 +157,7 @@ const CreateCenterModal: React.FC = ({ cdata: [], }, edata: { - id:'create-center-successfully', + id: 'create-center-successfully', type: Telemetry.CLICK, subtype: '', pageid: 'centers', @@ -168,6 +168,9 @@ const CreateCenterModal: React.FC = ({ onCenterAdded(); handleClose(); localStorage.removeItem('BMGSData'); + } else { + showToastMessage(t('CENTERS.DUPLICATE_CENTER'), 'error'); + handleClose(); } } };