resource-ordering.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset='utf-8' />
  5. <link href='../packages/core/dist/main.css' rel='stylesheet' />
  6. <link href='../packages/daygrid/dist/main.css' rel='stylesheet' />
  7. <link href='../packages/timegrid/dist/main.css' rel='stylesheet' />
  8. <link href='../packages-premium/timeline/dist/main.css' rel='stylesheet' />
  9. <link href='../packages-premium/resource-timeline/dist/main.css' rel='stylesheet' />
  10. <script src='../packages/core/dist/main.js'></script>
  11. <script src='../packages/interaction/dist/main.js'></script>
  12. <script src='../packages/daygrid/dist/main.js'></script>
  13. <script src='../packages/timegrid/dist/main.js'></script>
  14. <script src='../packages-premium/timeline/dist/main.js'></script>
  15. <script src='../packages-premium/resource-common/dist/main.js'></script>
  16. <script src='../packages-premium/resource-timeline/dist/main.js'></script>
  17. <script>
  18. document.addEventListener('DOMContentLoaded', function() {
  19. var calendarEl = document.getElementById('calendar');
  20. var calendar = new FullCalendar.Calendar(calendarEl, {
  21. plugins: [ 'interaction', 'dayGrid', 'timeGrid', 'resourceTimeline' ],
  22. now: '2020-05-07',
  23. editable: true,
  24. aspectRatio: 1.8,
  25. scrollTime: '00:00',
  26. header: {
  27. left: 'today prev,next',
  28. center: 'title',
  29. right: 'resourceTimelineDay,resourceTimelineThreeDays,timeGridWeek,dayGridMonth'
  30. },
  31. defaultView: 'resourceTimelineDay',
  32. views: {
  33. resourceTimelineThreeDays: {
  34. type: 'resourceTimeline',
  35. duration: { days: 3 },
  36. buttonText: '3 days'
  37. }
  38. },
  39. resourceAreaWidth: '30%',
  40. resourceColumns: [
  41. {
  42. labelText: 'Room',
  43. field: 'title'
  44. },
  45. {
  46. labelText: 'Occupancy',
  47. field: 'occupancy'
  48. }
  49. ],
  50. resourceOrder: '-occupancy,title', // when occupancy tied, order by title
  51. resources: [
  52. { id: 'a', title: 'Auditorium A', occupancy: 40 },
  53. { id: 'b', title: 'Auditorium B', occupancy: 40, eventColor: 'green' },
  54. { id: 'c', title: 'Auditorium C', occupancy: 40, eventColor: 'orange' },
  55. { id: 'd', title: 'Auditorium D', occupancy: 40 },
  56. { id: 'e', title: 'Auditorium E', occupancy: 40 },
  57. { id: 'f', title: 'Auditorium F', occupancy: 40, eventColor: 'red' },
  58. { id: 'g', title: 'Auditorium G', occupancy: 40 },
  59. { id: 'h', title: 'Auditorium H', occupancy: 40 },
  60. { id: 'i', title: 'Auditorium I', occupancy: 50 },
  61. { id: 'j', title: 'Auditorium J', occupancy: 50 },
  62. { id: 'k', title: 'Auditorium K', occupancy: 40 },
  63. { id: 'l', title: 'Auditorium L', occupancy: 40 },
  64. { id: 'm', title: 'Auditorium M', occupancy: 40 },
  65. { id: 'n', title: 'Auditorium N', occupancy: 80 },
  66. { id: 'o', title: 'Auditorium O', occupancy: 80 },
  67. { id: 'p', title: 'Auditorium P', occupancy: 40 },
  68. { id: 'q', title: 'Auditorium Q', occupancy: 40 },
  69. { id: 'r', title: 'Auditorium R', occupancy: 40 },
  70. { id: 's', title: 'Auditorium S', occupancy: 40 },
  71. { id: 't', title: 'Auditorium T', occupancy: 40 },
  72. { id: 'u', title: 'Auditorium U', occupancy: 40 },
  73. { id: 'v', title: 'Auditorium V', occupancy: 40 },
  74. { id: 'w', title: 'Auditorium W', occupancy: 40 },
  75. { id: 'x', title: 'Auditorium X', occupancy: 40 },
  76. { id: 'y', title: 'Auditorium Y', occupancy: 40 },
  77. { id: 'z', title: 'Auditorium Z', occupancy: 40 }
  78. ],
  79. events: [
  80. { id: '1', resourceId: 'b', start: '2020-05-07T02:00:00', end: '2020-05-07T07:00:00', title: 'event 1' },
  81. { id: '2', resourceId: 'c', start: '2020-05-07T05:00:00', end: '2020-05-07T22:00:00', title: 'event 2' },
  82. { id: '3', resourceId: 'd', start: '2020-05-06', end: '2020-05-08', title: 'event 3' },
  83. { id: '4', resourceId: 'e', start: '2020-05-07T03:00:00', end: '2020-05-07T08:00:00', title: 'event 4' },
  84. { id: '5', resourceId: 'f', start: '2020-05-07T00:30:00', end: '2020-05-07T02:30:00', title: 'event 5' }
  85. ]
  86. });
  87. calendar.render();
  88. });
  89. </script>
  90. <style>
  91. body {
  92. margin: 0;
  93. padding: 0;
  94. font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
  95. font-size: 14px;
  96. }
  97. p {
  98. text-align: center;
  99. }
  100. #calendar {
  101. max-width: 900px;
  102. margin: 50px auto;
  103. }
  104. </style>
  105. </head>
  106. <body>
  107. <p>Ordered by occupancy (descending)</p>
  108. <div id='calendar'></div>
  109. </body>
  110. </html>