2019-07-06 20:19:21 +02:00
var firstDay = null ;
if ( ! Grocy . CalendarFirstDayOfWeek . isEmpty ( ) )
{
firstDay = parseInt ( Grocy . CalendarFirstDayOfWeek ) ;
}
2019-09-24 09:21:57 +02:00
var calendar = $ ( "#calendar" ) . fullCalendar ( {
2018-11-18 15:39:43 +01:00
"themeSystem" : "bootstrap4" ,
"header" : {
2019-09-24 09:21:57 +02:00
"left" : "month,agendaWeek,agendaDay,listWeek" ,
2018-11-18 15:39:43 +01:00
"center" : "title" ,
"right" : "prev,next"
} ,
2019-09-18 18:30:25 +02:00
"weekNumbers" : Grocy . CalendarShowWeekNumbers ,
2019-09-24 09:21:57 +02:00
"defaultView" : ( $ ( window ) . width ( ) < 768 ) ? "agendaDay" : "month" ,
2019-07-06 20:19:21 +02:00
"firstDay" : firstDay ,
2020-02-09 15:24:05 +01:00
"eventLimit" : false ,
"height" : "auto" ,
2020-04-22 12:03:05 -04:00
"eventSources" : fullcalendarEventSources ,
2020-08-30 12:18:16 +02:00
eventClick : function ( info )
{
2020-04-22 12:03:05 -04:00
location . href = info . link ;
2020-08-30 12:18:16 +02:00
}
2018-11-18 15:39:43 +01:00
} ) ;
2019-03-04 17:44:48 +01:00
$ ( "#ical-button" ) . on ( "click" , function ( e )
{
e . preventDefault ( ) ;
Grocy . Api . Get ( 'calendar/ical/sharing-link' ,
function ( result )
{
2019-03-05 19:36:14 +01:00
bootbox . alert ( {
2019-05-01 20:19:18 +02:00
title : _ _t ( 'Share/Integrate calendar (iCal)' ) ,
2020-09-06 10:00:49 +02:00
message : _ _t ( 'Use the following (public) URL to share or integrate the calendar in iCal format' ) + '<input type="text" class="form-control form-control-sm mt-2 easy-link-copy-textbox" value="' + result . url + '"><p class="text-center mt-4">'
2020-12-20 19:53:28 +01:00
+ QrCodeImgHtml ( result . url ) + "</p>" ,
2019-09-24 10:24:47 +02:00
closeButton : false
2019-03-05 19:36:14 +01:00
} ) ;
2019-03-04 17:44:48 +01:00
} ,
function ( xhr )
{
console . error ( xhr ) ;
}
) ;
} ) ;
2019-09-24 09:21:57 +02:00
2020-12-16 17:26:39 +01:00
$ ( window ) . one ( "resize" , function ( )
2019-09-24 09:21:57 +02:00
{
// Automatically switch the calendar to "basicDay" view on small screens
// and to "month" otherwise
if ( $ ( window ) . width ( ) < 768 )
{
calendar . fullCalendar ( "changeView" , "agendaDay" ) ;
}
else
{
calendar . fullCalendar ( "changeView" , "month" ) ;
}
} ) ;