Improve add attachment

This commit is contained in:
Peter Maquiran
2021-04-20 16:06:31 +01:00
parent ecb87959a0
commit 0a900b1621
5 changed files with 45 additions and 12 deletions
@@ -184,7 +184,7 @@ export class EditEventComponent implements OnInit {
getAttachments(eventId: string){
this.attachmentsService.getAttachmentsById(eventId).subscribe(res=>{
this.loadedEventAttachments = res;
console.log('res', res);
console.log('res', res);
});
}
@@ -194,7 +194,40 @@ export class EditEventComponent implements OnInit {
res=>{
this.loadedEventAttachments = this.loadedEventAttachments.filter(e=> e.Id.toString() != attachmentID);
})
}
async getDoc() {
const modal = await this.modalController.create({
component: SearchPage,
cssClass: 'group-messages modal-desktop search-modal search-modal-to-desktop',
componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect'
}
});
await modal.present();
modal.onDidDismiss().then( async (res)=>{
if(res){
const data = res.data;
//data.selected
const DocumentToSave = {
SourceTitle: data.selected.Assunto,
ParentId: this.postEvent.EventId,
Source: '1',
SourceId: data.selected.Id,
ApplicationId: data.selected.ApplicationType.toString(),
Id: '0',
Link: '',
SerialNumber: '',
};
await this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{
this.getAttachments(this.postEvent.EventId);
});
}
});
}
}