From e2c3137262a6b5b914823a397fb225902a857d73 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Sun, 16 Oct 2022 22:03:29 +0300 Subject: [PATCH] Improve the content of the calendar event popover widget --- assets/js/utils/calendar_default_view.js | 25 +++++++++++++++--------- assets/js/utils/calendar_table_view.js | 19 ++++++++++++------ 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/assets/js/utils/calendar_default_view.js b/assets/js/utils/calendar_default_view.js index 9c149431..286c08f2 100755 --- a/assets/js/utils/calendar_default_view.js +++ b/assets/js/utils/calendar_default_view.js @@ -568,6 +568,16 @@ App.Utils.CalendarDefaultView = (function () { displayEdit = vars('privileges').appointments.edit === true ? '' : '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 = $('
', { 'html': [ $('', { @@ -644,11 +654,8 @@ App.Utils.CalendarDefaultView = (function () { }), App.Utils.CalendarEventPopover.renderMapIcon(info.event.extendedProps.data.customer), $('', { - 'class': 'd-inline-block ms-1', - 'text': - info.event.extendedProps.data.customer.first_name + - ' ' + - info.event.extendedProps.data.customer.last_name + 'class': 'd-inline-block', + 'text': customerInfo.length ? customerInfo.join(' ') : '-' }), $('
'), @@ -658,8 +665,8 @@ App.Utils.CalendarDefaultView = (function () { }), App.Utils.CalendarEventPopover.renderMailIcon(info.event.extendedProps.data.customer.email), $('', { - 'class': 'd-inline-block ms-1', - 'text': info.event.extendedProps.data.customer.email + 'class': 'd-inline-block', + 'text': info.event.extendedProps.data.customer.email || '-' }), $('
'), @@ -669,8 +676,8 @@ App.Utils.CalendarDefaultView = (function () { }), App.Utils.CalendarEventPopover.renderPhoneIcon(info.event.extendedProps.data.customer.phone_number), $('', { - 'class': 'd-inline-block ms-1', - 'text': info.event.extendedProps.data.customer.phone_number + 'class': 'd-inline-block', + 'text': info.event.extendedProps.data.customer.phone_number || '-' }), $('
'), diff --git a/assets/js/utils/calendar_table_view.js b/assets/js/utils/calendar_table_view.js index c1a50778..b550a093 100755 --- a/assets/js/utils/calendar_table_view.js +++ b/assets/js/utils/calendar_table_view.js @@ -1348,6 +1348,16 @@ App.Utils.CalendarTableView = (function () { displayEdit = vars('privileges').appointments.edit === 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 = $('
', { 'html': [ $('', { @@ -1424,10 +1434,7 @@ App.Utils.CalendarTableView = (function () { }), App.Utils.CalendarEventPopover.renderMapIcon(info.event.extendedProps.data.customer), $('', { - 'text': - info.event.extendedProps.data.customer.first_name + - ' ' + - info.event.extendedProps.data.customer.last_name + 'text': customerInfo.length ? customerInfo.join(' ') : '-' }), $('
'), @@ -1437,7 +1444,7 @@ App.Utils.CalendarTableView = (function () { }), App.Utils.CalendarEventPopover.renderMailIcon(info.event.extendedProps.data.customer.email), $('', { - 'text': info.event.extendedProps.data.customer.email + 'text': info.event.extendedProps.data.customer.email || '-' }), $('
'), @@ -1447,7 +1454,7 @@ App.Utils.CalendarTableView = (function () { }), App.Utils.CalendarEventPopover.renderPhoneIcon(info.event.extendedProps.data.customer.phone_number), $('', { - 'text': info.event.extendedProps.data.customer.phone_number + 'text': info.event.extendedProps.data.customer.phone_number || '-' }), $('
'),