From d5a342b83ddc25b709161750bff40f613e77ffab Mon Sep 17 00:00:00 2001 From: Joy A Date: Mon, 11 Mar 2024 10:15:47 +0530 Subject: [PATCH] avniproject/avni-product#1453 | Ability to configure Subject Type settings --- public/documentation/toolTip.json | 4 ++- src/adminApp/Constant.js | 6 +++- src/adminApp/Reducers.js | 5 ++++ .../SubjectType/AdvancedSettingShow.js | 12 ++++++++ src/adminApp/SubjectType/AdvancedSettings.js | 28 ++++++++++++++++++- 5 files changed, 52 insertions(+), 3 deletions(-) diff --git a/public/documentation/toolTip.json b/public/documentation/toolTip.json index 8ad50e3fd..9a1d2b1cf 100644 --- a/public/documentation/toolTip.json +++ b/public/documentation/toolTip.json @@ -19,7 +19,9 @@ "APP_DESIGNER_NAME_HELP_TEXT": "Help text will be displayed on the first name field.", "APP_DESIGNER_SUBJECT_TYPE_GROUP_ROLES": "Member roles that you can choose from while adding members to this group", "APP_DESIGNER_SUBJECT_TYPE_SYC_BY_LOCATION": "This will sync the subjects by their registered locations and catchment assigned to the users", - "APP_DESIGNER_SUBJECT_TYPE_SYNC_BY_DIRECT_ASSIGNMENT": "This will sync the subjects which are sirectly assigned to the users", + "APP_DESIGNER_SUBJECT_TYPE_SYNC_BY_DIRECT_ASSIGNMENT": "This will sync the subjects which are directly assigned to the users", + "APP_DESIGNER_SUBJECT_TYPE_DISPLAY_REGISTRATION_DETAILS": "Controls if registration details are shown to the field user on subject profile screen", + "APP_DESIGNER_SUBJECT_TYPE_DISPLAY_PLANNED_ENCOUNTERS": "Controls if planned visits are shown to the field user on the subject dashboard screens", "APP_DESIGNER_SUBJECT_MEMBER_SUBJECT_TYPE": "Person subject type that can be added as member to the household", "APP_DESIGNER_PROFILE_PICTURE_ICON": "Profile picture of an individual", "APP_DESIGNER_PROGRAM_NAME": "Name of the program.", diff --git a/src/adminApp/Constant.js b/src/adminApp/Constant.js index 742a57687..fd2770bbe 100644 --- a/src/adminApp/Constant.js +++ b/src/adminApp/Constant.js @@ -20,5 +20,9 @@ export const subjectTypeInitialState = { subjectSummaryRule: "", programEligibilityCheckRule: "", shouldSyncByLocation: true, - lastNameOptional: false + lastNameOptional: false, + settings: { + displayRegistrationDetails: true, + displayPlannedEncounters: true + } }; diff --git a/src/adminApp/Reducers.js b/src/adminApp/Reducers.js index 9ca1b3877..cd295caf9 100644 --- a/src/adminApp/Reducers.js +++ b/src/adminApp/Reducers.js @@ -191,6 +191,11 @@ export function subjectTypeReducer(subjectType, action) { ...subjectType, nameHelpText: action.payload }; + case "settings": + return { + ...subjectType, + settings: { ...subjectType.settings, [action.payload.setting]: action.payload.value } + }; default: return subjectType; } diff --git a/src/adminApp/SubjectType/AdvancedSettingShow.js b/src/adminApp/SubjectType/AdvancedSettingShow.js index 302b1f3e9..b5425be85 100644 --- a/src/adminApp/SubjectType/AdvancedSettingShow.js +++ b/src/adminApp/SubjectType/AdvancedSettingShow.js @@ -67,6 +67,18 @@ export const AdvancedSettingShow = ({ locationTypes, subjectType }) => { status={subjectType.directlyAssignable} label={"Sync By Direct Assignment"} /> + {!isEmpty(subjectType.settings) && ( +
+ + +
+ )} dispatch({ type: "nameHelpText", payload: event.target.value })} /> + {!isEmpty(subjectType.settings) && ( +
+ + dispatch({ + type: "settings", + payload: { setting: "displayRegistrationDetails", value: event.target.checked } + }) + } + name="Display Registration Details" + toolTipKey={"APP_DESIGNER_SUBJECT_TYPE_DISPLAY_REGISTRATION_DETAILS"} + /> + + dispatch({ + type: "settings", + payload: { setting: "displayPlannedEncounters", value: event.target.checked } + }) + } + name="Display Planned Encounters" + toolTipKey={"APP_DESIGNER_SUBJECT_TYPE_DISPLAY_PLANNED_ENCOUNTERS"} + /> +
+ )} {"Sync Settings"}