Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task/ggw 160 adding indicator values to activity preview #194

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 80 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/activity/preview/components/APPercentageList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ const APPercentageList = (listField, valueField, percentageField, listTitle = nu
} = this.props;
const title = listTitle ? translate(listTitle) : null;
let items = activity[listField];

let content = null;
let isListEnabled = activityFieldsManager.isFieldPathEnabled(listField) === true;
if (fmPath) {
Expand Down
28 changes: 21 additions & 7 deletions src/activity/preview/sections/APME.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,28 @@ class APME extends Component {
}

_generateValueOrValuesTable(sectionName, value) {
/** We need to separate different value pages based on if the value is single
* value or multiple value(i.e actual value might be an array)
* The pages thus are different in hierachy ME Item and ME Item Location/ME Item
*/
let valueIsArray = false;
let meItemValue = FeatureManagerConstants[`ME_ITEM_${sectionName.toUpperCase()}_VALUE_BASE_VALUE`];
let meItemDate = FeatureManagerConstants[`ME_ITEM_${sectionName.toUpperCase()}_VALUE_BASE_DATE`];
let meItemComment = FeatureManagerConstants[`ME_ITEM_${sectionName.toUpperCase()}_VALUE_BASE_COMMENTS`];
if (Array.isArray(value)) {
valueIsArray = true;
meItemValue = FeatureManagerConstants[`ME_ITEM_LOCATION_${sectionName.toUpperCase()}_VALUE_BASE_VALUE`];
meItemDate = FeatureManagerConstants[`ME_ITEM_LOCATION_${sectionName.toUpperCase()}_VALUE_BASE_DATE`];
meItemComment = FeatureManagerConstants[`ME_ITEM_LOCATION_${sectionName.toUpperCase()}_VALUE_BASE_COMMENTS`];
}
return (<div>
{Array.isArray(value)
? value.map(v => this._generateValueTable(sectionName, v))
: this._generateValueTable(sectionName, value)}
{valueIsArray
? value.map(v => this._generateValueTable(sectionName, v, meItemValue, meItemDate, meItemComment))
: this._generateValueTable(sectionName, value, meItemValue, meItemDate, meItemComment)}
</div>);
}

_generateValueTable(sectionName, value) {
_generateValueTable(sectionName, value, meItemValue, meItemDate, meItemComment) {
if (!value) {
return null;
}
Expand All @@ -59,14 +73,14 @@ class APME extends Component {
<tbody>
<tr key={Math.random()}>
<td>
{FeatureManager.isFMSettingEnabled(FeatureManagerConstants[`ME_ITEM_${sectionName.toUpperCase()}_VALUE_BASE_VALUE`])
{FeatureManager.isFMSettingEnabled(meItemValue)
? <APField
key={Math.random()} title={translate(`${sectionName} ${ActivityConstants.INDICATOR_VALUE}`)}
value={value[ActivityConstants.INDICATOR_VALUE]} inline={false} separator={false}
fieldNameClass={styles.box_field_name} fieldValueClass={styles.box_field_value} /> : null}
</td>
<td>
{FeatureManager.isFMSettingEnabled(FeatureManagerConstants[`ME_ITEM_${sectionName.toUpperCase()}_VALUE_BASE_DATE`]) ?
{FeatureManager.isFMSettingEnabled(meItemDate) ?
<APField
key={Math.random()} title={translate(`${sectionName} ${ActivityConstants.INDICATOR_DATE}`)}
value={value[ActivityConstants.INDICATOR_DATE]} inline={false} separator={false}
Expand All @@ -76,7 +90,7 @@ class APME extends Component {
{this._generateTaggedValuesRows(sectionName, value[ActivityConstants.INDICATOR_TAGGED_VALUES])}
<tr key={Math.random()}>
<td colSpan={2}>
{FeatureManager.isFMSettingEnabled(FeatureManagerConstants[`ME_ITEM_${sectionName.toUpperCase()}_VALUE_BASE_COMMENTS`]) ?
{FeatureManager.isFMSettingEnabled(meItemComment) ?
<APField
key={Math.random()} title={translate(`${sectionName} ${ActivityConstants.INDICATOR_COMMENT}`)}
value={value[ActivityConstants.INDICATOR_COMMENT]} inline={false} separator={false}
Expand Down
12 changes: 12 additions & 0 deletions src/modules/util/FeatureManagerConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ const ME_DELETE_ME_ITEM = `${ME}/Delete ME Item`;
const ME_DELETE_SECTOR = `${ME}/Delete Sector`;
const ME_INDICATOR_DESCRIPTION = `${ME}/Indicator Description`;
const ME_ITEM = `${ME}/ME Item`;
const ME_ITEM_LOCATION = `${ME}/ME Item Location`;
const ME_ITEM_LOCATION_ITEMS = `${ME}/ME Item Location/ME Item`;
const ME_ITEM_BASE_VALUE = `${ME_ITEM}/Base Value`;
const ME_ITEM_BASE_VALUE_BASE_COMMENTS = `${ME_ITEM_BASE_VALUE}/Base Comments`;
const ME_ITEM_BASE_VALUE_BASE_DATE = `${ME_ITEM_BASE_VALUE}/Base Date`;
Expand All @@ -169,6 +171,10 @@ const ME_ITEM_ACTUAL_VALUE = `${ME_ITEM}/Current Value`;
const ME_ITEM_ACTUAL_VALUE_BASE_COMMENTS = `${ME_ITEM_ACTUAL_VALUE}/Current Comments`;
const ME_ITEM_ACTUAL_VALUE_BASE_DATE = `${ME_ITEM_ACTUAL_VALUE}/Current Date`;
const ME_ITEM_ACTUAL_VALUE_BASE_VALUE = `${ME_ITEM_ACTUAL_VALUE}/Current Value`;
const ME_ITEM_LOCATION_ACTUAL_VALUE = `${ME_ITEM_LOCATION_ITEMS}/Actual Values`;
const ME_ITEM_LOCATION_ACTUAL_VALUE_BASE_VALUE = `${ME_ITEM_LOCATION_ACTUAL_VALUE}/Actual Value`;
const ME_ITEM_LOCATION_ACTUAL_VALUE_BASE_DATE = `${ME_ITEM_LOCATION_ACTUAL_VALUE}/Actual Date`;
const ME_ITEM_LOCATION_ACTUAL_VALUE_BASE_COMMENTS = `${ME_ITEM_LOCATION_ACTUAL_VALUE}/Actual Comment`;
const ME_ITEM_LOGFRAME_CATEGORY = `${ME_ITEM}/Logframe Category`;
const ME_ITEM_REVISED_VALUE = `${ME_ITEM}/Revised Value`;
const ME_ITEM_REVISED_VALUE_BASE_COMMENTS = `${ME_ITEM_REVISED_VALUE}/Revised Comments`;
Expand Down Expand Up @@ -314,6 +320,8 @@ export default Object.freeze({
ME_DELETE_SECTOR,
ME_INDICATOR_DESCRIPTION,
ME_ITEM,
ME_ITEM_LOCATION,
ME_ITEM_LOCATION_ITEMS,
ME_ITEM_BASE_VALUE,
ME_ITEM_BASE_VALUE_BASE_COMMENTS,
ME_ITEM_BASE_VALUE_BASE_DATE,
Expand All @@ -322,6 +330,10 @@ export default Object.freeze({
ME_ITEM_ACTUAL_VALUE_BASE_COMMENTS,
ME_ITEM_ACTUAL_VALUE_BASE_DATE,
ME_ITEM_ACTUAL_VALUE_BASE_VALUE,
ME_ITEM_LOCATION_ACTUAL_VALUE,
ME_ITEM_LOCATION_ACTUAL_VALUE_BASE_VALUE,
ME_ITEM_LOCATION_ACTUAL_VALUE_BASE_DATE,
ME_ITEM_LOCATION_ACTUAL_VALUE_BASE_COMMENTS,
ME_ITEM_LOGFRAME_CATEGORY,
ME_ITEM_REVISED_VALUE,
ME_ITEM_REVISED_VALUE_BASE_COMMENTS,
Expand Down