diff --git a/src/data-workspace/category-combo-table-body-pivoted/category-combo-table-body-pivoted.js b/src/data-workspace/category-combo-table-body-pivoted/category-combo-table-body-pivoted.js index 76eb5c1ff..703980133 100644 --- a/src/data-workspace/category-combo-table-body-pivoted/category-combo-table-body-pivoted.js +++ b/src/data-workspace/category-combo-table-body-pivoted/category-combo-table-body-pivoted.js @@ -94,8 +94,7 @@ export const PivotedCategoryComboTableBody = React.memo( colSpan={fieldInRow.colSpan} rowSpan={fieldInRow.rowSpan} > - {fieldInRow.displayFormName !== - 'default' && + {fieldInRow.name !== 'default' && fieldInRow.displayFormName} ) diff --git a/src/data-workspace/category-combo-table-body-pivoted/generate-form-matrix/__snapshots__/generate-form-matrix.test.js.snap b/src/data-workspace/category-combo-table-body-pivoted/generate-form-matrix/__snapshots__/generate-form-matrix.test.js.snap index aab57cf3f..012daa577 100644 --- a/src/data-workspace/category-combo-table-body-pivoted/generate-form-matrix/__snapshots__/generate-form-matrix.test.js.snap +++ b/src/data-workspace/category-combo-table-body-pivoted/generate-form-matrix/__snapshots__/generate-form-matrix.test.js.snap @@ -2409,108 +2409,126 @@ Array [ "displayFormName": "Location Fixed/Outreach", "id": "fMZEcRHuamy", "metadataType": "category", + "name": "Location Fixed/Outreach", "type": "columnHeader", }, Object { "displayFormName": "EPI/nutrition age", "id": "YNZyaJHiHYq", "metadataType": "category", + "name": "EPI/nutrition age", "type": "columnHeader", }, Object { "displayFormName": "Children getting therapeutic feeding", "id": "qw2sIef52Fu", "metadataType": "dataElement", + "name": "Children getting therapeutic feeding", "type": "columnHeader", }, Object { "displayFormName": "Children supplied with food supplemements", "id": "Y53Jcc9LBYh", "metadataType": "dataElement", + "name": "Children supplied with food supplemements", "type": "columnHeader", }, Object { "displayFormName": "Mebendazole/Albendazole (for children 12-59 months)", "id": "d5xTg3WR3DP", "metadataType": "dataElement", + "name": "Mebendazole/Albendazole (for children 12-59 months)", "type": "columnHeader", }, Object { "displayFormName": "Newborn protected at birth against tetanus (TT2+)", "id": "DUSpd8Jq3M7", "metadataType": "dataElement", + "name": "Newborn protected at birth against tetanus (TT2+)", "type": "columnHeader", }, Object { "displayFormName": "Q_Early breastfeeding (within 1 hr after delivery) at BCG", "id": "dU0GquGkGQr", "metadataType": "dataElement", + "name": "Q_Early breastfeeding (within 1 hr after delivery) at BCG", "type": "columnHeader", }, Object { "displayFormName": "Q_Exclusive breastfeeding at time of Penta 3", "id": "pEOVd4Z3TAS", "metadataType": "dataElement", + "name": "Q_Exclusive breastfeeding at time of Penta 3", "type": "columnHeader", }, Object { "displayFormName": "Q_LLITN given at time of 2nd Vit A dose", "id": "Rmixc9wJl0G", "metadataType": "dataElement", + "name": "Q_LLITN given at time of 2nd Vit A dose", "type": "columnHeader", }, Object { "displayFormName": "Q_Slept under LLIN last night Measles", "id": "GCGfEY82Wz6", "metadataType": "dataElement", + "name": "Q_Slept under LLIN last night Measles", "type": "columnHeader", }, Object { "displayFormName": "Q_Vitamin A received 4-6 months ago at 12-59 dose", "id": "ca8lfO062zg", "metadataType": "dataElement", + "name": "Q_Vitamin A received 4-6 months ago at 12-59 dose", "type": "columnHeader", }, Object { "displayFormName": "Vitamin A given to < 5y", "id": "tU7GixyHhsv", "metadataType": "dataElement", + "name": "Vitamin A given to < 5y", "type": "columnHeader", }, Object { "displayFormName": "Weight for age below lower line (red)", "id": "bTcRDVjC66S", "metadataType": "dataElement", + "name": "Weight for age below lower line (red)", "type": "columnHeader", }, Object { "displayFormName": "Weight for age between middle and lower line (yellow)", "id": "ldGXl6SEdqf", "metadataType": "dataElement", + "name": "Weight for age between middle and lower line (yellow)", "type": "columnHeader", }, Object { "displayFormName": "Weight for age on or above middle line (green)", "id": "NLnXLV5YpZF", "metadataType": "dataElement", + "name": "Weight for age on or above middle line (green)", "type": "columnHeader", }, Object { "displayFormName": "Weight for height 70-79 percent", "id": "pnL2VG8Bn7N", "metadataType": "dataElement", + "name": "Weight for height 70-79 percent", "type": "columnHeader", }, Object { "displayFormName": "Weight for height 80 percent and above", "id": "qPVDd87kS9Z", "metadataType": "dataElement", + "name": "Weight for height 80 percent and above", "type": "columnHeader", }, Object { "displayFormName": "Weight for height below 70 percent", "id": "lVsbKXoF0zX", "metadataType": "dataElement", + "name": "Weight for height below 70 percent", "type": "columnHeader", }, ], diff --git a/src/data-workspace/category-combo-table-body-pivoted/generate-form-matrix/generate-matrix-transposed.js b/src/data-workspace/category-combo-table-body-pivoted/generate-form-matrix/generate-matrix-transposed.js index 30330b8e6..cc2a4261f 100644 --- a/src/data-workspace/category-combo-table-body-pivoted/generate-form-matrix/generate-matrix-transposed.js +++ b/src/data-workspace/category-combo-table-body-pivoted/generate-form-matrix/generate-matrix-transposed.js @@ -1,3 +1,4 @@ +import i18n from '@dhis2/d2-i18n' import { selectors } from '../../../shared/index.js' export const generateMatrixTransposed = (options) => { @@ -16,6 +17,7 @@ export const generateMatrixTransposed = (options) => { ...columnHeaderFields.map((header) => { return { id: header?.id, + name: header.name, displayFormName: header?.displayFormName, type: 'columnHeader', metadataType: header.valueType ? 'dataElement' : 'category', @@ -43,11 +45,16 @@ export const generateMatrixTransposed = (options) => { if (!alreadyAdded[categoryOption.id] || lastCateogry) { dataEntryRow.push({ id: categoryOption?.id, - displayFormName: categoryOption?.displayName, + displayFormName: + categoryOption?.name === 'default' + ? i18n.t('Value') + : categoryOption?.displayName, rowSpan: - sortedCOCs.length / - categories.length / - (categoryIndex + 1), + categories.length === 1 + ? 1 + : sortedCOCs.length / + categories.length / + (categoryIndex + 1), type: 'rowHeader', }) alreadyAdded[categoryOption.id] = true diff --git a/src/data-workspace/section-form/section.js b/src/data-workspace/section-form/section.js index 2ebdbceba..74affa175 100644 --- a/src/data-workspace/section-form/section.js +++ b/src/data-workspace/section-form/section.js @@ -10,7 +10,7 @@ import { import classNames from 'classnames' import PropTypes from 'prop-types' import React, { useMemo, useState } from 'react' -import { useMetadata, selectors, useFeature } from '../../shared/index.js' +import { useMetadata, selectors } from '../../shared/index.js' import { CategoryComboTableBody } from '../category-combo-table-body/index.js' import { PivotedCategoryComboTableBody, @@ -69,26 +69,6 @@ export function SectionFormSection({ section, dataSetId, globalFilterText }) { const { displayOptions: displayOptionString } = section const displayOptions = JSON.parse(displayOptionString) - // feature toggle to enable testing this feature without maintenance app - // format of toggle is: &features=pivot_fMZEcRHuamy - // (to add to the query parameter) - const featureTogglePivotOptions = useFeature('pivot') - - console.debug('[feature toggle: pivotOptions]', featureTogglePivotOptions) - if (featureTogglePivotOptions) { - displayOptions.pivotMode = 'pivot' - - if (featureTogglePivotOptions.length) { - const [pivotedCategory] = featureTogglePivotOptions - - if (pivotedCategory) { - displayOptions.pivotMode = 'move_categories' - displayOptions.pivotedCategory = pivotedCategory - } - console.debug('[feature: final displayOptions]', displayOptions) - } - } - const isPivotMode = displayOptions.pivotMode === 'move_categories' || displayOptions.pivotMode === 'pivot' diff --git a/src/shared/use-context-selection/use-context-selection.js b/src/shared/use-context-selection/use-context-selection.js index 772f1cbcc..7749a79f4 100644 --- a/src/shared/use-context-selection/use-context-selection.js +++ b/src/shared/use-context-selection/use-context-selection.js @@ -27,20 +27,6 @@ export function usePeriodId() { return useQueryParam('periodId', PARAMS_SCHEMA.periodId) } -export function useFeature(feature) { - const [allFeatures] = useQueryParam('features', StringParam) - const features = allFeatures?.split(',') - - const featureWithOptions = features?.find((feat) => - feat.includes(`${feature}_`) - ) - - if (featureWithOptions) { - return featureWithOptions.replace(`${feature}_`, '')?.split(',') - } - return features?.includes(feature) -} - /** * * @returns the selected attribute-options in the shape of