

document.addEventListener('DOMContentLoaded', function() {
   // import { Calendar } from '@fullcalendar/core';
   // import googleCalendarPlugin from '@fullcalendar/google-calendar';
    var calendarEl = document.getElementById('calendar');

    var calendar = new FullCalendar.Calendar(calendarEl, {
      //timeZone: 'UTC',
      timeZone: 'Europe/Rome',
      initialView: 'timeGridWeek',
      googleCalendarApiKey: 'AIzaSyClqRqDMqD4grSx5HeLq1lXMxan1-UjK_E',
      events: {
        googleCalendarId: 'brebar.family@gmail.com'
      },
      editable: true,
      selectable: true,
      headerToolbar: {
          left: 'prev,next',
          center: 'title',
          right: 'dayGridMonth,timeGridWeek,timeGridDay' // user can switch between the two
      },
     
      dateClick: function(info) {
        var starttime =moment(info.dateStr);
        var endtime = moment(info.dateStr).add(30,'m');
        $('#startDay').val(moment(starttime).format("Y-M-D")) ;
        $('#startHour').val(moment(starttime).format("HH:mm")) ;
        
        $('#endDay').val(moment(endtime).format("Y-M-D")) ;
        $('#endHour').val(moment(endtime).format("HH:mm")) ;
        $('#event').modal('show');
        console.log(info.dateStr); 
        console.log(endtime.dateStr); 
      }
    });
    calendar.setOption('locale', 'it');
    calendar.render();
  }); 

$(document).ready(function () {
    var SITEURL = "{{ url('/admin/') }}";
   // $(".draggable").draggable();

    $.ajaxSetup({
        headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
});

      
