mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
save
This commit is contained in:
@@ -266,8 +266,8 @@ export class AgendaPage implements OnInit {
|
||||
// calendar change date
|
||||
this.eventSelectedDate = new Date(ev);
|
||||
|
||||
this.centralizeTimeline(500);
|
||||
this.timelineBoxCorrectHeight(500);
|
||||
/* this.centralizeTimeline(500);
|
||||
this.timelineBoxCorrectHeight(500); */
|
||||
};
|
||||
|
||||
// changedate
|
||||
@@ -286,7 +286,7 @@ export class AgendaPage implements OnInit {
|
||||
this.rangeStartDate = ev.startTime;
|
||||
this.rangeEndDate = ev.endTime;
|
||||
|
||||
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
||||
//this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
||||
}
|
||||
|
||||
// for calendar
|
||||
@@ -515,7 +515,7 @@ export class AgendaPage implements OnInit {
|
||||
return ((new Date(this.timelineDate)).getDate()).toString().padStart(2,'0')
|
||||
}
|
||||
|
||||
async loadRangeEvents(startTime: Date, endTime: Date){
|
||||
loadRangeEvents(startTime: Date, endTime: Date){
|
||||
|
||||
this.eventSelectedDate = new Date(startTime);
|
||||
|
||||
@@ -529,16 +529,17 @@ export class AgendaPage implements OnInit {
|
||||
case "Combinado":
|
||||
//Inicializa o array eventSource
|
||||
//this.eventSource=[];
|
||||
|
||||
if(this.loggeduser.Profile == 'MDGPR' ) {
|
||||
|
||||
let mdOficialEvents = await this.eventService.getAllMdOficialEvents(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.getAllMdPessoalEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).toPromise();
|
||||
|
||||
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.eventsList = mdOficialEvents.concat(mdPessoalEvents);
|
||||
this.eventsList = response;
|
||||
// loop
|
||||
this.eventsList.forEach((element, eventIndex) => {
|
||||
|
||||
@@ -573,17 +574,17 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
this.timelineBoxCorrectHeight(500);
|
||||
this.centralizeTimeline(500);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
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();
|
||||
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) => {
|
||||
|
||||
// calendar
|
||||
this.eventSource=[];
|
||||
|
||||
this.eventsList = prOficialEvents.concat(prPessoalEvents);
|
||||
this.eventsList = response;
|
||||
|
||||
// calendar
|
||||
this.eventsList.forEach((element, eventIndex) => {
|
||||
@@ -617,6 +618,8 @@ export class AgendaPage implements OnInit {
|
||||
this.timelineBoxCorrectHeight(500);
|
||||
this.centralizeTimeline(500);
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -624,7 +627,7 @@ export class AgendaPage implements OnInit {
|
||||
//Inicializa o array eventSource
|
||||
|
||||
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
|
||||
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.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.eventsListPessoal= [];
|
||||
@@ -665,11 +668,10 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
}
|
||||
else{
|
||||
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.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.eventsListPessoal = prPessoalEvents.filter(data => data.CalendarName == "Pessoal");
|
||||
this.eventsListPessoal = response.filter(data => data.CalendarName == "Pessoal");
|
||||
this.eventsListPessoal.forEach(element => {
|
||||
this.eventSource.push({
|
||||
title: element.Subject,
|
||||
@@ -699,7 +701,7 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
this.timelineBoxCorrectHeight(500);
|
||||
this.centralizeTimeline(500);
|
||||
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -708,8 +710,8 @@ export class AgendaPage implements OnInit {
|
||||
//Inicializa o array eventSource
|
||||
this.eventsListOficial = [];
|
||||
|
||||
if(this.loggeduser.Profile == 'MDGPR') {
|
||||
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 => {
|
||||
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.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
|
||||
|
||||
@@ -742,11 +744,10 @@ export class AgendaPage implements OnInit {
|
||||
this.timelineBoxCorrectHeight(500);
|
||||
this.centralizeTimeline(500);
|
||||
});
|
||||
}
|
||||
else {
|
||||
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();
|
||||
} 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.eventsListOficial = prOficialEvents.filter(data => data.CalendarName == "Oficial");
|
||||
this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
|
||||
this.eventsListOficial.forEach(element => {
|
||||
this.eventSource.push({
|
||||
title: element.Subject,
|
||||
@@ -776,12 +777,12 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
this.timelineBoxCorrectHeight(500);
|
||||
this.centralizeTimeline(500);
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
//this.showTimelinePR = false;
|
||||
//this.showTimelineMD = false;
|
||||
@@ -790,16 +791,17 @@ export class AgendaPage implements OnInit {
|
||||
let counter = 0;
|
||||
|
||||
if(this.loggeduser.Profile == 'MDGPR') {
|
||||
|
||||
let mdOficialEvents = await this.eventService.getAllMdOficialEvents( 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.getAllMdPessoalEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).toPromise();
|
||||
|
||||
console.log('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) => {
|
||||
|
||||
|
||||
if(this.segment == 'Oficial') {
|
||||
this.eventsList = mdOficialEvents;
|
||||
this.eventsList = response.filter(data => data.CalendarName == "Oficial");
|
||||
} else if (this.segment == 'Pessoal') {
|
||||
this.eventsList = mdPessoalEvents;
|
||||
this.eventsList = response.filter(data => data.CalendarName == "Pessoal");
|
||||
} else {
|
||||
this.eventsList = mdOficialEvents.concat(mdPessoalEvents);
|
||||
this.eventsList = response;
|
||||
}
|
||||
|
||||
this.eventSource= this.eventSource.filter(e => e.profile != 'md');
|
||||
@@ -842,21 +844,72 @@ export class AgendaPage implements OnInit {
|
||||
this.centralizeTimeline(500);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
});
|
||||
|
||||
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) => {
|
||||
|
||||
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.eventSource = this.eventSource.filter(e => e.profile != 'pr');
|
||||
|
||||
this.eventsList.forEach((element, eventIndex) => {
|
||||
|
||||
// calendar
|
||||
this.eventSource.push({
|
||||
index: eventIndex,
|
||||
title: element.Subject,
|
||||
startTime: new Date(element.StartDate),
|
||||
endTime: new Date(element.EndDate),
|
||||
allDay: false,
|
||||
event: element,
|
||||
calendarName: element.CalendarName,
|
||||
profile:'pr',
|
||||
id: element.EventId,
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
this.TimelinePR = this.timelineFilter(this.timelineFilterState, this.eventsList, 'pr');
|
||||
|
||||
|
||||
this.TimelinePRList = this.eventListBox(this.TimelinePR)
|
||||
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
|
||||
this.showTimelinePR = true;
|
||||
|
||||
counter++;
|
||||
|
||||
if(counter==2 || this.loggeduser.Profile == 'PR') {
|
||||
this.showLoader = false;
|
||||
this.timelineBoxCorrectHeight(500);
|
||||
this.centralizeTimeline(500);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
console.log('PR');
|
||||
|
||||
|
||||
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();
|
||||
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) => {
|
||||
|
||||
if(this.segment == 'Oficial') {
|
||||
this.eventsList = prOficialEvents;
|
||||
this.eventsList = response.filter(data => data.CalendarName == "Oficial");
|
||||
} else if (this.segment == 'Pessoal') {
|
||||
this.eventsList = prPessoalEvents;
|
||||
this.eventsList = response.filter(data => data.CalendarName == "Pessoal");
|
||||
} else {
|
||||
this.eventsList = prOficialEvents.concat(prPessoalEvents);
|
||||
this.eventsList = response;
|
||||
}
|
||||
|
||||
this.eventSource = this.eventSource.filter(e => e.profile != 'pr');
|
||||
@@ -896,7 +949,9 @@ export class AgendaPage implements OnInit {
|
||||
this.centralizeTimeline(500);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,6 @@ export class EventsPage implements OnInit {
|
||||
let prPessoalEvents= await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
|
||||
this.eventsList = prOficialEvents.concat(prPessoalEvents);
|
||||
console.log(this.eventsList);
|
||||
console.log(this.eventsList);
|
||||
|
||||
if(this.eventsList.length > 0){
|
||||
this.currentEvent = this.eventsList[0].Subject;
|
||||
|
||||
@@ -149,7 +149,17 @@ export class EventsService {
|
||||
return this.http.get<Event[]>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
getAllMdOficialEvents(startdate:string, enddate:string): Observable<Event[]>{
|
||||
async getAllPrEvents(startdate:string, enddate:string){
|
||||
let prO = await this.getAllPrOficialEvents(startdate, enddate).toPromise();
|
||||
let prP = await this.getAllPrPessoalEvents(startdate, enddate).toPromise();
|
||||
const resFinal = prO.concat(prP);
|
||||
console.log(resFinal);
|
||||
return new Promise(resolve =>{
|
||||
return resolve(resFinal)
|
||||
})
|
||||
}
|
||||
|
||||
getAllMdOficialEvents(startdate:string, enddate:string): any{
|
||||
const geturl = environment.apiURL + 'calendar/md';
|
||||
let params = new HttpParams();
|
||||
|
||||
@@ -160,10 +170,10 @@ export class EventsService {
|
||||
headers: this.headersMdOficial,
|
||||
params: params
|
||||
};
|
||||
return this.http.get<Event[]>(`${geturl}`, options);
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
getAllMdPessoalEvents(startdate:string, enddate:string): Observable<Event[]>{
|
||||
getAllMdPessoalEvents(startdate:string, enddate:string): any{
|
||||
const geturl = environment.apiURL + 'calendar/md';
|
||||
let params = new HttpParams();
|
||||
|
||||
@@ -174,7 +184,17 @@ export class EventsService {
|
||||
headers: this.headersMdPessoal,
|
||||
params: params
|
||||
};
|
||||
return this.http.get<Event[]>(`${geturl}`, options);
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
async getAllMdEvents(startdate:string, enddate:string){
|
||||
let prO = await this.getAllMdOficialEvents(startdate, enddate).toPromise();
|
||||
let prP = await this.getAllMdPessoalEvents(startdate, enddate).toPromise();
|
||||
const resFinal = prO.concat(prP);
|
||||
console.log(resFinal);
|
||||
return new Promise(resolve =>{
|
||||
return resolve(resFinal)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -207,6 +227,17 @@ export class EventsService {
|
||||
return this.http.get<Event[]>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
async getAllSharedEvents(startdate:string, enddate:string){
|
||||
let prO = await this.getAllSharedOficialEvents(startdate, enddate).toPromise();
|
||||
let prP = await this.getAllSharedPessoalEvents(startdate, enddate).toPromise();
|
||||
const resFinal = prO.concat(prP);
|
||||
console.log(resFinal);
|
||||
|
||||
return new Promise(resolve =>{
|
||||
return resolve(resFinal)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -181,6 +181,8 @@ export class NewEventPage implements OnInit {
|
||||
}
|
||||
|
||||
if(this.loggeduser.Profile == 'MDGPR') {
|
||||
console.log('MD - Aqui');
|
||||
console.log(this.postEvent);
|
||||
this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).subscribe(
|
||||
async (id) => {
|
||||
|
||||
@@ -223,6 +225,8 @@ export class NewEventPage implements OnInit {
|
||||
});
|
||||
}
|
||||
else if(this.loggeduser.Profile == 'PR') {
|
||||
console.log('PR - Aqui');
|
||||
console.log(this.postEvent);
|
||||
this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).subscribe(
|
||||
(id) => {
|
||||
console.log(id);
|
||||
|
||||
Reference in New Issue
Block a user