import "../../../../../../../assets/js/full-calendar/v6/fullcalendar.min.js";
export function renderCalendar(id, courseData, hoverOver) {
    let calendarEl = document.getElementById(id);
    let calendarAlert = document.getElementById(id + "-alert");
    if (calendarAlert) calendarAlert.remove();
    let calendar = new FullCalendar.Calendar(calendarEl, {
        initialView: 'dayGridMonth',
        headerToolbar: {
            right: 'today,prev,dayGridMonth,timeGridWeek,next'
        },
        locale: 'nl',
        firstDay: 1,
        slotMinTime: '08:00',
        slotMaxTime: '18:00',
        weekNumbers: false,
        buttonText: {
            today: 'vandaag',
            dayGridMonth: 'maand',
            timeGridWeek: 'week'
        },
        allDaySlot: false,
        slotLabelFormat: {
            hour: 'numeric',
            minute: '2-digit',
            omitZeroMinute: false
        },
        eventTimeFormat: {
            hour: 'numeric',
            minute: '2-digit',
            omitZeroMinute: false
        },
        navLinks: false,
        displayEventEnd: true,
        weekends: true,
        events: courseData,
        eventMouseEnter: function (data) {
            let tooltip = '<div class="tooltiptopicevent">' + data.event.extendedProps.description + '</div>';

            jQuery("body").append(tooltip);
            jQuery(data.el).mouseover(function (e) {
                if (hoverOver)
                {
                    jQuery(this).css('z-index', 10000);
                    let element = jQuery('.tooltiptopicevent');
                    element.fadeIn('500');
                    element.fadeTo('10', 1.9);
                }
            }).mousemove(function (e) {
                if (hoverOver)
                {
                    let element = jQuery('.tooltiptopicevent');
                    element.css('top', e.pageY + 10);
                    element.css('left', e.pageX + 20);
                }
            });
        },
        eventMouseLeave: function (data) {
            if (hoverOver)
            {
                jQuery(data.el).css('z-index', 8);
                jQuery('.tooltiptopicevent').remove();
            }
        }
    });

    calendar.render();
}