Improve agenda

This commit is contained in:
Peter Maquiran
2021-07-15 11:53:16 +01:00
parent ab298b30e8
commit 77a59e5128
7 changed files with 173 additions and 40 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
<ion-progress-bar class="calendar-progress-bar" type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<div>
<!-- Calendar is here -->
<div [ngSwitch]="segment">
<div class="calendar-segment-{{profile}}">
<div class="calendar-container" [style.height]="calendarHeight">
<ion-row class="ion-justify-content-between calendar-tool-tip">
+102 -14
View File
@@ -479,15 +479,23 @@ export class AgendaPage implements OnInit {
//Inicializa o array eventSource
//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') ).then(
(response:any) => {
// calendar
this.eventSource=[];
// this.eventSource=[];
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'md') {
return false
}
return true
})
this.eventsList = response;
// loop
this.eventsList.forEach((element, eventIndex) => {
@@ -526,13 +534,22 @@ export class AgendaPage implements OnInit {
})
}
else if(this.profile == "pr" && this.loggeduser.Profile == 'MDGPR'){
else if(this.profile == "pr" && this.loggeduser.Profile == 'MDGPR') {
console.log('HERE PR');
this.eventService.getAllSharedEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).then(
(response:any) => {
// calendar
this.eventSource=[];
//this.eventSource=[];
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'pr') {
return false
}
return true
})
this.eventsList = response;
@@ -578,7 +595,16 @@ export class AgendaPage implements OnInit {
(response:any) => {
// calendar
this.eventSource=[];
// this.eventSource=[];
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'pr') {
return false
}
return true
})
this.eventsList = response;
@@ -625,7 +651,17 @@ export class AgendaPage implements OnInit {
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')).then((response:any) => {
this.eventSource=[];
// this.eventSource=[];
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'md') {
return false
}
return true
})
this.eventsListPessoal= [];
this.eventsListPessoal = response.filter(data => data.CalendarName == "Pessoal");
@@ -665,8 +701,17 @@ 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')).then((response:any) => {
this.eventSource=[];
//this.eventSource=[];
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'pr') {
return false
}
return true
})
this.eventsListPessoal = response.filter(data => data.CalendarName == "Pessoal");
this.eventsListPessoal.forEach(element => {
this.eventSource.push({
@@ -708,7 +753,19 @@ export class AgendaPage implements OnInit {
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')).then((res:any) => {
this.eventSource=[];
// this.eventSource=[];
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'md') {
return false
}
return true
})
this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
this.eventsListOficial.forEach(element => {
@@ -742,7 +799,18 @@ 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')).then((res:any) => {
this.eventSource=[];
// this.eventSource=[];
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'pr') {
return false
}
return true
})
this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
this.eventsListOficial.forEach(element => {
this.eventSource.push({
@@ -797,7 +865,15 @@ export class AgendaPage implements OnInit {
this.eventsList = response;
}
this.eventSource= this.eventSource.filter(e => e.profile != 'md');
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'md') {
return false
}
return true
})
// loop
this.eventsList.forEach((element, eventIndex) => {
@@ -853,7 +929,13 @@ export class AgendaPage implements OnInit {
this.eventsList = response;
}
this.eventSource = this.eventSource.filter(e => e.profile != 'pr');
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'pr') {
return false
}
return true
})
this.eventsList.forEach((element, eventIndex) => {
@@ -909,7 +991,13 @@ export class AgendaPage implements OnInit {
this.eventsList = response;
}
this.eventSource = this.eventSource.filter(e => e.profile != 'pr');
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'pr') {
return false
}
return true
})
this.eventsList.forEach((element, eventIndex) => {
@@ -20,6 +20,7 @@ export class ViewPublicationsPage implements OnInit {
publicationList: Publication[];
item: PublicationFolder;
folderId:string;
error: any;
constructor(
private loadingController: LoadingService,
@@ -100,6 +101,15 @@ export class ViewPublicationsPage implements OnInit {
});
console.log(this.publicationList);
this.showLoader = false;
},
(error)=>{
if(error.status == '404'){
this.error = 'Sem publicações disponíveis!';
this.publicationList=null;
}
this.showLoader = false;
});
}