How do I get the user dragging an event to another date at the same time, returning it to the previous date? It already issues an alert if the event is at the same time, but it only returns to the previous date when F5 is pressed. See the structure below:
<script src="fullcalendar/moment.min.js"></script>
<script src="fullcalendar/fullcalendar.min.js"></script>
<script src='fullcalendar/locale/pt-br.js'></script>
<script>
$(document).ready(function() {
var calendar = $('#calendar').fullCalendar({
validRange: {
start: '<?php echo date("Y-m-d"); ?>'
},
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultDate: Date(),
navLinks: true,
editable: true,
eventLimit: true,
eventClick: function(event) {
$('#visualizar #id').text(event.id);
$('#visualizar #id').val(event.id);
$('#visualizar #title').text(event.title);
$('#visualizar #title').val(event.title);
$('#visualizar #start').text(event.start.format('DD/MM/YYYY HH:mm:ss'));
$('#visualizar #start').val(event.start.format('DD/MM/YYYY HH:mm:ss'));
$('#visualizar #color').val(event.color);
$('#visualizar #description').val(event.description);
$('#visualizar').modal('show');
return false;
},
selectable: true,
selectHelper: true,
select: function(start, end){
$('#cadastrar #start').val(moment(start).format('DD/MM/YYYY HH:mm:ss'));
$('#cadastrar #end').val(moment(end).format('DD/MM/YYYY HH:mm:ss'));
$('#cadastrar').modal('show');
},
events:<?php echo $metodos->visualizarAgenda($idEmpresa,$idUsuario); ?>,
eventDrop:function(event)
{
var start = $.fullCalendar.formatDate(event.start, "Y-MM-DD HH:mm:ss");
var title = event.title;
var id = event.id;
$.ajax({
url:"alterar-dia-agenda.php",
type:"POST",
dataType: 'JSON',
data:{start:start,id:id},
success:function(sucesso){
if(sucesso.hasEvent == false){
$('#confirmar').modal('show');
temporiza();
calendar.fullCalendar('refetchEvents');
}else{
$('#erro').modal('show');
temporiza();
calendar.fullCalendar('refetchEvents');
}
}
});
}
});
});
</script>