mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
Add agenda filter
This commit is contained in:
@@ -108,26 +108,54 @@
|
||||
</div>
|
||||
</ng-template>
|
||||
</div>
|
||||
<div class="calendar-container" *ngSwitchCase="'Pessoal'">
|
||||
<ion-row>
|
||||
<!-- Move back one screen of the slides -->
|
||||
<ion-col size="2">
|
||||
<ion-button fill="clear" (click)="back()" class="btn-no-color">
|
||||
<ion-icon name="arrow-back" slot="icon-only"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-col>
|
||||
<!-- The title of the calendar in the middle -->
|
||||
<ion-col size="8" class="ion-text-center">
|
||||
<div class="calendar-container" *ngSwitchCase="'Pessoal'" [style.height]="calendarHeight">
|
||||
<ion-row class="ion-justify-content-between calendar-tool-tip">
|
||||
<ion-row class="ion-align-items-center">
|
||||
<!-- Move back one screen of the slides -->
|
||||
|
||||
<div class="arrow">
|
||||
<button (click)="back()" class="btn-no-color" >
|
||||
<ion-icon slot="icon-only" src="assets/images/icons-calendar-arrow-left.svg"></ion-icon>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Move forward one screen of the slides -->
|
||||
<h2 class="capitaliseText">{{ viewTitle }}</h2>
|
||||
</ion-col>
|
||||
|
||||
<!-- Move forward one screen of the slides -->
|
||||
<ion-col size="2">
|
||||
<ion-button fill="clear" (click)="next()" class="btn-no-color">
|
||||
<ion-icon name="arrow-forward" slot="icon-only"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<!-- <div class="drop-down">
|
||||
<ion-icon slot="icon-only" class="arrow-down" src="assets/images/icons-arrow-arrow-down.svg"></ion-icon>
|
||||
<div class="drop-down-container">
|
||||
<ul>
|
||||
<li *ngFor="let month of monthList" (click)="dropDownChangeDate(month.id)" >{{ month.name }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Move forward one screen of the slides -->
|
||||
<div (click)="next()" class="arrow">
|
||||
<ion-icon slot="icon-only" src="assets/images/icons-calendar-arrow-right.svg"></ion-icon>
|
||||
</div>
|
||||
|
||||
</ion-row>
|
||||
<ion-row class="ion-align-items-center">
|
||||
|
||||
<button *ngIf="profile == 'mdgpr' " (click)="changeProfile()" class="right-icons d-md-none btn-no-color">
|
||||
<ion-icon src="assets/images/icons-profile-calendar-md.svg">ddddddd</ion-icon>
|
||||
</button>
|
||||
|
||||
<button *ngIf="profile == 'pr' " (click)="changeProfile()" class="btn-no-color">
|
||||
<ion-icon class="right-icons d-md-none" src="assets/images/icons-profile-calendar-pr.svg">dddddddd</ion-icon>
|
||||
</button>
|
||||
|
||||
<button class="btn-no-color" (click)="viewEventsToApprove()">
|
||||
<ion-icon class="right-icons" src="assets/images/icons-received-event.svg"></ion-icon>
|
||||
</button>
|
||||
|
||||
<button class="btn-no-color" (click)="clearContact();openAddEvent();">
|
||||
<ion-icon class="right-icons" src="assets/images/icons-add-new-event.svg" ></ion-icon>
|
||||
</button>
|
||||
|
||||
</ion-row>
|
||||
</ion-row>
|
||||
|
||||
|
||||
<table class="custom-calendar-header">
|
||||
@@ -165,35 +193,64 @@
|
||||
|
||||
<!-- Adding a customized ng-template -->
|
||||
<ng-template #template let-view="view" let-row="row" let-col="col">
|
||||
<div [class.with-event]="view.dates[row*7+col].events.length">
|
||||
{{view.dates[row*7+col].label}}
|
||||
<div class="indicator-container">
|
||||
<!-- <div class="event-indicator" *ngFor="let e of view.dates[row*7+col].events"></div> -->
|
||||
</div>
|
||||
<div [className]="currentDayEventDisplayBorder(view.dates, row*7+col)" class="d-flex justify-center align-center" [class.with-event]="view.dates[row*7+col].events.length">
|
||||
|
||||
<div class="day">
|
||||
{{ view.dates[row*7+col].label }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
|
||||
</div>
|
||||
<div class="calendar-container" *ngSwitchCase="'Oficial'">
|
||||
<ion-row>
|
||||
<!-- Move back one screen of the slides -->
|
||||
<ion-col size="2">
|
||||
<ion-button fill="clear" (click)="back()">
|
||||
<ion-icon name="arrow-back" slot="icon-only"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-col>
|
||||
<!-- The title of the calendar in the middle -->
|
||||
<ion-col size="8" class="ion-text-center">
|
||||
<div class="calendar-container" *ngSwitchCase="'Oficial'" [style.height]="calendarHeight">
|
||||
<ion-row class="ion-justify-content-between calendar-tool-tip">
|
||||
<ion-row class="ion-align-items-center">
|
||||
<!-- Move back one screen of the slides -->
|
||||
|
||||
<div class="arrow">
|
||||
<button (click)="back()" class="btn-no-color" >
|
||||
<ion-icon slot="icon-only" src="assets/images/icons-calendar-arrow-left.svg"></ion-icon>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Move forward one screen of the slides -->
|
||||
<h2 class="capitaliseText">{{ viewTitle }}</h2>
|
||||
</ion-col>
|
||||
|
||||
<!-- Move forward one screen of the slides -->
|
||||
<ion-col size="2">
|
||||
<ion-button fill="clear" (click)="next()">
|
||||
<ion-icon name="arrow-forward" slot="icon-only"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<!-- <div class="drop-down">
|
||||
<ion-icon slot="icon-only" class="arrow-down" src="assets/images/icons-arrow-arrow-down.svg"></ion-icon>
|
||||
<div class="drop-down-container">
|
||||
<ul>
|
||||
<li *ngFor="let month of monthList" (click)="dropDownChangeDate(month.id)" >{{ month.name }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Move forward one screen of the slides -->
|
||||
<div (click)="next()" class="arrow">
|
||||
<ion-icon slot="icon-only" src="assets/images/icons-calendar-arrow-right.svg"></ion-icon>
|
||||
</div>
|
||||
|
||||
</ion-row>
|
||||
<ion-row class="ion-align-items-center">
|
||||
|
||||
<button *ngIf="profile == 'mdgpr' " (click)="changeProfile()" class="right-icons d-md-none btn-no-color">
|
||||
<ion-icon src="assets/images/icons-profile-calendar-md.svg">ddddddd</ion-icon>
|
||||
</button>
|
||||
|
||||
<button *ngIf="profile == 'pr' " (click)="changeProfile()" class="btn-no-color">
|
||||
<ion-icon class="right-icons d-md-none" src="assets/images/icons-profile-calendar-pr.svg">dddddddd</ion-icon>
|
||||
</button>
|
||||
|
||||
<button class="btn-no-color" (click)="viewEventsToApprove()">
|
||||
<ion-icon class="right-icons" src="assets/images/icons-received-event.svg"></ion-icon>
|
||||
</button>
|
||||
|
||||
<button class="btn-no-color" (click)="clearContact();openAddEvent();">
|
||||
<ion-icon class="right-icons" src="assets/images/icons-add-new-event.svg" ></ion-icon>
|
||||
</button>
|
||||
|
||||
</ion-row>
|
||||
</ion-row>
|
||||
|
||||
|
||||
<table class="custom-calendar-header">
|
||||
@@ -228,15 +285,17 @@
|
||||
>
|
||||
</calendar>
|
||||
|
||||
<!-- Adding a customized ng-template -->
|
||||
<!-- Adding a customized ng-template -->
|
||||
<ng-template #template let-view="view" let-row="row" let-col="col">
|
||||
<div [class.with-event]="view.dates[row*7+col].events.length">
|
||||
{{view.dates[row*7+col].label}}
|
||||
<div class="indicator-container">
|
||||
<!-- <div class="event-indicator" *ngFor="let e of view.dates[row*7+col].events"></div> -->
|
||||
</div>
|
||||
<div [className]="currentDayEventDisplayBorder(view.dates, row*7+col)" class="d-flex justify-center align-center" [class.with-event]="view.dates[row*7+col].events.length">
|
||||
|
||||
<div class="day">
|
||||
{{ view.dates[row*7+col].label }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -270,10 +329,11 @@
|
||||
|
||||
<!-- List -->
|
||||
<ul *ngIf="showTimelineFilterState">
|
||||
<li [class.active]="timelineFilterState == 'Todos' " (click)="timelineFilter('Todos')">Todos</li>
|
||||
<li [class.active]="timelineFilterState == 'Oficial' " (click)="timelineFilter('Oficial')">Oficial</li>
|
||||
<li [class.active]="timelineFilterState == 'Pessoal' " (click)="timelineFilter('Pessoal')">Pessoal</li>
|
||||
<li [class.active]="segment == 'Combinado' " (click)="changeSegment('Combinado')">Todos</li>
|
||||
<li [class.active]="segment == 'Oficial' " (click)="changeSegment('Oficial')">Oficial</li>
|
||||
<li [class.active]="segment == 'Pessoal' " (click)="changeSegment('Pessoal')">Pessoal</li>
|
||||
</ul>
|
||||
|
||||
</ion-row>
|
||||
</ion-row>
|
||||
|
||||
|
||||
@@ -474,10 +474,6 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
this.showTimelineFilterState = false;
|
||||
|
||||
/* if( profile =='md'){
|
||||
console.log('eventsList: ', eventsList);
|
||||
} */
|
||||
|
||||
eventsList.forEach((element, eventIndex) => {
|
||||
|
||||
// timeline start
|
||||
@@ -491,7 +487,6 @@ export class AgendaPage implements OnInit {
|
||||
console.log('mdEvent:', element,eventIndex);
|
||||
}
|
||||
|
||||
// console.log( element.CalendarName);
|
||||
events.push({
|
||||
title: this.timeLineTemplate(startHours, element.Location, element.Body, element.CalendarName, element.Subject,startHoursOtherFormate,EndHoursOtherFormate, eventIndex, profile),
|
||||
start: setHours(setMinutes(new Date(element.StartDate), 0), parseInt(startHours)),
|
||||
@@ -502,16 +497,18 @@ export class AgendaPage implements OnInit {
|
||||
},
|
||||
id: element.EventId,
|
||||
index: eventIndex,
|
||||
profile: profile
|
||||
profile: profile,
|
||||
CalendarName: element.CalendarName,
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// this.onCurrentChanged(this.eventSelectedDate);
|
||||
|
||||
return events;
|
||||
}
|
||||
|
||||
eventFilter(){}
|
||||
|
||||
loadRangeEvents(startTime: Date, endTime: Date){
|
||||
|
||||
this.showLoader = true;
|
||||
@@ -526,7 +523,7 @@ export class AgendaPage implements OnInit {
|
||||
this.eventSource=[];
|
||||
|
||||
|
||||
if(this.profile == "mdgpr"){
|
||||
if(this.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 => {
|
||||
|
||||
@@ -550,6 +547,7 @@ export class AgendaPage implements OnInit {
|
||||
const list = this.timelineFilter(this.timelineFilterState, this.eventsList, 'md');
|
||||
|
||||
this.events = list;
|
||||
// optional
|
||||
this.TimelineMD = list;
|
||||
|
||||
this.myCal.update();
|
||||
@@ -560,11 +558,10 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
this.timelineBoxCorrectHeight(500);
|
||||
this.centralizeTimeline(500);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
else{
|
||||
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 => {
|
||||
|
||||
@@ -596,11 +593,13 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
this.showLoader = false;
|
||||
this.showTimeline = true;
|
||||
|
||||
this.timelineBoxCorrectHeight(500);
|
||||
this.centralizeTimeline(500);
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
@@ -613,24 +612,27 @@ export class AgendaPage implements OnInit {
|
||||
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.eventSource=[];
|
||||
|
||||
this.eventsListPessoal = response.filter(data => data.CalendarName == "Pessoal");
|
||||
this.eventsListPessoal.forEach(element => {
|
||||
|
||||
// loop
|
||||
this.eventsListPessoal.forEach((element, eventIndex) => {
|
||||
|
||||
this.eventSource.push({
|
||||
title: element.Subject,
|
||||
startTime: new Date(element.StartDate),
|
||||
endTime: new Date(element.EndDate),
|
||||
allDay: false,
|
||||
event: element,
|
||||
calendarName: element.CalendarName,
|
||||
profile: 'md'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
const list = this.timelineFilter(this.timelineFilterState, this.eventsList, 'md');
|
||||
|
||||
this.events = list;
|
||||
this.TimelineMD = list;
|
||||
|
||||
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
@@ -657,9 +659,21 @@ export class AgendaPage implements OnInit {
|
||||
profile: 'pr'
|
||||
});
|
||||
});
|
||||
|
||||
const list = this.timelineFilter(this.timelineFilterState, this.eventsListOficial, 'pr');
|
||||
|
||||
this.events = list;
|
||||
// optional
|
||||
this.TimelinePR = list;
|
||||
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
this.showLoader = false;
|
||||
this.showTimeline = true;
|
||||
|
||||
this.timelineBoxCorrectHeight(500);
|
||||
this.centralizeTimeline(500);
|
||||
});
|
||||
}
|
||||
break;
|
||||
@@ -667,7 +681,9 @@ export class AgendaPage implements OnInit {
|
||||
case "Oficial":
|
||||
//Inicializa o array eventSource
|
||||
this.eventSource=[];
|
||||
if(this.profile == "mdgpr"){
|
||||
this.eventsListOficial = [];
|
||||
|
||||
if(this.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.eventSource=[];
|
||||
this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
|
||||
@@ -678,11 +694,11 @@ export class AgendaPage implements OnInit {
|
||||
endTime: new Date(element.EndDate),
|
||||
allDay: false,
|
||||
event: element,
|
||||
profile: 'pr'
|
||||
profile: 'md'
|
||||
});
|
||||
});
|
||||
|
||||
const list = this.timelineFilter(this.timelineFilterState, this.eventsList, 'pr');
|
||||
const list = this.timelineFilter(this.timelineFilterState, this.eventsListOficial, 'pr');
|
||||
|
||||
this.events = list;
|
||||
this.TimelinePR = list;
|
||||
@@ -696,7 +712,7 @@ export class AgendaPage implements OnInit {
|
||||
this.timelineBoxCorrectHeight(500);
|
||||
this.centralizeTimeline(500);
|
||||
});
|
||||
}else{
|
||||
} 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 => {
|
||||
this.eventSource=[];
|
||||
this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
|
||||
@@ -710,9 +726,23 @@ export class AgendaPage implements OnInit {
|
||||
profile: 'pr'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
const list = this.timelineFilter(this.timelineFilterState, this.eventsListOficial, 'pr');
|
||||
|
||||
|
||||
this.events = list;
|
||||
// optional
|
||||
this.TimelinePR = list;
|
||||
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
this.showLoader = false;
|
||||
this.showTimeline = true;
|
||||
|
||||
this.timelineBoxCorrectHeight(500);
|
||||
this.centralizeTimeline(500);
|
||||
});
|
||||
}
|
||||
break;
|
||||
@@ -731,8 +761,15 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
this.TimelineMD = [];
|
||||
|
||||
this.eventsList = response;
|
||||
// loop
|
||||
if(this.segment == 'Oficial') {
|
||||
this.eventsList = response.filter(data => data.CalendarName == "Oficial");
|
||||
} else if (this.segment == 'Pessoal') {
|
||||
this.eventsList = response.filter(data => data.CalendarName == "Pessoal");
|
||||
} else {
|
||||
this.eventsList = response;
|
||||
}
|
||||
|
||||
// loop
|
||||
this.eventsList.forEach((element, eventIndex) => {
|
||||
|
||||
// calendar
|
||||
@@ -768,7 +805,14 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
this.TimelinePR = [];
|
||||
|
||||
this.eventsList = response;
|
||||
if(this.segment == 'Oficial') {
|
||||
this.eventsList = response.filter(data => data.CalendarName == "Oficial");
|
||||
} else if (this.segment == 'Pessoal') {
|
||||
this.eventsList = response.filter(data => data.CalendarName == "Pessoal");
|
||||
} else {
|
||||
this.eventsList = response;
|
||||
}
|
||||
|
||||
this.eventsList.forEach((element, eventIndex) => {
|
||||
|
||||
// calendar
|
||||
@@ -802,9 +846,7 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
actions(){
|
||||
|
||||
}
|
||||
actions(){}
|
||||
|
||||
doRefresh(ev: any){
|
||||
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
||||
@@ -1064,4 +1106,17 @@ export class AgendaPage implements OnInit {
|
||||
this.postEvent = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
async changeSegment(segments: "Combinado" | "Pessoal" | "Oficial") {
|
||||
this.segment = segments;
|
||||
|
||||
if(segments=='Combinado'){
|
||||
this.timelineFilterState = 'Todo'
|
||||
} else {
|
||||
this.timelineFilterState = segments
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user