diff --git a/src/assets/js/backend_calendar_default_view.js b/src/assets/js/backend_calendar_default_view.js index 68aa0481..1ad0a557 100755 --- a/src/assets/js/backend_calendar_default_view.js +++ b/src/assets/js/backend_calendar_default_view.js @@ -320,17 +320,21 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; + event.data.service.name + '
' + '' + EALang.provider + ' ' + + GeneralFunctions.renderMapIcon(event.data.customer) + ' ' + event.data.provider.first_name + ' ' + event.data.provider.last_name + '
' + '' + EALang.customer + ' ' + + GeneralFunctions.renderMapIcon(event.data.customer) + ' ' + event.data.customer.first_name + ' ' + event.data.customer.last_name + '
' + '' + EALang.email + ' ' + + GeneralFunctions.renderMailIcon(event.data.customer.email) + ' ' + event.data.customer.email + '
' + '' + EALang.phone_number + ' ' + + GeneralFunctions.renderPhoneIcon(event.data.customer.phone_number) + ' ' + event.data.customer.phone_number + '
' + '
' + diff --git a/src/assets/js/general_functions.js b/src/assets/js/general_functions.js index 21287f0e..70bf97dc 100755 --- a/src/assets/js/general_functions.js +++ b/src/assets/js/general_functions.js @@ -431,4 +431,97 @@ window.GeneralFunctions = window.GeneralFunctions || {}; return result; }; + /** + * Render a map icon that links to Google maps. + * + * @param {Object} user Should have the address, city, etc properties. + * + * @returns {string} The rendered HTML. + */ + exports.renderMapIcon = function (user) { + const data = []; + + if (user.address) { + data.push(user.address); + } + + if (user.city) { + data.push(user.city); + } + + if (user.state) { + data.push(user.state); + } + + if (user.zip_code) { + data.push(user.zip_code); + } + + if (!data.length) { + return ''; + } + + return $('
', { + 'html': [ + $('', { + 'href': 'https://www.google.com/maps/place/' + data.join(','), + 'target': '_blank', + 'html': [ + $('', { + 'class': 'glyphicon glyphicon-map-marker' + }) + ] + }) + ] + }) + .html(); + }; + + /** + * Render a mail icon. + * + * @param {String} email + * + * @returns {string} The rendered HTML. + */ + exports.renderMailIcon = function (email) { + return $('
', { + 'html': [ + $('', { + 'href': 'mailto:' + email, + 'target': '_blank', + 'html': [ + $('', { + 'class': 'glyphicon glyphicon-envelope' + }) + ] + }) + ] + }) + .html(); + }; + + /** + * Render a phone icon. + * + * @param {String} phone + * + * @returns {string} The rendered HTML. + */ + exports.renderPhoneIcon = function (phone) { + return $('
', { + 'html': [ + $('', { + 'href': 'tel:' + phone, + 'target': '_blank', + 'html': [ + $('', { + 'class': 'glyphicon glyphicon-earphone' + }) + ] + }) + ] + }) + .html(); + }; })(window.GeneralFunctions);