Add cancelation charges

This commit is contained in:
Senad Uka
2019-07-08 20:37:14 +02:00
parent 1e1c61882f
commit 9d96ac4772
21 changed files with 575 additions and 64 deletions

View File

@@ -4,7 +4,8 @@ import { Loader, Grid } from 'semantic-ui-react';
import {
UNSCHEDULED_INCIDENT_BEFORE_RESERVATION,
UNLOCKED_INCIDENT_RELATED_WITH_RESERVATION,
UNSCHEDULED_INCIDENT_AFTER_RESERVATION, UNSCHEDULED_INCIDENT_STANDALONE, UNLOCKED_INCIDENT_STANDALONE
UNSCHEDULED_INCIDENT_AFTER_RESERVATION, UNSCHEDULED_INCIDENT_STANDALONE, UNLOCKED_INCIDENT_STANDALONE,
BOOKING_MOVED_TO_ANOTHER_DAY, BOOKING_SHORTENED,
} from '../../../constants/enums';
const MemberSummary = props => {
@@ -13,6 +14,7 @@ const MemberSummary = props => {
let totalUnscheduledFees = 0;
let totalUnlockedFees = 0;
let totalBookingChangeFees = 0;
incidents.forEach((incident) => {
switch (incident.incidentType) {
@@ -25,15 +27,20 @@ const MemberSummary = props => {
case UNLOCKED_INCIDENT_STANDALONE:
totalUnlockedFees += parseFloat(incident.incidentPrice);
break;
case BOOKING_MOVED_TO_ANOTHER_DAY:
case BOOKING_SHORTENED:
totalBookingChangeFees += parseFloat(incident.totalChargeFee);
break;
default:
break;
}
});
const grandTotal = totalUnlockedFees + totalUnscheduledFees;
const grandTotal = totalUnlockedFees + totalUnscheduledFees + totalBookingChangeFees;
const formattedUnscheduledFees = `$ ${totalUnscheduledFees.toFixed(2)}`;
const formattedUnlockedFees = `$ ${totalUnlockedFees.toFixed(2)}`;
const formattedBookingChangeFees = `$ ${totalBookingChangeFees.toFixed(2)}`;
const formattedGrandTotalFee = `$ ${grandTotal.toFixed(2)}`;
return (
@@ -44,7 +51,7 @@ const MemberSummary = props => {
!loading &&
<Grid stackable>
<Grid.Row>
<Grid.Column width={3}>
<Grid.Column width={4}>
<p>Unscheduled incidents total :</p>
</Grid.Column>
<Grid.Column width={9}>
@@ -52,7 +59,7 @@ const MemberSummary = props => {
</Grid.Column>
</Grid.Row>
<Grid.Row>
<Grid.Column width={3}>
<Grid.Column width={4}>
<p>Unlocked incidents total :</p>
</Grid.Column>
<Grid.Column width={9}>
@@ -60,7 +67,15 @@ const MemberSummary = props => {
</Grid.Column>
</Grid.Row>
<Grid.Row>
<Grid.Column width={3}>
<Grid.Column width={4}>
<p>Booking change charges total :</p>
</Grid.Column>
<Grid.Column width={9}>
<p>{formattedBookingChangeFees}</p>
</Grid.Column>
</Grid.Row>
<Grid.Row>
<Grid.Column width={4}>
<p><b>Grand Total :</b></p>
</Grid.Column>
<Grid.Column width={9}>