mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
133 lines
3.0 KiB
TypeScript
133 lines
3.0 KiB
TypeScript
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'
|
|
}
|
|
}
|
|
|
|
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[]) {
|
|
console.log('added doc create event',documents)
|
|
return documents.map((e) => {
|
|
return {
|
|
docId: parseInt(e.Id),
|
|
sourceName: e.Assunto,
|
|
description: "",
|
|
applicationId: parseInt(JSON.stringify(e.ApplicationType))
|
|
};
|
|
});
|
|
|
|
}
|
|
|
|
editDocumentAdded(documents: any[]) {
|
|
console.log('document added', documents)
|
|
return documents.map((element) => {
|
|
return {
|
|
docId: parseInt(element.SourceId),
|
|
sourceName: element.SourceName,
|
|
description: "",
|
|
applicationId: parseInt(element.ApplicationId)
|
|
};
|
|
});
|
|
|
|
}
|
|
|
|
|
|
atendeesSeletedType(type) {
|
|
var selectedType = {
|
|
'true': 0,
|
|
'false':1,
|
|
'other':2,
|
|
}
|
|
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,
|
|
}
|
|
});
|
|
}
|
|
|
|
statusEventAproval(type) {
|
|
var selectedType = {
|
|
'Pending': 0,
|
|
'Revision':1,
|
|
'Approved':2,
|
|
"Declined":3,
|
|
"Communicated":4
|
|
}
|
|
return selectedType[type];
|
|
}
|
|
|
|
attendeesEdit(taskParticipants: any[]) {
|
|
return taskParticipants.map((e) => {
|
|
return {
|
|
name: e.Name,
|
|
emailAddress: e.EmailAddress,
|
|
attendeeType: this.atendeesSeletedType(JSON.stringify(e.IsRequired)),
|
|
wxUserId: e.wxUserId || e.Id,
|
|
}
|
|
});
|
|
}
|
|
}
|