Do not add a dash in the event title if there are no customer first and last name provided

This commit is contained in:
Alex Tselegidis 2022-10-16 21:58:50 +03:00
parent bbf63001da
commit b2015052d8
2 changed files with 38 additions and 12 deletions

View file

@ -1098,14 +1098,27 @@ App.Utils.CalendarDefaultView = (function () {
// Add appointments to calendar. // Add appointments to calendar.
response.appointments.forEach((appointment) => { response.appointments.forEach((appointment) => {
const title = [
appointment.service.name
];
const customerInfo = [];
if (appointment.customer.first_name) {
customerInfo.push(appointment.customer.first_name);
}
if (appointment.customer.last_name) {
customerInfo.push(appointment.customer.last_name);
}
if (customerInfo.length) {
title.push(customerInfo.join(' '));
}
const appointmentEvent = { const appointmentEvent = {
id: appointment.id, id: appointment.id,
title: title: title.join(' - '),
appointment.service.name +
' - ' +
appointment.customer.first_name +
' ' +
appointment.customer.last_name,
start: moment(appointment.start_datetime).toDate(), start: moment(appointment.start_datetime).toDate(),
end: moment(appointment.end_datetime).toDate(), end: moment(appointment.end_datetime).toDate(),
allDay: false, allDay: false,

View file

@ -969,14 +969,27 @@ App.Utils.CalendarTableView = (function () {
continue; continue;
} }
const title = [
appointment.service.name
];
const customerInfo = [];
if (appointment.customer.first_name) {
customerInfo.push(appointment.customer.first_name);
}
if (appointment.customer.last_name) {
customerInfo.push(appointment.customer.last_name);
}
if (customerInfo.length) {
title.push(customerInfo.join(' '));
}
calendarEvents.push({ calendarEvents.push({
id: appointment.id, id: appointment.id,
title: title: title.join(' - '),
appointment.service.name +
' - ' +
appointment.customer.first_name +
' ' +
appointment.customer.last_name,
start: moment(appointment.start_datetime).toDate(), start: moment(appointment.start_datetime).toDate(),
end: moment(appointment.end_datetime).toDate(), end: moment(appointment.end_datetime).toDate(),
allDay: false, allDay: false,