Improve the content of the calendar event popover widget

This commit is contained in:
Alex Tselegidis 2022-10-16 22:03:29 +03:00
parent b2015052d8
commit e2c3137262
2 changed files with 29 additions and 15 deletions

View file

@ -568,6 +568,16 @@ App.Utils.CalendarDefaultView = (function () {
displayEdit = vars('privileges').appointments.edit === true ? '' : 'd-none'; displayEdit = vars('privileges').appointments.edit === true ? '' : 'd-none';
displayDelete = vars('privileges').appointments.delete === true ? 'me-2' : 'd-none'; displayDelete = vars('privileges').appointments.delete === true ? 'me-2' : 'd-none';
const customerInfo = [];
if (info.event.extendedProps.data.customer.first_name) {
customerInfo.push(info.event.extendedProps.data.customer.first_name);
}
if (info.event.extendedProps.data.customer.last_name) {
customerInfo.push(info.event.extendedProps.data.customer.last_name);
}
$html = $('<div/>', { $html = $('<div/>', {
'html': [ 'html': [
$('<strong/>', { $('<strong/>', {
@ -644,11 +654,8 @@ App.Utils.CalendarDefaultView = (function () {
}), }),
App.Utils.CalendarEventPopover.renderMapIcon(info.event.extendedProps.data.customer), App.Utils.CalendarEventPopover.renderMapIcon(info.event.extendedProps.data.customer),
$('<span/>', { $('<span/>', {
'class': 'd-inline-block ms-1', 'class': 'd-inline-block',
'text': 'text': customerInfo.length ? customerInfo.join(' ') : '-'
info.event.extendedProps.data.customer.first_name +
' ' +
info.event.extendedProps.data.customer.last_name
}), }),
$('<br/>'), $('<br/>'),
@ -658,8 +665,8 @@ App.Utils.CalendarDefaultView = (function () {
}), }),
App.Utils.CalendarEventPopover.renderMailIcon(info.event.extendedProps.data.customer.email), App.Utils.CalendarEventPopover.renderMailIcon(info.event.extendedProps.data.customer.email),
$('<span/>', { $('<span/>', {
'class': 'd-inline-block ms-1', 'class': 'd-inline-block',
'text': info.event.extendedProps.data.customer.email 'text': info.event.extendedProps.data.customer.email || '-'
}), }),
$('<br/>'), $('<br/>'),
@ -669,8 +676,8 @@ App.Utils.CalendarDefaultView = (function () {
}), }),
App.Utils.CalendarEventPopover.renderPhoneIcon(info.event.extendedProps.data.customer.phone_number), App.Utils.CalendarEventPopover.renderPhoneIcon(info.event.extendedProps.data.customer.phone_number),
$('<span/>', { $('<span/>', {
'class': 'd-inline-block ms-1', 'class': 'd-inline-block',
'text': info.event.extendedProps.data.customer.phone_number 'text': info.event.extendedProps.data.customer.phone_number || '-'
}), }),
$('<br/>'), $('<br/>'),

View file

@ -1348,6 +1348,16 @@ App.Utils.CalendarTableView = (function () {
displayEdit = vars('privileges').appointments.edit === true ? '' : 'd-none'; displayEdit = vars('privileges').appointments.edit === true ? '' : 'd-none';
displayDelete = vars('privileges').appointments.delete === true ? '' : 'd-none'; displayDelete = vars('privileges').appointments.delete === true ? '' : 'd-none';
const customerInfo = [];
if (info.event.extendedProps.data.customer.first_name) {
customerInfo.push(info.event.extendedProps.data.customer.first_name);
}
if (info.event.extendedProps.data.customer.last_name) {
customerInfo.push(info.event.extendedProps.data.customer.last_name);
}
$html = $('<div/>', { $html = $('<div/>', {
'html': [ 'html': [
$('<strong/>', { $('<strong/>', {
@ -1424,10 +1434,7 @@ App.Utils.CalendarTableView = (function () {
}), }),
App.Utils.CalendarEventPopover.renderMapIcon(info.event.extendedProps.data.customer), App.Utils.CalendarEventPopover.renderMapIcon(info.event.extendedProps.data.customer),
$('<span/>', { $('<span/>', {
'text': 'text': customerInfo.length ? customerInfo.join(' ') : '-'
info.event.extendedProps.data.customer.first_name +
' ' +
info.event.extendedProps.data.customer.last_name
}), }),
$('<br/>'), $('<br/>'),
@ -1437,7 +1444,7 @@ App.Utils.CalendarTableView = (function () {
}), }),
App.Utils.CalendarEventPopover.renderMailIcon(info.event.extendedProps.data.customer.email), App.Utils.CalendarEventPopover.renderMailIcon(info.event.extendedProps.data.customer.email),
$('<span/>', { $('<span/>', {
'text': info.event.extendedProps.data.customer.email 'text': info.event.extendedProps.data.customer.email || '-'
}), }),
$('<br/>'), $('<br/>'),
@ -1447,7 +1454,7 @@ App.Utils.CalendarTableView = (function () {
}), }),
App.Utils.CalendarEventPopover.renderPhoneIcon(info.event.extendedProps.data.customer.phone_number), App.Utils.CalendarEventPopover.renderPhoneIcon(info.event.extendedProps.data.customer.phone_number),
$('<span/>', { $('<span/>', {
'text': info.event.extendedProps.data.customer.phone_number 'text': info.event.extendedProps.data.customer.phone_number || '-'
}), }),
$('<br/>'), $('<br/>'),