1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
var calendar = $('#calendar').fullCalendar({
header: {
left: 'today prev,next',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
weekends:false,
defaultView:'agendaWeek',
firstDay: 1,
locale: "fr",
selectable: true,
selectHelper: true,
minTime: '08:00:00',
maxTime: '20:00:00',
select: function (start, end, allDay) {
// OUVERTURE DU MODAL
$("#dialog").dialog({
buttons: [{
text: "OK",
click: function() {
var title = $('input[name=title]').val();
$( this ).dialog( "close" );
alert(title); // ICI la variable existe
}
}]
});
//VARIABLE DELETE et fin de la fonction
if (title) {
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
},
true // make the event "stick"
);
$.ajax({
url: '{{url("evenements/store")}}',
type: 'POST',
dataType: 'json',
data: {
title: title,
start: start.format(),
end: end.format(),
'_token': $('input[name=_token]').val()
},
success: function (res, statut) {
if(res.message){
Materialize.toast("<i class='material-icons left green-text'>done</i>"+ res.message, 5000);
}
},
});
}
calendar.fullCalendar('unselect');
},
editable: true,
events: [
@foreach (Auth::user()->planning as $planning)
{
title: '{{$planning->title}}',
start: '{{$planning->start}}',
end : '{{$planning->end}}',
},
@endforeach
]
}); |
Partager