Edit event show attachment

This commit is contained in:
Peter Maquiran
2021-04-19 18:03:41 +01:00
parent 8b26ffd9a5
commit e794c12872
5 changed files with 69 additions and 17 deletions
@@ -7,6 +7,8 @@ import { Event } from 'src/app/models/event.model';
import { AlertController } from '@ionic/angular';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
import { SearchPage } from 'src/app/pages/search/search.page';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { Attachment } from 'src/app/models/attachment.model';
@Component({
selector: 'app-edit-event',
templateUrl: './edit-event.component.html',
@@ -22,6 +24,7 @@ export class EditEventComponent implements OnInit {
segment:string = "true";
eventAttendees: EventPerson[];
minDate: string;
loadedEventAttachments: Attachment[];
@Input() taskParticipants: EventPerson[];
@Input() taskParticipantsCc: EventPerson[];
@@ -41,8 +44,11 @@ export class EditEventComponent implements OnInit {
private modalController: ModalController,
private eventsService: EventsService,
public alertController: AlertController,
private attachmentsService: AttachmentsService,
) {
}
ngOnInit() {
@@ -50,8 +56,14 @@ export class EditEventComponent implements OnInit {
if(!this.restoreTemporaryData()){
if(this.postEvent){
this.postEvent.Body.Text = this.postEvent.Body.Text.replace(/<[^>]+>/g, '');
if( this.postEvent.Body){
if(typeof(this.postEvent.Body.Text) == 'string'){
this.postEvent.Body.Text = this.postEvent.Body.Text.replace(/<[^>]+>/g, '');
}
}
}
// attendees list
if(this.postEvent.Attendees != null) {
@@ -79,6 +91,10 @@ export class EditEventComponent implements OnInit {
this.isRecurring = "Repete";
}
}
this.getAttachments(this.postEvent.EventId);
}
@@ -155,15 +171,22 @@ export class EditEventComponent implements OnInit {
this.eventBody = restoredData.eventBody
this.segment = restoredData.segment
return true;
return true;
} else {
return false;
}
}
deleteTemporaryData(){
window['temp.path:/home/agenda/edit-event.component.ts'] = {}
}
getAttachments(eventId: string){
this.attachmentsService.getAttachmentsById(eventId).subscribe(res=>{
this.loadedEventAttachments = res;
});
}
}