1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-18 03:09:32 +01:00
openstamanager/modules/statistiche/js/manager.js
2019-07-11 12:04:22 +02:00

39 lines
747 B
JavaScript

class Manager {
constructor(info) {
this.info = info;
this.calendars = {};
}
remove(name) {
if (Object.keys(this.calendars).length > 1) {
this.calendars[name].remove();
delete this.calendars[name];
return true;
}
return false;
}
add(id, name) {
var calendar = new Calendar(this.info, id);
this.calendars[name] = calendar;
return calendar;
}
init(name) {
var calendar = this.calendars[name];
var start = this.info.start_date;
var end = this.info.end_date;
calendar.update(start, end);
}
update(name, start, end){
this.calendars[name].update(start, end);
}
}