genericTimeline.js 1.2 KB

12345678910111213141516171819202122232425
  1. // eslint-disable-next-line no-undef
  2. const timeline = document.getElementById("timeline");
  3. const rows = [
  4. {id:'1',title:"Ressource 1 DarkSlate",eventBgColor:"DarkSlateBlue"},
  5. {id:'3',title:"Ressource 3"},
  6. {id:'4',title:"Ressource 4"},
  7. {id:'5',title:"Ressource 5"}];
  8. rows[0].parent = rows[1];
  9. rows[2].parent = rows[1];
  10. // eslint-disable-next-line no-undef
  11. const data = dayjs().startOf("hour").hour(9);
  12. const timeslots = [
  13. {id:'1', title:"Fixed ressource" ,ressourceId:'3', start:data.subtract(3,"h").toDate(), end:data.toDate(), ressourceEditable:false,bgColor:"darkgreen"},
  14. {id:'2', title:"Fixed time" , ressourceId:'3', start:data.toDate(), end:data.endOf("hour").add(1,"h").toDate(), editable:false,bgColor:"FireBrick"},
  15. {id:'3', ressourceId:'4', start:data.add(1,"h").toDate(), end:data.endOf("hour").add(2,"h").toDate()},
  16. {id:'4', ressourceId:'3', start:data.startOf("day").subtract(1,"h").toDate(), end:dayjs().endOf("hour").add(1,"h").toDate()}
  17. ]
  18. timeline.addRessources(rows);
  19. timeline.addTimeSlots(timeslots);
  20. // eslint-disable-next-line no-undef
  21. const timeline2 = document.getElementById("timeline2");
  22. timeline2.setLegendUnitFormat("d","MMM D")