add link to member summary report from incidents table
This commit is contained in:
@@ -7,14 +7,19 @@ import { mainMenuItems } from '../../constants/menuItems';
|
|||||||
const MainMenu = () =>
|
const MainMenu = () =>
|
||||||
(<Menu>
|
(<Menu>
|
||||||
{
|
{
|
||||||
mainMenuItems.map(mainMenuItem =>
|
mainMenuItems.map(mainMenuItem => {
|
||||||
<Menu.Item key={mainMenuItem.id}
|
if (!mainMenuItem.showInMenu){
|
||||||
as={NavLink}
|
return null;
|
||||||
to={mainMenuItem.url}
|
} else {
|
||||||
exact
|
return (
|
||||||
>
|
<Menu.Item key={mainMenuItem.id}
|
||||||
{mainMenuItem.title}
|
as={NavLink}
|
||||||
</Menu.Item>)
|
to={mainMenuItem.url}
|
||||||
|
exact
|
||||||
|
>
|
||||||
|
{mainMenuItem.title}
|
||||||
|
</Menu.Item>)
|
||||||
|
}})
|
||||||
}
|
}
|
||||||
</Menu>);
|
</Menu>);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React from 'react';
|
|||||||
import { Loader } from 'semantic-ui-react';
|
import { Loader } from 'semantic-ui-react';
|
||||||
import ReactTable from 'react-table';
|
import ReactTable from 'react-table';
|
||||||
import 'react-table/react-table.css';
|
import 'react-table/react-table.css';
|
||||||
|
import { NavLink } from 'react-router-dom';
|
||||||
|
|
||||||
import {incidentsReportHeaderTitles} from '../../constants/menuItems';
|
import {incidentsReportHeaderTitles} from '../../constants/menuItems';
|
||||||
import {
|
import {
|
||||||
@@ -13,7 +14,7 @@ import {
|
|||||||
|
|
||||||
|
|
||||||
const MemberIncidentsTable = props => {
|
const MemberIncidentsTable = props => {
|
||||||
const { loading, title } = props;
|
const { loading, title, openMemberSummaryOnMemberClick } = props;
|
||||||
const incidents = props.incidents ? props.incidents : [];
|
const incidents = props.incidents ? props.incidents : [];
|
||||||
|
|
||||||
const columns = [];
|
const columns = [];
|
||||||
@@ -34,9 +35,15 @@ const MemberIncidentsTable = props => {
|
|||||||
Header: incidentsReportHeaderTitles[header],
|
Header: incidentsReportHeaderTitles[header],
|
||||||
accessor: header,
|
accessor: header,
|
||||||
Cell: props => {
|
Cell: props => {
|
||||||
let cellValue;
|
let cellValue = '';
|
||||||
|
let urlValue = undefined;
|
||||||
|
|
||||||
switch (props.column.id) {
|
switch (props.column.id) {
|
||||||
|
case 'memberName':
|
||||||
|
const memberId = props.row['_original'].memberId;
|
||||||
|
urlValue = `/practice-summary-report/${memberId}`;
|
||||||
|
cellValue = props.value;
|
||||||
|
break;
|
||||||
case 'incidentType':
|
case 'incidentType':
|
||||||
cellValue = incidentDescriptions[props.value];
|
cellValue = incidentDescriptions[props.value];
|
||||||
break;
|
break;
|
||||||
@@ -68,7 +75,17 @@ const MemberIncidentsTable = props => {
|
|||||||
cellValue = props.value;
|
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>
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,24 +6,34 @@ import PracticeSummaryReport from '../scenes/PracticeSummaryReport';
|
|||||||
export const mainMenuItems = [
|
export const mainMenuItems = [
|
||||||
{
|
{
|
||||||
id: 'home',
|
id: 'home',
|
||||||
|
showInMenu: true,
|
||||||
title: 'Home',
|
title: 'Home',
|
||||||
url: '/',
|
url: '/',
|
||||||
component: Home,
|
component: Home,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'practiceSummaryReport',
|
id: 'practiceSummaryReport',
|
||||||
|
showInMenu: true,
|
||||||
title: 'Practice Summary Report',
|
title: 'Practice Summary Report',
|
||||||
url: '/practice-summary-report',
|
url: '/practice-summary-report',
|
||||||
component: PracticeSummaryReport,
|
component: PracticeSummaryReport,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'practiceSummaryReportWithMemberId',
|
||||||
|
showInMenu: false,
|
||||||
|
url: '/practice-summary-report/:memberId',
|
||||||
|
component: PracticeSummaryReport,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'report',
|
id: 'report',
|
||||||
|
showInMenu: true,
|
||||||
title: 'Incidents Report',
|
title: 'Incidents Report',
|
||||||
url: '/incidents-report',
|
url: '/incidents-report',
|
||||||
component: IncidentsReport,
|
component: IncidentsReport,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'uploadDLockData',
|
id: 'uploadDLockData',
|
||||||
|
showInMenu: true,
|
||||||
title: 'DLock',
|
title: 'DLock',
|
||||||
url: '/dlock',
|
url: '/dlock',
|
||||||
component: UploadDLockData,
|
component: UploadDLockData,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class IncidentsReport extends Component {
|
|||||||
<hr/>
|
<hr/>
|
||||||
<DateRangePicker buttonLabel="Show report" onDatesUpdate={this.onDatesUpdate.bind(this)} />
|
<DateRangePicker buttonLabel="Show report" onDatesUpdate={this.onDatesUpdate.bind(this)} />
|
||||||
<br/>
|
<br/>
|
||||||
<MemberIncidentsTable loading={pendingIncidents} incidents={incidents} />
|
<MemberIncidentsTable loading={pendingIncidents} incidents={incidents} openMemberSummaryOnMemberClick />
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ const MemberSummary = props => {
|
|||||||
let totalUnlockedFees = 0;
|
let totalUnlockedFees = 0;
|
||||||
|
|
||||||
incidents.forEach((incident) => {
|
incidents.forEach((incident) => {
|
||||||
console.log(incident);
|
|
||||||
switch (incident.incidentType) {
|
switch (incident.incidentType) {
|
||||||
case UNSCHEDULED_INCIDENT:
|
case UNSCHEDULED_INCIDENT:
|
||||||
totalUnscheduledFees += parseFloat(incident.totalChargeFee);
|
totalUnscheduledFees += parseFloat(incident.totalChargeFee);
|
||||||
@@ -19,6 +18,8 @@ const MemberSummary = props => {
|
|||||||
case UNLOCKED_INCIDENT:
|
case UNLOCKED_INCIDENT:
|
||||||
totalUnlockedFees += parseFloat(incident.incidentPrice);
|
totalUnlockedFees += parseFloat(incident.incidentPrice);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -65,5 +66,4 @@ const MemberSummary = props => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export default MemberSummary;
|
export default MemberSummary;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class PracticeSummaryReport extends Component {
|
|||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
dateRange: null,
|
dateRange: null,
|
||||||
memberId: null,
|
memberId: props.match.params.memberId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user