mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
Miglioramento modulo Statistiche
This commit is contained in:
38
modules/statistiche/js/manager.js
Normal file
38
modules/statistiche/js/manager.js
Normal file
@ -0,0 +1,38 @@
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user