Fixed bookings and timezone problems
This commit is contained in:
@@ -73,17 +73,25 @@ class DateRangePicker extends Component {
|
||||
|
||||
render() {
|
||||
const { startDate, endDate, error, startDateLabel, endDateLabel } = this.state;
|
||||
const { inlineButton } = this.props;
|
||||
|
||||
const buttonLabel = this.props.buttonLabel || 'Save';
|
||||
|
||||
const startDateValue = startDate.format(defaultDateFormat);
|
||||
const endDateValue = endDate.format(defaultDateFormat);
|
||||
|
||||
const buttonRender = (
|
||||
<Grid.Column width={inlineButton ? 1 : null}>
|
||||
{ inlineButton && <label>{'\u00A0'}</label> }
|
||||
<Form.Button onClick={this.onButtonClick.bind(this)}>{buttonLabel}</Form.Button>
|
||||
</Grid.Column>
|
||||
);
|
||||
|
||||
return (
|
||||
<Form>
|
||||
<Grid columns="equal">
|
||||
<Grid stackable columns={inlineButton ? null : 'equal'}>
|
||||
<Grid.Row>
|
||||
<Grid.Column>
|
||||
<Grid.Column width={inlineButton ? 7 : null}>
|
||||
<label>{startDateLabel}</label>
|
||||
<Form.Input
|
||||
fluid
|
||||
@@ -93,7 +101,7 @@ class DateRangePicker extends Component {
|
||||
onChange={this.onStartDateChange.bind(this)}
|
||||
/>
|
||||
</Grid.Column>
|
||||
<Grid.Column>
|
||||
<Grid.Column width={inlineButton ? 6 : null}>
|
||||
<label>{endDateLabel}</label>
|
||||
<Form.Input
|
||||
fluid
|
||||
@@ -103,6 +111,9 @@ class DateRangePicker extends Component {
|
||||
onChange={this.onEndDateChange.bind(this)}
|
||||
/>
|
||||
</Grid.Column>
|
||||
{
|
||||
inlineButton && buttonRender
|
||||
}
|
||||
</Grid.Row>
|
||||
{ error &&
|
||||
<Grid.Row>
|
||||
@@ -114,11 +125,12 @@ class DateRangePicker extends Component {
|
||||
</Grid.Column>
|
||||
</Grid.Row>
|
||||
}
|
||||
<Grid.Row>
|
||||
<Grid.Column>
|
||||
<Form.Button onClick={this.onButtonClick.bind(this)}>{buttonLabel}</Form.Button>
|
||||
</Grid.Column>
|
||||
</Grid.Row>
|
||||
{
|
||||
!inlineButton &&
|
||||
<Grid.Row>
|
||||
{buttonRender}
|
||||
</Grid.Row>
|
||||
}
|
||||
</Grid>
|
||||
</Form>
|
||||
);
|
||||
|
||||
@@ -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>);
|
||||
|
||||
|
||||
@@ -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>
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,24 +6,34 @@ import PracticeSummaryReport from '../scenes/PracticeSummaryReport';
|
||||
export const mainMenuItems = [
|
||||
{
|
||||
id: 'home',
|
||||
showInMenu: true,
|
||||
title: 'Home',
|
||||
url: '/',
|
||||
component: Home,
|
||||
},
|
||||
{
|
||||
id: 'practiceSummaryReport',
|
||||
showInMenu: true,
|
||||
title: 'Practice Summary Report',
|
||||
url: '/practice-summary-report',
|
||||
component: PracticeSummaryReport,
|
||||
},
|
||||
{
|
||||
id: 'practiceSummaryReportWithMemberId',
|
||||
showInMenu: false,
|
||||
url: '/practice-summary-report/:memberId',
|
||||
component: PracticeSummaryReport,
|
||||
},
|
||||
{
|
||||
id: 'report',
|
||||
showInMenu: true,
|
||||
title: 'Incidents Report',
|
||||
url: '/incidents-report',
|
||||
component: IncidentsReport,
|
||||
},
|
||||
{
|
||||
id: 'uploadDLockData',
|
||||
showInMenu: true,
|
||||
title: 'DLock',
|
||||
url: '/dlock',
|
||||
component: UploadDLockData,
|
||||
|
||||
@@ -24,7 +24,7 @@ class IncidentsReport extends Component {
|
||||
<hr/>
|
||||
<DateRangePicker buttonLabel="Show report" onDatesUpdate={this.onDatesUpdate.bind(this)} />
|
||||
<br/>
|
||||
<MemberIncidentsTable loading={pendingIncidents} incidents={incidents} />
|
||||
<MemberIncidentsTable loading={pendingIncidents} incidents={incidents} openMemberSummaryOnMemberClick />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ const MemberSummary = props => {
|
||||
let totalUnlockedFees = 0;
|
||||
|
||||
incidents.forEach((incident) => {
|
||||
console.log(incident);
|
||||
switch (incident.incidentType) {
|
||||
case UNSCHEDULED_INCIDENT:
|
||||
totalUnscheduledFees += parseFloat(incident.totalChargeFee);
|
||||
@@ -19,6 +18,8 @@ const MemberSummary = props => {
|
||||
case UNLOCKED_INCIDENT:
|
||||
totalUnlockedFees += parseFloat(incident.incidentPrice);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -65,5 +66,4 @@ const MemberSummary = props => {
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
export default MemberSummary;
|
||||
|
||||
@@ -16,7 +16,7 @@ class PracticeSummaryReport extends Component {
|
||||
|
||||
this.state = {
|
||||
dateRange: null,
|
||||
memberId: null,
|
||||
memberId: props.match.params.memberId,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class PracticeSummaryReport extends Component {
|
||||
<MemberSelector onMemberSelect={this.onMemberSelectionUpdate.bind(this)} />
|
||||
</Grid.Column>
|
||||
<Grid.Column>
|
||||
<DateRangePicker onDatesUpdate={this.onDateRangeUpdate.bind(this)}/>
|
||||
<DateRangePicker inlineButton onDatesUpdate={this.onDateRangeUpdate.bind(this)}/>
|
||||
</Grid.Column>
|
||||
</Grid.Row>
|
||||
<Grid.Row>
|
||||
|
||||
Reference in New Issue
Block a user