add defualt calendar

This commit is contained in:
Peter Maquiran
2024-01-29 15:50:32 +01:00
parent 78c6ac2f36
commit 07939149ee
3 changed files with 99 additions and 67 deletions
+1 -1
View File
@@ -140,7 +140,7 @@
</thead>
</table>
<div class="calendar-conteiner-height overflow-hidden" [style.height]="listBoxService.height">
<div class="calendar-conteiner-height overflow-hidden" [style.height]="listBoxService.height">
<calendar
class="calendar-component"
[eventSource]="listToPresent"
+18 -4
View File
@@ -239,6 +239,14 @@ export class AgendaPage implements OnInit {
}
this.weekToShow()
this.eventService.registerOnLoadCalendars(()=> {
this.setCalendarByDefault(true)
const selectedCalendarIds = this.getSelectedAgendaCalendars();
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
this.tigerUpdate()
})
}
tigerUpdate() {
@@ -257,7 +265,7 @@ export class AgendaPage implements OnInit {
ngOnInit() {
this.setCalendarByDefault()
this.setCalendarByDefault(false)
const selectedCalendarIds = this.getSelectedAgendaCalendars();
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
@@ -338,14 +346,20 @@ export class AgendaPage implements OnInit {
}, 250)
}
setCalendarByDefault() {
if (!this.CalendarName) {
if (this.eventService.calendarNamesAry.includes('Meu calendario')) {
setCalendarByDefault(force) {
if (!this.CalendarName || force) {
const prObject = this.eventService.calendarNamesAry.find(e => e?.RoleId == 100000014)
if(prObject) {
console.log({prObject})
this.CalendarName = prObject.Fullname
} else if (this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.CalendarName = 'Meu calendario';
} else {
this.CalendarName = this.eventService.calendarNamesAry[0]
}
}
}
//Go to the next view of the calendar month/week/day
+18
View File
@@ -65,6 +65,10 @@ export class EventsService {
HasMdGPR = false
onLoadCalendars: Function[] =[]
loadCalendars = false
onCalendarFinishLoad = new Subscribe({execute : false, deleteOnExecute: true})
constructor(
@@ -368,6 +372,20 @@ export class EventsService {
}
this.onLoadCalendars.forEach(e=> e());
this.loadCalendars = true
}
registerOnLoadCalendars(e: Function) {
if( this.loadCalendars) {
e()
} else {
this.onLoadCalendars.push(e)
}
}