diff --git a/public/documentation/toolTip.json b/public/documentation/toolTip.json
index 9a1d2b1cf..5b75ab8c1 100644
--- a/public/documentation/toolTip.json
+++ b/public/documentation/toolTip.json
@@ -196,5 +196,6 @@
"ENABLE_MESSAGING_BUTTON": "Enable messaging through WhatsApp. Requires a Glific account",
"APP_DESIGNER_MESSAGE_RULE_NAME": "Name",
"APP_DESIGNER_SELECT_MESSAGE_TEMPLATE": "Choose the message template",
- "APP_DESIGNER_SELECT_RECEIVER_TYPE": "Choose the receiver type"
+ "APP_DESIGNER_SELECT_RECEIVER_TYPE": "Choose the receiver type",
+ "IGNORE_SYNC_SETTINGS_IN_DEA": "Ignore the SubjectType sync settings restrictions in the Data Entry app."
}
diff --git a/src/adminApp/user.js b/src/adminApp/user.js
index 477ee1e1c..74275ba28 100644
--- a/src/adminApp/user.js
+++ b/src/adminApp/user.js
@@ -1,10 +1,10 @@
-import _, { filter, get, isEmpty, isFinite, isNil, map, some, startCase, sortBy } from "lodash";
+import _, { filter, get, isEmpty, isFinite, isNil, map, some, sortBy, startCase } from "lodash";
import React, { cloneElement, Fragment, useContext, useEffect, useState } from "react";
import {
ArrayField,
ArrayInput,
- Create,
ChipField,
+ Create,
Datagrid,
DisabledInput,
Edit,
@@ -85,9 +85,7 @@ const UserGroupsDisplay = ({ record, style }) => (
{_.isArrayLike(record.userGroups) &&
record.userGroups
.filter(ug => ug && !ug.voided)
- .map(userGroup => (
-
- ))}
+ .map(userGroup => )}
);
@@ -110,13 +108,7 @@ export const UserList = ({ ...props }) => {
-
+
@@ -124,13 +116,7 @@ export const UserList = ({ ...props }) => {
- user.voided === true
- ? "Deleted"
- : user.disabledInCognito === true
- ? "Disabled"
- : "Active"
- }
+ render={user => (user.voided === true ? "Deleted" : user.disabledInCognito === true ? "Disabled" : "Active")}
/>
@@ -145,12 +131,7 @@ const CustomShowActions = ({ hasEditUserPrivilege, basePath, data, resource }) =
-
+
)}
@@ -169,9 +150,7 @@ const formatLang = lang =>
const SubjectTypeSyncAttributeShow = ({ subjectType, syncConceptValueMap, ...props }) => (
-
{`Sync settings for Subject Type: ${
- subjectType.name
- }`}
+
{`Sync settings for Subject Type: ${subjectType.name}`}
{subjectType.syncAttribute1 && (
);
-const ConceptSyncAttributeShow = ({
- subjectType,
- syncConceptValueMap,
- syncAttributeName,
- ...props
-}) => {
+const ConceptSyncAttributeShow = ({ subjectType, syncConceptValueMap, syncAttributeName, ...props }) => {
const syncSettings = get(props.record, ["syncSettings", subjectType.name], {});
const conceptUUID = get(syncSettings, [syncAttributeName]);
if (isEmpty(conceptUUID)) return null;
return (
-
- {startCase(syncAttributeName)}
-
+ {startCase(syncAttributeName)}
{map(get(syncSettings, `${syncAttributeName}Values`, []), value => (
-
+
))}
);
@@ -222,23 +190,13 @@ export const UserDetail = ({ user, hasEditUserPrivilege, ...props }) => {
fetchSyncAttributeData(setSyncAttributesData);
return (
- }
- actions={}
- {...props}
- >
+ } actions={} {...props}>
-
+
@@ -248,11 +206,13 @@ export const UserDetail = ({ user, hasEditUserPrivilege, ...props }) => {
+ formatOperatingScope(user.operatingIndividualScope)} />
+
+ Sync Settings
formatOperatingScope(user.operatingIndividualScope)}
+ label="Below Subject type Sync settings are to be ignored in the Data Entry app: "
+ render={user => (user.ignoreSyncSettingsInDEA ? "Yes" : "No")}
/>
-
{map(syncAttributesData.subjectTypes, st => (
{
syncConceptValueMap={syncAttributesData.syncConceptValueMap}
/>
))}
- (!isNil(user.settings) ? formatLang(user.settings.locale) : "")}
- />
- (!isNil(user.settings) ? user.settings.datePickerMode : "Calendar")}
- />
- (!isNil(user.settings) ? user.settings.timePickerMode : "Clock")}
- />
+ (!isNil(user.settings) ? formatLang(user.settings.locale) : "")} />
+ (!isNil(user.settings) ? user.settings.datePickerMode : "Calendar")} />
+ (!isNil(user.settings) ? user.settings.timePickerMode : "Clock")} />
- !isNil(user.settings) ? (user.settings.trackLocation ? "True" : "False") : ""
- }
+ render={user => (!isNil(user.settings) ? (user.settings.trackLocation ? "True" : "False") : "")}
/>
- !isNil(user.settings) ? (user.settings.showBeneficiaryMode ? "True" : "False") : ""
- }
+ render={user => (!isNil(user.settings) ? (user.settings.showBeneficiaryMode ? "True" : "False") : "")}
/>
- !isNil(user.settings) ? (user.settings.disableAutoRefresh ? "True" : "False") : ""
- }
+ render={user => (!isNil(user.settings) ? (user.settings.disableAutoRefresh ? "True" : "False") : "")}
/>
- !isNil(user.settings) ? (user.settings.disableAutoSync ? "True" : "False") : ""
- }
+ render={user => (!isNil(user.settings) ? (user.settings.disableAutoSync ? "True" : "False") : "")}
/>
- !isNil(user.settings) ? (user.settings.registerEnrol ? "True" : "False") : ""
- }
+ render={user => (!isNil(user.settings) ? (user.settings.registerEnrol ? "True" : "False") : "")}
/>
- !isNil(user.settings) ? (user.settings.enableCallMasking ? "True" : "False") : ""
- }
+ render={user => (!isNil(user.settings) ? (user.settings.enableCallMasking ? "True" : "False") : "")}
/>
createdAudit(audit)} />
@@ -328,23 +267,9 @@ This might take time depending on the data.`;
const SubjectTypeSyncAttributes = ({ subjectType, ...props }) => (
- {`Sync settings for Subject Type: ${
- subjectType.name
- }`}
- {subjectType.syncAttribute1 && (
-
- )}
- {subjectType.syncAttribute2 && (
-
- )}
+ {`Sync settings for Subject Type: ${subjectType.name}`}
+ {subjectType.syncAttribute1 && }
+ {subjectType.syncAttribute2 && }
);
@@ -352,26 +277,16 @@ const ConceptSyncAttribute = ({ subjectType, syncAttributeName, edit, ...props }
return (
{({ formData, dispatch }) => {
- const syncAttributeConceptUUID = get(
- formData,
- `syncSettings.${[subjectType.name]}.${syncAttributeName}`
- );
+ const syncAttributeConceptUUID = get(formData, `syncSettings.${[subjectType.name]}.${syncAttributeName}`);
const syncAttributeConcept = subjectType[syncAttributeName];
- const selectedValue = get(
- formData,
- `syncSettings.${[subjectType.name]}.${syncAttributeName}`
- );
+ const selectedValue = get(formData, `syncSettings.${[subjectType.name]}.${syncAttributeName}`);
const defaultValue = selectedValue ? { defaultValue: selectedValue } : {};
const [answerConcepts, setAnswerConcepts] = useState([]);
- const syncAttributeValuesFieldName = `syncSettings.${[
- subjectType.name
- ]}.${syncAttributeName}Values`;
+ const syncAttributeValuesFieldName = `syncSettings.${[subjectType.name]}.${syncAttributeName}Values`;
const selectedSyncAttributeValueIds = get(formData, syncAttributeValuesFieldName);
- const selectedAnswerConcepts = filter(answerConcepts, x =>
- some(selectedSyncAttributeValueIds, y => x.id === y)
- );
+ const selectedAnswerConcepts = filter(answerConcepts, x => some(selectedSyncAttributeValueIds, y => x.id === y));
useEffect(() => {
if (isEmpty(syncAttributeConceptUUID)) setAnswerConcepts([]);
@@ -409,31 +324,16 @@ const ConceptSyncAttribute = ({ subjectType, syncAttributeName, edit, ...props }
options={answerConcepts.map(ReactSelectHelper.toReactSelectItem)}
style={{ width: "auto" }}
onChange={event => {
- const selectedValues = ReactSelectHelper.getCurrentValues(event).map(
- x => x.id
- );
- dispatch(
- change(REDUX_FORM_NAME, syncAttributeValuesFieldName, selectedValues)
- );
+ const selectedValues = ReactSelectHelper.getCurrentValues(event).map(x => x.id);
+ dispatch(change(REDUX_FORM_NAME, syncAttributeValuesFieldName, selectedValues));
}}
/>
) : (
-
- {"Values to sync"}
-
-
+ {"Values to sync"}
+
-
+
@@ -454,14 +354,8 @@ const getSyncConceptValueMap = async sortedSubjectTypes => {
const syncConceptValueMap = new Map();
const codedConceptUUIDSet = new Set();
sortedSubjectTypes.forEach(subject => {
- const syncAttribute1UUID =
- subject.syncAttribute1 &&
- subject.syncAttribute1.dataType === "Coded" &&
- subject.syncAttribute1.id;
- const syncAttribute2UUID =
- subject.syncAttribute2 &&
- subject.syncAttribute2.dataType === "Coded" &&
- subject.syncAttribute2.id;
+ const syncAttribute1UUID = subject.syncAttribute1 && subject.syncAttribute1.dataType === "Coded" && subject.syncAttribute1.id;
+ const syncAttribute2UUID = subject.syncAttribute2 && subject.syncAttribute2.dataType === "Coded" && subject.syncAttribute2.id;
syncAttribute1UUID && codedConceptUUIDSet.add(syncAttribute1UUID);
syncAttribute2UUID && codedConceptUUIDSet.add(syncAttribute2UUID);
});
@@ -479,11 +373,7 @@ function fetchSyncAttributeData(setSyncAttributesData) {
useEffect(() => {
let isMounted = true;
http.get("/subjectType/syncAttributesData").then(res => {
- const {
- subjectTypes,
- anySubjectTypeDirectlyAssignable,
- anySubjectTypeSyncByLocation
- } = res.data;
+ const { subjectTypes, anySubjectTypeDirectlyAssignable, anySubjectTypeSyncByLocation } = res.data;
const sortedSubjectTypes = sortBy(subjectTypes, "id");
getSyncConceptValueMap(sortedSubjectTypes).then(syncConceptValueMap => {
@@ -506,17 +396,13 @@ function fetchSyncAttributeData(setSyncAttributesData) {
const UserForm = ({ edit, nameSuffix, ...props }) => {
const [languages, setLanguages] = useState([]);
const [syncAttributesData, setSyncAttributesData] = useState(initialSyncAttributes);
- const isSyncSettingsRequired =
- syncAttributesData.subjectTypes.length > 0 ||
- syncAttributesData.isAnySubjectTypeDirectlyAssignable;
+ const isSyncSettingsRequired = syncAttributesData.subjectTypes.length > 0 || syncAttributesData.isAnySubjectTypeDirectlyAssignable;
useEffect(() => {
http.get("/organisationConfig").then(res => {
const organisationLocales = isEmpty(res.data._embedded.organisationConfig)
? [localeChoices[0]]
- : filter(localeChoices, l =>
- res.data._embedded.organisationConfig[0].settings.languages.includes(l.id)
- );
+ : filter(localeChoices, l => res.data._embedded.organisationConfig[0].settings.languages.includes(l.id));
setLanguages(organisationLocales);
});
}, []);
@@ -529,12 +415,7 @@ const UserForm = ({ edit, nameSuffix, ...props }) => {
save
});
return (
- }
- {...sanitizeProps(props)}
- redirect="show"
- validate={validatePasswords}
- >
+ } {...sanitizeProps(props)} redirect="show" validate={validatePasswords}>
{edit ? (
) : (
@@ -547,10 +428,7 @@ const UserForm = ({ edit, nameSuffix, ...props }) => {
source="ignored"
validate={isRequired}
label={"Login ID (username)"}
- onChange={(e, newVal) =>
- !isEmpty(newVal) &&
- dispatch(change(REDUX_FORM_NAME, "username", newVal + "@" + nameSuffix))
- }
+ onChange={(e, newVal) => !isEmpty(newVal) && dispatch(change(REDUX_FORM_NAME, "username", newVal + "@" + nameSuffix))}
{...rest}
toolTipKey={"ADMIN_USER_USER_NAME"}
>
@@ -595,19 +473,8 @@ const UserForm = ({ edit, nameSuffix, ...props }) => {
}}
)}
-
-
+
+
{
reference="catchment"
label="Which catchment?"
filterToQuery={searchText => ({ name: searchText })}
- validate={
- syncAttributesData.isAnySubjectTypeSyncByLocation &&
- required("Please select a catchment")
- }
+ validate={syncAttributesData.isAnySubjectTypeSyncByLocation && required("Please select a catchment")}
onChange={(e, newVal) => {
if (edit) alert(catchmentChangeMessage);
dispatch(
- change(
- REDUX_FORM_NAME,
- "operatingIndividualScope",
- isFinite(newVal) ? operatingScopes.CATCHMENT : operatingScopes.NONE
- )
+ change(REDUX_FORM_NAME, "operatingIndividualScope", isFinite(newVal) ? operatingScopes.CATCHMENT : operatingScopes.NONE)
);
}}
{...rest}
@@ -659,26 +519,12 @@ const UserForm = ({ edit, nameSuffix, ...props }) => {
User Groups
-
-
+
+
-
+
@@ -687,11 +533,7 @@ const UserForm = ({ edit, nameSuffix, ...props }) => {
-
+
{
label="Disable auto sync"
toolTipKey={"ADMIN_USER_SETTINGS_DISABLE_AUTO_SYNC"}
/>
-
+
-
+
{
Sync Settings
+
{map(syncAttributesData.subjectTypes, st => (
))}