timeline-columns.html 4.3 KB

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