Tasks 5, 6 and 7 - late fees, reservation, moved
This commit is contained in:
@@ -102,7 +102,7 @@ incidentTypeExplanations[incidentType.UNLOCKED_INCIDENT_STANDALONE]
|
|||||||
incidentTypeExplanations[incidentType.UNSCHEDULED_INCIDENT_BEFORE_RESERVATION] = 'room used before reservation';
|
incidentTypeExplanations[incidentType.UNSCHEDULED_INCIDENT_BEFORE_RESERVATION] = 'room used before reservation';
|
||||||
incidentTypeExplanations[incidentType.UNSCHEDULED_INCIDENT_AFTER_RESERVATION] = 'room used after reservation';
|
incidentTypeExplanations[incidentType.UNSCHEDULED_INCIDENT_AFTER_RESERVATION] = 'room used after reservation';
|
||||||
incidentTypeExplanations[incidentType.UNSCHEDULED_INCIDENT_STANDALONE] = 'room used without reservation';
|
incidentTypeExplanations[incidentType.UNSCHEDULED_INCIDENT_STANDALONE] = 'room used without reservation';
|
||||||
incidentTypeExplanations[incidentType.BOOKING_MOVED_TO_ANOTHER_DAY] = 'reservation moved to another day';
|
incidentTypeExplanations[incidentType.BOOKING_MOVED_TO_ANOTHER_DAY] = 'reservation moved to another day in less than 24 hrs';
|
||||||
incidentTypeExplanations[incidentType.BOOKING_SHORTENED] = 'reservation shortened after grace period';
|
incidentTypeExplanations[incidentType.BOOKING_SHORTENED] = 'reservation shortened after grace period';
|
||||||
incidentTypeExplanations[incidentType.BOOKING_CANCELED_LATE] = 'reservation cancelled after grace period';
|
incidentTypeExplanations[incidentType.BOOKING_CANCELED_LATE] = 'reservation cancelled after grace period';
|
||||||
|
|
||||||
|
|||||||
@@ -138,8 +138,8 @@ const createFeeFromIncident = (incident) => {
|
|||||||
roomExplanation = newResourceName || 'Unknown';
|
roomExplanation = newResourceName || 'Unknown';
|
||||||
|
|
||||||
// dateExplanation = `${oldBookingStartMoment.clone().format('ddd, MMM DD')} -> ${newBookingStartMoment.clone().format('ddd, MMM DD')}`;
|
// dateExplanation = `${oldBookingStartMoment.clone().format('ddd, MMM DD')} -> ${newBookingStartMoment.clone().format('ddd, MMM DD')}`;
|
||||||
dateExplanation = `${newBookingStartMoment.clone().format('MMM DD')}`;
|
dateExplanation = `${oldBookingStartMoment.clone().format('MMM DD')}`;
|
||||||
bookingTimeExplanation = `[${newBookingStartMoment.clone().format('HH:mm')} to ${newBookingEndMoment.clone().format('HH:mm')}]`;
|
bookingTimeExplanation = `[${oldBookingStartMoment.clone().format('HH:mm')} to ${oldBookingEndMoment.clone().format('HH:mm')}]`;
|
||||||
incidentTimeExplanation = `moved on : ${incidentTimestampMoment.clone().format('MMM DD, HH:mm')}`;
|
incidentTimeExplanation = `moved on : ${incidentTimestampMoment.clone().format('MMM DD, HH:mm')}`;
|
||||||
incidentExplanation += `, ${incidentTimeExplanation}`;
|
incidentExplanation += `, ${incidentTimeExplanation}`;
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ const createFeeFromIncident = (incident) => {
|
|||||||
incidentTimeExplanation = `reservation shortened from [${originalBookingExplanation}] on [${incidentTimestampMoment.clone().format('MMM DD, HH:mm')}]`;
|
incidentTimeExplanation = `reservation shortened from [${originalBookingExplanation}] on [${incidentTimestampMoment.clone().format('MMM DD, HH:mm')}]`;
|
||||||
incidentExplanation = `${incidentTimeExplanation}`;
|
incidentExplanation = `${incidentTimeExplanation}`;
|
||||||
|
|
||||||
date = incidentTimestampMoment.clone().startOf('day').format();
|
date = newBookingStartMoment.clone().utc(UI_TIMEZONE).startOf('day').format();
|
||||||
|
|
||||||
price = +totalChargeFee.toFixed(2);
|
price = +totalChargeFee.toFixed(2);
|
||||||
quantity = 1.00;
|
quantity = 1.00;
|
||||||
|
|||||||
@@ -22,9 +22,14 @@ const deleteFeesFromORD = (dateRange, memberIds) => {
|
|||||||
const fetchedFees = feesResponse.data ? feesResponse.data : [];
|
const fetchedFees = feesResponse.data ? feesResponse.data : [];
|
||||||
const fetchedPlans = plansResponse.data ? plansResponse.data : [];
|
const fetchedPlans = plansResponse.data ? plansResponse.data : [];
|
||||||
|
|
||||||
|
const planIsRateMap = {};
|
||||||
|
|
||||||
const manualFeeNames = [];
|
const manualFeeNames = [];
|
||||||
fetchedPlans.forEach((plan) => {
|
fetchedPlans.forEach((plan) => {
|
||||||
const { name } = plan;
|
const { name, _id, isRate } = plan;
|
||||||
|
|
||||||
|
planIsRateMap[_id] = !!isRate;
|
||||||
|
|
||||||
if (name && name.length > 0){
|
if (name && name.length > 0){
|
||||||
manualFeeNames.push(name);
|
manualFeeNames.push(name);
|
||||||
}
|
}
|
||||||
@@ -40,18 +45,24 @@ const deleteFeesFromORD = (dateRange, memberIds) => {
|
|||||||
const feeIdsToRemove = [];
|
const feeIdsToRemove = [];
|
||||||
|
|
||||||
fetchedFees.forEach((fee) => {
|
fetchedFees.forEach((fee) => {
|
||||||
const { member, date, invoice, name } = fee;
|
const { member, date, invoice, name, plan } = fee;
|
||||||
const { status } = invoice;
|
const { status } = invoice;
|
||||||
const feeId = fee['_id'];
|
const feeId = fee['_id'];
|
||||||
|
const feePlanIsRate = plan ? planIsRateMap[plan] : null;
|
||||||
|
|
||||||
const isDateInDateRange = startDate.isSameOrBefore(date) && endDate.isSameOrAfter(date);
|
const isDateInDateRange = startDate.isSameOrBefore(date) && endDate.isSameOrAfter(date);
|
||||||
let manuallyAddedFee = false;
|
let manuallyAddedFee = false;
|
||||||
if (manualFeeNames.indexOf(name) === -1){
|
|
||||||
if (name && name[0] && CUSTOM_FEES_PREFIXES.indexOf(name[0]) !== -1){
|
if (plan && !feePlanIsRate){
|
||||||
|
manuallyAddedFee = true;
|
||||||
|
}else{
|
||||||
|
if (manualFeeNames.indexOf(name) === -1){
|
||||||
|
if (name && name[0] && CUSTOM_FEES_PREFIXES.indexOf(name[0]) !== -1){
|
||||||
|
manuallyAddedFee = true;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
manuallyAddedFee = true;
|
manuallyAddedFee = true;
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
manuallyAddedFee = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const memberFeesShouldBeDeleted = filterByMemberIds ? memberIdsMap[member] : true;
|
const memberFeesShouldBeDeleted = filterByMemberIds ? memberIdsMap[member] : true;
|
||||||
|
|||||||
Reference in New Issue
Block a user