This commit is contained in:
Peter Maquiran
2021-06-30 09:45:56 +01:00
parent fb367b40ae
commit 22bafcc357
9 changed files with 139 additions and 197 deletions
@@ -13,7 +13,7 @@
</div>
</ion-header>
</div>
<ion-item-sliding class="overflow-y-auto">
<ion-item-sliding class="overflow-y-auto" >
<div class="px-20">
<div class="ion-item-container width-100">
<ion-input placeholder="Assunto*" [(ngModel)]="eventProcess.workflowInstanceDataFields.Subject"></ion-input>
@@ -5,15 +5,13 @@ import * as moment from 'moment';
import { Attachment } from 'src/app/models/attachment.model';
import { EventPerson } from 'src/app/models/eventperson.model';
import { SearchDocument } from 'src/app/models/search-document';
import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.page';
import { SearchPage } from 'src/app/pages/search/search.page';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { EventsService } from 'src/app/services/events.service';
import { ProcessesService } from 'src/app/services/processes.service';
import { ToastService } from 'src/app/services/toast.service';
import { Event } from '../../../models/event.model';
import { NgxMatDateFormats, NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
@@ -44,7 +42,6 @@ export class EditEventToApprovePage implements OnInit {
public stepHour = 1;
public stepMinute = 5;
public stepSecond = 5;
public dateControlStart = new FormControl(moment("DD MM YYYY hh"));
public dateControlEnd = new FormControl(moment("DD MM YYYY hh"));
@@ -65,7 +62,6 @@ export class EditEventToApprovePage implements OnInit {
@Input() serialNumber: string
loadedAttachments: Attachment[]= []
eventProcess = {
@@ -91,10 +87,8 @@ export class EditEventToApprovePage implements OnInit {
show = false
postEvent: Event;
isRecurring:string;
isEventEdited: boolean;
segment:string = "true";
profile:string;
eventAttendees: EventPerson[];
@@ -107,7 +101,7 @@ export class EditEventToApprovePage implements OnInit {
showAttendees = false;
InstanceId: string
InstanceId: string;
@Output() openAttendeesComponent = new EventEmitter<any>();
@Output() clearContact = new EventEmitter<any>();
@@ -115,67 +109,69 @@ export class EditEventToApprovePage implements OnInit {
@Output() setIntervenientCC = new EventEmitter<any>();
@Output() closeComponent = new EventEmitter<any>();
@Input() saveData: any;
constructor(
private modalController: ModalController,
private eventsService: EventsService,
public alertController: AlertController,
private attachmentsService: AttachmentsService,
private processes:ProcessesService,
private animationController: AnimationController,
private toastService: ToastService,
) {
/* this.serialNumber = this.navParams.get('serialNumber'); */
this.isEventEdited = false;
this.dateControlStart = new FormControl(moment(new Date()));
this.dateControlEnd = new FormControl(moment(new Date()));
console.log('saveDatas', this.saveData)
alert(this.serialNumber)
// if(!this.restoreTemporaryData()) {
// alert('restore')
this.eventProcess = this.saveData
// }
}
ngOnInit() {
this.getTask();
console.log(this.serialNumber);
}
async getTask() {
console.log('this.eventProcess', this.eventProcess);
// this.eventProcess = result
const result = await this.processes.GetTask(this.serialNumber).subscribe( result =>{
this.eventProcess = result
this.restoreDatepickerData()
console.log(this.eventProcess.workflowInstanceDataFields.Subject)
// description
let body : any =this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '')
this.eventProcess.workflowInstanceDataFields.Body = body
this.Location = this.eventProcess.workflowInstanceDataFields.Location
// description
let body : any =this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '')
this.eventProcess.workflowInstanceDataFields.Body = body
this.Location = this.eventProcess.workflowInstanceDataFields.Location
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
this.getAttachments()
if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) {
this.isRecurring = "Não se repete";
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
this.getAttachments()
if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) {
this.isRecurring = "Não se repete";
}
else {
this.isRecurring = "Repete";
}
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
if(e.IsRequired) {
this.taskParticipants.push(e);
} else {
this.taskParticipantsCc.push(e);
}
else {
this.isRecurring = "Repete";
}
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
if(e.IsRequired) {
this.taskParticipants.push(e);
} else {
this.taskParticipantsCc.push(e);
}
})
})
}
close() {
console.log('CLOSE');
this.closeComponent.emit();
/* this.setIntervenient.emit([]);
this.setIntervenientCC.emit([]);
@@ -220,7 +216,6 @@ export class EditEventToApprovePage implements OnInit {
ReviewUserComment: ''
}
console.log(event);
this.eventsService.postEventToApproveEdit(event).subscribe(()=>{
this.toastService.successMessage('Evento editado');
@@ -228,7 +223,6 @@ export class EditEventToApprovePage implements OnInit {
this.toastService.badRequest('Evento não editado');
})
this.loadedAttachments.forEach((document:any)=>{
if(document['action'] == 'add') {
delete document.action
@@ -248,104 +242,34 @@ export class EditEventToApprovePage implements OnInit {
})
this.modalController.dismiss();
}
/* async openAttendees() {
if(window.innerWidth <= 1024) {
const modal = await this.modalController.create({
component: AttendeesPageModal,
componentProps: {
adding: this.adding,
taskParticipants: this.taskParticipants,
taskParticipantsCc: this.taskParticipantsCc
},
cssClass: 'attendee modal modal-desktop',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then((data) => {
if(data){
data = data['data'];
const newAttendees: EventPerson[] = data['taskParticipants'];
const newAttendeesCC: EventPerson[] = data['taskParticipantsCc'];
this.setIntervenient(newAttendees);
this.setIntervenientCC(newAttendeesCC);
}
});
} else {
this.showAttendees = true
}
}
setIntervenient(data){
this.taskParticipants = data;
this.postEvent.Attendees = data;
}
setIntervenientCC(data) {
this.taskParticipantsCc = data;
}
addParticipants(){
this.adding = 'intervenient'
this.openAttendees();
}
addParticipantsCC(){
this.adding = 'CC'
this.openAttendees();
}
dynamicSetIntervenient({taskParticipants, taskParticipantsCc}){
this.taskParticipants = taskParticipants;
this.taskParticipantsCc = taskParticipantsCc;
} */
async addParticipants() {
// async addParticipants() {
//this.saveTemporaryData();
// //this.saveTemporaryData();
this.openAttendeesComponent.emit({
type: "intervenient"
});
// this.openAttendeesComponent.emit({
// type: "intervenient"
// });
this.clearContact.emit();
}
// this.clearContact.emit();
// }
async addParticipantsCC() {
// async addParticipantsCC() {
//this.saveTemporaryData();
// //this.saveTemporaryData();
this.openAttendeesComponent.emit({
type: "CC"
});
this.clearContact.emit();
}
saveTemporaryData() {
this.getDatepickerData()
window['temp.path:/home/agenda/edit-event-to-approve.page.ts'] = {
postEvent: this.postEvent,
segment: this.segment
}
}
// this.openAttendeesComponent.emit({
// type: "CC"
// });
// this.clearContact.emit();
// }
async getAttachments() {
@@ -416,6 +340,36 @@ export class EditEventToApprovePage implements OnInit {
}
saveTemporaryData() {
this.getDatepickerData()
window['temp.path:/home/agenda/edit-event.component.ts'] = {
eventProcess: this.eventProcess
}
}
restoreTemporaryData(): boolean {
const restoredData = window['temp.path:/home/agenda/edit-event.component.ts']
if(JSON.stringify(restoredData) != "{}" && undefined != restoredData){
this.eventProcess = restoredData.eventProcess
this.restoreDatepickerData()
return true;
} else {
return false;
}
}
getDatepickerData() {
this.eventProcess.workflowInstanceDataFields.StartDate = this.dateStart