diff --git a/src/app/pages/agenda/edit-event/edit-event.page.ts b/src/app/pages/agenda/edit-event/edit-event.page.ts index 81d1983c5..cad8a56c1 100644 --- a/src/app/pages/agenda/edit-event/edit-event.page.ts +++ b/src/app/pages/agenda/edit-event/edit-event.page.ts @@ -313,7 +313,7 @@ export class EditEventPage implements OnInit { } - save() { + async save() { this.injectValidation() this.runValidation() @@ -340,7 +340,6 @@ export class EditEventPage implements OnInit { await this.eventsService.changeAgenda(body).toPromise(); } catch (error) {} finally { - this.goBack(); } } @@ -363,7 +362,6 @@ export class EditEventPage implements OnInit { await this.eventsService.changeAgenda(body).toPromise(); } catch (error) {} finally { - this.goBack(); } } @@ -379,42 +377,50 @@ export class EditEventPage implements OnInit { this.isEventEdited = true; - this.modalController.dismiss(this.isEventEdited); + await this.saveDocument() - this.saveDocument() + this.goBack(); } - saveDocument() { + async saveDocument() { - this.loadedEventAttachments.forEach((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(); - this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{ - this.getAttachments(this.postEvent.EventId); - }); - - } else if(remove) { - this.attachmentsService.deleteEventAttachmentById(e.Id).subscribe( res=> {}) + } else if(remove) { + await this.attachmentsService.deleteEventAttachmentById(e.Id).toPromise() + } } + } catch (error) { - }) + } finally { + + } + + this.modalController.dismiss({ + isEventEdited: this.isEventEdited, + postEvent: this.postEvent + }); } diff --git a/src/app/pages/agenda/view-event/view-event.page.ts b/src/app/pages/agenda/view-event/view-event.page.ts index 221db70d4..d73cba9f4 100644 --- a/src/app/pages/agenda/view-event/view-event.page.ts +++ b/src/app/pages/agenda/view-event/view-event.page.ts @@ -357,6 +357,7 @@ export class ViewEventPage implements OnInit { this.loadEvent() }, 250); this.isEventEdited = true; + console.log('res', res) } }); @@ -391,6 +392,12 @@ export class ViewEventPage implements OnInit { }, 250); this.isEventEdited = true; + + if(res.data.Attendees?.length >= 1) { + this.loadedEvent.HasAttachments = true + this.getAttachments() + } + console.log('res', res) } this.getAttachments() diff --git a/src/app/shared/agenda/edit-event/edit-event.page.ts b/src/app/shared/agenda/edit-event/edit-event.page.ts index 1c1f2ded0..6f788844c 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.ts +++ b/src/app/shared/agenda/edit-event/edit-event.page.ts @@ -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) { - }) + } } diff --git a/version/git-version.ts b/version/git-version.ts index c6343aea3..d9797c653 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,12 +1,12 @@ export let versionData = { - "shortSHA": "a8c4bccfe", - "SHA": "a8c4bccfedb2866c629c9744da471b0a7ec519e0", + "shortSHA": "1f45e0f73", + "SHA": "1f45e0f73378c2e54e7ef6d77cf9c41594d60eeb", "branch": "feature/gabinete-search", "lastCommitAuthor": "'Eudes InĂ¡cio'", - "lastCommitTime": "'Tue Jun 13 11:47:56 2023 +0100'", - "lastCommitMessage": "bug fix by Peter", - "lastCommitNumber": "5015", + "lastCommitTime": "'Tue Jun 13 11:49:58 2023 +0100'", + "lastCommitMessage": "order event to aprove tabs", + "lastCommitNumber": "5017", "change": "", - "changeStatus": "On branch feature/gabinete-search\nYour branch and 'origin/feature/gabinete-search' have diverged,\nand have 6 and 1 different commits each, respectively.\n (use \"git pull\" to merge the remote branch into yours)\n\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/app/pages/gabinete-digital/event-list/event-list.page.html\n\tmodified: src/app/pages/gabinete-digital/event-list/event-list.page.ts\n\tmodified: src/app/services/events.service.ts\n\tmodified: src/app/shared/agenda/event-list/event-list.page.html\n\tmodified: src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.html\n\tmodified: src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts", + "changeStatus": "On branch feature/gabinete-search\nYour branch and 'origin/feature/gabinete-search' have diverged,\nand have 7 and 2 different commits each, respectively.\n (use \"git pull\" to merge the remote branch into yours)\n\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/app/pages/agenda/edit-event/edit-event.page.ts\n\tmodified: src/app/pages/agenda/view-event/view-event.page.ts\n\tmodified: src/app/shared/agenda/edit-event/edit-event.page.ts", "changeAuthor": "eudes.inacio" } \ No newline at end of file