- Booking: added modify a booking (+ emails).
This commit is contained in:
@@ -33,6 +33,10 @@ const bookingSchema = new Schema({
|
||||
datebooked: {
|
||||
type: Date,
|
||||
},
|
||||
modified: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
booked: {
|
||||
type: Boolean,
|
||||
},
|
||||
@@ -43,7 +47,7 @@ bookingSchema.statics.findAllByUserIdAndIdApp = function (userId, idapp) {
|
||||
const Booking = this;
|
||||
|
||||
return Booking.find({userId, idapp, booked: true}, (err, arrbooked) => {
|
||||
console.log('ris Booking:', arrbooked);
|
||||
// console.log('ris Booking:', arrbooked);
|
||||
return arrbooked
|
||||
});
|
||||
};
|
||||
|
||||
@@ -148,6 +148,7 @@ module.exports = {
|
||||
surname: user.surname,
|
||||
emailto: emailto,
|
||||
participants: '',
|
||||
msgbooking: recbooking.msgbooking,
|
||||
eventtextplain: tools.removeSpecialCharForEmail(recbooking.infoevent),
|
||||
event: recbooking.infoevent,
|
||||
};
|
||||
@@ -155,10 +156,17 @@ module.exports = {
|
||||
if (recbooking.numpeople > 1)
|
||||
mylocalsconf.participants = recbooking.numpeople.toString() + ' ' + res.__("partecipanti");
|
||||
|
||||
this.sendEmail_base('booking/makebooking/' + lang, user, emailto, mylocalsconf);
|
||||
let texthtml = '';
|
||||
if (recbooking.modified) {
|
||||
texthtml = 'modifybooking';
|
||||
}else {
|
||||
texthtml = 'makebooking';
|
||||
}
|
||||
|
||||
this.sendEmail_base('booking/'+texthtml+'/' + lang, user, emailto, mylocalsconf);
|
||||
|
||||
// Send Email also to the Admin
|
||||
this.sendEmail_base('admin/makebooking/' + lang, user, tools.getAdminEmailByIdApp(idapp), mylocalsconf);
|
||||
this.sendEmail_base('admin/'+texthtml+'/' + lang, user, tools.getAdminEmailByIdApp(idapp), mylocalsconf);
|
||||
},
|
||||
|
||||
sendEmail_CancelBooking: function (res, lang, emailto, user, idapp, recbooking) {
|
||||
|
||||
@@ -73,11 +73,11 @@ module.exports = {
|
||||
},
|
||||
|
||||
allfieldBooking: function () {
|
||||
return ['idapp', 'userId', 'id_bookedevent', 'numpeople', 'msgbooking', 'infoevent', 'datebooked', 'booked']
|
||||
return ['idapp', 'userId', 'id_bookedevent', 'numpeople', 'msgbooking', 'modified', 'infoevent', 'datebooked', 'booked']
|
||||
},
|
||||
|
||||
allfieldBookingChange: function () {
|
||||
return ['numpeople', 'msgbooking', 'infoevent', 'datebooked', 'booked']
|
||||
return ['numpeople', 'msgbooking', 'modified', 'infoevent', 'datebooked', 'booked']
|
||||
},
|
||||
|
||||
allfieldProjectWithId: function () {
|
||||
|
||||
Reference in New Issue
Block a user