2022-01-12 13:22:22 +03:00
|
|
|
/* ----------------------------------------------------------------------------
|
2022-01-18 15:05:42 +03:00
|
|
|
* Easy!Appointments - Online Appointment Scheduler
|
2022-01-12 13:22:22 +03:00
|
|
|
*
|
|
|
|
* @package EasyAppointments
|
|
|
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
|
|
|
* @copyright Copyright (c) Alex Tselegidis
|
|
|
|
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
|
|
|
|
* @link https://easyappointments.org
|
2022-01-18 15:01:22 +03:00
|
|
|
* @since v1.5.0
|
2022-01-12 13:22:22 +03:00
|
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
|
2022-01-14 11:26:44 +03:00
|
|
|
/**
|
|
|
|
* Calendar event popover utility.
|
|
|
|
*
|
|
|
|
* This module implements the functionality of calendar event popovers.
|
|
|
|
*/
|
2022-01-12 13:22:22 +03:00
|
|
|
App.Utils.CalendarEventPopover = (function () {
|
|
|
|
/**
|
|
|
|
* Render a map icon that links to Google maps.
|
|
|
|
*
|
|
|
|
* Old Name: GeneralFunctions.renderMapIcon
|
|
|
|
*
|
|
|
|
* @param {Object} user Should have the address, city, etc properties.
|
|
|
|
*
|
2022-10-16 21:55:59 +03:00
|
|
|
* @return {String} The rendered HTML.
|
2022-01-12 13:22:22 +03:00
|
|
|
*/
|
|
|
|
function renderMapIcon(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) {
|
2022-10-16 21:55:59 +03:00
|
|
|
return null;
|
2022-01-12 13:22:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return $('<div/>', {
|
|
|
|
'html': [
|
|
|
|
$('<a/>', {
|
|
|
|
'href': 'https://google.com/maps/place/' + data.join(','),
|
|
|
|
'target': '_blank',
|
|
|
|
'html': [
|
|
|
|
$('<span/>', {
|
2023-12-22 13:35:41 +03:00
|
|
|
'class': 'fas fa-map-marker-alt',
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
],
|
2022-01-12 13:22:22 +03:00
|
|
|
}).html();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Render a mail icon.
|
|
|
|
*
|
|
|
|
* Old Name: GeneralFunctions.renderMailIcon
|
|
|
|
*
|
|
|
|
* @param {String} email
|
|
|
|
*
|
2022-10-16 21:55:59 +03:00
|
|
|
* @return {String} The rendered HTML.
|
2022-01-12 13:22:22 +03:00
|
|
|
*/
|
|
|
|
function renderMailIcon(email) {
|
2022-10-16 21:55:59 +03:00
|
|
|
if (!email) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-01-12 13:22:22 +03:00
|
|
|
return $('<div/>', {
|
|
|
|
'html': [
|
|
|
|
$('<a/>', {
|
|
|
|
'href': 'mailto:' + email,
|
|
|
|
'target': '_blank',
|
|
|
|
'html': [
|
|
|
|
$('<span/>', {
|
2023-12-22 13:35:41 +03:00
|
|
|
'class': 'fas fa-envelope',
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
],
|
2022-01-12 13:22:22 +03:00
|
|
|
}).html();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Render a phone icon.
|
|
|
|
*
|
|
|
|
* Old Name: GeneralFunctions.renderPhoneIcon
|
|
|
|
*
|
|
|
|
* @param {String} phone
|
|
|
|
*
|
2022-10-16 21:55:59 +03:00
|
|
|
* @return {String} The rendered HTML.
|
2022-01-12 13:22:22 +03:00
|
|
|
*/
|
|
|
|
function renderPhoneIcon(phone) {
|
2022-10-16 21:55:59 +03:00
|
|
|
if (!phone) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-01-12 13:22:22 +03:00
|
|
|
return $('<div/>', {
|
|
|
|
'html': [
|
|
|
|
$('<a/>', {
|
|
|
|
'href': 'tel:' + phone,
|
|
|
|
'target': '_blank',
|
|
|
|
'html': [
|
|
|
|
$('<span/>', {
|
2023-12-22 13:35:41 +03:00
|
|
|
'class': 'fas fa-phone-alt',
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
],
|
2022-01-12 13:22:22 +03:00
|
|
|
}).html();
|
|
|
|
}
|
|
|
|
|
2024-05-17 21:13:58 +03:00
|
|
|
/**
|
|
|
|
* Render custom content into the popover of events.
|
|
|
|
*
|
|
|
|
* @param {Object} info The info object as passed from FullCalendar
|
|
|
|
*
|
|
|
|
* @return {Object|String|null} Return HTML string, a jQuery selector or null for nothing.
|
|
|
|
*/
|
|
|
|
function renderCustomContent(info) {
|
|
|
|
return null; // Default behavior
|
|
|
|
}
|
|
|
|
|
2022-01-12 13:22:22 +03:00
|
|
|
return {
|
|
|
|
renderPhoneIcon,
|
|
|
|
renderMapIcon,
|
2023-12-22 13:35:41 +03:00
|
|
|
renderMailIcon,
|
2024-05-17 21:13:58 +03:00
|
|
|
renderCustomContent,
|
2022-01-12 13:22:22 +03:00
|
|
|
};
|
|
|
|
})();
|