0byt3m1n1
Path:
/
home
/
mgatv524
/
public_html
/
giga
/
modules
/
[
Home
]
File: xibo-calendar-render.js.map
{"version":3,"sources":["webpack://xibo-cms/./modules/src/xibo-calendar-render.js"],"names":["jQuery","fn","extend","xiboCalendarRender","options","events","defaults","duration","previewWidth","previewHeight","scaleOverride","$","TODAY","moment","INITIAL_YEAR","year","INITIAL_MONTH","month","INITIAL_DATE","date","TIME_FORMAT","timeFormat","DEFAULT_DAY_START_TIME","startOf","format","DEFAULT_DAY_END_TIME","endOf","GRID_STEP","gridStep","DEFAULT_FONT_SIZE","DEFAULT_FONT_SCALE","textScale","maxEventPerDay","maxEventPerDayWithExtra","weekdaysNames","weekdays","weekdayNameLength","weekdaysMin","weekdaysShort","monthsNames","months","monthNameLength","monthsShort","createCalendar","addEventsToCalendar","applyStyleOptions","toggleClass","showHeader","css","mainBackgroundColor","gridColor","gridTextColor","dayBgColor","dayTextColor","todayTextColor","nowMarkerColor","dayOtherMonthBgColor","dayOtherMonthTextColor","headerBgColor","headerTextColor","weekDaysHeaderBgColor","weekDaysHeaderTextColor","eventBgColor","eventTextColor","dailyEventBgColor","dailyEventTextColor","multiDayEventBgColor","multiDayEventTextColor","aditionalEventsBgColor","aditionalEventsTextColor","noEventsBgColor","noEventsTextColor","getWeekday","weekday","createNowMarker","$container","timeData","dayViewDuration","end","start","$nowMarker","nowTimeInMinutes","diff","as","eventPositionPerc","appendTo","addEventsToCalendarBase","forEach","event","startDate","allDayEvent","isSame","endDate","allDay","subtract","eventTotalDays","currentDayOfEvent","momentAux","addEventToDay","add","getEventContainer","calendarType","find","getAllDayEventsContainer","$newEvent","weekDay","eventDuration","addClass","htmlToAdd","summary","html","remainingDays","$dailyEventsContainer","slots","data","daySlot","undefined","index","length","slot","push","dayAfter","$newContainer","dataSlots","updateContainerExtraEvents","$eventsContainer","containerData","eventData","eventHeightAdj","eventLevel","newLevel","level","eventHeight","height","parseFloat","prependTo","bodyFontSize","parseInt","split","singleEventHeight","extraEventsHeight","Math","floor","maxEventsForThisDay","numberOfExtendedEvents","filter","ev","idx","remove","numEventsToHide","numExtendedEventsFix","append","createCalendarHourGrid","gridSpacing","$calendarContainer","addedEvents","getDayContainer","$dayContainerTemp","$dayContainerTitle","attr","$dayContainer","$dayContainerEvents","showDescription","description","useDateRange","rangeStart","rangeEnd","showNowMarker","$dayEventsContainer","$targetElement","each","insertBefore","noEventsMessage","$hourGrid","$dayTitle","$weekDay","today","day","dayOfMonth","$dayOfMonthElement","startTime","endTime","$dayElement","$daysOfWeek","$calendarDays","currentWeekDays","createDaysForCurrentWeek","appendDay","startOfWeek","Array","map","dayOfWeek","currentMonthDays","previousMonthDays","nextMonthDays","createDaysForCurrentMonth","createDaysForPreviousMonth","createDaysForNextMonth","days","isCurrentMonth","getNumberOfDaysInMonth","daysInMonth","firstDayOfTheMonthWeekday","previousMonth","visibleNumberOfDaysFromPreviousMonth","previousMonthLastMondayDayOfMonth","lastDayOfTheMonthWeekday","nextMonth","visibleNumberOfDaysFromNextMonth"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;AAoBAA,MAAM,CAACC,EAAP,CAAUC,MAAV,CAAiB;AACfC,oBAAkB,EAAE,4BAASC,OAAT,EAAkBC,MAAlB,EAA0B;AAC5C;AACA,QAAMC,QAAQ,GAAG;AACfC,cAAQ,EAAE,IADK;AAEfC,kBAAY,EAAE,CAFC;AAGfC,mBAAa,EAAE,CAHA;AAIfC,mBAAa,EAAE;AAJA,KAAjB;AAOAN,WAAO,GAAGO,CAAC,CAACT,MAAF,CAAS,EAAT,EAAaI,QAAb,EAAuBF,OAAvB,CAAV,CAT4C,CAW5C;;AACA,QAAMQ,KAAK,GAAGC,MAAM,EAApB;AAEA,QAAMC,YAAY,GAAGD,MAAM,GAAGE,IAAT,EAArB,CAd4C,CAgB5C;;AACA,QAAMC,aAAa,GAAGH,MAAM,GAAGI,KAAT,EAAtB;AACA,QAAMC,YAAY,GAAGL,MAAM,GAAGM,IA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nB,CAAhB;;AAEA,gBAAIS,SAAS,KAAKP,SAAlB,EAA6B;AAC3BO,uBAAS,GAAG,EAAZ;AACD;;AAEDA,qBAAS,CAACR,OAAD,CAAT,GAAqB,CAArB;AACAO,yBAAa,CAACR,IAAd,CAAmB,OAAnB,EAA4BS,SAA5B;AACD;AACF;;AAEDnB,iBAAS,CAACxD,GAAV,CAAc,KAAd,EAAqB,IAAI,QAAQmE,OAAZ,GAAsB,KAA3C,EAjIqE,CAmIrE;;AACAX,iBAAS,CAACnB,QAAV,CAAmBwC,gBAAnB,EApIqE,CAsIrE;;AACAD,kCAA0B,CAACC,gBAAD,EAAmBZ,KAAnB,CAA1B;AACD;AACF,KAh0C2C,CAk0C5C;;;AACApE,qBAAiB,CAACzC,OAAD,CAAjB;AACAuC,kBAAc;AACdC,uBAAmB,CAACvC,MAAD,CAAnB;AAEA,WAAO,IAAP;AACD;AAz0Cc,CAAjB,E","file":"xibo-calendar-render.js","sourcesContent":["/**\n * Copyright (C) 2021 Xibo Signage Ltd\n *\n * Xibo - Digital Signage - http://www.xibo.org.uk\n *\n * This file is part of Xibo.\n *\n * Xibo is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * any later version.\n *\n * Xibo is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Xibo. If not, see <http://www.gnu.org/licenses/>.\n */\njQuery.fn.extend({\n xiboCalendarRender: function(options, events) {\n // Default options\n const defaults = {\n duration: '30',\n previewWidth: 0,\n previewHeight: 0,\n scaleOverride: 0,\n };\n\n options = $.extend({}, defaults, options);\n\n // Global constants\n const TODAY = moment();\n\n const INITIAL_YEAR = moment().year();\n\n // NOTE: month format for momentjs is 1-12 and month value is zero indexed\n const INITIAL_MONTH = moment().month();\n const INITIAL_DATE = moment().date();\n\n const TIME_FORMAT = options.timeFormat || 'HH:mm';\n\n const DEFAULT_DAY_START_TIME = moment().startOf('day').format(TIME_FORMAT);\n const DEFAULT_DAY_END_TIME = moment().endOf('day').format(TIME_FORMAT);\n\n const GRID_STEP = options.gridStep &&\n options.gridStep > 0 ? options.gridStep : 60;\n\n const DEFAULT_FONT_SIZE = 16;\n const DEFAULT_FONT_SCALE = options.textScale || 1;\n\n // Global vars for all calendar types\n let maxEventPerDay;\n let maxEventPerDayWithExtra;\n\n let weekdaysNames = moment.weekdays(true);\n if (options.weekdayNameLength == 'short') {\n weekdaysNames = moment.weekdaysMin(true);\n } else if (options.weekdayNameLength == 'medium') {\n weekdaysNames = moment.weekdaysShort(true);\n }\n\n let monthsNames = moment.months();\n if (options.monthNameLength == 'short') {\n monthsNames = moment.monthsShort();\n }\n\n // Main functions to be overriden\n let createCalendar = () => {};\n let addEventsToCalendar = () => {};\n\n /**\n * Apply style based on options\n */\n function applyStyleOptions() {\n $('#content').toggleClass('hide-header', options.showHeader != '1');\n $(':root').css('font-size', DEFAULT_FONT_SIZE * DEFAULT_FONT_SCALE);\n\n options.mainBackgroundColor &&\n $(':root').css('--main-background-color', options.mainBackgroundColor);\n\n options.gridColor && $(':root').css('--grid-color', options.gridColor);\n options.gridTextColor &&\n $(':root').css('--grid-text-color', options.gridTextColor);\n\n options.dayBgColor &&\n $(':root').css('--day-bg-color', options.dayBgColor);\n options.dayTextColor &&\n $(':root').css('--day-text-color', options.dayTextColor);\n\n options.todayTextColor &&\n $(':root').css('--today-text-color', options.todayTextColor);\n\n options.nowMarkerColor &&\n $(':root').css('--now-marker-color', options.nowMarkerColor);\n\n options.dayOtherMonthBgColor &&\n $(':root').css(\n '--day-other-month-bg-color',\n options.dayOtherMonthBgColor,\n );\n options.dayOtherMonthTextColor &&\n $(':root').css(\n '--day-other-month-text-color',\n options.dayOtherMonthTextColor,\n );\n\n options.headerBgColor &&\n $(':root').css('--header-bg-color', options.headerBgColor);\n options.headerTextColor &&\n $(':root').css('--header-text-color', options.headerTextColor);\n\n options.weekDaysHeaderBgColor &&\n $(':root').css('--weekdays-bg-color', options.weekDaysHeaderBgColor);\n options.weekDaysHeaderTextColor &&\n $(':root').css(\n '--weekdays-text-color',\n options.weekDaysHeaderTextColor,\n );\n\n options.eventBgColor &&\n $(':root').css('--event-bg-color', options.eventBgColor);\n options.eventTextColor &&\n $(':root').css('--event-text-color', options.eventTextColor);\n\n options.dailyEventBgColor &&\n $(':root').css('--daily-event-bg-color', options.dailyEventBgColor);\n options.dailyEventTextColor &&\n $(':root').css('--daily-event-text-color', options.dailyEventTextColor);\n\n options.multiDayEventBgColor &&\n $(':root').css(\n '--multi-day-event-bg-color',\n options.multiDayEventBgColor,\n );\n options.multiDayEventTextColor &&\n $(':root').css(\n '--multi-day-event-text-color',\n options.multiDayEventTextColor,\n );\n\n options.aditionalEventsBgColor &&\n $(':root').css(\n '--aditional-events-bg-color',\n options.aditionalEventsBgColor,\n );\n options.aditionalEventsTextColor &&\n $(':root').css(\n '--aditional-events-text-color',\n options.aditionalEventsTextColor,\n );\n\n options.noEventsBgColor &&\n $(':root').css(\n '--no-events-bg-color',\n options.noEventsBgColor,\n );\n options.noEventsTextColor &&\n $(':root').css(\n '--no-events-text-color',\n options.noEventsTextColor,\n );\n }\n\n /**\n * Get week day number by date\n * @param {string} date date string\n * @return {number} week day number\n */\n function getWeekday(date) {\n return moment(date).weekday() + 1;\n }\n\n /**\n * Create a marker showing current time\n * @param {object} $container target container\n * @param {object} timeData data with start and end dates for the view\n */\n function createNowMarker($container, timeData) {\n const dayViewDuration = timeData.end - timeData.start;\n const $nowMarker = $('<div class=\"now-marker\">');\n\n const nowTimeInMinutes = moment\n .duration(\n moment(TODAY).diff(\n moment(TODAY).startOf('day'),\n ),\n )\n .as('minutes');\n\n // Skip if it's not included in the selected delta time view\n if (\n nowTimeInMinutes >= timeData.end ||\n nowTimeInMinutes <= timeData.start\n ) {\n return;\n }\n\n // Calculate position\n const eventPositionPerc = (\n nowTimeInMinutes / dayViewDuration -\n timeData.start / dayViewDuration\n ) * 100;\n\n $nowMarker.css(\n 'top',\n eventPositionPerc + '%',\n );\n\n // Append marker to container\n $nowMarker.appendTo($container);\n }\n\n /**\n * Add events to calendar\n */\n function addEventsToCalendarBase() {\n events.forEach((event) => {\n const startDate = moment(event.startDate).startOf('date');\n\n // Check if event is an all day\n // (startDate 00:00 day 1, endDate 00:00 day after last day)\n const allDayEvent =\n moment(event.startDate).isSame(startDate) &&\n moment(event.endDate).isSame(moment(event.endDate).startOf('date'));\n event.allDay = allDayEvent;\n\n const endDate = allDayEvent ?\n moment(event.endDate).startOf('date').subtract(1, 'd') :\n moment(event.endDate).startOf('date');\n\n const eventTotalDays = endDate.diff(startDate, 'days') + 1;\n let currentDayOfEvent = 1;\n\n // Days loop\n const momentAux = moment(startDate);\n while (momentAux <= endDate) {\n addEventToDay(momentAux, event, eventTotalDays, currentDayOfEvent);\n currentDayOfEvent++;\n momentAux.add(1, 'd');\n }\n });\n }\n\n /**\n * Add event to specific day\n * @param {object} date momentjs date\n * @param {object} event\n * @param {number} eventTotalDays\n * @param {number} currentDayOfEvent\n */\n function addEventToDay(date, event, eventTotalDays, currentDayOfEvent) {\n /**\n * Get container by date\n * @param {object} date\n * @return {object} Jquery container\n */\n function getEventContainer(date) {\n return (options.calendarType == 2) ?\n $('.calendar-day .calendar-events-container') :\n $('#day_' + date.date()).find('.calendar-events-container');\n }\n\n /**\n * Get all days container by date\n * @param {object} date\n * @return {object} Jquery container\n */\n function getAllDayEventsContainer(date) {\n return (options.calendarType == 2) ?\n $('.calendar-day .calendar-all-day-events-container') :\n $('#day_' + date.date()).find('.calendar-all-day-events-container');\n }\n\n const $newEvent = $('<div class=\"calendar-event\">');\n const weekDay = getWeekday(date);\n let eventDuration = 1;\n\n // Mark event as an all day\n if (event.allDay) {\n $newEvent.addClass('all-day');\n }\n\n if (eventTotalDays > 1) {\n // Multiple day event\n let htmlToAdd =\n '<span class=\"event-summary\">' + event.summary + '</span>';\n\n // Mark as multi event\n $newEvent.addClass('multi-day');\n\n // Draw only on the first day of the event\n // or at the beggining of the weeks when it breaks\n if (currentDayOfEvent == 1 || weekDay == 1) {\n if (currentDayOfEvent == 1 && !event.allDay) {\n htmlToAdd =\n '<div class=\"event-time\">' +\n moment(event.startDate).format(TIME_FORMAT) +\n '</div>' +\n htmlToAdd;\n }\n\n // Show event content in multiple days\n $newEvent.html(htmlToAdd);\n\n // Update element duration based on event duration\n eventDuration = eventTotalDays - (currentDayOfEvent - 1);\n\n const remainingDays = 8 - weekDay;\n if (eventDuration > remainingDays) {\n eventDuration = remainingDays;\n $newEvent.addClass('cropped-event-end');\n }\n\n if (currentDayOfEvent > 1) {\n $newEvent.addClass('cropped-event-start');\n }\n $newEvent.css(\n 'width',\n 'calc(' +\n eventDuration * 100 +\n '% + ' +\n eventDuration * 2 +\n 'px)',\n );\n } else {\n // Multiple event that was extended, no need to be rendered\n return;\n }\n } else {\n // Single day event\n let htmlToAdd =\n '<div class=\"event-summary\">' + event.summary + '</div>';\n\n // Mark event as an all day\n if (event.allDay) {\n $newEvent.addClass('all-day');\n } else {\n htmlToAdd =\n htmlToAdd +\n '<div class=\"event-time\">' +\n moment(event.startDate).format(TIME_FORMAT) +\n ' - ' +\n moment(event.endDate).format(TIME_FORMAT) +\n '</div>';\n }\n\n // Add inner html\n $newEvent.html(htmlToAdd);\n }\n\n // All day or multi day events\n if (eventTotalDays > 1 || event.allDay) {\n // If there's at least one daily event\n // enable the container in the calendar view\n $('.calendar-container').addClass('show-all-day-events');\n\n const $dailyEventsContainer = getAllDayEventsContainer(date);\n\n // Calculate event slot\n let slots = $dailyEventsContainer.data('slots');\n let daySlot;\n if (slots != undefined) {\n for (let index = 0; index < slots.length; index++) {\n const slot = slots[index];\n if (slot === undefined) {\n daySlot = index;\n slots[index] = 1;\n break;\n }\n }\n\n if (daySlot === undefined) {\n daySlot = slots.length;\n slots.push(1);\n }\n } else {\n daySlot = 0;\n slots = [1];\n }\n\n $dailyEventsContainer.data('slots', slots);\n\n // Extend event to the remaining days\n if (eventDuration > 1 && options.calendarType != 2) {\n for (let dayAfter = 1; dayAfter < eventDuration; dayAfter++) {\n const $newContainer = getAllDayEventsContainer(\n moment(date).add(dayAfter, 'd'),\n );\n let dataSlots = $newContainer.data('slots');\n\n if (dataSlots === undefined) {\n dataSlots = [];\n }\n\n dataSlots[daySlot] = 2;\n $newContainer.data('slots', dataSlots);\n }\n }\n\n $newEvent.css('top', 1.875 * daySlot + 'rem');\n\n // Append event to container\n $newEvent.appendTo($dailyEventsContainer);\n\n // Check container height and slots to show number of extra events\n updateContainerExtraEvents($dailyEventsContainer, slots);\n } else {\n // Daily timed event\n const $eventsContainer = getEventContainer(date);\n const containerData = $('.hour-grid').data();\n\n const dayViewDuration = containerData.end - containerData.start;\n const eventData = {\n start: moment\n .duration(\n moment(event.startDate).diff(\n moment(event.startDate).startOf('day'),\n ),\n )\n .as('minutes'),\n duration: moment\n .duration(moment(event.endDate).diff(moment(event.startDate)))\n .as('minutes'),\n };\n\n // Skip event if it's not included in the selected delta time view\n if (\n eventData.start >= containerData.end ||\n eventData.start + eventData.duration <= containerData.start\n ) {\n return;\n }\n\n // Calculate position\n let eventPositionPerc = (\n eventData.start / dayViewDuration -\n containerData.start / dayViewDuration\n ) * 100;\n let eventHeightAdj = 0;\n\n // Check if event starts before view time\n if (eventPositionPerc < 0) {\n $newEvent.addClass('before-view');\n eventHeightAdj = eventPositionPerc;\n eventPositionPerc = 0;\n }\n\n $newEvent.css(\n 'top',\n eventPositionPerc + '%',\n );\n\n // Calculate event slot\n let slots = $eventsContainer.data('slots');\n let eventLevel = 0;\n if (slots != undefined) {\n let newLevel = 0;\n for (let index = 0; index < slots.length; index++) {\n const slot = slots[index];\n if (\n !(\n eventData.start >= slot.end ||\n eventData.start + eventData.duration <= slot.start\n )\n ) {\n newLevel = slot.level + 1;\n }\n }\n\n slots.push({\n level: newLevel,\n start: eventData.start,\n end: eventData.start + eventData.duration,\n });\n\n eventLevel = newLevel;\n } else {\n slots = [\n {\n level: 0,\n start: eventData.start,\n end: eventData.start + eventData.duration,\n },\n ];\n\n eventLevel = 0;\n }\n\n // Update container slots\n $eventsContainer.data('slots', slots);\n\n // Assign level\n $newEvent.addClass('level-' + eventLevel);\n $newEvent.toggleClass('concurrent', eventLevel > 0);\n\n // Calculate height\n const eventHeight = ((eventData.duration / dayViewDuration) * 100) +\n eventHeightAdj;\n\n $newEvent.height(eventHeight + '%');\n\n // Append event to container\n $newEvent.appendTo($eventsContainer);\n\n // Mark shorter events to be styled\n if ($newEvent.height() < parseFloat($newEvent.css('font-size')) * 2) {\n $newEvent.addClass('shorter-event');\n $newEvent.find('.event-time').prependTo($newEvent);\n }\n }\n }\n\n /**\n * Update container and hide the number of extra events\n * @param {object} $container jquery container\n * @param {object} slots occupied slots\n */\n function updateContainerExtraEvents($container, slots) {\n // Calculate max events per container (if not defined)\n if (!maxEventPerDay) {\n const bodyFontSize = parseInt(\n $('body').css('font-size').split('px')[0],\n );\n const singleEventHeight =\n bodyFontSize * 1.25 + bodyFontSize * 0.5 + bodyFontSize * 0.125;\n const extraEventsHeight = bodyFontSize * 1.25 + bodyFontSize * 0.125;\n maxEventPerDay = Math.floor($container.height() / singleEventHeight);\n\n maxEventPerDayWithExtra = Math.floor(\n ($container.height() - extraEventsHeight) / singleEventHeight,\n );\n }\n\n // If we show extra. get number of events\n // that fit inside that space ( smaller )\n let maxEventsForThisDay = maxEventPerDay;\n if (slots.length > maxEventPerDay) {\n maxEventsForThisDay = maxEventPerDayWithExtra;\n }\n\n // Get number of dummy events that were generated\n // by extended events in the visible elements\n const numberOfExtendedEvents = slots.filter((ev, idx) => {\n return ev == 2 && idx <= maxEventsForThisDay;\n }).length;\n\n // Remove extra elements\n if (\n maxEventsForThisDay > 0 &&\n maxEventsForThisDay > numberOfExtendedEvents\n ) {\n $container\n .find(\n '.calendar-event:gt(' +\n (maxEventsForThisDay - numberOfExtendedEvents - 1) +\n ')',\n )\n .remove();\n } else {\n $container.find('.calendar-event').remove();\n }\n\n // Calculate number of events that were hidden\n let numEventsToHide = 0;\n for (let index = maxEventsForThisDay; index < slots.length; index++) {\n if (slots[index] != undefined) {\n numEventsToHide++;\n }\n }\n\n // Fix for extended events\n let numExtendedEventsFix = 0;\n if (maxEventsForThisDay > 0 &&\n maxEventsForThisDay < numberOfExtendedEvents) {\n numExtendedEventsFix = numberOfExtendedEvents - maxEventsForThisDay;\n }\n numEventsToHide -= numExtendedEventsFix;\n\n // Update extra events label\n if (numEventsToHide > 0) {\n if ($container.find('.extra-events').length > 0) {\n $container.find('.extra-events span').html('+ ' + numEventsToHide);\n } else {\n $container.append(\n '<div class=\"extra-events\"><span>+ ' +\n numEventsToHide +\n '</span></div>',\n );\n }\n }\n }\n\n /**\n * Create hour grid\n * @param {object} $container jquery container\n * @param {string} start\n * @param {string} end\n */\n function createCalendarHourGrid($container, start, end) {\n start =\n start == '' ?\n moment(DEFAULT_DAY_START_TIME, TIME_FORMAT) :\n moment(start, TIME_FORMAT);\n end =\n end == '' ?\n moment(DEFAULT_DAY_END_TIME, TIME_FORMAT) :\n moment(end, TIME_FORMAT);\n\n // Hour loop\n const momentAux = moment(start);\n while (momentAux <= end) {\n $container.append(\n '<li class=\"hour-time\">' + momentAux.format(TIME_FORMAT) + '</li>',\n );\n momentAux.add(GRID_STEP, 'm');\n }\n\n // Save properties to the container for later use\n const containerData = {\n start: moment\n .duration(moment(start).diff(moment(start).startOf('day')))\n .as('minutes'),\n end: moment\n .duration(moment(end).diff(moment(end).startOf('day')))\n .as('minutes'),\n };\n $container.data(containerData);\n\n // Calculate hour grid spacing\n const gridSpacing =\n (1 / ((containerData.end - containerData.start) / GRID_STEP)) * 100;\n $container.find('.hour-time').height(gridSpacing + '%');\n }\n\n // Functions by calendar type\n if (options.calendarType == 1) {\n // Schedule View\n const $calendarContainer = $('.calendar-container');\n let addedEvents = 0;\n\n /**\n * Add event to specific day (override)\n * @param {object} date momentjs date\n * @param {object} event\n * @param {number} eventTotalDays\n * @param {number} currentDayOfEvent\n */\n function addEventToDay(date, event, eventTotalDays, currentDayOfEvent) {\n /**\n * Get container by date\n * @param {object} date\n * @return {object} Jquery container\n */\n function getDayContainer(date) {\n let $dayContainerTemp;\n let $dayContainerTitle;\n\n if ($('#day_' + date.month() + '_' + date.date()).length > 0) {\n $dayContainerTemp = $('#day_' + date.month() + '_' + date.date());\n } else {\n $dayContainerTemp = $('<div>').attr('id', 'day_' +\n date.month() + '_' + date.date()).addClass('day-container');\n\n $dayContainerTitle = $('<div class=\"title-container\">').appendTo(\n $dayContainerTemp);\n\n if (moment(date).startOf('d').isSame(moment(TODAY).startOf('d'))) {\n $dayContainerTemp.addClass('today');\n }\n\n $('<div class=\"day-title-date\">' +\n date.date() +\n '</div>').appendTo($dayContainerTitle);\n\n $('<div class=\"day-title-month\">' +\n monthsNames[date.month()] +\n '</div>').appendTo($dayContainerTitle);\n\n $('<div class=\"day-title-weekday\">' +\n weekdaysNames[date.weekday()] +\n '</div>').appendTo($dayContainerTitle);\n\n $('<div class=\"day-events\">').appendTo($dayContainerTemp);\n\n $dayContainerTemp.appendTo($calendarContainer);\n }\n\n // $calendarContainer\n return $dayContainerTemp;\n }\n\n const $newEvent = $('<div class=\"calendar-event\">');\n const $dayContainer = getDayContainer(date);\n const $dayContainerEvents = $dayContainer.find('.day-events');\n let htmlToAdd = '';\n\n // Add time\n if (!event.allDay) {\n if (currentDayOfEvent == 1) {\n htmlToAdd +=\n '<span class=\"event-start-time\">' +\n moment(event.startDate).format(TIME_FORMAT) +\n '</span>';\n\n // Save start date to object data\n $newEvent.data('start', event.startDate);\n\n if (eventTotalDays == 1) {\n htmlToAdd +=\n ' - <span class=\"event-end-time\">' +\n moment(event.endDate).format(TIME_FORMAT) +\n '</span>';\n }\n }\n } else {\n // Mark event as an all day\n $newEvent.addClass('all-day');\n }\n\n // Mark event as a multi-day\n if (eventTotalDays > 1) {\n $newEvent.addClass('multi');\n }\n\n // Add summary\n htmlToAdd += '<span class=\"event-summary\">' + event.summary + '</span>';\n\n if (options.showDescription == 1 && event.description) {\n htmlToAdd += '<div class=\"event-description\">' +\n event.description + '</div>';\n }\n\n // Add inner html\n $newEvent.html(htmlToAdd);\n\n // Append event to container\n if (event.allDay) {\n $newEvent.prependTo($dayContainerEvents);\n } else {\n $newEvent.appendTo($dayContainerEvents);\n }\n\n addedEvents++;\n }\n\n // Override addEventsToCalendarBase\n addEventsToCalendar = function(events) {\n events.forEach((event) => {\n const startDate = moment(event.startDate).startOf('date');\n\n // Check if event is an all day\n // (startDate 00:00 day 1, endDate 00:00 day after last day)\n const allDayEvent =\n moment(event.startDate).isSame(startDate) &&\n moment(event.endDate).isSame(moment(event.endDate).startOf('date'));\n event.allDay = allDayEvent;\n\n const endDate = allDayEvent ?\n moment(event.endDate).startOf('date').subtract(1, 'd') :\n moment(event.endDate).startOf('date');\n\n const eventTotalDays = endDate.diff(startDate, 'days') + 1;\n let currentDayOfEvent = 1;\n\n // Days loop\n const momentAux = moment(startDate);\n\n while (momentAux <= endDate) {\n let startDate = null;\n let endDate = null;\n\n // If we're using a date range\n // show only events from the start date onwards\n // and before the end date\n if (options.useDateRange == 1) {\n (options.rangeStart) && (startDate = moment(options.rangeStart));\n (options.rangeEnd) && (endDate = moment(options.rangeEnd));\n } else {\n startDate = TODAY.startOf('d');\n }\n\n // Add event\n if ((!startDate || momentAux >= startDate) &&\n (!endDate || momentAux <= endDate)) {\n addEventToDay(\n momentAux,\n event,\n eventTotalDays,\n currentDayOfEvent);\n }\n\n currentDayOfEvent++;\n momentAux.add(1, 'd');\n }\n });\n\n // Create now marker\n if (options.showNowMarker == 1) {\n const $nowMarker = $('<div class=\"now-marker\">');\n const $dayEventsContainer = $calendarContainer.find('#day_' +\n moment(TODAY).month() + '_' + moment(TODAY).date() +\n ' .day-events');\n let $targetElement;\n\n if ($dayEventsContainer.length > 0) {\n // Calculate position\n $dayEventsContainer.find('.calendar-event').each((idx, event) => {\n const start = $(event).data('start');\n\n if (start && TODAY < moment(start)) {\n $targetElement = $(event);\n $nowMarker.insertBefore($targetElement);\n return false;\n }\n });\n\n // Append marker to container\n if (!$targetElement) {\n $nowMarker.appendTo($dayEventsContainer);\n }\n }\n }\n\n // Show no events message\n if (options.noEventsMessage != '' && addedEvents == 0) {\n $calendarContainer.append('<div class=\"no-events-message\">' +\n options.noEventsMessage + '</div>');\n }\n // noEventsMessage\n };\n } else if (options.calendarType == 2) {\n // Daily View\n const $hourGrid = $('.hour-grid');\n const $dayTitle = $('.day-title');\n const $dayContainer = $('.day-container');\n\n createCalendar = function() {\n // Add day label\n const $weekDay = $('<li>');\n $dayTitle.append($weekDay);\n $weekDay.html('<div class=\"week-day\">' +\n weekdaysNames[TODAY.weekday()] +\n '</div>');\n\n const today = moment(TODAY);\n const day = {\n date: today.format('YYYY-MM-DD'),\n dayOfMonth: today.date(),\n };\n\n const $dayOfMonthElement = $('<div class=\"week-day-date\">');\n $dayOfMonthElement.html(day.dayOfMonth);\n $weekDay.append($dayOfMonthElement);\n\n // Add hour grid\n createCalendarHourGrid($hourGrid, options.startTime, options.endTime);\n\n // Add day element\n const $dayElement = $('<li id=\"day_' + day.dayOfMonth + '\">');\n $dayElement.addClass('calendar-day');\n\n // Append all day events container\n $dayElement.append(\n $('<div class=\"calendar-all-day-events-container\">'),\n );\n\n // Append normal events container\n $dayElement.append($('<div class=\"calendar-events-container\">'));\n\n // Append day to container\n $dayContainer.append($dayElement);\n\n if (options.showNowMarker == 1) {\n createNowMarker(\n $dayElement.find('.calendar-events-container'),\n $('.hour-grid').data(),\n );\n }\n };\n\n addEventsToCalendar = addEventsToCalendarBase;\n } else if (options.calendarType == 3) {\n // Weekly View\n const $daysOfWeek = $('.day-of-week');\n const $calendarDays = $('.days-row');\n const $hourGrid = $('.hour-grid');\n\n createCalendar = function() {\n const year = INITIAL_YEAR;\n const month = INITIAL_MONTH;\n const date = INITIAL_DATE;\n\n weekdaysNames.forEach((weekday, idx) => {\n const $weekDay = $('<li id=\"' + idx + '\">');\n $daysOfWeek.append($weekDay);\n $weekDay.html('<div class=\"week-day\">' + weekday + '</div>');\n });\n\n // Add hour grid\n createCalendarHourGrid($hourGrid, options.startTime, options.endTime);\n\n // Remove all days\n $calendarDays.find('.calendar-day').remove();\n\n currentWeekDays = createDaysForCurrentWeek(year, month, date);\n\n currentWeekDays.forEach((day) => {\n appendDay(day, $calendarDays);\n });\n };\n\n /**\n * Create days for current week\n * @param {string} year\n * @param {string} month\n * @param {string} date\n * @return {array} Days of the week\n */\n function createDaysForCurrentWeek(year, month, date) {\n const startOfWeek = moment({\n year: year,\n month: month,\n date: date,\n }).startOf('week');\n\n return [...Array(7)].map((day, index) => {\n const weekDay = moment(startOfWeek).add(index, 'd');\n return {\n date: weekDay.format('YYYY-MM-DD'),\n dayOfMonth: weekDay.date(),\n dayOfWeek: index,\n };\n });\n }\n\n /**\n * Append new day\n * @param {object} day\n * @param {object} $calendarDays\n */\n function appendDay(day, $calendarDays) {\n const $daysOfWeek = $('.day-of-week');\n const $dayElement = $('<li id=\"day_' + day.dayOfMonth + '\">');\n $dayElement.addClass('calendar-day');\n\n // Append all day events container\n $dayElement.append(\n $('<div class=\"calendar-all-day-events-container\">'),\n );\n\n // Append normal events container\n $dayElement.append($('<div class=\"calendar-events-container\">'));\n\n // Append week day name element\n const $dayOfMonthElement = $('<div class=\"week-day-date\">');\n $dayOfMonthElement.html(day.dayOfMonth);\n $daysOfWeek.find('#' + day.dayOfWeek).append($dayOfMonthElement);\n\n $calendarDays.append($dayElement);\n\n if (day.date === moment(TODAY).format('YYYY-MM-DD')) {\n $daysOfWeek.find('#' + day.dayOfWeek).addClass('day-of-week--today');\n\n if (options.showNowMarker == 1) {\n createNowMarker(\n $dayElement.find('.calendar-events-container'),\n $('.hour-grid').data(),\n );\n }\n }\n }\n\n // Override addEventsToCalendarBase\n addEventsToCalendar = function(events) {\n events.forEach((event) => {\n const startDate = moment(event.startDate).startOf('date');\n\n // Check if event is an all day\n // (startDate 00:00 day 1, endDate 00:00 day after last day)\n const allDayEvent =\n moment(event.startDate).isSame(startDate) &&\n moment(event.endDate).isSame(moment(event.endDate).startOf('date'));\n event.allDay = allDayEvent;\n\n const endDate = allDayEvent ?\n moment(event.endDate).startOf('date').subtract(1, 'd') :\n moment(event.endDate).startOf('date');\n\n const eventTotalDays = endDate.diff(startDate, 'days') + 1;\n let currentDayOfEvent = 1;\n\n // Days loop\n const momentAux = moment(startDate);\n while (momentAux <= endDate) {\n addEventToDay(momentAux, event, eventTotalDays, currentDayOfEvent);\n currentDayOfEvent++;\n momentAux.add(1, 'd');\n }\n });\n };\n } else if (options.calendarType == 4) {\n // Monthly View\n let currentMonthDays;\n let previousMonthDays;\n let nextMonthDays;\n\n createCalendar = function() {\n const $calendarDays = $('#calendarDays');\n const year = INITIAL_YEAR;\n const month = INITIAL_MONTH;\n const $daysOfWeek = $('#daysOfWeek');\n\n weekdaysNames.forEach((weekday) => {\n const $weekDay = $('<li>');\n $daysOfWeek.append($weekDay);\n $weekDay.html(weekday);\n });\n\n $('#selectedMonth').html(\n moment({\n year: year,\n month: month,\n }).format('MMMM YYYY'),\n );\n\n // Remove all days\n $calendarDays.find('.calendar-day').remove();\n\n currentMonthDays = createDaysForCurrentMonth(year, month);\n\n previousMonthDays = createDaysForPreviousMonth(year, month - 1);\n nextMonthDays = createDaysForNextMonth(year, month + 1);\n\n const days = [\n ...previousMonthDays,\n ...currentMonthDays,\n ...nextMonthDays,\n ];\n\n days.forEach((day) => {\n appendDay(day, $calendarDays);\n });\n };\n\n /**\n * Append new day\n * @param {object} day\n * @param {object} $calendarDays\n */\n function appendDay(day, $calendarDays) {\n const $dayElement = $(\n '<li id=\"day_' + day.month + '_' + day.dayOfMonth + '\">',\n );\n $dayElement.addClass('calendar-day');\n\n // Append events container\n const $eventsContainer = $('<div class=\"calendar-events-container\">');\n $dayElement.append($eventsContainer);\n\n // Append day\n const $dayOfMonthElement = $('<span class=\"date\">');\n $dayOfMonthElement.html(day.dayOfMonth);\n $dayElement.append($dayOfMonthElement);\n\n $calendarDays.append($dayElement);\n\n if (!day.isCurrentMonth) {\n $dayElement.addClass('calendar-day--not-current');\n }\n\n if (day.date === moment(TODAY).format('YYYY-MM-DD')) {\n $dayElement.addClass('calendar-day--today');\n }\n }\n\n /**\n * Get the number of days in a given month\n * @param {number} year\n * @param {number} month\n * @return {array} day objects\n */\n function getNumberOfDaysInMonth(year, month) {\n return moment({\n year: year,\n month: month,\n }).daysInMonth();\n }\n\n /**\n * Create days on current month\n * @param {number} year\n * @param {number} month\n * @return {array} day objects\n */\n function createDaysForCurrentMonth(year, month) {\n return [...Array(getNumberOfDaysInMonth(year, month))].map(\n (day, index) => {\n return {\n date: moment({\n year: year,\n month: month,\n day: index + 1,\n }).format('YYYY-MM-DD'),\n dayOfMonth: index + 1,\n month: month,\n isCurrentMonth: true,\n };\n },\n );\n }\n\n /**\n * Create days in previous month\n * @param {number} year\n * @param {number} month\n * @return {array} day objects\n */\n function createDaysForPreviousMonth(year, month) {\n const firstDayOfTheMonthWeekday = getWeekday(currentMonthDays[0].date);\n\n const previousMonth = moment({\n year: year,\n month: month - 1,\n });\n\n // Cover first day of the month\n // being sunday (firstDayOfTheMonthWeekday === 0)\n const visibleNumberOfDaysFromPreviousMonth = firstDayOfTheMonthWeekday ?\n firstDayOfTheMonthWeekday - 1 :\n 6;\n\n const previousMonthLastMondayDayOfMonth = moment(\n currentMonthDays[0].date,\n )\n .subtract(visibleNumberOfDaysFromPreviousMonth, 'day')\n .date();\n\n return [...Array(visibleNumberOfDaysFromPreviousMonth)].map(\n (day, index) => {\n return {\n date: moment({\n year: previousMonth.year(),\n month: previousMonth.month(),\n day: previousMonthLastMondayDayOfMonth + index,\n }).format('YYYY-MM-DD'),\n month: previousMonth.month(),\n dayOfMonth: previousMonthLastMondayDayOfMonth + index,\n isCurrentMonth: false,\n };\n },\n );\n }\n\n /**\n * Create days in next month\n * @param {number} year\n * @param {number} month\n * @return {array} day objects\n */\n function createDaysForNextMonth(year, month) {\n const lastDayOfTheMonthWeekday = getWeekday({\n year: year,\n month: month - 1,\n date: currentMonthDays.length,\n });\n\n const nextMonth = moment({\n year: year,\n month: month,\n });\n\n const visibleNumberOfDaysFromNextMonth = lastDayOfTheMonthWeekday ?\n 7 - lastDayOfTheMonthWeekday :\n lastDayOfTheMonthWeekday;\n\n return [...Array(visibleNumberOfDaysFromNextMonth)].map(\n (day, index) => {\n return {\n date: moment({\n year: nextMonth.year(),\n month: nextMonth.month(),\n day: index + 1,\n }).format('YYYY-MM-DD'),\n month: nextMonth.month(),\n dayOfMonth: index + 1,\n isCurrentMonth: false,\n };\n },\n );\n }\n\n addEventsToCalendar = function(events) {\n events.forEach((event) => {\n const startDate = moment(event.startDate).startOf('date');\n\n // Check if event is an all day\n // (startDate 00:00 day 1, endDate 00:00 day after last day)\n const allDayEvent =\n moment(event.startDate).isSame(startDate) &&\n moment(event.endDate).isSame(moment(event.endDate).startOf('date'));\n event.allDay = allDayEvent;\n\n const endDate = allDayEvent ?\n moment(event.endDate).startOf('date').subtract(1, 'd') :\n moment(event.endDate).startOf('date');\n\n const eventTotalDays = endDate.diff(startDate, 'days') + 1;\n\n // Days loop\n let currentDayOfEvent = 1;\n const momentAux = moment(startDate);\n while (momentAux <= endDate) {\n addEventToDay(momentAux, event, eventTotalDays, currentDayOfEvent);\n currentDayOfEvent++;\n momentAux.add(1, 'd');\n }\n });\n };\n\n /**\n * Add event to specific day (override)\n * @param {object} date momentjs date\n * @param {object} event\n * @param {number} eventTotalDays\n * @param {number} currentDayOfEvent\n */\n function addEventToDay(date, event, eventTotalDays, currentDayOfEvent) {\n /**\n * Get container by date\n * @param {object} date\n * @return {object} Jquery container\n */\n function getEventContainer(date) {\n return $('#day_' + date.month() + '_' + date.date()).find(\n '.calendar-events-container',\n );\n }\n\n const $newEvent = $('<div class=\"calendar-event\">');\n const $eventsContainer = getEventContainer(date);\n const weekDay = getWeekday(date);\n let eventDuration = 1;\n\n // Mark event as an all day\n if (event.allDay) {\n $newEvent.addClass('all-day');\n }\n\n if (eventTotalDays > 1) {\n // Multiple day event\n let htmlToAdd =\n '<span class=\"event-summary\">' + event.summary + '</span>';\n\n // Mark as multi event\n $newEvent.addClass('multi-day');\n\n // Draw only on the first day of the event\n // or at the beggining of the weeks when it breaks\n if (currentDayOfEvent == 1 || weekDay == 1) {\n if (currentDayOfEvent == 1 && !event.allDay) {\n htmlToAdd =\n '<span class=\"event-time\">' +\n moment(event.startDate).format(TIME_FORMAT) +\n '</span>' +\n htmlToAdd;\n }\n\n // Show event content in multiple days\n $newEvent.html(htmlToAdd);\n\n // Update element duration based on event duration\n eventDuration = eventTotalDays - (currentDayOfEvent - 1);\n\n const remainingDays = 8 - weekDay;\n if (eventDuration > remainingDays) {\n eventDuration = remainingDays;\n $newEvent.addClass('cropped-event-end');\n }\n\n if (currentDayOfEvent > 1) {\n $newEvent.addClass('cropped-event-start');\n }\n $newEvent.css(\n 'width',\n 'calc(' +\n eventDuration * 100 +\n '% + ' +\n eventDuration * 2 +\n 'px)',\n );\n } else {\n // Multiple event that was extended, no need to be rendered\n return;\n }\n } else {\n // Single day event\n let htmlToAdd =\n '<span class=\"event-summary\">' + event.summary + '</span>';\n\n // Mark event as an all day\n if (event.allDay) {\n $newEvent.addClass('all-day');\n } else {\n htmlToAdd =\n '<span class=\"event-time\">' +\n moment(event.startDate).format(TIME_FORMAT) +\n '</span>' +\n htmlToAdd;\n }\n\n // Add inner html\n $newEvent.html(htmlToAdd);\n }\n\n // Calculate event slot\n let slots = $eventsContainer.data('slots');\n let daySlot;\n if (slots != undefined) {\n for (let index = 0; index < slots.length; index++) {\n const slot = slots[index];\n if (slot === undefined) {\n daySlot = index;\n slots[index] = 1;\n break;\n }\n }\n\n if (daySlot === undefined) {\n daySlot = slots.length;\n slots.push(1);\n }\n } else {\n daySlot = 0;\n slots = [1];\n }\n\n $eventsContainer.data('slots', slots);\n\n // Extend event to the remaining days\n if (eventDuration > 1) {\n for (let dayAfter = 1; dayAfter < eventDuration; dayAfter++) {\n const $newContainer = getEventContainer(\n moment(date).add(dayAfter, 'd'),\n );\n let dataSlots = $newContainer.data('slots');\n\n if (dataSlots === undefined) {\n dataSlots = [];\n }\n\n dataSlots[daySlot] = 2;\n $newContainer.data('slots', dataSlots);\n }\n }\n\n $newEvent.css('top', 2 + 1.875 * daySlot + 'rem');\n\n // Append event to container\n $newEvent.appendTo($eventsContainer);\n\n // Check container height and slots to show number of extra events\n updateContainerExtraEvents($eventsContainer, slots);\n }\n }\n\n // Create calendar\n applyStyleOptions(options);\n createCalendar();\n addEventsToCalendar(events);\n\n return true;\n },\n});\n"],"sourceRoot":""}