mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Improve documents
This commit is contained in:
@@ -261,8 +261,8 @@
|
||||
</ion-label>
|
||||
</div>
|
||||
|
||||
<div class="d-flex container-div width-100" *ngFor="let document of loadedEventAttachments" >
|
||||
<ion-list class="width-100 list">
|
||||
<div class="d-flex container-div width-100" *ngFor="let document of loadedEventAttachments; let i = index" >
|
||||
<ion-list class="width-100 list" *ngIf="!document.remove">
|
||||
<ion-item class="width-100">
|
||||
<ion-label class="width-100">
|
||||
<p class="d-flex ion-justify-content-between">
|
||||
@@ -270,7 +270,7 @@
|
||||
<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.Id, i)" >
|
||||
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
|
||||
</span>
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ export class EditEventPage implements OnInit {
|
||||
segment:string = "true";
|
||||
eventAttendees: EventPerson[];
|
||||
// minDate: string;
|
||||
loadedEventAttachments: Attachment[];
|
||||
loadedEventAttachments: Attachment[]=[];
|
||||
|
||||
public date: any;
|
||||
public disabled = false;
|
||||
@@ -221,6 +221,41 @@ export class EditEventPage implements OnInit {
|
||||
this.clearPostEvent.emit();
|
||||
this.deleteTemporaryData();
|
||||
this.close();
|
||||
|
||||
this.saveDocument()
|
||||
}
|
||||
|
||||
|
||||
saveDocument() {
|
||||
|
||||
this.loadedEventAttachments.forEach((e)=>{
|
||||
|
||||
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: '',
|
||||
};
|
||||
|
||||
this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{
|
||||
this.getAttachments(this.postEvent.EventId);
|
||||
});
|
||||
|
||||
} else if(remove) {
|
||||
this.attachmentsService.deleteEventAttachmentById(e.Id).subscribe( res=> {})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
async addParticipants() {
|
||||
@@ -300,12 +335,17 @@ export class EditEventPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
deleteAttachment(attachmentID: string) {
|
||||
deleteAttachment(attachmentID: string, index) {
|
||||
|
||||
this.attachmentsService.deleteEventAttachmentById(attachmentID).subscribe(
|
||||
res=>{
|
||||
this.loadedEventAttachments = this.loadedEventAttachments.filter(e=> e.Id.toString() != attachmentID);
|
||||
})
|
||||
const id: any = this.loadedEventAttachments[index].Id
|
||||
|
||||
if(id == 'add') {
|
||||
this.loadedEventAttachments = this.loadedEventAttachments.filter((e,i)=> i!=index)
|
||||
} else {
|
||||
this.loadedEventAttachments[index]['remove'] = true
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -323,21 +363,25 @@ export class EditEventPage implements OnInit {
|
||||
modal.onDidDismiss().then( async (res)=>{
|
||||
if(res){
|
||||
const data = res.data;
|
||||
//data.selected
|
||||
const DocumentToSave = {
|
||||
SourceTitle: data.selected.Assunto,
|
||||
|
||||
const ApplicationIdDocumentToSave: any = {
|
||||
SourceName: data.selected.Assunto,
|
||||
ParentId: this.postEvent.EventId,
|
||||
Source: '1',
|
||||
SourceId: data.selected.Id,
|
||||
Stakeholders: false,
|
||||
ApplicationId: data.selected.ApplicationType.toString(),
|
||||
Id: '0',
|
||||
CreateDate: false,
|
||||
// needed to attach this document
|
||||
Id: 'add',
|
||||
SourceTitle: data.selected.Assunto,
|
||||
Source: '1',
|
||||
Link: '',
|
||||
SerialNumber: '',
|
||||
};
|
||||
}
|
||||
|
||||
console.log( this.loadedEventAttachments)
|
||||
this.loadedEventAttachments.push(ApplicationIdDocumentToSave)
|
||||
|
||||
await this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{
|
||||
this.getAttachments(this.postEvent.EventId);
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user