This commit is contained in:
Peter Maquiran
2021-06-30 10:24:23 +01:00
parent fb367b40ae
commit b2af086bd2
3 changed files with 56 additions and 75 deletions
@@ -1,18 +1,17 @@
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
import { FormControl } from '@angular/forms';
import { AlertController, AnimationController, ModalController } from '@ionic/angular';
import { AlertController, ModalController } from '@ionic/angular';
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 = {
@@ -65,7 +64,6 @@ export class EditEventToApprovePage implements OnInit {
@Input() serialNumber: string
loadedAttachments: Attachment[]= []
eventProcess = {
@@ -90,8 +88,6 @@ export class EditEventToApprovePage implements OnInit {
}
show = false
postEvent: Event;
isRecurring:string;
isEventEdited: boolean;
segment:string = "true";
@@ -121,25 +117,30 @@ export class EditEventToApprovePage implements OnInit {
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()));
}
ngOnInit() {
if(!this.restoreTemporaryData()){
} else {
alert('restore!!')
}
this.getTask();
console.log(this.serialNumber);
// console.log(this.serialNumber);
}
async getTask() {
console.log('this.eventProcess', this.eventProcess);
// console.log('this.eventProcess', this.eventProcess);
const result = await this.processes.GetTask(this.serialNumber).subscribe( result =>{
this.eventProcess = result
@@ -253,64 +254,31 @@ export class EditEventToApprovePage implements OnInit {
}
/* 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
});
// setIntervenient(data){
// this.taskParticipants = data;
// this.postEvent.Attendees = data;
// }
await modal.present();
modal.onDidDismiss().then((data) => {
if(data){
data = data['data'];
// setIntervenientCC(data) {
// this.taskParticipantsCc = data;
// }
const newAttendees: EventPerson[] = data['taskParticipants'];
const newAttendeesCC: EventPerson[] = data['taskParticipantsCc'];
// addParticipants(){
// this.adding = 'intervenient'
this.setIntervenient(newAttendees);
this.setIntervenientCC(newAttendeesCC);
}
});
} else {
this.showAttendees = true
}
}
// this.openAttendees();
// }
setIntervenient(data){
this.taskParticipants = data;
this.postEvent.Attendees = data;
}
setIntervenientCC(data) {
this.taskParticipantsCc = data;
}
addParticipants(){
this.adding = 'intervenient'
this.openAttendees();
}
addParticipantsCC(){
// addParticipantsCC(){
this.adding = 'CC'
this.openAttendees();
}
// this.adding = 'CC'
// this.openAttendees();
// }
dynamicSetIntervenient({taskParticipants, taskParticipantsCc}){
dynamicSetIntervenient({taskParticipants, taskParticipantsCc}) {
this.taskParticipants = taskParticipants;
this.taskParticipantsCc = taskParticipantsCc;
} */
}
async addParticipants() {
@@ -340,13 +308,31 @@ export class EditEventToApprovePage implements OnInit {
this.getDatepickerData()
window['temp.path:/home/agenda/edit-event-to-approve.page.ts'] = {
postEvent: this.postEvent,
segment: this.segment
window['temp.path:/shared/agenda/edit-event-to-approve.ts'] = {
eventProcess: this.eventProcess
}
}
restoreTemporaryData(): boolean {
const restoredData = window['temp.path:/shared/agenda/edit-event-to-approve.ts']
if(JSON.stringify(restoredData) != "{}" && undefined != restoredData) {
this.eventProcess = restoredData.eventProcess
// restore dater for date and hours picker
this.restoreDatepickerData()
return true;
} else {
return false;
}
}
async getAttachments() {
let result: any = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise();
@@ -357,7 +343,7 @@ export class EditEventToApprovePage implements OnInit {
this.loadedAttachments = result
console.log('this.loadedAttachments', this.loadedAttachments, result)
// console.log('this.loadedAttachments', this.loadedAttachments, result)
}
deleteAttachment(attachment: Attachment, index) {