This commit is contained in:
tiago.kayaya
2021-05-19 16:13:04 +01:00
2 changed files with 12 additions and 10 deletions
@@ -188,18 +188,17 @@
</div>
<div class="d-flex container-div width-100" >
<ion-list class="width-100 ">
<ion-item class="width-100" *ngFor="let document of loadedAttachments">
<ion-list class="width-100 ">
<ion-item class="width-100" *ngFor="let document of loadedAttachments; let i = index">
<ion-label class="width-100 d-block list" *ngIf="document.action != 'delete' ">
<p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.SourceName}}</span>
<span class="app-name" *ngIf="document.ApplicationId == 8"> Correspondencia </span>
<span class="app-name" *ngIf="document.ApplicationId == 386"> AccoesPresidenciais </span>
<span class="app-name" *ngIf="document.ApplicationId == 361 "> ArquivoDespachoElect </span>
<span class="close-button text-black cursor-pointer" (click)="deleteAttachment(document.Id)" >
<span class="close-button text-black cursor-pointer" (click)="deleteAttachment(document, i)" >
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span>
</p>
<p><span class="span-left">{{document.Stakeholders}}</span><span class="span-right"> {{document.CreateDate | date: 'dd-MM-yy'}} </span></p>
</ion-label>
@@ -257,17 +257,19 @@ export class EditEventToApproveComponent implements OnInit {
this.loadedAttachments.forEach((document:any)=>{
if(document['action'] == 'add'){
if(document['action'] == 'add') {
delete document.action
this.attachmentsService.setEventAttachmentById(document).subscribe(()=>{});
} else if(document['action'] == 'delete') {
delete document.action
this.attachmentsService.deleteEventAttachmentById(document).subscribe( res=>{})
this.attachmentsService.deleteEventAttachmentById(document.Id).subscribe( res=>{})
}
})
alert('save')
this.modalController.dismiss();
}
async openAttendees() {
@@ -343,9 +345,10 @@ export class EditEventToApproveComponent implements OnInit {
console.log('this.loadedAttachments', this.loadedAttachments, result)
}
deleteAttachment(attachment: Attachment) {
deleteAttachment(attachment: Attachment, index) {
this.attachmentsService.deleteEventAttachmentById(attachment.Id).subscribe( res=>{})
console.log('index', index)
this.loadedAttachments[index]['action'] = 'delete'
}