add link to member summary report from incidents table

This commit is contained in:
Bilal Catic
2019-06-21 11:36:17 +02:00
parent ac92401960
commit f7c30919e6
6 changed files with 47 additions and 15 deletions

View File

@@ -7,14 +7,19 @@ import { mainMenuItems } from '../../constants/menuItems';
const MainMenu = () =>
(<Menu>
{
mainMenuItems.map(mainMenuItem =>
<Menu.Item key={mainMenuItem.id}
as={NavLink}
to={mainMenuItem.url}
exact
>
{mainMenuItem.title}
</Menu.Item>)
mainMenuItems.map(mainMenuItem => {
if (!mainMenuItem.showInMenu){
return null;
} else {
return (
<Menu.Item key={mainMenuItem.id}
as={NavLink}
to={mainMenuItem.url}
exact
>
{mainMenuItem.title}
</Menu.Item>)
}})
}
</Menu>);

View File

@@ -2,6 +2,7 @@ import React from 'react';
import { Loader } from 'semantic-ui-react';
import ReactTable from 'react-table';
import 'react-table/react-table.css';
import { NavLink } from 'react-router-dom';
import {incidentsReportHeaderTitles} from '../../constants/menuItems';
import {
@@ -13,7 +14,7 @@ import {
const MemberIncidentsTable = props => {
const { loading, title } = props;
const { loading, title, openMemberSummaryOnMemberClick } = props;
const incidents = props.incidents ? props.incidents : [];
const columns = [];
@@ -34,9 +35,15 @@ const MemberIncidentsTable = props => {
Header: incidentsReportHeaderTitles[header],
accessor: header,
Cell: props => {
let cellValue;
let cellValue = '';
let urlValue = undefined;
switch (props.column.id) {
case 'memberName':
const memberId = props.row['_original'].memberId;
urlValue = `/practice-summary-report/${memberId}`;
cellValue = props.value;
break;
case 'incidentType':
cellValue = incidentDescriptions[props.value];
break;
@@ -68,7 +75,17 @@ const MemberIncidentsTable = props => {
cellValue = props.value;
}
return <div style={{ textAlign: columnContentsAlignment }}>{cellValue}</div>
if (openMemberSummaryOnMemberClick && urlValue){
return <NavLink to={urlValue}>{cellValue}</NavLink>
}else{
return <div style={{ textAlign: columnContentsAlignment }}>{cellValue}</div>
}
// return <NavLink to={urlValue}>
// <div>{cellValue}</div>
// </NavLink>
// return <div style={{ textAlign: columnContentsAlignment }}><a href={'www.gogole.com'} >{cellValue}</a></div>
}
});
}