text: $(function(){enableDrag();function enableDrag(){$('#external-events .fc-event').each(function(){$(this).data('event',{title:$.trim($(this).text()),stick:true});$(this).draggable({zIndex:999,revert:true,revertDuration:0});});}
  $(".save-event").on('click',function(){var categoryName=$('#addNewEvent form').find("input[name='category-name']").val();var categoryColor=$('#addNewEvent form').find("select[name='category-color']").val();if(categoryName!==null&&categoryName.length!=0){$('#event-list').append('<div class="fc-event bg-'+categoryColor+'" data-class="bg-'+categoryColor+'">'+categoryName+'</div>');$('#addNewEvent form').find("input[name='category-name']").val("");$('#addNewEvent form').find("select[name='category-color']").val("");enableDrag();}});var today=new Date();var dd=today.getDate();var mm=today.getMonth()+1;var yyyy=today.getFullYear();if(dd<10){dd='0'+dd}
  if(mm<10){mm='0'+mm}
  var current=yyyy+'-'+mm+'-';var calendar=$('#calendar');var newEvent=function(start){$('#addDirectEvent input[name="event-name"]').val("");$('#addDirectEvent select[name="event-bg"]').val("");$('#addDirectEvent').modal('show');$('#addDirectEvent .save-btn').unbind();$('#addDirectEvent .save-btn').on('click',function(){var title=$('#addDirectEvent input[name="event-name"]').val();var classes='bg-'+$('#addDirectEvent select[name="event-bg"]').val();if(title){var eventData={title:title,start:start,className:classes};calendar.fullCalendar('renderEvent',eventData,true);$('#addDirectEvent').modal('hide');}else{alert("Title can't be blank. Please try again.")}});}
  calendar.fullCalendar({header:{left:'title',center:'',right:'month, agendaWeek, agendaDay, prev, next'},editable:true,droppable:true,eventLimit:true,selectable:true,events:[{title:'Birthday Party',start:current+'01',className:'bg-info'},{title:'Conference',start:current+'05',end:'2020-06-06',className:'bg-warning'},{title:'Meeting',start:current+'09T12:30:00',allDay:false,className:'bg-success',},{title:'Meeting',start:current+'09T18:30:00',allDay:false,className:'bg-info',},{title:'BOD Event',start:'2020-06-16',end:'2020-06-16',className:'bg-indigo'},{title:'June Challenge',start:'2020-06-10',end:'2020-06-12',className:'bg-gray'},{title:'Earthcon Exhibition',start:'2020-06-18',end:'2020-06-22',className:'bg-red'},{title:'Toastmasters Meeting #3',start:'2020-06-26',end:'2020-06-26',className:'bg-orange'},{title:'Salary',start:'2020-06-07',end:'2020-06-07',className:'bg-pink'}],drop:function(date,jsEvent){if($('#drop-remove').is(':checked')){$(this).remove();}},select:function(start,end,allDay){newEvent(start);},eventClick:function(calEvent,jsEvent,view){var eventModal=$('#eventEditModal');eventModal.modal('show');eventModal.find('input[name="event-name"]').val(calEvent.title);eventModal.find('.save-btn').click(function(){calEvent.title=eventModal.find("input[name='event-name']").val();calendar.fullCalendar('updateEvent',calEvent);eventModal.modal('hide');});}});});