remove unsude code

This commit is contained in:
Peter Maquiran
2024-10-18 11:34:39 +01:00
parent bb93726fc2
commit 8484b1b600
22 changed files with 310 additions and 777 deletions
+17
View File
@@ -0,0 +1,17 @@
export enum RoleId {
/**
* @description President role id
*/
PV = 100000011,
MD = 100000011,
/**
* @description Vice president role id
*/
PRES = 100000014,
/**
* @description Consultant role id
*/
Consultant = 99999872
}
@@ -0,0 +1,35 @@
import { Observable } from "rxjs";
import { AttendeesRemoveInputDTO } from "src/app/module/agenda/data/dto/attendeeRemoveInputDTO";
import { EventOutputDTO } from "src/app/module/agenda/data/dto/eventDTOOutput";
import { EventInputDTO } from "src/app/module/agenda/data/dto/eventInputDTO";
import { EventListOutputDTO } from "src/app/module/agenda/data/dto/eventListDTOOutput";
import { SharedCalendarListOutputDTO } from "src/app/module/agenda/data/dto/sharedCalendarOutputDTO";
import { IDraftSaveByIdInput } from "src/app/module/agenda/domain/usecase/draft-save-by-id-use-case.service";
import { IGetDraftListByProcessIdSchema, IGetDraftListByProcessIdOutput } from "src/app/module/agenda/domain/usecase/getDraft-list-by-process-id.service";
import { TracingType } from "src/app/services/monitoring/opentelemetry/tracer";
export abstract class IAgendaRepository {
// Documents Endpoints
abstract getAttachments(subject: string, applicationType: number): Observable<any>;
abstract viewDocument(userId: number, docId: number, applicationId: number): Observable<any>;
// Events Endpoints
abstract createEvent(eventData: EventInputDTO): Observable<any>;
abstract getEvents(params: { userId: number, startDate?: string, endDate?: string, status?: string, category?: string, type?: string }, tracing?: TracingType): Observable<EventListOutputDTO>;
abstract searchEvent(queryParameter: {value: string, status: string}): Observable<EventListOutputDTO>;
abstract getEvent(id: string, tracing?: TracingType): Observable<EventOutputDTO>;
abstract updateEvent(id: string, eventData: any): Observable<any>;
abstract approveEvent(id: string): Observable<any>;
abstract deleteEvent(id: string, deleteAllEvents: boolean): Promise<any>;
abstract updateEventStatus(id: string, statusData: Object): Observable<any>;
abstract addEventAttendee(id: string, attendeeData: any): Observable<any>;
abstract removeEventAttendee(id: string, attendeeData: AttendeesRemoveInputDTO): Observable<any>;
abstract addEventAttachment(id: string, attachmentData: any): Observable<any>;
abstract removeEventAttachment(id: string, attachmentData: any): Observable<any>;
// Other Endpoints
abstract getDocumentAttachment(aplicationId: string, userId: string, value: string, pageNumber: number, pageSize: number): Observable<any>;
abstract getSharedCalendar(): Promise<SharedCalendarListOutputDTO>;
abstract getDraftListByProcessId(input: IGetDraftListByProcessIdSchema): Promise<IGetDraftListByProcessIdOutput>;
abstract draftSaveById(input: IDraftSaveByIdInput): Promise<IGetDraftListByProcessIdOutput>;
}
@@ -0,0 +1,83 @@
import { Injectable } from '@angular/core';
import { EEventOwnerType, EEventType, EEventCategory } from 'src/app/module/agenda/data/dto/enums';
import { z } from 'zod';
import { IAgendaRepository } from '../repository/agenda-repository';
import { zodSafeValidation } from 'src/app/utils/zodValidation';
const attendeeSchema = z.object({
name: z.string(),
emailAddress: z.string(),
attendeeType: z.number(),
wxUserId: z.number(),
userType: z.enum(['GD','External', 'Internal']),
entity: z.string()
});
const recurrenceSchema = z.object({
frequency: z.number(),
until: z.string().nullable().optional()
});
const attachmentSchema = z.object({
docId: z.number(),
sourceName: z.string(),
description: z.string(),
applicationId: z.number()
});
const EventCreateInputSchema = z.object({
userId: z.number(),
ownerType: z.nativeEnum(EEventOwnerType),
subject: z.string(),
body: z.string(),
location: z.string(),
startDate: z.string(),
endDate: z.string(),
type: z.nativeEnum(EEventType),
category: z.nativeEnum(EEventCategory),
attendees: z.array(attendeeSchema),
attachments: z.array(attachmentSchema),
recurrence: recurrenceSchema,
organizerId: z.number(),
isAllDayEvent: z.boolean()
})
export type EventCreateInput= z.infer<typeof EventCreateInputSchema>
const EventCreateUseCaseInputSchema = z.object({
userId: z.number(),
ownerType: z.nativeEnum(EEventOwnerType),
subject: z.string(),
body: z.string(),
location: z.string(),
startDate: z.string(),
endDate: z.string(),
type: z.nativeEnum(EEventType),
category: z.nativeEnum(EEventCategory),
attendees: z.array(attendeeSchema),
attachments: z.array(attachmentSchema),
recurrence: recurrenceSchema,
organizerId: z.number(),
isAllDayEvent: z.boolean()
})
export type EventCreateUseCaseInput= z.infer<typeof EventCreateUseCaseInputSchema>
@Injectable({
providedIn: 'root'
})
export class EventCreateService {
constructor(
private agendaRepository: IAgendaRepository
) { }
async execute(input: EventCreateInput) {
const validation = zodSafeValidation<EventCreateInput>(EventCreateInputSchema, input)
this.agendaRepository
}
}
@@ -0,0 +1,59 @@
import { Injectable } from '@angular/core';
import { ContactRepositoryService } from 'src/app/services/Repositorys/contacts/repository/contacts-repository.service';
import { SessionStore } from 'src/app/store/session.service';
import { UserList } from "src/app/models/entiry/agenda/contact";
import { err, ok, Result } from 'neverthrow';
import { XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
export enum RoleId {
/**
* @description President role id
*/
PV = 100000011,
MD = 100000011,
/**
* @description Vice president role id
*/
PRES = 100000014,
/**
* @description Consultant role id
*/
Consultant = 99999872
}
@Injectable({
providedIn: 'root'
})
export class EventSetDefaultParticipantsService {
constructor(
private ContactRepositoryService: ContactRepositoryService
) { }
@XTracerAsync({name:'Event-Set-Default-Participants', module:'chat', bugPrint: true})
async execute(): Promise<Result<UserList|null, any>> {
if (SessionStore.user.Profile == 'PR') {
const RequestResult = await this.ContactRepositoryService.getUsersMap();
if(RequestResult.isOk()) {
const result = RequestResult.value
let filterLoggedUserEmail = result.filter(item => item.RoleId == RoleId.MD)
if(filterLoggedUserEmail.length >= 1) {
filterLoggedUserEmail[0].IsRequired = true
}
return ok(filterLoggedUserEmail)
} else {
return err(null)
}
}
}
}
@@ -184,13 +184,13 @@ export class DocumentSetUpMeetingPage implements OnInit {
this.postData.Category = 'Reunião'
if (!this.CalendarName) {
if (this._eventService.calendarNamesAry.includes('Meu calendario')) {
this.CalendarName = 'Meu calendario';
} else {
this.CalendarName = this._eventService.calendarNamesAry[0]
}
}
// if (!this.CalendarName) {
// if (this._eventService.calendarNamesAry.includes('Meu calendario')) {
// this.CalendarName = 'Meu calendario';
// } else {
// this.CalendarName = this._eventService.calendarNamesAry[0]
// }
// }
if (this.taskParticipants.length == 0) {
this.taskParticipants = [
@@ -94,7 +94,7 @@ export class AgendaDataRepositoryService {
})
}
async EventList({ userId, startDate, endDate, status = EEventFilterStatus.Approved, category = null, type = null, calendarOwnerName = '' }, tracing?: TracingType) {
async EventList({ userId, startDate, endDate, status = EEventFilterStatus.Approved, category = null, type = null}, tracing?: TracingType) {
const result = await this.agendaDataService.getEvents({userId, startDate, endDate, status, category, type}, tracing)
@@ -113,7 +113,7 @@ export class AgendaDataRepositoryService {
} else {
profile = "pr"
}
const listToPresent = ListEventMapper.toDomain(response, calendarOwnerName, userId)
const listToPresent = ListEventMapper.toDomain(response)
const map : EventListStore[] = listToPresent.map( element => {
return {
@@ -133,14 +133,14 @@ export class AgendaDataRepositoryService {
const events = this.utils.getAllEvents(year)
this.NativeNotificationService.scheduleNotifications(events)
this.memoryStore.pipe(
select(selectEventsInRange(startDate, endDate, userId))
).subscribe((localList)=> {
// console.log({localList})
});
// this.memoryStore.pipe(
// select(selectEventsInRange(startDate, endDate, userId))
// ).subscribe((localList)=> {
// // console.log({localList})
// });
this.memoryStore.dispatch(removeRangeForCalendar({ startDate, endDate, userId }));
this.memoryStore.dispatch(pushEvent({ eventsList:listToPresent as any, userId, profile }));
// this.memoryStore.dispatch(removeRangeForCalendar({ startDate, endDate, userId }));
// this.memoryStore.dispatch(pushEvent({ eventsList:listToPresent as any, userId, profile }));
return listToPresent
})
@@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import { GetDraftListByProcessIdService, IGetDraftListByProcessIdSchema } from './usecase/getDraft-list-by-process-id.service';
import { DraftSaveByIdInputSchema, DraftSaveByIdUseCaseService, IDraftSaveByIdInput } from './usecase/draft-save-by-id-use-case.service';
import { EventSetDefaultParticipantsService } from 'src/app/core/agenda/use-case/event-set-default-participants.service';
@Injectable({
providedIn: 'root'
@@ -9,7 +10,8 @@ export class AgendaService {
constructor(
private getDraftListByProcessIdService: GetDraftListByProcessIdService,
private DraftSaveByIdUseCaseService: DraftSaveByIdUseCaseService
private DraftSaveByIdUseCaseService: DraftSaveByIdUseCaseService,
private EventSetDefaultParticipants: EventSetDefaultParticipantsService
) { }
getDraftListByProcessId(input: IGetDraftListByProcessIdSchema) {
@@ -19,4 +21,8 @@ export class AgendaService {
draftSaveById(input: IDraftSaveByIdInput) {
return this.DraftSaveByIdUseCaseService.execute(input)
}
setDefaultParticipants() {
return this.EventSetDefaultParticipants.execute()
}
}
@@ -15,7 +15,7 @@ function getTextInsideParentheses(inputString): string {
export class ListEventMapper {
// @XTracer({name:'ListEventMapper/toDomain', log: false, bugPrint: false})
static toDomain(dto: EventListOutputDTO, calendarOwnerName: string, userId: string): EventList {
static toDomain(dto: EventListOutputDTO): EventList {
return dto.data.map((e) => {
+4 -4
View File
@@ -97,7 +97,7 @@
</div>
<div class="float-button">
<div class="float-button" *ngIf="(sharedCalendar | async) as calendarData">
<button title="Visualizar a lista de Eventos para aprovação" class="cursor-pointer resize pr-20-rem" (click)="viewEventsToApprove()" *ngIf="p.userPermission([p.permissionList.Gabinete.aprove_event])">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="right-icons" src="assets/images/icons-received-event.svg"></ion-icon>
@@ -106,7 +106,7 @@
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="right-icons" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-received-event.svg"></ion-icon>
</button>
<button *ngIf="eventService.hasAnyCalendar" title="Novo Evento" class="cy-add-event cursor-pointer resize" (click)="clearContact();openAddEvent();">
<button *ngIf="calendarData.length >=1" title="Novo Evento" class="cy-add-event cursor-pointer resize" (click)="clearContact();openAddEvent();">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="right-icons" src="assets/images/icons-add.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && !mobileComponent.showAddNewEvent" class="right-icons" src="assets/images/theme/gov/icons-add.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && mobileComponent.showAddNewEvent" class="right-icons" src="assets/images/theme/gov/icons-add-selected.svg" ></ion-icon>
@@ -116,7 +116,7 @@
</ion-row>
<ion-row class="ion-align-items-center calendar-options">
<ion-row class="ion-align-items-center calendar-options" *ngIf="(sharedCalendar | async) as calendarData">
<button title="Visualizar a lista de Eventos para aprovação" class="cursor-pointer resize pr-10" (click)="viewEventsToApprove()" *ngIf="p.userPermission([p.permissionList.Gabinete.aprove_event])">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="right-icons" src="assets/images/icons-received-event.svg"></ion-icon>
@@ -125,7 +125,7 @@
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="right-icons" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-received-event.svg"></ion-icon>
</button>
<button *ngIf="eventService.hasAnyCalendar && p.userPermission([p.permissionList.Agenda.creatEvent])" title="Novo Evento" class="cy-add-event cursor-pointer resize" (click)="clearContact();openAddEvent();">
<button *ngIf="calendarData.length >=1 && p.userPermission([p.permissionList.Agenda.creatEvent])" title="Novo Evento" class="cy-add-event cursor-pointer resize" (click)="clearContact();openAddEvent();">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="right-icons" src="assets/images/icons-add.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && !mobileComponent.showAddNewEvent" class="right-icons" src="assets/images/theme/gov/icons-add.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && mobileComponent.showAddNewEvent" class="right-icons" src="assets/images/theme/gov/icons-add-selected.svg" ></ion-icon>
-1
View File
@@ -730,7 +730,6 @@ export class AgendaPage implements OnInit {
const response = await this.AgendaDataRepositoryService.EventList({
userId: selectedCalendar.wxUserId,
calendarOwnerName: selectedCalendar.wxFullName,
endDate: endTime.toISOString(),
startDate: startTime.toISOString(),
status: EEventFilterStatus.AllToCommunicate
@@ -287,19 +287,6 @@ export class EditEventPage implements OnInit {
return _date
}
onSelectedRecurringChanged(ev?: any) {
this.calculetedLastOccurrence(ev);
if (ev.length > 1) {
this.selectedRecurringType = ev.filter(data => data != '-1');
}
if (ev.length == 0) {
this.selectedRecurringType = "-1";
}
}
calculetedLastOccurrence(type: number) {
// console.log(type);
var valor;
@@ -27,6 +27,8 @@ import { TableSharedCalendar } from 'src/app/module/agenda/data/data-source/agen
import { map } from 'rxjs/operators';
import { RoleIdService } from 'src/app/services/role-id.service'
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
import { AgendaService } from 'src/app/module/agenda/domain/agenda.service'
import { RoleId } from 'src/app/core/agenda/entity/event';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
@@ -133,6 +135,7 @@ export class NewEventPage implements OnInit {
private contactsService: ContactsService,
private agendaDataRepository: AgendaDataRepositoryService,
public RoleIdService: RoleIdService,
private AgendaService: AgendaService
) {
this.loggeduser = SessionStore.user;
this.postEvent = new Event();
@@ -185,7 +188,7 @@ export class NewEventPage implements OnInit {
const data = await this.agendaDataRepository.geCalendars()
const prObject = data.find(e => e?.roleId == 100000014)
const prObject = data.find(e => e?.roleId == RoleId.PRES)
if(prObject) {
this.selectedUserCalendar = prObject.wxUserId
} else {
@@ -200,20 +203,8 @@ export class NewEventPage implements OnInit {
// this.taskParticipants = [];
}
if (!this.CalendarName) {
// console.log('true', this.eventService.calendarNamesAry.includes('Meu calendario'))
if (this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.CalendarName = 'Meu calendario';
// console.log(this.eventService.calendarNamesAry)
} else {
this.CalendarName = this.eventService.calendarNamesAry[0]
}
}
this.selectedRecurringType = "-1";
if (this.selectedSegment != "Combinada") {
this.postEvent = {
EventId: '',
Subject: '',
@@ -235,30 +226,6 @@ export class NewEventPage implements OnInit {
EventRecurrence: { frequency: this.eventRecurence, until: "",
Type: '' },
};
}
else {
this.postEvent = {
EventId: '',
Subject: '',
Body: this.eventBody,
Location: '',
CalendarId: '',
CalendarName: 'Oficial',
StartDate: this.autoStartTime,
EndDate: this.autoEndTime,
EventType: 'Reunião',
Attendees: null,
IsMeeting: false,
IsRecurring: false,
AppointmentState: 0,
TimeZone: '',
Organizer: '',
Category: 'Meeting',
HasAttachments: false,
EventRecurrence: { frequency: this.eventRecurence, until: "",
Type: '' },
};
}
window.onresize = (event) => {
if (window.innerWidth >= 1024) {
@@ -268,7 +235,6 @@ export class NewEventPage implements OnInit {
this.setDefaultTime()
this.checkRoleInArray()
this.changeAgenda()
this.fetchContacts("")
@@ -354,18 +320,7 @@ export class NewEventPage implements OnInit {
}
onSelectedRecurringChanged(ev: any) {
this.calculetedLastOccurrence(ev);
if (ev.length > 1) {
this.selectedRecurringType = ev.filter(data => data != '-1');
}
if (ev.length == 0) {
this.selectedRecurringType = "-1";
}
}
calculetedLastOccurrence(type: number) {
// console.log(type);
@@ -640,17 +595,6 @@ export class NewEventPage implements OnInit {
}
checkRoleInArray() {
for (let index = 0; index < this.eventService.calendarNamesAry.length; index++) {
// console.log('ROLE1', this.eventService.calendarNamesAry[index])
}
for (let index = 0; index < this.eventService.calendarRole.length; index++) {
// console.log('ROLE2', this.eventService.calendarRole[index])
}
}
// Deve ser removido posteriormente
eventToaproveBody(event, calendarId, role, userId, attachments) {
@@ -681,35 +625,16 @@ export class NewEventPage implements OnInit {
async fetchContacts(filter: string) {
if (this.loggeduser.Profile == 'PR') {
this.contactsService.getContacts(filter).subscribe(result => {
if (this.eventPersons != null) {
this.eventPersons.forEach(attendee => {
const index: number = result.findIndex((cont) => {
return cont.EmailAddress.toLocaleLowerCase() == attendee.EmailAddress.toLocaleLowerCase()
});
const result = await this.AgendaService.setDefaultParticipants()
result.splice(index, 1);
});
if(result.isOk()) {
if(result.value) {
this.taskParticipants.push(result.value[0]);
this.setIntervenient(result.value);
console.log('Attendes Email', result.value)
}
this.contacts = result;
//console.log('Attendes Email', this.loggeduser.Email)
let filterLoggedUserEmail = this.contacts.filter(item => item.RoleDescription == "Ministro e Director do Gabinete do PR")
//console.log('Attendes Email', filterLoggedUserEmail)
if(filterLoggedUserEmail.length >= 1) {
filterLoggedUserEmail[0].IsRequired = true
}
this.contacts = filterLoggedUserEmail;
const newAttendees: EventPerson[] = this.contacts;
this.setIntervenient(newAttendees);
//console.log('Attendes Email', this.contacts)
}
);
}
}
onCheckboxChange(event: any) {
-1
View File
@@ -242,7 +242,6 @@ export class EventsPage implements OnInit {
const response = await this.AgendaDataRepositoryService.EventList({
userId: SessionStore.user.UserId,
calendarOwnerName: SessionStore.user.FullName,
startDate: date.toISOString(),
endDate: new Date(end).toISOString(),
status: EEventFilterStatus.AllToCommunicate
+6 -307
View File
@@ -47,12 +47,12 @@ export class EventsService {
calendarNames = {}
calendarNamesAry = []
calendarNamesAryNoPr = []
calendarNamesAryNoPrNMD = []
calendarNamesAryOnlyMD = []
calendarNamesAryReverse = []
calendarNamesAryPR = []
// calendarNamesAry = []
// calendarNamesAryNoPr = []
// calendarNamesAryNoPrNMD = []
// calendarNamesAryOnlyMD = []
// calendarNamesAryReverse = []
// calendarNamesAryPR = []
calendarNamesType = {}
calendarRole = []
@@ -91,309 +91,8 @@ export class EventsService {
}
async setHeader () {
try {
this.headers = new HttpHeaders();;
this.headersMdOficial = new HttpHeaders();;
this.headersMdPessoal = new HttpHeaders();;
this.headersPrOficial = new HttpHeaders();;
this.headersPrPessoal = new HttpHeaders();;
this.headersSharedOficial = new HttpHeaders();;
this.headersSharedPessoal = new HttpHeaders();;
this.headerOwnOficial= new HttpHeaders();;
this.headerOwnPessoal= new HttpHeaders();;
this.headerSharedOficial= new HttpHeaders();;
this.headerSharedPessoal= new HttpHeaders();;
this.headers = this.headers.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
this.usersCalendarIds = [];
this.calendarNames = {}
this.calendarRole = []
this.calendrFullName = [];
this.calendarIds = []
this.calendarNamesAry = []
this.calendarNamesType = {}
this.calendarNamesAryNoPr = []
this.calendarNamesAryPR = []
this.calendarNamesAryNoPrNMD = []
this.calendarNamesAryOnlyMD = []
this.hasSharedCalendar = false
this.hasSharedOficial = false
this.hasSharedPessoal = false
this.hasOwnCalendar = false
this.hasOwnOficial = false
this.hasOwnPessoal = false
this.HasMdGPR = false
if (SessionStore.user) {
if (SessionStore.user.Profile == 'MDGPR') {
if(SessionStore?.user?.OwnerCalendars) {
for (let calendar of SessionStore?.user?.OwnerCalendars) {
this.hasAnyCalendar = true
if (calendar.CalendarName == 'Oficial') {
this.hasOwnOficial = true
this.headersMdOficial = this.headersMdOficial.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
this.headersMdOficial = this.headersMdOficial.set('CalendarId', calendar.CalendarId);
this.headersMdOficial = this.headersMdOficial.set('CalendarRoleId', calendar.CalendarRoleId);
}
else if (calendar.CalendarName == 'Pessoal') {
this.hasOwnPessoal = true
this.headersMdPessoal = this.headersMdPessoal.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
this.headersMdPessoal = this.headersMdPessoal.set('CalendarId', calendar.CalendarId);
this.headersMdPessoal = this.headersMdPessoal.set('CalendarRoleId', calendar.CalendarRoleId);
}
}
}
if(SessionStore?.user?.SharedCalendars) {
for (let sharedCalendar of SessionStore.user.SharedCalendars) {
this.hasAnyCalendar = true
if (sharedCalendar.CalendarName == 'Oficial') {
this.hasSharedOficial = true
this.headersSharedOficial = this.headersSharedOficial.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
this.headersSharedOficial = this.headersSharedOficial.set('CalendarId', sharedCalendar.CalendarId);
this.headersSharedOficial = this.headersSharedOficial.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
}
else if (sharedCalendar.CalendarName == 'Pessoal') {
this.hasSharedPessoal = true
this.headersSharedPessoal = this.headersSharedPessoal.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
this.headersSharedPessoal = this.headersSharedPessoal.set('CalendarId', sharedCalendar.CalendarId);
this.headersSharedPessoal = this.headersSharedPessoal.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
}
}
}
}
else if (SessionStore.user.Profile == 'PR') {
for (let calendar of SessionStore?.user?.OwnerCalendars) {
this.hasAnyCalendar = true
if (calendar.CalendarName == 'Oficial') {
this.hasOwnOficial = true
this.headersPrOficial = this.headersPrOficial.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
this.headersPrOficial = this.headersPrOficial.set('CalendarId', calendar.CalendarId);
this.headersPrOficial = this.headersPrOficial.set('CalendarRoleId', calendar.CalendarRoleId);
}
else if (calendar.CalendarName == 'Pessoal') {
this.hasOwnPessoal = true
this.headersPrPessoal = this.headersPrPessoal.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
this.headersPrPessoal = this.headersPrPessoal.set('CalendarId', calendar.CalendarId);
this.headersPrPessoal = this.headersPrPessoal.set('CalendarRoleId', calendar.CalendarRoleId);
}
}
}
for (let calendar of SessionStore?.user?.OwnerCalendars) {
this.hasAnyCalendar = true
if(!this.usersCalendarIds.includes(calendar.OwnerUserId)) {
this.usersCalendarIds.push(calendar.OwnerUserId)
}
if(!this.calendarIds.includes(calendar.CalendarId)) {
this.calendarIds.push(calendar.CalendarId)
}
this.hasOwnCalendar = true
if (calendar.CalendarName == 'Oficial') {
this.hasOwnOficial = true
this.headerOwnOficial = this.headerOwnOficial.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
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.hasOwnPessoal = true
this.headerOwnPessoal = this.headerOwnPessoal.set('Authorization', 'Bearer ' + SessionStore.user.Authorization);
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 SessionStore?.user?.SharedCalendars) {
this.hasAnyCalendar = true
if(!this.usersCalendarIds.includes(sharedCalendar.OwnerUserId)) {
this.usersCalendarIds.push(sharedCalendar.OwnerUserId)
}
if(!this.calendarIds.includes(sharedCalendar.CalendarId)) {
this.calendarIds.push(sharedCalendar.CalendarId)
}
this.hasSharedCalendar = true
if (sharedCalendar.CalendarName == 'Oficial') {
this.hasSharedOficial = true
this.headerSharedOficial = this.headerSharedOficial.set('Authorization','Bearer ' + SessionStore.user.Authorization);
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.hasSharedPessoal = true
this.headerSharedPessoal = this.headerSharedPessoal.set('Authorization','Bearer ' + SessionStore.user.Authorization);
this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarId', sharedCalendar.CalendarId);
this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarName', sharedCalendar.CalendarName);
}
}
for (let OwnerCalendar of SessionStore?.user?.OwnerCalendars) {
this.hasAnyCalendar = true
this.calendarNames[OwnerCalendar.CalendarId] = 'Meu calendario'
if(!this.calendarNamesAry.includes('Meu calendario')) {
this.calendarNamesAry.push('Meu calendario')
this.calendarNamesAryNoPr.push('Meu calendario')
this.calendarNamesType['Meu calendario'] = {}
}
this.calendarNamesType['Meu calendario'][OwnerCalendar.CalendarName] = true
this.calendarNamesType['Meu calendario'][OwnerCalendar.CalendarName+'Id'] = OwnerCalendar.OwnerUserId || SessionStore.user.UserId
this.calendarNamesType['Meu calendario']['RoleId'] = OwnerCalendar.CalendarRoleId
this.calendarNamesType['Meu calendario']['OwnerId'] = OwnerCalendar.OwnerUserId || SessionStore.user.UserId
this.calendarNamesType['Meu calendario']['FullName'] = SessionStore.user.FullName
}
for (let sharedCalendar of SessionStore?.user?.SharedCalendars) {
this.hasAnyCalendar = true
if(sharedCalendar?.OwnerUserId) {
const e = await this.GetCalendarName(sharedCalendar.OwnerUserId).toPromise()
this.calendarNames[sharedCalendar.CalendarId] = e.FullName
this.myCalendarNames[sharedCalendar.CalendarId] = e.FullName
if(!this.calendarNamesAry.find(x => x.Role == e.Role)) {
let objectShared = {
"Fullname": e.FullName,
"Role": e.Role,
"OwnerUserId": sharedCalendar.OwnerUserId,
"RoleId": sharedCalendar.CalendarRoleId
}
this.calendarNamesAry.push(objectShared)
if(e.Role == 'Presidente da República') {
this.calendarNamesAryPR.push(objectShared)
} else {
this.calendarNamesAryNoPr.push(objectShared)
}
this.calendarNamesType[e.FullName] = {}
}
this.calendarNamesType[e.FullName][sharedCalendar.CalendarName] = true
this.calendarNamesType[e.FullName][sharedCalendar.CalendarName+'Id'] = sharedCalendar.OwnerUserId
this.calendarNamesType[e.FullName]['RoleId'] = sharedCalendar.CalendarRoleId
this.calendarNamesType[e.FullName]['OwnerId'] = sharedCalendar.OwnerUserId
this.calendarNamesType[e.FullName]['Shared'] = sharedCalendar.OwnerUserId
}
}
this.calendarNamesAryNoPrNMD = this.calendarNamesAryNoPr.filter((e)=> {
return e.Role != 'Ministro e Director do Gabinete do PR' && e.Role != 'Presidente da República'
})
this.calendarNamesAryOnlyMD = this.calendarNamesAryNoPr.filter((e)=> {
return e.Role == 'Ministro e Director do Gabinete do PR'
})
this.HasMdGPR = this.calendarNamesAryNoPr.find( (e)=> {
if(e.Role == 'Ministro e Director do Gabinete do PR') {
return true
}
return false
})
if(SessionStore.user?.OwnerCalendars.length == 0 && SessionStore.user.SharedCalendars.length == 0) {
this.hasAnyCalendar = false
} else {
this.hasAnyCalendar = true
}
this.calendarNamesAryReverse = this.calendarNamesAry.reverse();
this.onCalendarFinishLoad.executor();
(() => {
const keys = {}
for (let e of SessionStore.user?.OwnerCalendars) {
if(!keys[e.CalendarId]) {
keys[e.CalendarId] = e.CalendarId
} else {
throw(`Calendar ${e.CalendarId} is repeated for user `+ SessionStore.user.FullName);
}
}
for (let e of SessionStore.user.SharedCalendars) {
if(!keys[e.CalendarId]) {
keys[e.CalendarId] = e.CalendarId
} else {
throw(`Calendar ${e.CalendarId} is repeated for user `+ SessionStore.user.FullName);
}
}
})();
}
this.onLoadCalendars.forEach(e=> e());
this.loadCalendars = true
} catch (err) {
console.log(err)
}
}
@@ -223,67 +223,6 @@
</div>
</div>
<!-- <div class="container-div width-100">
<div class="ion-item-class-2">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-refresh.svg"></ion-icon>
</div>
<div class="ion-input-class">
<mat-form-field
class="width-100 d-block "
placeholder="Selecione repetição"
value="false"
interface="action-sheet"
required
appearance="none"
>
<mat-select
[(ngModel)]="eventProcess.workflowInstanceDataFields.OccurrenceType"
(ngModelChange)="onSelectedRecurringChanged($event)"
>
<mat-option
*ngFor="let recurring of recurringTypes" value="{{recurring.Code}}"
>
{{recurring.Description}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</div> -->
<!-- <div *ngIf="eventProcess.workflowInstanceDataFields.OccurrenceType != '-1'"
class="container-div width-100">
<div class="ion-item-class-2 d-flex">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div>
<div class="ion-input-class flex-grow-1">
<mat-form-field class="date-hour-picker d-none d-md-block">
<input matInput [ngxMatDatetimePicker]="occurrrence"
placeholder="Choose a date"
[(ngModel)]="eventProcess.workflowInstanceDataFields.LastOccurrence"
[disabled]="disabled"
[min]="eventProcess.workflowInstanceDataFields.EndDate"
>
<mat-datepicker-toggle id="last-occurrence" matSuffix [for]="occurrrence"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #occurrrence
[showSpinners]="showSpinners"
[showSeconds]="showSeconds"
[stepHour]="stepHour" [stepMinute]="stepMinute"
[stepSecond]="stepSecond"
[touchUi]="touchUi"
>
</ngx-mat-datetime-picker>
</mat-form-field>
</div>
</div>
</div> -->
<div class="container-div width-100">
<div class="ion-item-class-2">
@@ -201,18 +201,7 @@ export class EditEventToApprovePage implements OnInit {
});
}
onSelectedRecurringChanged(ev: any) {
this.calculetedLastOccurrence(ev);
if (ev.length > 1) {
this.eventProcess.workflowInstanceDataFields.OccurrenceType = ev.filter(data => data != '-1');
}
if (ev.length == 0) {
this.eventProcess.workflowInstanceDataFields.OccurrenceType = "-1";
}
}
calculetedLastOccurrence(type: number) {
var valor;
@@ -318,18 +318,6 @@ export class EditEventPage implements OnInit {
return _date
}
onSelectedRecurringChanged(ev: any) {
this.calculetedLastOccurrence(ev);
if (ev.length > 1) {
this._postEvent.EventRecurrence.Type = ev.filter(data => data != '-1');
}
if (ev.length == 0) {
this._postEvent.EventRecurrence.Type = "-1";
}
}
calculetedLastOccurrence(type: number) {
var valor;
@@ -325,56 +325,6 @@
</div>
<!-- <div class="container-div width-100">
<div class="ion-item-class-2 d-flex">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-refresh.svg"></ion-icon>
</div>
<div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('dateOccurrence')?.invalid && validateFrom ">
<mat-form-field appearance="none" floatLabel="never" class="width-100" value="false" interface="action-sheet" required>
<mat-select placeholder="Selecione repetição*"
[(ngModel)]="postEvent.EventRecurrence.Type"
(ngModelChange)="onSelectedRecurringChanged($event)">
<mat-option
*ngFor="let recurring of recurringTypes" value="{{recurring.Code}}"
>
{{recurring.Description}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</div> -->
<!-- <div *ngIf="postEvent.EventRecurrence.Type != '-1'" class="container-div width-100">
<div class="ion-item-class-2 d-flex">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div>
<div (click)="openLastOccurrence()" class="ion-input-class flex-grow-1">
<mat-form-field class="date-hour-picker">
<input matInput [ngxMatDatetimePicker]="occurrrence"
placeholder="Choose a date"
[(ngModel)]="postEvent.EventRecurrence.LastOccurrence"
[disabled]="disabled"
[min]="postEvent.EndDate"
>
<mat-datepicker-toggle id="last-occurrence" matSuffix [for]="occurrrence"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #occurrrence
[showSpinners]="showSpinners"
[showSeconds]="showSeconds"
[stepHour]="stepHour" [stepMinute]="stepMinute"
[stepSecond]="stepSecond"
[touchUi]="touchUi"
>
</ngx-mat-datetime-picker>
</mat-form-field>
</div>
</div>
</div> -->
<div class="container-div width-100">
@@ -32,7 +32,8 @@ import { TableSharedCalendar } from 'src/app/module/agenda/data/data-source/agen
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
import { ContactRepositoryService } from 'src/app/services/Repositorys/contacts/repository/contacts-repository.service';
import { UserList } from 'src/app/models/entiry/agenda/contact';
import { AgendaService } from 'src/app/module/agenda/domain/agenda.service'
import { RoleId } from 'src/app/core/agenda/use-case/event-set-default-participants.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
@@ -150,7 +151,8 @@ export class NewEventPage implements OnInit {
private changeProfileService: ChangeProfileService,
private agendaDataRepository: AgendaDataRepositoryService,
public RoleIdService: RoleIdService,
private ContactRepositoryService: ContactRepositoryService
private ContactRepositoryService: ContactRepositoryService,
private AgendaService: AgendaService
) {
this.dateAdapter.setLocale('pt');
this.loggeduser = SessionStore.user;
@@ -176,7 +178,7 @@ export class NewEventPage implements OnInit {
const data = await this.agendaDataRepository.geCalendars()
const prObject = data.find(e => e?.roleId == 100000014)
const prObject = data.find(e => e?.roleId == RoleId.PRES)
if(prObject) {
this.selectedUserCalendar = prObject.wxUserId
} else {
@@ -220,19 +222,16 @@ export class NewEventPage implements OnInit {
this.setIntervenientCC.emit(this.taskParticipantsCc);
this.setDefaultTime();
this.fetchContacts("")
}
this.date = new Date(2021, 9, 4, 5, 6, 7);
this.injectValidation();
this.changeAgenda()
this.fetchContacts("")
}
initializeData() {
if (this.selectedSegment != "Combinada") {
this.postEvent = {
EventId: '',
Subject: '',
@@ -255,30 +254,6 @@ export class NewEventPage implements OnInit {
frequency: this.eventRecurence, until: "",
Type: ''
},
};
}
else {
this.postEvent = {
EventId: '',
Subject: '',
Body: this.eventBody,
Location: '',
CalendarId: '',
CalendarName: 'Oficial',
StartDate: this.autoStartTime,
EndDate: this.autoEndTime,
EventType: 'Reunião',
Attendees: this.attendees || null,
IsMeeting: false,
IsRecurring: false,
AppointmentState: 0,
TimeZone: '',
Organizer: '',
Category: 'Meeting',
HasAttachments: false,
EventRecurrence: { frequency: this.eventRecurence, until: "",
Type: '' },
}
}
}
@@ -388,14 +363,6 @@ export class NewEventPage implements OnInit {
}
openInicio() {
let input: any = document.querySelector('#new-inicio')
if (input) {
input.click()
}
}
openFim() {
let input: any = document.querySelector('#new-fim')
if (input) {
@@ -428,12 +395,12 @@ export class NewEventPage implements OnInit {
}
openLastOccurrence() {
let input: any = document.querySelector('#last-occurrence')
if (input) {
input.click()
}
}
// openLastOccurrence() {
// let input: any = document.querySelector('#last-occurrence')
// if (input) {
// input.click()
// }
// }
async getDoc() {
const modal = await this.modalController.create({
@@ -484,18 +451,6 @@ export class NewEventPage implements OnInit {
});
}
onSelectedRecurringChanged(ev: any) {
this.calculetedLastOccurrence(ev);
if (ev.length > 1) {
this.postEvent.EventRecurrence.Type = ev.filter(data => data != '-1');
}
if (ev.length == 0) {
this.postEvent.EventRecurrence.Type = "-1";
}
}
calculetedLastOccurrence(type: number) {
@@ -670,43 +625,19 @@ export class NewEventPage implements OnInit {
async fetchContacts(filter: string) {
console.log(this.loggeduser.Profile)
if (this.loggeduser.Profile == 'PR') {
const RequestResult = await this.ContactRepositoryService.getUsersMap();
if(RequestResult.isOk()) {
const result = RequestResult.value
//if(this.taskParticipants.length ==0) {
const result = await this.AgendaService.setDefaultParticipants()
if (this.eventPersons != null) {
this.eventPersons.forEach(attendee => {
const index: number = result.findIndex((cont) => {
return cont.EmailAddress.toLocaleLowerCase() == attendee.EmailAddress.toLocaleLowerCase()
});
result.splice(index, 1);
});
if(result.isOk()) {
if(result.value) {
this.taskParticipants.push(result.value[0]);
this.setIntervenient.emit(result.value);
console.log('Attendes Email', result.value)
}
this.contacts = result;
console.log('Attendes Email', this.loggeduser.Email)
let filterLoggedUserEmail = this.contacts.filter(item => item.RoleId == this.RoleIdService.MD)
console.log('Attendes Email', filterLoggedUserEmail);
if(filterLoggedUserEmail.length >= 1) {
filterLoggedUserEmail[0].IsRequired = true
}
//}
this.contacts = filterLoggedUserEmail;
this.taskParticipants.push(this.contacts[0]);
this.setIntervenient.emit(this.taskParticipants);
console.log('Attendes Email', this.taskParticipants)
} else {
}
}
}
onCheckboxChange(event: any) {
@@ -165,65 +165,6 @@
</div>
</div>
<!-- <div class="container-div width-100">
<div class="ion-item-class-2">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-refresh.svg"></ion-icon>
</div>
<div class="ion-input-class">
<mat-form-field
class="width-100"
placeholder="Selecione repetição"
value="false"
interface="action-sheet"
required
appearance="none"
>
<mat-select [(ngModel)]="eventProcess.workflowInstanceDataFields.OccurrenceType"
(ngModelChange)="onSelectedRecurringChanged($event)"
>
<mat-option
*ngFor="let recurring of recurringTypes" value="{{recurring.Code}}"
>
{{recurring.Description}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</div> -->
<!--
<div *ngIf="eventProcess.workflowInstanceDataFields.OccurrenceType != '-1'"
class="container-div width-100">
<div class="ion-item-class-2 d-flex">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div>
<div class="ion-input-class flex-grow-1">
<mat-form-field class="date-hour-picker">
<input matInput [ngxMatDatetimePicker]="occurrrence"
placeholder="Choose a date"
[(ngModel)]="eventProcess.workflowInstanceDataFields.LastOccurrence"
[disabled]="disabled"
[min]="endDate"
>
<mat-datepicker-toggle id="last-occurrence" matSuffix [for]="occurrrence"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #occurrrence
[showSpinners]="showSpinners"
[showSeconds]="showSeconds"
[stepHour]="stepHour" [stepMinute]="stepMinute"
[stepSecond]="stepSecond"
[touchUi]="touchUi"
>
</ngx-mat-datetime-picker>
</mat-form-field>
</div>
</div>
</div> -->
<div class="container-div width-100">
<div class="ion-item-class-2">
@@ -199,20 +199,6 @@ export class EditEventToApproveComponent implements OnInit {
/* }) */
}
onSelectedRecurringChanged(ev: any) {
this.calculetedLastOccurrence(ev);
if (ev.length > 1) {
this.postEvent.EventRecurrence.Type = ev.filter(data => data != '-1');
}
if (ev.length == 0) {
this.postEvent.EventRecurrence.Type = "-1";
}
}
calculetedLastOccurrence(type: number) {
var valor;
var opcao: boolean;
+6 -6
View File
@@ -1,11 +1,11 @@
export let versionData = {
"shortSHA": "ddc6ef026",
"SHA": "ddc6ef0265c60a9d6e9fae92edca2cf9ee8c9397",
"shortSHA": "bb93726fc",
"SHA": "bb93726fc2e569fb8b6ccad03229be8e084bce58",
"branch": "feature/chat-new-api-peter",
"lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Thu Oct 17 22:31:03 2024 +0100'",
"lastCommitMessage": "remove all service validation",
"lastCommitNumber": "6099",
"changeStatus": "On branch feature/chat-new-api-peter\nYour branch is ahead of 'origin/feature/chat-new-api-peter' by 3 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/pages/agenda/agenda.page.html\n\tmodified: version/git-version.ts",
"lastCommitTime": "'Thu Oct 17 22:32:43 2024 +0100'",
"lastCommitMessage": "add ,",
"lastCommitNumber": "6100",
"changeStatus": "On branch feature/chat-new-api-peter\nYour branch is up to date with 'origin/feature/chat-new-api-peter'.\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tnew file: src/app/core/agenda/entity/event.ts\n\tnew file: src/app/core/agenda/repository/agenda-repository.ts\n\tnew file: src/app/core/agenda/use-case/event-create.service.ts\n\tnew file: src/app/core/agenda/use-case/event-set-default-participants.service.ts\n\tmodified: src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts\n\tmodified: src/app/module/agenda/data/repository/agenda-data-repository.service.ts\n\tmodified: src/app/module/agenda/domain/agenda.service.ts\n\tmodified: src/app/module/agenda/domain/mapper/EventListMapper.ts\n\tmodified: src/app/pages/agenda/agenda.page.html\n\tmodified: src/app/pages/agenda/agenda.page.ts\n\tmodified: src/app/pages/agenda/edit-event/edit-event.page.ts\n\tmodified: src/app/pages/agenda/new-event/new-event.page.ts\n\tmodified: src/app/pages/events/events.page.ts\n\tmodified: src/app/services/events.service.ts\n\tmodified: src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html\n\tmodified: src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts\n\tmodified: src/app/shared/agenda/edit-event/edit-event.page.ts\n\tmodified: src/app/shared/agenda/new-event/new-event.page.html\n\tmodified: src/app/shared/agenda/new-event/new-event.page.ts\n\tmodified: src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html\n\tmodified: src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.ts",
"changeAuthor": "peter.maquiran"
}