display booking charge incidents; refactor frontend

This commit is contained in:
Bilal Catic
2019-07-08 20:23:50 +02:00
parent c0d7418f3f
commit f6e8e6667b
7 changed files with 179 additions and 36 deletions

View File

@@ -247,7 +247,38 @@ const getAllIncidents = (dateRange, memberId) => {
});
});
allIncidents.push(...bookingChangeIncidents);
bookingChangeIncidents.forEach((bookingChangeIncident) => {
const {
id,
memberId,
resourceId,
oldBookingStart,
oldBookingEnd,
newBookingStart,
newBookingEnd,
incidentType,
chargeFee,
createdAt,
} = bookingChangeIncident;
const memberName = membersMap[memberId].name;
const resource = resourcesMap[resourceId];
const resourceName = resource.resourceName;
const officeName = officesMap[resource.officeId].officeName;
allIncidents.push({
incidentId: id,
memberId,
memberName,
resourceName,
officeName,
oldBookingStart: formatTime(oldBookingStart),
oldBookingEnd: formatTime(oldBookingEnd),
newBookingStart: formatTime(newBookingStart),
newBookingEnd: formatTime(newBookingEnd),
incidentType,
totalChargeFee: chargeFee,
incidentTimestamp: formatTime(createdAt),
});
});
resolve(allIncidents);
})