mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
new api implementation
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AgendaDataService } from './agenda-data.service';
|
||||
import { EventsService } from '../../events.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class Utils {
|
||||
constructor(
|
||||
private agendaDataService: AgendaDataService,
|
||||
public eventService: EventsService,
|
||||
) { }
|
||||
|
||||
|
||||
selectedCalendarUserId(CalendarName,postEvent) {
|
||||
|
||||
if (this.eventService.calendarNamesType[CalendarName]?.['Oficial'] && postEvent.CalendarName == 'Oficial') {
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
|
||||
} else if (this.eventService.calendarNamesType[CalendarName]?.['Pessoal'] && postEvent.CalendarName == 'Pessoal') {
|
||||
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
|
||||
} else {
|
||||
return '11:11'
|
||||
}
|
||||
}
|
||||
|
||||
editeEventCalendarUserId(CalendarName,postEvent) {
|
||||
|
||||
let CalendarNameOwnerName = this.eventService.detectCalendarNameByCalendarId(postEvent.CalendarId)
|
||||
if(this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Oficial'] && this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Pessoal']) {
|
||||
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
|
||||
} else if (this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Oficial']) {
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
|
||||
} else if (this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Pessoal']) {
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
|
||||
} else {
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
}
|
||||
}
|
||||
|
||||
selectedCalendarOwner(CalendarName) {
|
||||
let selectedCalendar = this.eventService.calendarNamesType[CalendarName]?.['RoleId'];
|
||||
|
||||
if (selectedCalendar) {
|
||||
if (selectedCalendar.Role == 100000014) {
|
||||
return 1;
|
||||
} else if (selectedCalendar.Role == 100000011) {
|
||||
return 2
|
||||
} else {
|
||||
return 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
calendarCategorySeleted(calendarName) {
|
||||
var selectedCalendar = {
|
||||
'Oficial': 1,
|
||||
'Pessoal': 2
|
||||
}
|
||||
return selectedCalendar[calendarName];
|
||||
}
|
||||
|
||||
calendarTypeSeleted(calendarName) {
|
||||
var selectedType = {
|
||||
'Reunião': 1,
|
||||
'Viagem': 2,
|
||||
'Conferência': 3,
|
||||
'Encontro': 1
|
||||
}
|
||||
return selectedType[calendarName];
|
||||
}
|
||||
|
||||
documentAdded(documents:any[]) {
|
||||
return documents.map((e) => {
|
||||
return {
|
||||
sourceId: e.Id,
|
||||
sourceName: e.Assunto,
|
||||
description: "",
|
||||
applicationId: parseInt(e.ApplicationType.toString())
|
||||
};
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
atendeesSeletedType(type) {
|
||||
var selectedType = {
|
||||
'true': 1,
|
||||
'false':2,
|
||||
'other':3,
|
||||
}
|
||||
return selectedType[type];
|
||||
}
|
||||
|
||||
|
||||
attendeesAdded(taskParticipants: any[]) {
|
||||
return taskParticipants.map((e) => {
|
||||
return {
|
||||
name: e.Name,
|
||||
emailAddress: e.EmailAddress,
|
||||
attendeeType: this.atendeesSeletedType(JSON.stringify(e.IsRequired)),
|
||||
wxUserId: e.Id,
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user