Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer

This commit is contained in:
Peter Maquiran
2021-06-16 09:11:34 +01:00
8 changed files with 210 additions and 156 deletions
+29 -31
View File
@@ -514,7 +514,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);
@@ -530,13 +530,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) => {
@@ -571,17 +572,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) => {
@@ -615,8 +616,6 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
});
}
break;
@@ -624,7 +623,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= [];
@@ -665,10 +664,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,
@@ -698,7 +698,7 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
});
}
break;
@@ -708,7 +708,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");
@@ -742,9 +742,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,
@@ -774,7 +774,6 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
});
}
break;
@@ -788,15 +787,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');
@@ -839,18 +839,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');
@@ -889,8 +889,6 @@ export class AgendaPage implements OnInit {
this.timelineBoxCorrectHeight(500);
this.centralizeTimeline(500);
}
});
}
}