calendar.ui.js 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. window.setCalendarOptions = function(_, options)
  2. {
  3. const colors = {
  4. doing: 'var(--color-danger-400)',
  5. done : 'var(--color-success-400)',
  6. pause: 'var(--color-important-400)',
  7. };
  8. return $.extend({
  9. categories: [{id: 'DEFAULT', color: 'var(--color-gray-400)'}],
  10. events: options.tasks.map(task => {
  11. return {
  12. id: task.id,
  13. title: task.title,
  14. allDay: true,
  15. start: task.start,
  16. color: colors[task.status],
  17. task: task,
  18. };
  19. }),
  20. eventRender: (event) => {
  21. const task = event.task;
  22. return {
  23. hint : task.desc || task.title,
  24. url : task.url,
  25. text : {html: task.iconTitle ? task.iconTitle : task.title, className: 'flex items-center gap-1'},
  26. 'data-toggle': 'modal',
  27. 'data-size' : '90%',
  28. };
  29. },
  30. }, options);
  31. };