Skip to content

Commit

Permalink
#1186 - clarification text for address filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
petmongrels committed Jan 11, 2024
1 parent e19dde6 commit 9867d5e
Show file tree
Hide file tree
Showing 8 changed files with 340 additions and 316 deletions.
9 changes: 9 additions & 0 deletions packages/openchs-android/src/utility/JsonStringify.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const duckCheckNativeRealmCollection = function (obj) {
&& !_.isNil(_.get(obj, "snapshot")));
}

function duckCheckForError(obj) {
return obj.stack && obj.message;
}

const JSONStringifyInternal = function (obj, depth, objectMap: Map, arrayWidth, objectKey) {
if (depth === 0)
return "BELOW_DEPTH";
Expand Down Expand Up @@ -75,6 +79,11 @@ const JSONStringifyInternal = function (obj, depth, objectMap: Map, arrayWidth,
const eachValue = obj[eachKey];
objStr += `"${eachKey}":${JSONStringifyInternal(eachValue, depth - 1, objectMap, arrayWidth, eachKey)},`;
});
if (duckCheckForError(obj)) {
objStr += `message:${obj.message},`;
objStr += `stack:${obj.stack},`;
}

return `{` + removeComma(objStr) + `}`;
} else if (!_.isNil(objectMap.get(obj))) {
return "<object_repeated>";
Expand Down
13 changes: 11 additions & 2 deletions packages/openchs-android/src/views/common/AddressLevels.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ class AddressLevels extends AbstractComponent {
minLevelTypeUUIDs: PropTypes.array,
maxLevelTypeUUID: PropTypes.string,
isOutsideCatchment: PropTypes.bool,
fieldLabel: PropTypes.string
fieldLabel: PropTypes.string,
userHintText: PropTypes.string
};

static defaultProps = {
userHintText: ""
}

viewName() {
return 'AddressLevels';
}
Expand Down Expand Up @@ -119,6 +124,7 @@ class AddressLevels extends AbstractComponent {

General.logDebug(this.viewName(), 'render');
const mandatoryText = this.props.mandatory ? <Text style={{color: Colors.ValidationError}}> * </Text> : <Text/>;
const userHint = ` ${this.props.userHintText}`;
let addressLevels = this.state.data.levels.map(([levelType, levels], idx) =>
_.size(levels) > this.getMaxInlineDisplayCount() ?
<AutocompleteSearchWithLabel
Expand All @@ -142,7 +148,10 @@ class AddressLevels extends AbstractComponent {
marginBottom: Styles.VerticalSpacingBetweenFormElements,
}}>
{this.props.skipLabel ? null :
<Text style={Styles.formLabel}>{this.props.fieldLabel || this.I18n.t('Address')}{mandatoryText}</Text>}
<>
<Text style={Styles.formLabel}>{this.props.fieldLabel || this.I18n.t('Address')}{mandatoryText}</Text>
<Text style={Styles.helpText}>{userHint}</Text>
</>}
<View style={{
borderWidth: 1,
borderStyle: 'dashed',
Expand Down
3 changes: 2 additions & 1 deletion packages/openchs-android/src/views/filter/FiltersViewV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ class FiltersViewV2 extends AbstractComponent {
fieldLabel={this.I18n.t(filter.name)}
key={index}
onSelect={(updatedAddressLevelState) => this.dispatchFilterUpdate(filter, updatedAddressLevelState)}
multiSelect={true}/>;
multiSelect={true}
userHintText={this.I18n.t('addressFilterBehaviorHint')}/>;
case CustomFilter.type.RegistrationDate:
case CustomFilter.type.EnrolmentDate:
case CustomFilter.type.ProgramEncounterDate:
Expand Down
3 changes: 2 additions & 1 deletion packages/openchs-android/translations/gu_IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
"autoRefresh": "ડેશબોર્ડ ઓટો રિફ્રેશ",
"trackLocation": "ટ્રૅક સ્થાન",
"disableAutoSync": "સ્વતઃ સમન્વયન અક્ષમ કરો",
"autoSync": "સ્વતઃ સમન્વયન"
"autoSync": "સ્વતઃ સમન્વયન",
"addressFilterBehaviorHint": "(યોગ્ય સ્તર પસંદ કરો કે જેમાં વિષય નોંધાયેલ છે)"
}
}
3 changes: 2 additions & 1 deletion packages/openchs-android/translations/hi_IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@
"Send OTP" : "वन-टाइम पासवर्ड (OTP) भेजें",
"disableAutoSync": "ऑटो सिंक अक्षम करें",
"autoSync": "ऑटो सिंक",
"backgroundSyncInProgress": "ऑटो सिंक प्रगति पर है| कृपया कुछ देर बाद प्रयास करें।"
"backgroundSyncInProgress": "ऑटो सिंक प्रगति पर है| कृपया कुछ देर बाद प्रयास करें।",
"addressFilterBehaviorHint": "(वही लोकेशन जहाँ सब्जेक्ट रजिस्टर्ड है)"
}
}
Loading

0 comments on commit 9867d5e

Please sign in to comment.