This commit is contained in:
Peter Maquiran
2022-05-12 16:54:11 +01:00
parent b8ccefc9e3
commit 53b107e83c
9 changed files with 191 additions and 135 deletions
+1 -1
View File
@@ -298,7 +298,7 @@
<div class="EventListBox-container" >
<div class="day EventListBox-day mt-10" >
{{ TimelineDayEvent(events.key)}}
{{ TimelineDayEvent(events.key) }}
</div>
<div *ngFor="let event of events.value" class="EventListBox" >
@@ -18,7 +18,7 @@
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Assunto*" [(ngModel)]="postEvent.Subject"></ion-input>
</div>
<div class="container-div" *ngIf="loggeduser.Profile == 'MDGPR'">
<div class="container-div" >
<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>
@@ -26,13 +26,12 @@
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs " [class.input-error]="Form?.get('CalendarName')?.invalid && validateFrom ">
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
<mat-select [(value)]="CalendarName" >
<!-- <mat-select [(value)]="postEvent.CalendarName" > -->
<mat-option value="PR">
Calendário do Presidente da República
</mat-option>
<mat-option value="MDGPR">
Calendário do MDGPR
<mat-select [(value)]="CalendarName" (selectionChange)="changeAgenda()">
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{calendars}}">
<div *ngIf="calendars != 'Meu calendario' "> Calendário de {{calendars}} </div>
<div *ngIf="calendars == 'Meu calendario'"> {{calendars}} </div>
</mat-option>
</mat-select>
@@ -62,11 +61,8 @@
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
<mat-select [(value)]="postEvent.CalendarName" >
<mat-option value="Oficial">
Oficial
</mat-option>
<mat-option value="Pessoal">
Pessoal
<mat-option *ngFor="let calendars of CalendarNamesOptions" value="{{calendars}}">
{{ calendars }}
</mat-option>
</mat-select>
</mat-form-field>
@@ -112,14 +108,6 @@
</div>
</div>
<!-- <div *ngIf="Form && validateFrom" >
<div *ngIf="Form.get('Categories').invalid " class="input-errror-message">
{{ postEvent.Category }}
<div *ngIf="Form.get('Categories').errors?.required">
Campo obrigatório.
</div>
</div>
</div> -->
<div class="container-div">
<div class="ion-item-class-2 d-flex" >
@@ -82,11 +82,12 @@ export class NewEventPage implements OnInit {
autoStartTime;
autoEndTime;
CalendarNamesOptions = ['Oficial', 'Pessoal']
constructor(
private modalController: ModalController,
private navParams: NavParams,
private eventService: EventsService,
public eventService: EventsService,
private attachmentsService: AttachmentsService,
private toastService: ToastService,
userService: AuthService,
@@ -297,23 +298,21 @@ export class NewEventPage implements OnInit {
try {
const CalendarId = this.selectedCalendarId()
if(this.loggeduser.Profile == 'MDGPR') {
eventId = await this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).toPromise();
eventId = await this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).toPromise();
}
else if(this.loggeduser.Profile == 'PR') {
eventId = await this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).toPromise();
const CalendarId = this.selectedCalendarId()
eventId = await this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).toPromise();
} else {
eventId = await this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName).toPromise();
const CalendarId = this.selectedCalendarId()
eventId = await this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).toPromise();
}
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
@@ -351,6 +350,44 @@ export class NewEventPage implements OnInit {
}
selectedCalendarId () {
if (this.eventService.calendarNamesType[this.CalendarName]?.['Oficial']) {
return this.eventService.calendarNamesType[this.CalendarName]['OficialId']
} else if (this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
return this.eventService.calendarNamesType[this.CalendarName]['PessoalId']
} else {
return '11:11'
}
}
changeAgenda() {
setTimeout(() => {
if(this.eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
} else if (this.eventService.calendarNamesType[this.CalendarName]?.['Oficial']) {
this.CalendarNamesOptions = ['Oficial']
this.postEvent.CalendarName = 'Oficial'
} else if (this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
this.CalendarNamesOptions = ['Pessoal']
this.postEvent.CalendarName = 'Pessoal'
} else {
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
}
}, 50)
}
async openAttendees() {
const modal = await this.modalController.create({