mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix
This commit is contained in:
@@ -41,7 +41,7 @@ export class EventsService {
|
||||
hasOwnCalendar = false
|
||||
|
||||
|
||||
calendarOwnerIds = []
|
||||
calendarIds = []
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
@@ -83,19 +83,13 @@ export class EventsService {
|
||||
this.hasSharedCalendar = false
|
||||
this.hasOwnCalendar = false
|
||||
|
||||
this.calendarOwnerIds = []
|
||||
this.calendarIds = []
|
||||
|
||||
if (this.loggeduser) {
|
||||
if (this.loggeduser.Profile == 'MDGPR') {
|
||||
|
||||
this.loggeduser.OwnerCalendars.forEach(calendar => {
|
||||
|
||||
if(!this.calendarOwnerIds.includes(calendar.OwnerUserId)) {
|
||||
this.calendarOwnerIds.push(calendar.OwnerUserId)
|
||||
}
|
||||
|
||||
this.hasOwnCalendar = true
|
||||
|
||||
if (calendar.CalendarName == 'Oficial') {
|
||||
this.headersMdOficial = this.headersMdOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
this.headersMdOficial = this.headersMdOficial.set('CalendarId', calendar.CalendarId);
|
||||
@@ -111,12 +105,6 @@ export class EventsService {
|
||||
|
||||
this.loggeduser.SharedCalendars.forEach(sharedCalendar => {
|
||||
|
||||
if(!this.calendarOwnerIds.includes(sharedCalendar.OwnerUserId)) {
|
||||
this.calendarOwnerIds.push(sharedCalendar.OwnerUserId)
|
||||
}
|
||||
|
||||
this.hasSharedCalendar = true
|
||||
|
||||
if (sharedCalendar.CalendarName == 'Oficial') {
|
||||
this.headersSharedOficial = this.headersSharedOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
this.headersSharedOficial = this.headersSharedOficial.set('CalendarId', sharedCalendar.CalendarId);
|
||||
@@ -129,16 +117,11 @@ export class EventsService {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
else if (this.loggeduser.Profile == 'PR') {
|
||||
|
||||
this.loggeduser.OwnerCalendars.forEach(calendar => {
|
||||
|
||||
if(!this.calendarOwnerIds.includes(calendar.OwnerUserId)) {
|
||||
this.calendarOwnerIds.push(calendar.OwnerUserId)
|
||||
}
|
||||
|
||||
this.hasOwnCalendar = true
|
||||
|
||||
if (calendar.CalendarName == 'Oficial') {
|
||||
this.headersPrOficial = this.headersPrOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
this.headersPrOficial = this.headersPrOficial.set('CalendarId', calendar.CalendarId);
|
||||
@@ -151,55 +134,54 @@ export class EventsService {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
|
||||
this.loggeduser.OwnerCalendars.forEach(calendar => {
|
||||
|
||||
if(!this.calendarOwnerIds.includes(calendar.OwnerUserId)) {
|
||||
this.calendarOwnerIds.push(calendar.OwnerUserId)
|
||||
}
|
||||
this.hasOwnCalendar = true
|
||||
|
||||
if (calendar.CalendarName == 'Oficial') {
|
||||
this.headerOwnOficial = this.headerOwnOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
this.headerOwnOficial = this.headerOwnOficial.set('CalendarId', calendar.CalendarId);
|
||||
this.headerOwnOficial = this.headerOwnOficial.set('CalendarRoleId', calendar.CalendarRoleId);
|
||||
this.headerOwnOficial = this.headerOwnOficial.set('CalendarName', calendar.CalendarName);
|
||||
}
|
||||
else if (calendar.CalendarName == 'Pessoal') {
|
||||
this.headerOwnPessoal = this.headerOwnPessoal.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
this.headerOwnPessoal =this.headerOwnPessoal.set('CalendarId', calendar.CalendarId);
|
||||
this.headerOwnPessoal =this.headerOwnPessoal.set('CalendarRoleId', calendar.CalendarRoleId);
|
||||
this.headerOwnPessoal = this.headerOwnPessoal.set('CalendarName', calendar.CalendarName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
for (let sharedCalendar of this.loggeduser.SharedCalendars) {
|
||||
|
||||
this.loggeduser.OwnerCalendars.forEach(calendar => {
|
||||
|
||||
if(!this.calendarOwnerIds.includes(sharedCalendar.OwnerUserId)) {
|
||||
this.calendarOwnerIds.push(sharedCalendar.OwnerUserId)
|
||||
}
|
||||
|
||||
this.hasSharedCalendar = true
|
||||
|
||||
if (sharedCalendar.CalendarName == 'Oficial') {
|
||||
sharedCalendar.CalendarName
|
||||
this.headerSharedOficial = this.headerSharedOficial.set('Authorization', 'Basic '+sharedCalendar.CalendarToken);
|
||||
this.headerSharedOficial = this.headerSharedOficial.set('CalendarId', sharedCalendar.CalendarId);
|
||||
this.headerSharedOficial = this.headerSharedOficial.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
|
||||
this.headerSharedOficial = this.headerSharedOficial.set('CalendarName', sharedCalendar.CalendarName);
|
||||
}
|
||||
else if (sharedCalendar.CalendarName == 'Pessoal') {
|
||||
this.headerSharedPessoal = this.headerSharedPessoal.set('Authorization', 'Basic '+sharedCalendar.CalendarToken);
|
||||
this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarId', sharedCalendar.CalendarId);
|
||||
this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
|
||||
this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarName', sharedCalendar.CalendarName);
|
||||
}
|
||||
if(!this.calendarIds.includes(calendar.OwnerUserId)) {
|
||||
this.calendarIds.push(calendar.OwnerUserId)
|
||||
}
|
||||
this.hasOwnCalendar = true
|
||||
|
||||
if (calendar.CalendarName == 'Oficial') {
|
||||
this.headerOwnOficial = this.headerOwnOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
this.headerOwnOficial = this.headerOwnOficial.set('CalendarId', calendar.CalendarId);
|
||||
this.headerOwnOficial = this.headerOwnOficial.set('CalendarRoleId', calendar.CalendarRoleId);
|
||||
this.headerOwnOficial = this.headerOwnOficial.set('CalendarName', calendar.CalendarName);
|
||||
}
|
||||
else if (calendar.CalendarName == 'Pessoal') {
|
||||
this.headerOwnPessoal = this.headerOwnPessoal.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
this.headerOwnPessoal =this.headerOwnPessoal.set('CalendarId', calendar.CalendarId);
|
||||
this.headerOwnPessoal =this.headerOwnPessoal.set('CalendarRoleId', calendar.CalendarRoleId);
|
||||
this.headerOwnPessoal = this.headerOwnPessoal.set('CalendarName', calendar.CalendarName);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
for (let sharedCalendar of this.loggeduser.SharedCalendars) {
|
||||
|
||||
|
||||
if(!this.calendarIds.includes(sharedCalendar.OwnerUserId)) {
|
||||
this.calendarIds.push(sharedCalendar.OwnerUserId)
|
||||
}
|
||||
|
||||
this.hasSharedCalendar = true
|
||||
|
||||
if (sharedCalendar.CalendarName == 'Oficial') {
|
||||
sharedCalendar.CalendarName
|
||||
this.headerSharedOficial = this.headerSharedOficial.set('Authorization', 'Basic '+sharedCalendar.CalendarToken);
|
||||
this.headerSharedOficial = this.headerSharedOficial.set('CalendarId', sharedCalendar.CalendarId);
|
||||
this.headerSharedOficial = this.headerSharedOficial.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
|
||||
this.headerSharedOficial = this.headerSharedOficial.set('CalendarName', sharedCalendar.CalendarName);
|
||||
}
|
||||
else if (sharedCalendar.CalendarName == 'Pessoal') {
|
||||
this.headerSharedPessoal = this.headerSharedPessoal.set('Authorization', 'Basic '+sharedCalendar.CalendarToken);
|
||||
this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarId', sharedCalendar.CalendarId);
|
||||
this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
|
||||
this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarName', sharedCalendar.CalendarName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.headers = new HttpHeaders();
|
||||
@@ -881,6 +863,49 @@ export class EventsService {
|
||||
}
|
||||
return this.http.post<any>(`${geturl}`, body, options)
|
||||
}
|
||||
|
||||
|
||||
genericPostExpedientEvent(docId: any, body: any, sharedagenda: string, serialNumber: any, applicationID: any, calendar: 'myCalendar' | 'sharedCalendar') {
|
||||
const geturl = environment.apiURL + 'calendar/' + ((sharedagenda != '') ? sharedagenda : 'CreateEventExpediente') + '/event';
|
||||
let params = new HttpParams();
|
||||
let options;
|
||||
|
||||
params = params.set("DocId", docId);
|
||||
params = params.set("SerialNumber", serialNumber);
|
||||
params = params.set("applicationID", applicationID);
|
||||
|
||||
if(calendar == 'myCalendar') {
|
||||
if (body.CalendarName == 'Pessoal') {
|
||||
options = {
|
||||
headers: this.headerOwnPessoal,
|
||||
params: params
|
||||
}
|
||||
}
|
||||
else if (body.CalendarName == 'Oficial') {
|
||||
options = {
|
||||
headers: this.headerOwnOficial,
|
||||
params: params
|
||||
}
|
||||
}
|
||||
} else if (calendar == 'sharedCalendar') {
|
||||
if (body.CalendarName == 'Pessoal') {
|
||||
options = {
|
||||
headers: this.headerSharedPessoal,
|
||||
params: params
|
||||
};
|
||||
}
|
||||
else if (body.CalendarName == 'Oficial') {
|
||||
options = {
|
||||
headers: this.headerSharedOficial,
|
||||
params: params
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return this.http.post<any>(`${geturl}`, body, options)
|
||||
}
|
||||
|
||||
createTaskEvent(folderId: any, body: any, sharedagenda: string, serialNumber: any, applicationID: any) {
|
||||
const geturl = environment.apiURL + 'calendar/' + ((sharedagenda != '') ? sharedagenda : 'CreateEventExpediente') + '/dispatch';
|
||||
let params = new HttpParams();
|
||||
|
||||
Reference in New Issue
Block a user