mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
- Integrate combined profile events at home
-Added another button to change profile
This commit is contained in:
@@ -29,11 +29,17 @@ export class EventsPage implements OnInit {
|
||||
timeDate = this.today.getHours() + ":" + this.today.getMinutes();
|
||||
/* Set segment variable */
|
||||
segment:string;
|
||||
profile:string;
|
||||
|
||||
eventsList: Event[];
|
||||
officialeventsList: Event[];
|
||||
personaleventsList: Event[];
|
||||
|
||||
prEventList: Event[];
|
||||
mdEventList: Event[];
|
||||
|
||||
combinedEvents: Event[];
|
||||
|
||||
customText = false;
|
||||
|
||||
showLoader: boolean;
|
||||
@@ -42,11 +48,16 @@ export class EventsPage implements OnInit {
|
||||
private router: Router,
|
||||
public activatedRoute: ActivatedRoute,
|
||||
private alertController: AlertService,
|
||||
private authService: AuthService) { }
|
||||
private authService: AuthService) {
|
||||
this.prEventList = null;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
//Inicializar segment
|
||||
this.segment = "Combinada";
|
||||
//Initialize profile as mdgpr
|
||||
this.profile = "mdgpr";
|
||||
|
||||
this.showGreeting();
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
@@ -56,6 +67,7 @@ export class EventsPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
doRefresh(event) {
|
||||
this.RefreshEvents();
|
||||
event.target.complete();
|
||||
@@ -70,31 +82,72 @@ export class EventsPage implements OnInit {
|
||||
|
||||
RefreshEvents(){
|
||||
this.showLoader = true;
|
||||
|
||||
switch (this.segment)
|
||||
{
|
||||
case "Combinada":
|
||||
this.eventService.getAllEvents(formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59')
|
||||
if(this.profile == "mdgpr"){
|
||||
this.eventService.getAllEvents(formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59')
|
||||
.subscribe(response => {
|
||||
this.eventsList = response;
|
||||
this.combinedEvents = response;
|
||||
/* this.eventsList = response; */
|
||||
this.showLoader = false;
|
||||
}
|
||||
);
|
||||
}else{
|
||||
this.eventService.getAllPrEvents(formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59').subscribe(res => {
|
||||
this.prEventList = res;
|
||||
this.eventService.getAllMdEvents(formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59').subscribe(res => {
|
||||
this.mdEventList = res;
|
||||
this.combinedEvents = this.prEventList.concat(this.mdEventList);
|
||||
console.log(this.combinedEvents);
|
||||
this.showLoader = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
break;
|
||||
case "Pessoal":
|
||||
this.eventService.getEvents(this.segment, formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59')
|
||||
.subscribe(response => {
|
||||
if(this.profile == "mdgpr"){
|
||||
this.eventService.getEvents(this.segment, formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59')
|
||||
.subscribe(response => {
|
||||
this.personaleventsList = response;
|
||||
this.showLoader = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}else{
|
||||
this.eventService.getAllPrEvents(formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59').subscribe(res => {
|
||||
this.prEventList = res;
|
||||
this.eventService.getAllMdEvents(formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59').subscribe(res => {
|
||||
this.mdEventList = res;
|
||||
this.personaleventsList = this.prEventList.concat(this.mdEventList).filter(data => data.CalendarName == "Pessoal");
|
||||
console.log(this.personaleventsList);
|
||||
this.showLoader = false;
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case "Oficial":
|
||||
this.eventService.getEvents(this.segment, formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59')
|
||||
.subscribe(response => {
|
||||
this.officialeventsList = response;
|
||||
this.showLoader = false;
|
||||
}
|
||||
);
|
||||
if(this.profile == "mdgpr"){
|
||||
this.eventService.getEvents(this.segment, formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59')
|
||||
.subscribe(response => {
|
||||
this.officialeventsList = response;
|
||||
this.showLoader = false;
|
||||
}
|
||||
);
|
||||
}else{
|
||||
this.eventService.getAllPrEvents(formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59').subscribe(res => {
|
||||
this.prEventList = res;
|
||||
this.eventService.getAllMdEvents(formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59').subscribe(res => {
|
||||
this.mdEventList = res;
|
||||
this.officialeventsList = this.prEventList.concat(this.mdEventList).filter(data => data.CalendarName == "Oficial");
|
||||
console.log(this.officialeventsList);
|
||||
this.showLoader = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -115,8 +168,17 @@ export class EventsPage implements OnInit {
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
|
||||
showAlert(){
|
||||
this.alertController.presentAlert("Funcionalidade em desenvolvimento!");
|
||||
changeProfile(){
|
||||
if(this.profile == "mdgpr"){
|
||||
console.log('pr');
|
||||
this.profile ="pr";
|
||||
this.RefreshEvents();
|
||||
}
|
||||
else{
|
||||
console.log('mdgpr');
|
||||
this.profile ="mdgpr";
|
||||
this.RefreshEvents();
|
||||
}
|
||||
}
|
||||
|
||||
logout()
|
||||
|
||||
Reference in New Issue
Block a user