I've found a solution - Maybe not the most pretty one, but it seems to do the job.
I've created an Event Object template using a "CGCalendar::Event List View" template and named it "fetch_bookings":
Code: Select all
[
{foreach from=$events key=key item=event name=list}{strip}
{literal}{{/literal}
{/strip}title: '{$event.event_title}',
{if $event.fgcolor != '' && $event.bgcolor != ''}
color:'{$event.bgcolor}',
textColor:'{$event.fgcolor}',
{/if}
allDay:{if $event.event_all_day == 1}true{else}false{/if},
start: '{$event.event_date_start}',
{if $event.event_date_end != 0}end: '{$event.event_date_end}',{/if}
category: '{$event.category_names}',
className: ["hide"]
{literal}}{/literal}{if $smarty.foreach.list.last}{else},{/if}
{/foreach}
]
In the template i've set event category as an Event Object as FullCalendar allows Non-standard Fields in the callback.
https://fullcalendar.io/docs/event_data/Event_Object/
Then in my "CGCalendar::fullCalendar View" template i replace {$fetch_url} with a module call to my "CGCalendar::Event List View" template i named "fetch_bookings" like this:
Code: Select all
events: {cms_module module='CGCalendar' display='upcominglist' listtemplate='fetch_bookings' category='Booket,Reseveret'},
and add in an eventRender callback function setting a class depending on event category:
Code: Select all
eventRender: function (event, element) {
var start = moment(event.start);
var end = moment(event.end);
while( start.format('YYYY-MM-DD') != end.format('YYYY-MM-DD') ){
var dataToFind = start.format('YYYY-MM-DD');
$("td[data-date='"+dataToFind+"']").addClass(event.category);
start.add(1, 'd');
}
},
It seems to do the trick and i can now use CSS to style my days with events.
Any who has more clean suggestions to a solution is welcome to share.