Files
doneit-web/src/app/services/Repositorys/Agenda/utils.ts
T

133 lines
3.0 KiB
TypeScript
Raw Normal View History

2024-05-29 15:43:37 +01:00
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[]) {
2024-05-31 11:21:32 +01:00
console.log('added doc create event',documents)
2024-05-29 15:43:37 +01:00
return documents.map((e) => {
return {
2024-05-31 11:21:32 +01:00
docId: parseInt(e.Id),
2024-05-29 15:43:37 +01:00
sourceName: e.Assunto,
description: "",
2024-05-31 11:21:32 +01:00
applicationId: parseInt(JSON.stringify(e.ApplicationType))
2024-05-29 15:43:37 +01:00
};
});
}
2024-06-02 13:53:46 +01:00
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)
};
});
}
2024-05-29 15:43:37 +01:00
atendeesSeletedType(type) {
var selectedType = {
2024-05-31 11:21:32 +01:00
'true': 0,
'false':1,
'other':2,
2024-05-29 15:43:37 +01:00
}
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,
}
});
}
2024-05-31 12:50:25 +01:00
statusEventAproval(type) {
var selectedType = {
'Pending': 0,
'Revision':1,
'Approved':2,
"Declined":3,
"Communicated":4
}
return selectedType[type];
}
2024-06-02 13:53:46 +01:00
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,
}
});
}
2024-05-29 15:43:37 +01:00
}