Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $(document).on("change", "#profissional", function() {
- $('#calendar').fullCalendar('removeEventSource', eventos);
- var id_profissional = $("#profissional").val();
- $.ajax({
- url: "http://localhost/clinica/home/listaAgenda",
- data: {id_profissional: id_profissional},
- type: 'POST',
- dataType: 'json',
- beforeSend: function(data) {
- },
- success: function(data) {
- if (data.events) {
- //INICIO DO FULLCALENDAR
- var initialLocaleCode = 'pt-br';
- $('#calendar').fullCalendar({
- header: {
- left: 'prev,next today',
- center: 'title',
- right: 'month,agendaWeek,agendaDay,listMonth'
- },
- defaultView: 'agendaWeek',
- editable: true,
- eventLimit: true,
- locale: initialLocaleCode,
- selectable: true,
- selectHelper: true,
- locale: initialLocaleCode,
- buttonIcons: true, // show the prev/next text
- weekNumbers: false,
- navLinks: true, // can click day/week names to navigate views
- hiddenDays: [0,6],
- showNonCurrentDates: true,
- aspectRatio: 1,
- minTime: '06:00:00',
- maxTime: '18:00:00',
- droppable: true,
- select: function(start, end) {
- $('#ModalAdd #start').val(moment(start).format('YYYY-MM-DD HH:mm:ss'));
- $('#ModalAdd #end').val(moment(end).format('YYYY-MM-DD HH:mm:ss'));
- $('#ModalAdd').modal('show');
- },
- eventRender: function(event, element) {
- element.bind('dblclick', function() {
- $('#ModalEdit #id').val(event.id);
- $('#ModalEdit #title').val(event.title);
- $('#ModalEdit #color').val(event.color);
- $('#ModalEdit').modal('show');
- });
- },
- eventDrop: function(event, delta, revertFunc) {
- edit(event);
- },
- eventResize: function(event, dayDelta, minuteDelta, revertFunc) {
- edit(event);
- },
- events: data
- });
- // Fim do Calendar
- //Atualizar apenas com os novos dados a cada change do selectBox
- $('#calendar').fullCalendar('addEventSource', eventos);
- $('#calendar').fullCalendar('rerenderEvents', eventos);
- }
- }
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement