This commit is contained in:
tiago.kayaya
2021-06-15 17:42:51 +01:00
parent 1682d63a42
commit b9d4e2dc95
9 changed files with 239 additions and 232 deletions
+29 -31
View File
@@ -515,7 +515,7 @@ export class AgendaPage implements OnInit {
return ((new Date(this.timelineDate)).getDate()).toString().padStart(2,'0')
}
loadRangeEvents(startTime: Date, endTime: Date){
async loadRangeEvents(startTime: Date, endTime: Date){
this.eventSelectedDate = new Date(startTime);
@@ -531,13 +531,14 @@ export class AgendaPage implements OnInit {
//this.eventSource=[];
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR' ) {
this.eventService.getAllMdEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).subscribe(
response => {
let mdOficialEvents = await this.eventService.getAllPrOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
let mdPessoalEvents = await this.eventService.getAllPrPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
// calendar
this.eventSource=[];
this.eventsList = response;
this.eventsList = mdOficialEvents.concat(mdPessoalEvents);
// loop
this.eventsList.forEach((element, eventIndex) => {
@@ -572,17 +573,17 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
});
}
else {
this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(
response => {
let prOficialEvents= await this.eventService.getAllPrOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
let prPessoalEvents= await this.eventService.getAllPrPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
// calendar
this.eventSource=[];
this.eventsList = response;
this.eventsList = prOficialEvents.concat(prPessoalEvents);
// calendar
this.eventsList.forEach((element, eventIndex) => {
@@ -616,8 +617,6 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
});
}
break;
@@ -625,7 +624,7 @@ export class AgendaPage implements OnInit {
//Inicializa o array eventSource
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.eventService.getAllMdEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(response => {
this.eventService.getAllMdPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(response => {
this.eventSource=[];
this.eventsListPessoal= [];
@@ -666,10 +665,11 @@ export class AgendaPage implements OnInit {
}
else{
this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(response => {
let prPessoalEvents= await this.eventService.getAllPrPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
this.eventSource=[];
this.eventsListPessoal = response.filter(data => data.CalendarName == "Pessoal");
this.eventsListPessoal = prPessoalEvents.filter(data => data.CalendarName == "Pessoal");
this.eventsListPessoal.forEach(element => {
this.eventSource.push({
title: element.Subject,
@@ -699,7 +699,7 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
});
}
break;
@@ -709,7 +709,7 @@ export class AgendaPage implements OnInit {
this.eventsListOficial = [];
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.eventService.getAllMdEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(res => {
this.eventService.getAllMdOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(res => {
this.eventSource=[];
this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
@@ -743,9 +743,9 @@ export class AgendaPage implements OnInit {
this.centralizeTimeline(500);
});
} else {
this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(res => {
let prOficialEvents= await this.eventService.getAllPrOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
this.eventSource=[];
this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
this.eventsListOficial = prOficialEvents.filter(data => data.CalendarName == "Oficial");
this.eventsListOficial.forEach(element => {
this.eventSource.push({
title: element.Subject,
@@ -775,7 +775,6 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
});
}
break;
@@ -789,15 +788,16 @@ export class AgendaPage implements OnInit {
let counter = 0;
if(this.loggeduser.Profile == 'MDGPR') {
this.eventService.getAllMdEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).subscribe(
response => {
let mdOficialEvents = await this.eventService.getAllPrOficialEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).toPromise();
let mdPessoalEvents = await this.eventService.getAllPrPessoalEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).toPromise();
if(this.segment == 'Oficial') {
this.eventsList = response.filter(data => data.CalendarName == "Oficial");
this.eventsList = mdOficialEvents;
} else if (this.segment == 'Pessoal') {
this.eventsList = response.filter(data => data.CalendarName == "Pessoal");
this.eventsList = mdPessoalEvents;
} else {
this.eventsList = response;
this.eventsList = mdOficialEvents.concat(mdPessoalEvents);
}
this.eventSource= this.eventSource.filter(e => e.profile != 'md');
@@ -840,18 +840,18 @@ export class AgendaPage implements OnInit {
this.centralizeTimeline(500);
}
});
}
this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).subscribe(
response => {
let prOficialEvents= await this.eventService.getAllPrOficialEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
let prPessoalEvents= await this.eventService.getAllPrPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
if(this.segment == 'Oficial') {
this.eventsList = response.filter(data => data.CalendarName == "Oficial");
this.eventsList = prOficialEvents;
} else if (this.segment == 'Pessoal') {
this.eventsList = response.filter(data => data.CalendarName == "Pessoal");
this.eventsList = prPessoalEvents;
} else {
this.eventsList = response;
this.eventsList = prOficialEvents.concat(prPessoalEvents);
}
this.eventSource = this.eventSource.filter(e => e.profile != 'pr');
@@ -890,8 +890,6 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
}
});
}
}