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 2ea3bfa9d..65bc20414 100644 --- a/src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts +++ b/src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts @@ -97,10 +97,9 @@ export class AgendaDataRepositoryService { } createEvent(eventData: Event, CalendarName, documents) { - console.log(eventData) let eventInput = { - userId: this.utils.selectedCalendarUserId(CalendarName, eventData) as any, + userId: CalendarName, ownerType: this.utils.selectedCalendarOwner(CalendarName), subject: eventData.Subject, body: eventData.Body.Text, diff --git a/src/app/services/Repositorys/Agenda/utils.ts b/src/app/services/Repositorys/Agenda/utils.ts index f82407d80..1b833ec6f 100644 --- a/src/app/services/Repositorys/Agenda/utils.ts +++ b/src/app/services/Repositorys/Agenda/utils.ts @@ -27,12 +27,12 @@ export class Utils { } selectedCalendarOwner(CalendarName) { - let selectedCalendar = this.eventService.calendarNamesType[CalendarName]?.['RoleId']; - + let selectedCalendar = this.findRoleIdByUserId(this.eventService.calendarNamesAry, CalendarName); + console.log('selected', selectedCalendar ) if (selectedCalendar) { - if (selectedCalendar.Role == 100000014) { + if (selectedCalendar == "Presidente da República") { return 1; - } else if (selectedCalendar.Role == 100000011) { + } else if (selectedCalendar == "Ministro e Director do Gabinete do PR") { return 2 } else { return 3 @@ -40,6 +40,19 @@ export class Utils { } } + findRoleIdByUserId(array, userId) { + for (let item of array) { + console.log('each item before',item) + if (typeof item === 'object' && item !== null && item.OwnerUserId === parseInt(userId)) { + console.log('each item after',item) + return item.Role; + } else { + return 'other'; + } + } + + } + calendarCategorySeleted(calendarName) { 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 b636e64aa..818c0a9f9 100644 --- a/src/app/shared/agenda/new-event/new-event.page.html +++ b/src/app/shared/agenda/new-event/new-event.page.html @@ -30,7 +30,7 @@ -
+
@@ -40,17 +40,15 @@ - - -
{{ environment.agendaPR}}
-
{{ environment.agendaVP}}
-
Agenda do {{calendars.Fullname}}
-
Minha agenda
+
PR
+
AGENDA DO MDGPR
+
Agenda do {{calendars.wxFullName}}
+
+ Minha agenda +
+
@@ -59,29 +57,6 @@
- -
- - - - - - - -
PR
-
AGENDA DO MDGPR
-
Agenda do {{calendars.wxFullName}}
-
- Minha agenda -
- -
- -
-
- -
-
@@ -96,7 +71,7 @@
-
+
@@ -158,13 +133,13 @@
- +
- + Nunca @@ -187,6 +162,36 @@
+
+
+
+ +
+ +
+ + + + + + + + +
+
+
+
@@ -335,7 +340,7 @@
--> -
+
diff --git a/src/app/shared/agenda/new-event/new-event.page.ts b/src/app/shared/agenda/new-event/new-event.page.ts index d1b84d83d..33e260a82 100644 --- a/src/app/shared/agenda/new-event/new-event.page.ts +++ b/src/app/shared/agenda/new-event/new-event.page.ts @@ -278,7 +278,7 @@ export class NewEventPage implements OnInit { Category: 'Reunião', HasAttachments: false, EventRecurrence: { - frequency: "never", until: this.autoEndTime, + frequency: this.eventRecurence, until: this.autoEndTime, Type: '' }, }; @@ -302,7 +302,7 @@ export class NewEventPage implements OnInit { Organizer: '', Category: 'Reunião', HasAttachments: false, - EventRecurrence: { frequency: "never", until: this.autoEndTime, + EventRecurrence: { frequency: this.eventRecurence, until: this.autoEndTime, Type: '' }, } } @@ -377,10 +377,10 @@ export class NewEventPage implements OnInit { injectValidation() { - if (typeof (this.postEvent.EventRecurrence.Type) == 'number') { + /* if (typeof (this.postEvent.EventRecurrence.Type) == 'number') { const str: any = this.postEvent.EventRecurrence.Type.toString() this.postEvent.EventRecurrence.Type = str - } + } */ this.Form = new FormGroup({ Subject: new FormControl(this.postEvent.Subject, [ @@ -400,9 +400,9 @@ export class NewEventPage implements OnInit { dateEnd: new FormControl(this.postEvent.EndDate, [ Validators.required ]), - dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok'] : this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok' : null, [ + /* dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok'] : this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok' : null, [ Validators.required - ]), + ]), */ participantes: new FormControl(this.taskParticipants, [ // Validators.required ]), @@ -580,11 +580,12 @@ export class NewEventPage implements OnInit { return false } + let loader = this.toastService.loading(); this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc); this.postEvent.IsAllDayEvent = this.allDayCheck; - this.postEvent.EventRecurrence.frequency = this.eventRecurence; - + console.log('evenr rec 1 ',this.eventRecurence) + console.log('eent rec 2 ',this.postEvent.EventRecurrence.frequency) this.agendaDataRepository.createEvent(this.postEvent, this.CalendarName, this.documents).subscribe((value) => { console.log(value)