add history in chat to record meeting created!

This commit is contained in:
tiago.kayaya
2021-12-22 10:31:10 +01:00
parent 16294f93c3
commit fa5f67453e
28 changed files with 1268 additions and 53 deletions
@@ -25,6 +25,7 @@ import { ViewChild } from '@angular/core';
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'
import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service';
const moment = _rollupMoment || _moment;
@@ -70,6 +71,7 @@ export class NewEventPage implements OnInit {
selectedRecurringType: any;
@Input() profile:string;
@Input() roomId:string;
@Input() selectedSegment: string;
@Input() selectedDate: Date;
@Input() taskParticipants: EventPerson[] = [];
@@ -120,7 +122,8 @@ export class NewEventPage implements OnInit {
private toastService: ToastService,
private userService: AuthService,
private dateAdapter: DateAdapter<any>,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private chatMethodService: ChatMethodsService,
// private translate: TranslateService
) {
this.dateAdapter.setLocale('pt');
@@ -341,7 +344,6 @@ export class NewEventPage implements OnInit {
return false
}
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
if(this.documents.length >= 0) {
@@ -353,27 +355,16 @@ export class NewEventPage implements OnInit {
}
if(this.loggeduser.Profile == 'MDGPR') {
// console.log('MD - Aqui');
// console.log(this.postEvent);
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) => {
loader.remove()
this.showLoader = false
const eventId: any = id;
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return {
SourceTitle: e.Assunto,
@@ -386,32 +377,30 @@ export class NewEventPage implements OnInit {
SerialNumber: ''
};
});
await DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{
if(DocumentToSave.length == (i+1)){
this.afterSave();
}
});
});
if(DocumentToSave.length == 0){
this.afterSave();
}
this.toastService._successMessage('Evento criado')
this.toastService._successMessage('Evento criado');
let data = {
"subject": this.postEvent.Subject,
"start": this.postEvent.StartDate,
"end": this.postEvent.EndDate,
"venue": this.postEvent.Location,
"id": id,
}
this.chatMethodService.sendMessage(this.roomId,data);
},
error => {
loader.remove()
this.showLoader = false
this.toastService._badRequest('Evento não criado')
});
}
@@ -439,19 +428,15 @@ export class NewEventPage implements OnInit {
DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{
if(DocumentToSave.length == (i+1)){
this.afterSave();
}
});
});
if(DocumentToSave.length == 0){
this.afterSave();
}
this.toastService.successMessage('Evento criado')
});
}