diff --git a/src/app/pages/publications/publications.page.html b/src/app/pages/publications/publications.page.html index ee3c204bf..2dc6c80a3 100644 --- a/src/app/pages/publications/publications.page.html +++ b/src/app/pages/publications/publications.page.html @@ -151,6 +151,7 @@ (goBacktoPublicationDetails)="goBacktoPublicationDetails()" (goBackToViewPublications)="goBackToViewPublications()" (closeDesktopComponent)="closeDesktopComponent($event)" + (getActions)="getActions()" > @@ -164,6 +165,7 @@ (closeDesktopComponent)="closeDesktopComponent($event)" (goBacktoPublicationDetails)="goBacktoPublicationDetails()" (goBackToViewPublications)="goBackToViewPublications()" + (getActions)="getActions()" > @@ -176,12 +178,14 @@ (closeDesktopComponent)="closeDesktopComponent($event)" (goBacktoPublicationDetails)="goBacktoPublicationDetails()" (goBackToViewPublications)="goBackToViewPublications()" + (getActions)="getActions()" > diff --git a/src/app/pages/publications/publications.page.ts b/src/app/pages/publications/publications.page.ts index b060456b9..bb74a7ae3 100644 --- a/src/app/pages/publications/publications.page.ts +++ b/src/app/pages/publications/publications.page.ts @@ -360,6 +360,8 @@ export class PublicationsPage implements OnInit { if(res['data']=='edit'){ this.closeDesktopComponent(); this.desktopComponent.showEditActions = true; + } else if (res['data']=='delete') { + this.getActions(); } }); } diff --git a/src/app/shared/popover/actions-options/actions-options.page.ts b/src/app/shared/popover/actions-options/actions-options.page.ts index ce641025d..eeceae5ed 100644 --- a/src/app/shared/popover/actions-options/actions-options.page.ts +++ b/src/app/shared/popover/actions-options/actions-options.page.ts @@ -32,7 +32,7 @@ export class ActionsOptionsPage implements OnInit { deleteAction(){ this.publicationsService.DeletePresidentialAction(this.id).toPromise(); - this.close(); + this.modalController.dismiss('delete'); } } diff --git a/src/app/shared/publication/edit-action/edit-action.page.ts b/src/app/shared/publication/edit-action/edit-action.page.ts index d9fd54533..0dba3d430 100644 --- a/src/app/shared/publication/edit-action/edit-action.page.ts +++ b/src/app/shared/publication/edit-action/edit-action.page.ts @@ -34,6 +34,7 @@ export class EditActionPage implements OnInit { @Input() folderId: string; @Output() closeDesktopComponent= new EventEmitter(); @Output() updateDesktopComponent= new EventEmitter(); + @Output() getActions= new EventEmitter(); constructor( private publicationsService: PublicationsService, @@ -103,6 +104,8 @@ export class EditActionPage implements OnInit { this.close(); this.updateDesktopComponent.emit(); this.toastService.successMessage('Acção presidencial atualizada') + this.getActions.emit() + } catch (error) { this.toastService.badRequest('Não foi possivel atualizar a acção presidencial') } finally { diff --git a/src/app/shared/publication/new-action/new-action.page.html b/src/app/shared/publication/new-action/new-action.page.html index 10b578239..361402fbd 100644 --- a/src/app/shared/publication/new-action/new-action.page.html +++ b/src/app/shared/publication/new-action/new-action.page.html @@ -45,7 +45,7 @@ @@ -81,14 +81,14 @@ - - - + (); + @Output() getActions= new EventEmitter(); constructor( private publication: PublicationsService, @@ -46,8 +47,11 @@ export class NewActionPage implements OnInit { ) { this.folder = new PublicationFolder(); - this.dateControlStart = new FormControl(moment(new Date())); - this.dateControlEnd = new FormControl(moment(new Date(new Date().getTime() + 15 * 60000))); + + this.folder = Object.assign(this.folder, { + DateBegin: moment(new Date()), + DateEnd: moment(new Date(new Date().getTime() + 15 * 60000)), + }) } @@ -69,7 +73,7 @@ export class NewActionPage implements OnInit { get dateValid() { if (window.innerWidth >= 800) { - return this.folder.DateBegin < this.folder.DateEnd? ['ok']: [] + return new Date(this.folder.DateBegin).toLocaleString('pt') < new Date(this.folder.DateEnd).toLocaleString("pt")? ['ok'] : [] } else { return ['ok'] } @@ -81,6 +85,8 @@ export class NewActionPage implements OnInit { injectValidation() { + console.log(this.dateValid) + this.Form = new FormGroup({ Subject: new FormControl(this.folder.Description, [ Validators.required, @@ -98,7 +104,13 @@ export class NewActionPage implements OnInit { this.injectValidation() this.runValidation() - if(this.Form.invalid) return false + if(this.Form.invalid) { + return false + } else { + console.log ('not passded') + } + + console.log('pass') this.folder = { ProcessId: null, @@ -116,6 +128,8 @@ export class NewActionPage implements OnInit { await this.publication.CreatePublicationFolder(this.folder).toPromise() this.close(); this.toastService.successMessage('Acção presidencial criada') + + this.getActions.emit() } catch (error) { this.toastService.badRequest('Não foi possivel criar a acção presidencial') } finally {