mirror of
https://github.com/devcode-it/openstamanager.git
synced 2024-12-11 07:56:16 +01:00
39 lines
747 B
JavaScript
Executable File
39 lines
747 B
JavaScript
Executable File
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);
|
|
}
|
|
}
|