This commit is contained in:
Peter Maquiran
2021-12-21 15:46:26 +01:00
parent bb22042ed8
commit 95d014e70a
3 changed files with 49 additions and 12 deletions
@@ -19,6 +19,23 @@
</div>
<div class="container-div">
<div class="ion-item-class-2">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div>
<div class="ion-input-class" >
<ion-select placeholder="Agenda"
interface="action-sheet"
Cancel-text="Cancelar" required>
<ion-select-option value="Reunião">MD</ion-select-option>
<ion-select-option value="Viagem">PR</ion-select-option>
</ion-select>
</div>
</div>
</div>
<!-- <div *ngIf="Form && validateFrom" >
<div *ngIf="Form.get('Subject').invalid " class="input-errror-message">
<div *ngIf="Form.get('Subject').errors?.required">
@@ -29,6 +29,32 @@
</div>
</div>
{{ CalendarName }}
<div class="container-div" *ngIf="loggeduser.Profile == 'MDGPR'">
<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 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">
Meu calendário
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</div>
<div class="container-div">
<div class="ion-item-class-2 d-flex">
<div class="ion-icon-class">
@@ -26,7 +26,6 @@ import { FormGroup, Validators } from '@angular/forms';
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { ThemeService } from 'src/app/services/theme.service'
const moment = _rollupMoment || _moment;
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
@@ -109,9 +108,9 @@ export class NewEventPage implements OnInit {
public stepMinutes = [1, 5, 10, 15, 20, 25];
public stepSeconds = [1, 5, 10, 15, 20, 25];
showLoader = false
CalendarName;
constructor(
private modalController: ModalController,
@@ -133,13 +132,15 @@ export class NewEventPage implements OnInit {
ngOnInit() {
this.CalendarName = this.loggeduser.Profile;
this.getRecurrenceTypes();
if(!this.restoreTemporaryData()){
// clear
this.eventBody = { BodyType : "1", Text : ""};
this.postEvent.Body = this.eventBody;
/* console.log(this.profile); */
/* console.log(this.profile); */
let selectedStartdDate = this.selectedDate;
let selectedEndDate = new Date(this.selectedDate);
@@ -352,19 +353,12 @@ export class NewEventPage implements OnInit {
this.postEvent.EventRecurrence.Type = '-1'
}
if(this.loggeduser.Profile == 'MDGPR') {
// console.log('MD - Aqui');
// console.log(this.postEvent);
if(this.CalendarName == 'MDGPR') {
this.showLoader = true;
console.log(this.postEvent);
let loader = this.toastService.loading();
console.log(this.postEvent);
this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).subscribe(
async (id) => {
@@ -415,7 +409,7 @@ export class NewEventPage implements OnInit {
});
}
else if(this.loggeduser.Profile == 'PR') {
else if(this.CalendarName == 'PR') {
console.log('PR - Aqui');
console.log(this.postEvent);
this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).subscribe(