From fdd4491e0745e970bc5084fc24062988c4bb4bbf Mon Sep 17 00:00:00 2001 From: Bilal Catic Date: Tue, 16 Jul 2019 11:23:11 +0200 Subject: [PATCH] add button and modal dialog for invoice integration --- .../GenerateFeesInORDButton/index.js | 44 +++++++++++++++++++ client/src/scenes/IncidentsReport/index.js | 12 ++++- .../src/scenes/PracticeSummaryReport/index.js | 16 ++++++- 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 client/src/components/GenerateFeesInORDButton/index.js diff --git a/client/src/components/GenerateFeesInORDButton/index.js b/client/src/components/GenerateFeesInORDButton/index.js new file mode 100644 index 0000000..9fae85c --- /dev/null +++ b/client/src/components/GenerateFeesInORDButton/index.js @@ -0,0 +1,44 @@ +import React, { Component } from 'react'; +import { Button, Modal } from 'semantic-ui-react'; + +class GenerateFeesInORDButton extends Component { + state = { open: false }; + + show = size => () => this.setState({ size, open: true }); + close = () => this.setState({ open: false }); + confirm = () => { + const { onConfirm } = this.props; + this.close(); + if (onConfirm){ + onConfirm(); + } + }; + + render() { + const { open, size } = this.state; + const { singleMember, disabled } = this.props; + + const modalContent = singleMember ? + 'This will remove all existing fees in ORD for selected member in selected date range and generate new fees based on shown incident tables. Do you want to continue ?': + 'This will remove all existing fees in ORD for all members in selected date range and generate new fees based on shown incident tables. Do you want to continue ?'; + + return ( +
+ + + + Add fees to the ORD + +

{modalContent}

+
+ + +
+ ); + } +} + +export default GenerateFeesInORDButton; diff --git a/client/src/scenes/IncidentsReport/index.js b/client/src/scenes/IncidentsReport/index.js index 3c4f766..0ce667c 100644 --- a/client/src/scenes/IncidentsReport/index.js +++ b/client/src/scenes/IncidentsReport/index.js @@ -5,6 +5,7 @@ import { Container } from 'semantic-ui-react'; import MainMenu from '../../components/MainMenu'; import DateRangePicker from '../../components/DateRangePicker'; import MemberIncidentsTables from '../../components/MemberIncidentsTables'; +import GenerateFeesInORDButton from '../../components/GenerateFeesInORDButton'; import { fetchIncidents } from '../../store/actions'; @@ -14,6 +15,8 @@ class IncidentsReport extends Component { fetchIncidents(dateRange); } + onAddFeesClick = () => {}; + render () { const { pendingIncidents, incidents } = this.props; @@ -22,7 +25,14 @@ class IncidentsReport extends Component {

Incidents Report


- + +
+ +

+

diff --git a/client/src/scenes/PracticeSummaryReport/index.js b/client/src/scenes/PracticeSummaryReport/index.js index e9a062b..379934b 100644 --- a/client/src/scenes/PracticeSummaryReport/index.js +++ b/client/src/scenes/PracticeSummaryReport/index.js @@ -7,6 +7,7 @@ import DateRangePicker from '../../components/DateRangePicker'; import MemberSelector from './components/MemberSelector'; import MemberSummary from './components/MemberSummary'; import MemberIncidentsTables from '../../components/MemberIncidentsTables'; +import GenerateFeesInORDButton from '../../components/GenerateFeesInORDButton'; import { fetchMemberIncidents } from '../../store/actions'; @@ -38,9 +39,13 @@ class PracticeSummaryReport extends Component { } } + onAddFeesClick = () => {}; + render () { const { memberIncidents, loading } = this.props; - const { memberId } = this.state; + const { memberId, dateRange } = this.state; + + const addFeesButtonDisabled = !memberId || !dateRange || loading; return ( @@ -64,6 +69,15 @@ class PracticeSummaryReport extends Component { /> + + + + +