Add cancelation charges
This commit is contained in:
@@ -4,33 +4,48 @@ import ReactTable from 'react-table';
|
||||
import 'react-table/react-table.css';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
|
||||
import {incidentsReportHeaderTitles} from '../../../constants/menuItems';
|
||||
import {incidentsReportHeaderTitles} from '../../../constants/constants';
|
||||
import {
|
||||
incidentTableTypes,
|
||||
incidentDescriptions,
|
||||
incidentLevelDescriptions,
|
||||
UNLOCKED_INCIDENT_RELATED_WITH_RESERVATION, UNLOCKED_INCIDENT_STANDALONE, UNSCHEDULED_INCIDENT_AFTER_RESERVATION,
|
||||
UNSCHEDULED_INCIDENT_BEFORE_RESERVATION, UNSCHEDULED_INCIDENT_STANDALONE
|
||||
} from '../../../constants/enums';
|
||||
import { doorLockRelatedWithReservationIncidentHeaders, standaloneDoorLockIncidentHeaders, bookingChangeIncidentHeaders } from '../../../constants/constants';
|
||||
|
||||
|
||||
const SingleIncidentsTable = props => {
|
||||
const { loading, title, openMemberSummaryOnMemberClick, showBookingTimes, showDoorLockEntryTimes, hideMemberName } = props;
|
||||
const {
|
||||
loading,
|
||||
title,
|
||||
openMemberSummaryOnMemberClick,
|
||||
hideMemberName,
|
||||
tableType
|
||||
} = props;
|
||||
const incidents = props.incidents ? props.incidents : [];
|
||||
|
||||
const columns = [];
|
||||
if (incidents && incidents.length > 0){
|
||||
const incidentHeaders = Object.keys(incidentsReportHeaderTitles);
|
||||
|
||||
incidentHeaders.forEach((header) => {
|
||||
if (incidents && incidents.length > 0){
|
||||
let tableHeaders;
|
||||
switch (tableType) {
|
||||
case incidentTableTypes.INCIDENTS_RELATED_TO_RESERVATIONS:
|
||||
tableHeaders = doorLockRelatedWithReservationIncidentHeaders;
|
||||
break;
|
||||
case incidentTableTypes.STANDALONE_INCIDENTS:
|
||||
tableHeaders = standaloneDoorLockIncidentHeaders;
|
||||
break;
|
||||
case incidentTableTypes.BOOKING_CHANGE_INCIDENTS:
|
||||
tableHeaders = bookingChangeIncidentHeaders;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
tableHeaders.forEach((header) => {
|
||||
const columnTitle = incidentsReportHeaderTitles[header];
|
||||
|
||||
let showColumn = true;
|
||||
if ((header === 'bookingStart' || header === 'bookingEnd') && !showBookingTimes){
|
||||
showColumn = false;
|
||||
}
|
||||
if ((header === 'unlockTimestamp' || header === 'lockTimestamp') && !showDoorLockEntryTimes){
|
||||
showColumn = false;
|
||||
}
|
||||
if (header === 'memberName' && hideMemberName){
|
||||
showColumn = false;
|
||||
}
|
||||
@@ -55,6 +70,16 @@ const SingleIncidentsTable = props => {
|
||||
urlValue = `/practice-summary-report/${memberId}`;
|
||||
cellValue = props.value;
|
||||
break;
|
||||
case 'reservation':
|
||||
const bookingStart = props.row['_original'].bookingStart;
|
||||
const bookingEnd = props.row['_original'].bookingEnd;
|
||||
cellValue = `${bookingStart}\n${bookingEnd}`;
|
||||
break;
|
||||
case 'doorLockTimestamps':
|
||||
const unlockTimestamp = props.row['_original'].unlockTimestamp;
|
||||
const lockTimestamp = props.row['_original'].lockTimestamp;
|
||||
cellValue = `${unlockTimestamp ? unlockTimestamp : '---'}\n${lockTimestamp ? lockTimestamp : '---'}`;
|
||||
break;
|
||||
case 'incidentType':
|
||||
cellValue = incidentDescriptions[props.value];
|
||||
break;
|
||||
@@ -85,6 +110,16 @@ const SingleIncidentsTable = props => {
|
||||
cellValue = `$ ${totalFeeFormatted}`;
|
||||
columnContentsAlignment = columnAlignments.right;
|
||||
break;
|
||||
case 'oldReservation':
|
||||
const oldBookingStart = props.row['_original'].oldBookingStart;
|
||||
const oldBookingEnd = props.row['_original'].oldBookingEnd;
|
||||
cellValue = `${oldBookingStart}\n${oldBookingEnd}`;
|
||||
break;
|
||||
case 'newReservation':
|
||||
const newBookingStart = props.row['_original'].newBookingStart;
|
||||
const newBookingEnd = props.row['_original'].newBookingEnd;
|
||||
cellValue = `${newBookingStart}\n${newBookingEnd}`;
|
||||
break;
|
||||
default:
|
||||
cellValue = props.value;
|
||||
}
|
||||
@@ -92,7 +127,7 @@ const SingleIncidentsTable = props => {
|
||||
if (openMemberSummaryOnMemberClick && urlValue){
|
||||
return <NavLink to={urlValue}>{cellValue}</NavLink>
|
||||
}else{
|
||||
return <div style={{ textAlign: columnContentsAlignment }}>{cellValue}</div>
|
||||
return <div style={{ textAlign: columnContentsAlignment, whiteSpace: 'pre' }}>{cellValue}</div>
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,7 +3,8 @@ import {Accordion, Label} from 'semantic-ui-react';
|
||||
import SingleIncidentsTable from './components/SingleIncidentsTable';
|
||||
import {
|
||||
UNLOCKED_INCIDENT_RELATED_WITH_RESERVATION, UNLOCKED_INCIDENT_STANDALONE, UNSCHEDULED_INCIDENT_AFTER_RESERVATION,
|
||||
UNSCHEDULED_INCIDENT_BEFORE_RESERVATION, UNSCHEDULED_INCIDENT_STANDALONE
|
||||
UNSCHEDULED_INCIDENT_BEFORE_RESERVATION, UNSCHEDULED_INCIDENT_STANDALONE, BOOKING_MOVED_TO_ANOTHER_DAY, BOOKING_SHORTENED,
|
||||
incidentTableTypes
|
||||
} from '../../constants/enums';
|
||||
|
||||
export default function MemberIncidentsTables (props) {
|
||||
@@ -11,6 +12,7 @@ export default function MemberIncidentsTables (props) {
|
||||
|
||||
const incidentsRelatedToReservations = [];
|
||||
const standaloneIncidents = [];
|
||||
const bookingChangeIncidents = [];
|
||||
|
||||
if (Array.isArray(incidents)){
|
||||
incidents.forEach((incident) => {
|
||||
@@ -25,6 +27,12 @@ export default function MemberIncidentsTables (props) {
|
||||
case UNSCHEDULED_INCIDENT_STANDALONE:
|
||||
standaloneIncidents.push(incident);
|
||||
break;
|
||||
case BOOKING_MOVED_TO_ANOTHER_DAY:
|
||||
case BOOKING_SHORTENED:
|
||||
bookingChangeIncidents.push(incident);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -35,8 +43,8 @@ export default function MemberIncidentsTables (props) {
|
||||
loading={pendingIncidents}
|
||||
incidents={incidentsRelatedToReservations}
|
||||
openMemberSummaryOnMemberClick
|
||||
showBookingTimes
|
||||
hideMemberName={hideMemberName}
|
||||
tableType={incidentTableTypes.INCIDENTS_RELATED_TO_RESERVATIONS}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -45,8 +53,18 @@ export default function MemberIncidentsTables (props) {
|
||||
loading={pendingIncidents}
|
||||
incidents={standaloneIncidents}
|
||||
openMemberSummaryOnMemberClick
|
||||
showDoorLockEntryTimes
|
||||
hideMemberName={hideMemberName}
|
||||
tableType={incidentTableTypes.STANDALONE_INCIDENTS}
|
||||
/>
|
||||
);
|
||||
|
||||
const bookingChangeIncidentsTable = (
|
||||
<SingleIncidentsTable
|
||||
loading={pendingIncidents}
|
||||
incidents={bookingChangeIncidents}
|
||||
openMemberSummaryOnMemberClick
|
||||
hideMemberName={hideMemberName}
|
||||
tableType={incidentTableTypes.BOOKING_CHANGE_INCIDENTS}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -63,7 +81,8 @@ export default function MemberIncidentsTables (props) {
|
||||
},
|
||||
{
|
||||
key: 'reservation-modification-incidents',
|
||||
title: {content: <Label color='blue' content={'Cancellation charges'}/>},
|
||||
title: {content: <Label color='blue' content={'Booking change charges'}/>},
|
||||
content: { content: bookingChangeIncidentsTable },
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user