send request to add fees in ORD

This commit is contained in:
Bilal Catic
2019-07-18 03:44:16 +02:00
parent fdd4491e07
commit 7437972a53
5 changed files with 50 additions and 17 deletions

View File

@@ -7,29 +7,32 @@ import DateRangePicker from '../../components/DateRangePicker';
import MemberIncidentsTables from '../../components/MemberIncidentsTables';
import GenerateFeesInORDButton from '../../components/GenerateFeesInORDButton';
import { fetchIncidents } from '../../store/actions';
import { fetchIncidents, addFeesToOrd } from '../../store/actions';
class IncidentsReport extends Component {
onDatesUpdate(dateRange) {
const { fetchIncidents } = this.props;
fetchIncidents(dateRange);
}
state = {dateRange: null};
onAddFeesClick = () => {};
onDatesUpdate = (dateRange) => {
const { fetchIncidents } = this.props;
this.setState({dateRange});
fetchIncidents(dateRange);
};
render () {
const { pendingIncidents, incidents } = this.props;
const { dateRange } = this.state;
return (
<Container>
<MainMenu/>
<h3>Incidents Report</h3>
<hr/>
<DateRangePicker buttonLabel="Show report" onDatesUpdate={this.onDatesUpdate.bind(this)} inlineButton />
<DateRangePicker buttonLabel="Show report" onDatesUpdate={this.onDatesUpdate} inlineButton />
<br/>
<GenerateFeesInORDButton
disabled={pendingIncidents}
onConfirm={this.onAddFeesClick}
dateRange={dateRange}
/>
<br/><br/>
<hr/>
@@ -47,6 +50,7 @@ const mapStateToProps = (state) => ({
const mapDispatchToProps = (dispatch) => ({
fetchIncidents: (dateRange) => fetchIncidents(dispatch, dateRange),
addFeesToOrd: (dateRange, memberIds) => addFeesToOrd(dispatch, dateRange, memberIds),
});
export default connect(mapStateToProps, mapDispatchToProps)(IncidentsReport);

View File

@@ -9,7 +9,7 @@ import MemberSummary from './components/MemberSummary';
import MemberIncidentsTables from '../../components/MemberIncidentsTables';
import GenerateFeesInORDButton from '../../components/GenerateFeesInORDButton';
import { fetchMemberIncidents } from '../../store/actions';
import { fetchMemberIncidents, addFeesToOrd } from '../../store/actions';
class PracticeSummaryReport extends Component {
constructor(props){
@@ -39,8 +39,6 @@ class PracticeSummaryReport extends Component {
}
}
onAddFeesClick = () => {};
render () {
const { memberIncidents, loading } = this.props;
const { memberId, dateRange } = this.state;
@@ -74,7 +72,8 @@ class PracticeSummaryReport extends Component {
<GenerateFeesInORDButton
singleMember
disabled={addFeesButtonDisabled}
onConfirm={this.onAddFeesClick}
dateRange={dateRange}
memberIds={[memberId]}
/>
</Grid.Column>
</Grid.Row>