Skip to content

Commit

Permalink
chore: adds the fourth parameter (#1541)
Browse files Browse the repository at this point in the history
  • Loading branch information
paschalidi authored Mar 10, 2021
1 parent 0893bad commit 1e363cf
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useSelector } from 'react-redux';
import i18n from '@dhis2/d2-i18n';
import { Button } from '@dhis2/ui';
import { Grid, Paper, withStyles } from '@material-ui/core';
import { useLocation } from 'react-router';
import type { Props } from './RegistrationDataEntry.types';
import { EnrollmentRegistrationEntry, TeiRegistrationEntry, SingleEventRegistrationEntry } from '../../../DataEntries';
import { scopeTypes } from '../../../../metaData';
Expand Down Expand Up @@ -57,6 +58,7 @@ const DialogButtons = ({ onCancel, onSave }) => (<>
</>);

const CardListButton = (({ teiId, orgUnitId }) => {
const { pathname, search } = useLocation();
const scopeHierarchy = useSelector(({ router: { location: { query } } }) => (query.programId ? 'PROGRAM' : 'TRACKED_ENTITY_TYPE'));
const selectedScopeId: string = useSelector(({ router: { location: { query } } }) => query.trackedEntityTypeId || query.programId);
const scopeSearchParam = `${scopeHierarchy.toLowerCase()}=${selectedScopeId}`;
Expand All @@ -65,7 +67,7 @@ const CardListButton = (({ teiId, orgUnitId }) => {
<Button
small
dataTest="dhis2-capture-view-dashboard-button"
onClick={() => navigateToTrackedEntityDashboard(teiId, orgUnitId, scopeSearchParam)}
onClick={() => navigateToTrackedEntityDashboard(teiId, orgUnitId, scopeSearchParam, `${pathname}${search}`)}
>
{i18n.t('View dashboard')}
</Button>
Expand Down

0 comments on commit 1e363cf

Please sign in to comment.