Member Practice Summary Report and bugfixes
This commit is contained in:
@@ -67,7 +67,7 @@ const SingleIncidentsTable = props => {
|
||||
switch (props.column.id) {
|
||||
case 'memberName':
|
||||
const memberId = props.row['_original'].memberId;
|
||||
urlValue = `/practice-summary-report/${memberId}`;
|
||||
urlValue = `/specific-member-incidents-report/${memberId}`;
|
||||
cellValue = props.value;
|
||||
break;
|
||||
case 'resourceName':
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import UploadDLockData from '../scenes/UploadDLockData';
|
||||
import Home from '../scenes/Home';
|
||||
import IncidentsReport from '../scenes/IncidentsReport';
|
||||
import PracticeSummaryReport from '../scenes/PracticeSummaryReport';
|
||||
import SpecificMemberIncidentsReport from '../scenes/SpecificMemberIncidentsReport';
|
||||
import MemberPracticeSummaryReport from '../scenes/MemberPracticeSummaryReport';
|
||||
|
||||
export const mainMenuItems = [
|
||||
{
|
||||
@@ -12,17 +13,24 @@ export const mainMenuItems = [
|
||||
component: Home,
|
||||
},
|
||||
{
|
||||
id: 'practiceSummaryReport',
|
||||
id: 'memberPracticeSummaryReport',
|
||||
showInMenu: true,
|
||||
title: 'Practice Summary Report',
|
||||
url: '/practice-summary-report',
|
||||
component: PracticeSummaryReport,
|
||||
title: 'Member Practice Summary Report',
|
||||
url: '/member-practice-summary-report',
|
||||
component: MemberPracticeSummaryReport,
|
||||
},
|
||||
{
|
||||
id: 'practiceSummaryReportWithMemberId',
|
||||
id: 'specificMemberIncidentsReport',
|
||||
showInMenu: true,
|
||||
title: 'Member Incidents Report',
|
||||
url: '/specific-member-incidents-report',
|
||||
component: SpecificMemberIncidentsReport,
|
||||
},
|
||||
{
|
||||
id: 'specificMemberIncidentsReportWithMemberId',
|
||||
showInMenu: false,
|
||||
url: '/practice-summary-report/:memberId',
|
||||
component: PracticeSummaryReport,
|
||||
url: '/specific-member-incidents-report/:memberId',
|
||||
component: SpecificMemberIncidentsReport,
|
||||
},
|
||||
{
|
||||
id: 'report',
|
||||
|
||||
33
client/src/scenes/MemberPracticeSummaryReport/index.js
Normal file
33
client/src/scenes/MemberPracticeSummaryReport/index.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { Container, Button, Loader } from 'semantic-ui-react';
|
||||
|
||||
import MainMenu from '../../components/MainMenu';
|
||||
|
||||
import { fetchMemberPracticeSummaryReport } from '../../store/actions';
|
||||
|
||||
class MemberPracticeSummaryReport extends Component {
|
||||
render () {
|
||||
const { fetchMemberPracticeSummaryReport, pendingReport } = this.props;
|
||||
return (
|
||||
<Container>
|
||||
<MainMenu/>
|
||||
<h3>Member Practice Summary Report</h3>
|
||||
<hr/>
|
||||
<br/>
|
||||
<Loader active={pendingReport} />
|
||||
<Button disabled={pendingReport} onClick={fetchMemberPracticeSummaryReport}>Generate Report</Button>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
pendingReport: state.memberPracticeSummaryReport.pending,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
fetchMemberPracticeSummaryReport: () => fetchMemberPracticeSummaryReport(dispatch),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(MemberPracticeSummaryReport);
|
||||
@@ -11,7 +11,7 @@ import GenerateFeesInORDButton from '../../components/GenerateFeesInORDButton';
|
||||
|
||||
import { fetchMemberIncidents } from '../../store/actions';
|
||||
|
||||
class PracticeSummaryReport extends Component {
|
||||
class SpecificMemberIncidentsReport extends Component {
|
||||
constructor(props){
|
||||
super(props);
|
||||
|
||||
@@ -50,7 +50,7 @@ class PracticeSummaryReport extends Component {
|
||||
return (
|
||||
<Container>
|
||||
<MainMenu/>
|
||||
<h3>Practice Summary Report</h3>
|
||||
<h3>Member Incidents Report</h3>
|
||||
<hr/>
|
||||
<Grid stackable columns="equal">
|
||||
<Grid.Row>
|
||||
@@ -101,4 +101,4 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
fetchMemberIncidents: (memberId, dateRange) => fetchMemberIncidents(dispatch, memberId, dateRange),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(PracticeSummaryReport);
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(SpecificMemberIncidentsReport);
|
||||
@@ -20,6 +20,9 @@ import {
|
||||
CHECK_PROCESSING_PENDING,
|
||||
CHECK_PROCESSING_SUCCESS,
|
||||
CHECK_PROCESSING_FAILED,
|
||||
FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_PENDING,
|
||||
FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_SUCCESS,
|
||||
FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_FAILED,
|
||||
} from '../constants';
|
||||
|
||||
import API from '../../utilities/api';
|
||||
@@ -109,3 +112,16 @@ export const checkProcessing = (dispatch) => {
|
||||
dispatch({type: CHECK_PROCESSING_FAILED, payload: error.response});
|
||||
});
|
||||
};
|
||||
|
||||
export const fetchMemberPracticeSummaryReport = (dispatch) => {
|
||||
dispatch({type: FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_PENDING});
|
||||
API.get('integration/report/practiceSummary', {
|
||||
responseType: 'blob',
|
||||
})
|
||||
.then(response => {
|
||||
dispatch({type: FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_SUCCESS, payload: response});
|
||||
})
|
||||
.catch(error => {
|
||||
dispatch({type: FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_FAILED, payload: error.response});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -29,3 +29,7 @@ export const ADD_FEES_TO_ORD_FAILED = 'ADD_FEES_TO_ORD_FAILED';
|
||||
export const CHECK_PROCESSING_PENDING = 'CHECK_PROCESSING_PENDING';
|
||||
export const CHECK_PROCESSING_SUCCESS = 'CHECK_PROCESSING_SUCCESS';
|
||||
export const CHECK_PROCESSING_FAILED = 'CHECK_PROCESSING_FAILED';
|
||||
|
||||
export const FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_PENDING = 'FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_PENDING';
|
||||
export const FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_SUCCESS = 'FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_SUCCESS';
|
||||
export const FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_FAILED = 'FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_FAILED';
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import {
|
||||
FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_PENDING,
|
||||
FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_SUCCESS,
|
||||
FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_FAILED,
|
||||
} from '../constants';
|
||||
|
||||
const initialState = {
|
||||
pending: false,
|
||||
result: null,
|
||||
error: null,
|
||||
};
|
||||
|
||||
export const memberPracticeSummaryReport = (state, action) => {
|
||||
state = state || initialState;
|
||||
action = action || {};
|
||||
|
||||
switch(action.type){
|
||||
case FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_PENDING:
|
||||
return Object.assign({}, state, {
|
||||
pending: true,
|
||||
error: null,
|
||||
});
|
||||
case FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_SUCCESS:
|
||||
const url = window.URL.createObjectURL(new Blob([action.payload.data]));
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.setAttribute('download', 'Member Practice Summary Report.xlsx');
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
||||
return Object.assign({}, state, {
|
||||
pending: false,
|
||||
result: null,
|
||||
error: null,
|
||||
});
|
||||
case FETCH_MEMBER_PRACTICE_SUMMARY_REPORT_FAILED:
|
||||
return Object.assign({}, state, {
|
||||
pending: false,
|
||||
result: {},
|
||||
error: action.payload,
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -8,6 +8,7 @@ import { membersList } from './membersListReducer';
|
||||
import { memberIncidents} from './memberIncidentsReducer';
|
||||
import { addFeesStatus } from './addFeesToOrdReducer';
|
||||
import { checkProcessing } from './checkProcessingReducer';
|
||||
import { memberPracticeSummaryReport} from './fetchMemberPracticeSummaryReportReducer';
|
||||
|
||||
export const rootReducer = combineReducers({
|
||||
doorLockData,
|
||||
@@ -18,5 +19,6 @@ export const rootReducer = combineReducers({
|
||||
memberIncidents,
|
||||
addFeesStatus,
|
||||
checkProcessing,
|
||||
memberPracticeSummaryReport,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user