This commit is contained in:
Peter Maquiran
2023-06-13 12:27:27 +01:00
parent 5db8d1f1e5
commit fced941d55
4 changed files with 70 additions and 55 deletions
@@ -366,32 +366,34 @@ export class EditEventPage implements OnInit {
async saveDocument() {
await this.loadedEventAttachments.forEach( async (e)=>{
try {
for( let e of this.loadedEventAttachments) {
const id: any = e.Id
const remove = e['remove']
const id: any = e.Id
const remove = e['remove']
if ( id == 'add') {
//data.selected
const DocumentToSave = {
SourceTitle: e.SourceName,
ParentId: this.postEvent.EventId,
Source: '1',
SourceId: e.SourceId,
ApplicationId: e.ApplicationId.toString(),
Id: '0',
Link: '',
SerialNumber: '',
};
if ( id == 'add') {
//data.selected
const DocumentToSave = {
SourceTitle: e.SourceName,
ParentId: this.postEvent.EventId,
Source: '1',
SourceId: e.SourceId,
ApplicationId: e.ApplicationId.toString(),
Id: '0',
Link: '',
SerialNumber: '',
};
await this.attachmentsService.setEventAttachmentById(DocumentToSave).toPromise();
await this.attachmentsService.setEventAttachmentById(DocumentToSave).toPromise();
await this.getAttachments(this.postEvent.EventId);
} else if(remove) {
await this.attachmentsService.deleteEventAttachmentById(e.Id).toPromise()
} else if(remove) {
await this.attachmentsService.deleteEventAttachmentById(e.Id).toPromise()
}
}
} catch (error) {
})
}
}