|
12 | 12 | <%@ page import="org.labkey.webutils.api.json.JsonUtils" %> |
13 | 13 | <%@ page import="org.labkey.wnprc_ehr.WNPRC_EHRController" %> |
14 | 14 | <%@ page import="java.util.List" %> |
| 15 | +<%@ page import="org.labkey.api.view.template.ClientDependencies" %> |
15 | 16 | <%@ page extends="org.labkey.api.jsp.JspBase" %> |
16 | 17 |
|
| 18 | +<%! |
| 19 | + @Override |
| 20 | + public void addClientDependencies(ClientDependencies dependencies) |
| 21 | + { |
| 22 | + dependencies.add("fullcalendar"); |
| 23 | + } |
| 24 | +%> |
17 | 25 | <script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script> |
18 | | -<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.6.0/fullcalendar.css' /> |
19 | | -<script src='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.6.0/fullcalendar.min.js'></script> |
20 | 26 | <%--<script src='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.6.0/fullcalendar.js'></script>--%> |
21 | 27 | <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> |
22 | 28 | <%--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css">--%> |
|
327 | 333 | var necropsySuiteLookup = <%=necropsySuiteLookup%>; |
328 | 334 | WebUtils.VM.necropsySuiteLookup = necropsySuiteLookup; |
329 | 335 |
|
330 | | - var $calendar = $('#calendar'); |
331 | 336 | $(document).ready(function() { |
332 | | - $calendar.fullCalendar({ |
333 | | - header: { |
334 | | - left: 'prev,next today', |
| 337 | + let calendarEl = document.getElementById('calendar'); |
| 338 | + calendar = new FullCalendar.Calendar(calendarEl, { |
| 339 | + themeSystem: 'bootstrap', |
| 340 | + height: 800, |
| 341 | + initialView: 'dayGridMonth', |
| 342 | + headerToolbar: { |
| 343 | + left: 'prev,next,today', |
335 | 344 | center: 'title', |
336 | | - right: 'month,agendaWeek' |
| 345 | + right: 'dayGridMonth,timeGridWeek,timeGridDay' |
337 | 346 | }, |
338 | | - events: function(startMoment, endMoment, timezone, callback) { |
| 347 | + eventSources: [{ |
| 348 | + events: function (fetchInfo, callback) { |
| 349 | + console.log(" startStr " + fetchInfo.startStr); |
| 350 | + console.log(" endtStr " + moment(fetchInfo.startStr).format( "YYYY-MM-DD")); |
| 351 | +
|
339 | 352 | WebUtils.API.selectRows("study", "Necropsy Schedule", { |
340 | | - "date~gte": startMoment.format('Y-MM-DD'), |
341 | | - "date~lte": endMoment.format('Y-MM-DD') |
| 353 | + "date~gte": moment(fetchInfo.startStr).format( "YYYY-MM-DD"), |
| 354 | + "date~lte": moment(fetchInfo.endStr).format( "YYYY-MM-DD") |
342 | 355 | }).then(function(data) { |
343 | 356 | var events = data.rows; |
344 | 357 |
|
345 | 358 | callback(events.map(function(row) { |
346 | 359 | var eventObj = { |
347 | 360 | title: row.animalid, |
348 | 361 | start: row.date, |
349 | | - rawRowData: row |
| 362 | + rawRowData: row, |
| 363 | + display: 'block' |
350 | 364 | }; |
351 | 365 |
|
352 | 366 | if (row.location in necropsySuiteLookup) { |
|
356 | 370 | return eventObj; |
357 | 371 | })) |
358 | 372 | }) |
359 | | - }, |
| 373 | + }}], |
360 | 374 | eventClick: function(calEvent, jsEvent, view) { |
361 | | - jQuery.each(calEvent.rawRowData, function(key, value) { |
| 375 | + jQuery.each(calEvent.event.extendedProps.rawRowData, function(key, value) { |
362 | 376 | if (key in WebUtils.VM.taskDetails) { |
363 | 377 | if (key == "date") { |
364 | 378 | value = displayDate(value); |
|
367 | 381 | } |
368 | 382 | }); |
369 | 383 | } |
370 | | - }) |
| 384 | + },); |
| 385 | + calendar.render() |
371 | 386 | }); |
372 | 387 |
|
373 | 388 |
|
|
670 | 685 | rowsToUpdate[0] = rowsToUpdate[0].map(function(row) { |
671 | 686 | row.performedby = pathologistLookup[form.pathologist]; |
672 | 687 | row.assistant = pathologistLookup[form.assistant]; |
| 688 | + row.location = form.location; |
673 | 689 |
|
674 | 690 | return row; |
675 | 691 | }); |
|
682 | 698 | ]); |
683 | 699 | }).then(function() { |
684 | 700 | // Refresh the calendar view. |
685 | | - $calendar.fullCalendar('refetchEvents'); |
| 701 | + calendar.refetchEvents(); |
686 | 702 |
|
687 | 703 | WebUtils.VM.pendingRequestTable.rows.remove(WebUtils.VM.requestRowInForm); |
688 | 704 |
|
|
0 commit comments