diff --git a/src/app/pages/agenda/agenda.page.html b/src/app/pages/agenda/agenda.page.html index e6a2b3f56..7940f08c3 100644 --- a/src/app/pages/agenda/agenda.page.html +++ b/src/app/pages/agenda/agenda.page.html @@ -247,8 +247,8 @@
-
+ +
Início
@@ -266,7 +266,6 @@
Todo
o dia
-
Todo
o dia
diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index ca2d949b0..a80c1e097 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -704,7 +704,8 @@ export class AgendaPage implements OnInit { userId: selectedCalendar.wxUserId, calendarOwnerName: selectedCalendar.wxFullName, endDate: endTime.toISOString(), - startDate: startTime.toISOString() + startDate: startTime.toISOString(), + status: -1 }) if(response.isOk()) { diff --git a/src/app/services/Repositorys/Agenda/agenda-data.service.ts b/src/app/services/Repositorys/Agenda/agenda-data.service.ts index 0e1df19f4..7b644e855 100644 --- a/src/app/services/Repositorys/Agenda/agenda-data.service.ts +++ b/src/app/services/Repositorys/Agenda/agenda-data.service.ts @@ -48,12 +48,16 @@ export class AgendaDataService { getEvents(userId: number, startDate: string, endDate: string, status: number, category: string, type: string): Observable { let params = new HttpParams() .set('UserId', userId) - .set('Status', status) if(userId == null || userId == undefined) { throw('userId '+ userId) } + + if(status == -1 || status == undefined) { + params = params.set('status', status); + } + if (startDate !== null && startDate !== undefined) { params = params.set('startDate', startDate); } diff --git a/src/app/services/Repositorys/Agenda/mapper/EventDetailsMapper.ts b/src/app/services/Repositorys/Agenda/mapper/EventDetailsMapper.ts index f5bc3c2de..cd9ceee97 100644 --- a/src/app/services/Repositorys/Agenda/mapper/EventDetailsMapper.ts +++ b/src/app/services/Repositorys/Agenda/mapper/EventDetailsMapper.ts @@ -15,6 +15,41 @@ export class EventMapper { constructor() {} static toDomain(dto: EventOutputDTO) { + let category; + if(dto.category == 1) { + category = 'Oficial' + } else { + category = 'Pessoal' + } + + let ownerType; + if(dto.ownerType == 1) { + ownerType = 'PR' + } else if(dto.ownerType == 2) { + ownerType = 'MD' + } else if(dto.ownerType == 3) { + ownerType = 'Other' + } + + let type; + + let status; + if(dto.status == 1) { + status = 'Pending' + } else if(dto.status == 2) { + status = 'Revision' + } + + function EAttendeeType(num) { + if(num == 1) { + return 'Required' + } else if (num == 2) { + return 'Acknowledgment' + } else if (num == 3) { + return 'Optional' + } + } + return { "HasAttachments": dto.hasAttachments, "EventComunicationId": 1682, @@ -26,7 +61,7 @@ export class EventMapper { }, "Location": dto.location, "CalendarId": "", - "CalendarName": dto.category, + "CalendarName": category, "StartDate": dto.startDate, "EndDate": dto.endDate, "EventType": "Single", @@ -35,14 +70,14 @@ export class EventMapper { wxUserId: e.wxUserId, EmailAddress: e.emailAddress, Name: e.name, - IsRequired: e.attendeeType == 'Required', + IsRequired: EAttendeeType(e.attendeeType) == 'Required', UserType: "GD", // "IsPR": false, - attendeeType: e.attendeeType + attendeeType: EAttendeeType(e.attendeeType) // "RoleDescription": null, // "RoleId": 0 })), - "IsMeeting": dto.category, + "IsMeeting": category, "IsRecurring": dto.isRecurring, "IsAllDayEvent": dto.isAllDayEvent, "AppointmentState": 1, @@ -53,7 +88,7 @@ export class EventMapper { "Name": dto.organizer.wxFullName, "IsRequired": true, "UserType": 'GD', - "IsPR": dto.ownerType == 'PR', + "IsPR": ownerType == 'PR', //"Entity": null, "Acknowledgment": true, //"RoleDescription": null, diff --git a/src/app/services/Repositorys/Agenda/mapper/EventListMapper.ts b/src/app/services/Repositorys/Agenda/mapper/EventListMapper.ts index 295f3f375..12cdb2ab8 100644 --- a/src/app/services/Repositorys/Agenda/mapper/EventListMapper.ts +++ b/src/app/services/Repositorys/Agenda/mapper/EventListMapper.ts @@ -1,7 +1,6 @@ import { EventList } from "src/app/models/entiry/agenda/eventList" import { EventListOutputDTO } from "../model/eventListDTOOutput" - function getTextInsideParentheses(inputString): string { var startIndex = inputString.indexOf('('); var endIndex = inputString.indexOf(')'); @@ -14,23 +13,57 @@ function getTextInsideParentheses(inputString): string { export class ListEventMapper { static toDomain(dto: EventListOutputDTO, calendarOwnerName: string, userId: string): EventList { - return dto.map((e) => ({ - "HasAttachments": e.hasAttachments, - "IsAllDayEvent": e.isAllDayEvent, - "EventId": e.id, - "Subject": e.subject, - "Location": e.location, - "CalendarId": userId, - "CalendarName": e.category, - "StartDate": new Date(e.startDate) + '', - "EndDate": new Date(e.endDate)+ '', - "Schedule": calendarOwnerName, - "RequiredAttendees": null as any, - "OptionalAttendees": null as any, - "HumanDate": "2 semanas atrás" as any, - "TimeZone": getTextInsideParentheses(new Date(e.startDate)+ ''), - "IsPrivate": false as any - })) + + return dto.map((e) => { + + let category; + if(e.category == 1) { + category = 'Oficial' + } else { + category = 'Pessoal' + } + + let ownerType; + if(e.ownerType == 1) { + ownerType = 'PR' + } else if(e.ownerType == 2) { + ownerType = 'MD' + } else if(e.ownerType == 3) { + ownerType = 'Other' + } + + let type; + if(e.type == 1) { + type = 'Meeting' + } else { + type = 'Travel' + } + + let status; + if(e.status == 1) { + status = 'Pending' + } else if(e.status == 2) { + status = 'Revision' + } + + return { + "HasAttachments": e.hasAttachments, + "IsAllDayEvent": e.isAllDayEvent, + "EventId": e.id, + "Subject": e.subject, + "Location": e.location, + "CalendarId": userId, + "CalendarName": category, + "StartDate": new Date(e.startDate) + '', + "EndDate": new Date(e.endDate)+ '', + "Schedule": calendarOwnerName, + "RequiredAttendees": null as any, + "OptionalAttendees": null as any, + "HumanDate": "2 semanas atrás" as any, + "TimeZone": getTextInsideParentheses(new Date(e.startDate)+ ''), + "IsPrivate": false as any + } + }) } static toDTO() {} diff --git a/src/app/services/Repositorys/Agenda/mapper/EventToApproveDetailsMapper.ts b/src/app/services/Repositorys/Agenda/mapper/EventToApproveDetailsMapper.ts index f2dbf4491..55eea8153 100644 --- a/src/app/services/Repositorys/Agenda/mapper/EventToApproveDetailsMapper.ts +++ b/src/app/services/Repositorys/Agenda/mapper/EventToApproveDetailsMapper.ts @@ -17,33 +17,58 @@ export class EventToApproveDetailsMapper { constructor() {} static toDomain(dto: EventOutputDTO): EventToApproveDetails { - const category = dto.category + let category; + if(dto.category == 1) { + category = 'Oficial' + } else { + category = 'Pessoal' + } + let color; - if(dto.ownerType != 'PR') { + // if(dto.ownerType != 'PR') { + if(dto.ownerType == 2) { color = 'MDGPR' } else { color = 'PR' } let activityInstanceName; + let taskStatus; - if(dto.status == 'Pending') { + if(dto.status == 1) { activityInstanceName = 'Aprovar evento' - } else if(dto.status == 'Revision') { + taskStatus = 'Pending' ////// + } else if(dto.status == 2) { activityInstanceName = 'Editar evento' - } else if (dto.status == 'Approved') { + taskStatus = 'Revision' ////// + } else if (dto.status == 3) { activityInstanceName = 'Evento Aprovado' - } else if (dto.status == 'Evento Rejeitado') { + taskStatus = 'Approved' ////// + } else if (dto.status == 4) { activityInstanceName = 'Declined' - } else if (dto.status == 'Evento comunicado') { + taskStatus = 'Declined' ////// + } else if (dto.status == 5) { activityInstanceName = 'Communicated' - } else if (dto.status == 'Comunicar evento') { + taskStatus = 'Communicated' ////// + } else if (dto.status == 6) { activityInstanceName = 'ToCommunicate' + taskStatus = 'ToCommunicate' ////// } + function EAttendeeType(num) { + if(num == 1) { + return 'Required' + } else if (num == 2) { + return 'Acknowledgment' + } else if (num == 3) { + return 'Optional' + } + } + + return { "serialNumber": dto.id, - "taskStatus": dto.status, + "taskStatus": taskStatus, "originator": { "email": dto.organizer.wxeMail, "manager": "", @@ -90,10 +115,10 @@ export class EventToApproveDetailsMapper { ...dto.attendees.map( e => ({ Name: e.name, EmailAddress: e.emailAddress, - IsRequired: e.attendeeType == 'Required', + IsRequired: EAttendeeType(e.attendeeType) == 'Required', UserType: "GD", wxUserId: e.wxUserId, - attendeeType: e.attendeeType + attendeeType: EAttendeeType(e.attendeeType) })) ], //"EventOrganizer": "{\"$type\":\"GabineteDigital.k2RESTidentifier_EventPerson, GabineteDigital, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\",\"EmailAddress\":\"agenda.mdgpr@gabinetedigital.local\",\"Name\":\"Agenda do Ministro e Director do Gabinete do PR\",\"IsRequired\":true}", diff --git a/src/app/services/Repositorys/Agenda/model/eventDTOOutput.ts b/src/app/services/Repositorys/Agenda/model/eventDTOOutput.ts index 9e12523f3..faf4addff 100644 --- a/src/app/services/Repositorys/Agenda/model/eventDTOOutput.ts +++ b/src/app/services/Repositorys/Agenda/model/eventDTOOutput.ts @@ -18,7 +18,7 @@ const CommentSchema = z.object({ const AttendeeSchema = z.object({ id: z.string(), name: z.string(), - attendeeType: z.enum(["Required", "Acknowledgment", "Optional"]), + attendeeType: z.enum(["Required", "Acknowledgment", "Optional"]), // ["Required", "Acknowledgment", "Optional"] = [1,2,3] emailAddress: z.string(), wxUserId: z.number(), }); @@ -50,14 +50,14 @@ const EventRecurrenceSchema = z.object({ export const EventOutputDTOSchema = z.object({ id: z.string(), owner: OwnerSchema, - ownerType: z.enum(["PR", "MD", "Other"]), + ownerType: z.number(), // ["PR", "MD", "Other"] = [1,2,3], subject: z.string(), body: z.string(), location: z.string(), startDate: z.string(), endDate: z.string(), type: z.string(), - category: z.enum(['Oficial', 'Pessoal']), + category: z.number(), // ['Oficial', 'Pessoal'] = [1, 2] attendees: z.array(AttendeeSchema), isRecurring: z.boolean(), eventRecurrence: EventRecurrenceSchema, @@ -67,7 +67,7 @@ export const EventOutputDTOSchema = z.object({ isPrivate: z.boolean(), isAllDayEvent: z.boolean(), organizer: OrganizerSchema, - status: z.enum(['Pending', 'Revision']), + status: z.number(), // ['Pending', 'Revision', 'Approved', 'Declined', 'Communicated', 'ToCommunicate'] = [1, 2, 3, 4, 5, 6] }); export type EventOutputDTO = z.infer diff --git a/src/app/services/Repositorys/Agenda/model/eventListDTOOutput.ts b/src/app/services/Repositorys/Agenda/model/eventListDTOOutput.ts index fcdb234da..4bf9a9e25 100644 --- a/src/app/services/Repositorys/Agenda/model/eventListDTOOutput.ts +++ b/src/app/services/Repositorys/Agenda/model/eventListDTOOutput.ts @@ -3,20 +3,22 @@ import { z } from 'zod'; const EventSchema = z.array(z.object({ id: z.string(), owner: z.string().nullable(), - ownerType: z.enum(['MD','PR', 'Other']), // Assuming "MD" is the only valid option based on provided data + ownerType: z.number(),// ['MD','PR', 'Other'] // Assuming "MD" is the only valid option based on provided data subject: z.string(), body: z.string(), location: z.string(), startDate: z.string().datetime({ offset: true }), endDate: z.string().datetime({ offset: true }), - type: z.enum(['Meeting', 'Travel']), - category: z.enum(['Oficial', 'Pessoal']), // Assuming "Oficial" is the only valid option based on provided data + type: z.number(), // ['Meeting', 'Travel'] = [1,2 ] + // category: z.enum(['Oficial', 'Pessoal']), // Assuming "Oficial" is the only valid option based on provided data + category: z.number(), isRecurring: z.boolean(), eventRecurrence: z.null(), hasAttachments: z.boolean(), isPrivate: z.boolean(), isAllDayEvent: z.boolean(), - status: z.enum(['Approved']), // Assuming "Approved" is the only valid option based on provided data + // status: z.enum(['Approved']), // Assuming "Approved" is the only valid option based on provided data + status: z.number(), // Assuming "Approved" is the only valid option based on provided data })) export type EventListOutputDTO = z.infer;