mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-28 02:43:32 +03:00
Do not add a dash in the event title if there are no customer first and last name provided
This commit is contained in:
parent
bbf63001da
commit
b2015052d8
2 changed files with 38 additions and 12 deletions
|
@ -1098,14 +1098,27 @@ App.Utils.CalendarDefaultView = (function () {
|
|||
|
||||
// Add appointments to calendar.
|
||||
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 = {
|
||||
id: appointment.id,
|
||||
title:
|
||||
appointment.service.name +
|
||||
' - ' +
|
||||
appointment.customer.first_name +
|
||||
' ' +
|
||||
appointment.customer.last_name,
|
||||
title: title.join(' - '),
|
||||
start: moment(appointment.start_datetime).toDate(),
|
||||
end: moment(appointment.end_datetime).toDate(),
|
||||
allDay: false,
|
||||
|
|
|
@ -969,14 +969,27 @@ App.Utils.CalendarTableView = (function () {
|
|||
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({
|
||||
id: appointment.id,
|
||||
title:
|
||||
appointment.service.name +
|
||||
' - ' +
|
||||
appointment.customer.first_name +
|
||||
' ' +
|
||||
appointment.customer.last_name,
|
||||
title: title.join(' - '),
|
||||
start: moment(appointment.start_datetime).toDate(),
|
||||
end: moment(appointment.end_datetime).toDate(),
|
||||
allDay: false,
|
||||
|
|
Loading…
Reference in a new issue