diff --git a/src/app/models/event.model.ts b/src/app/models/event.model.ts index bd5079888..cc6ff05cd 100644 --- a/src/app/models/event.model.ts +++ b/src/app/models/event.model.ts @@ -4,11 +4,13 @@ import { EventPerson } from './eventperson.model'; export interface EventRecurrence { - Type: number | string; + Type?: number | string; Day?: number; DayOfWeek?: number; Month?: number | string; LastOccurrence?: Date | string; + frequency?: string, + until?: string } export class Event{ diff --git a/src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts b/src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts index 1a4078af3..6371cd399 100644 --- a/src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts +++ b/src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts @@ -98,8 +98,8 @@ export class AgendaDataRepositoryService { attendees: this.utils.attendeesAdded(eventData.Attendees), attachments: this.utils.documentAdded(documents), recurrence: { - frequency: 0, - occurrences: 0, + frequency: this.utils.eventRecurence(eventData.EventRecurrence.frequency), + until: eventData.EndDate.toISOString(), }, organizerId: SessionStore.user.UserId, isAllDayEvent: eventData.IsAllDayEvent, diff --git a/src/app/services/Repositorys/Agenda/agendaDataModels.ts b/src/app/services/Repositorys/Agenda/agendaDataModels.ts index d757e31bd..b5da75bc8 100644 --- a/src/app/services/Repositorys/Agenda/agendaDataModels.ts +++ b/src/app/services/Repositorys/Agenda/agendaDataModels.ts @@ -80,7 +80,7 @@ export const EventInputDTOSchema = z.object({ attachments: z.array(AttachmentInputDTOSchema).nullable().optional(), recurrence: z.object({ frequency: z.number().int(), - occurrences: z.number().int(), + until: z.string(), }), organizerId: z.number().int(), isAllDayEvent: z.boolean(), diff --git a/src/app/services/Repositorys/Agenda/utils.ts b/src/app/services/Repositorys/Agenda/utils.ts index 9c6a031d9..f82407d80 100644 --- a/src/app/services/Repositorys/Agenda/utils.ts +++ b/src/app/services/Repositorys/Agenda/utils.ts @@ -3,16 +3,16 @@ import { AgendaDataService } from './agenda-data.service'; import { EventsService } from '../../events.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class Utils { - constructor( - private agendaDataService: AgendaDataService, - public eventService: EventsService, - ) { } + constructor( + private agendaDataService: AgendaDataService, + public eventService: EventsService, + ) { } - selectedCalendarUserId(CalendarName,postEvent) { + selectedCalendarUserId(CalendarName, postEvent) { if (this.eventService.calendarNamesType[CalendarName]?.['Oficial'] && postEvent.CalendarName == 'Oficial') { return this.eventService.calendarNamesType[CalendarName]['OwnerId'] @@ -60,8 +60,8 @@ export class Utils { return selectedType[calendarName]; } - documentAdded(documents:any[]) { - console.log('added doc create event',documents) + documentAdded(documents: any[]) { + console.log('added doc create event', documents) let listupdate = [] documents.forEach(element => { let object = { @@ -70,18 +70,18 @@ export class Utils { description: "", applicationId: element.applicationId } - + listupdate.push(object) }); return listupdate - /* return documents.map((e) => { - return { - docId: e.docId, - sourceName: e.subject || e.sourceNames, - description: "", - applicationId: e.applicationId - }; - }); */ + /* return documents.map((e) => { + return { + docId: e.docId, + sourceName: e.subject || e.sourceNames, + description: "", + applicationId: e.applicationId + }; + }); */ } @@ -102,8 +102,8 @@ export class Utils { atendeesSeletedType(type) { var selectedType = { 'true': 0, - 'false':1, - 'other':2, + 'false': 1, + 'other': 2, } return selectedType[type]; } @@ -115,7 +115,7 @@ export class Utils { name: e.Name, emailAddress: e.EmailAddress, attendeeType: this.atendeesSeletedType(JSON.stringify(e.IsRequired)), - wxUserId: e.Id, + wxUserId: e.Id, } }); } @@ -123,10 +123,10 @@ export class Utils { statusEventAproval(type) { var selectedType = { 'Pending': 0, - 'Revision':1, - 'Approved':2, - "Declined":3, - "Communicated":4 + 'Revision': 1, + 'Approved': 2, + "Declined": 3, + "Communicated": 4 } return selectedType[type]; } @@ -141,4 +141,15 @@ export class Utils { } }); } + + eventRecurence(type) { + var selectedType = { + 'never': 0, + 'daily': 1, + 'weekly': 2, + "monthly": 3, + "yearly": 4 + } + return selectedType[type]; + } } diff --git a/src/app/shared/agenda/new-event/new-event.page.html b/src/app/shared/agenda/new-event/new-event.page.html index 31eb8e0c9..8d1c26662 100644 --- a/src/app/shared/agenda/new-event/new-event.page.html +++ b/src/app/shared/agenda/new-event/new-event.page.html @@ -132,6 +132,38 @@ +