This commit is contained in:
tiago.kayaya
2021-06-16 13:29:57 +01:00
parent 3435354f55
commit 16c8e27d34
6 changed files with 195 additions and 132 deletions
@@ -12,6 +12,8 @@ import { EventAttachment } from 'src/app/models/attachment.model';
import { BadRequestPage } from '../../popover/bad-request/bad-request.page';
import { SuccessMessagePage} from '../../popover/success-message/success-message.page';
import { ToastService } from 'src/app/services/toast.service';
import { User } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
@Component({
@@ -45,14 +47,19 @@ export class NewEventPage implements OnInit {
minDate: string;
loggeduser: User;
constructor(
private modalController: ModalController,
private eventService: EventsService,
private attachmentsService: AttachmentsService,
private animationController: AnimationController,
private toastService: ToastService
private toastService: ToastService,
private userService: AuthService,
) {}
) {
this.loggeduser = userService.ValidatedUser;
}
ngOnInit() {
@@ -173,11 +180,11 @@ export class NewEventPage implements OnInit {
this.postEvent.HasAttachments = true;
}
if(this.profile=='mdgpr') {
if(this.loggeduser.Profile == 'MDGPR') {
this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).subscribe(
async (id) => {
const eventId: string = id;
const eventId: any = id;
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return {
@@ -215,11 +222,13 @@ export class NewEventPage implements OnInit {
this.toastService.badRequest('Evento não criado')
});
}
else if(this.profile=='pr') {
else if(this.loggeduser.Profile == 'PR') {
this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).subscribe(
(id) => {
console.log(id);
const eventId: string = id;
const eventId: any = id;
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return {