mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
improve
This commit is contained in:
@@ -54,7 +54,7 @@ export class EventsService {
|
||||
userCalendarNameOwnOficial = '';
|
||||
userCalendarNameOwnPessoal = '';
|
||||
|
||||
|
||||
calendarNames = {}
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
@@ -246,17 +246,24 @@ export class EventsService {
|
||||
this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarName', sharedCalendar.CalendarName);
|
||||
}
|
||||
|
||||
for (let sharedCalendar of this.loggeduser.SharedCalendars) {
|
||||
this.GetCalendarName(sharedCalendar.OwnerUserId).subscribe((e)=> {
|
||||
this.calendarNames[sharedCalendar.CalendarId] = e.FullName
|
||||
})
|
||||
}
|
||||
|
||||
this.GetCalendarName(sharedCalendar.OwnerUserId).subscribe((e)=> {
|
||||
console.log(e)
|
||||
})
|
||||
|
||||
for (let sharedCalendar of this.loggeduser.OwnerCalendars) {
|
||||
this.GetCalendarName(sharedCalendar.OwnerUserId).subscribe((e)=> {
|
||||
this.calendarNames[sharedCalendar.CalendarId] = e.FullName
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
getCalendarOwnNameByCalendarId(CalendarId) {
|
||||
return this.calendarNames[CalendarId] || ""
|
||||
}
|
||||
|
||||
|
||||
isMyEvent(event: any) {
|
||||
@@ -435,20 +442,36 @@ export class EventsService {
|
||||
|
||||
async genericGetAllSharedEvents(startdate: string, enddate: string) {
|
||||
|
||||
let prO = [], prP = [];
|
||||
|
||||
if(this.hasSharedOficial) {
|
||||
prO = await this.genericGetAllSharedOficialEvents(startdate, enddate).toPromise();
|
||||
}
|
||||
let result = []
|
||||
|
||||
if(this.hasSharedPessoal) {
|
||||
prP = await this.genericGetAllSharedPessoalEvents(startdate, enddate).toPromise();
|
||||
}
|
||||
for (let sharedCalendar of this.loggeduser.SharedCalendars) {
|
||||
|
||||
var header = new HttpHeaders();
|
||||
header = header.set('Authorization', 'Basic '+ sharedCalendar.CalendarToken);
|
||||
header = header.set('CalendarId', sharedCalendar.CalendarId);
|
||||
header = header.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
|
||||
header = header.set('CalendarName', sharedCalendar.CalendarName);
|
||||
|
||||
let geturl = environment.apiURL + 'calendar/GetEvents';
|
||||
|
||||
const resFinal = prO.concat(prP);
|
||||
let params = new HttpParams();
|
||||
|
||||
params = params.set("StartDate", startdate);
|
||||
params = params.set("EndDate", enddate);
|
||||
|
||||
let options = {
|
||||
headers: header,
|
||||
params: params
|
||||
};
|
||||
|
||||
const calendar = await this.http.get<Event[]>(`${geturl}`, options).toPromise()
|
||||
|
||||
result = result.concat(calendar)
|
||||
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
return resolve(resFinal)
|
||||
return resolve(result)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user