diff --git a/src/app/pages/agenda/edit-event/edit-event.page.html b/src/app/pages/agenda/edit-event/edit-event.page.html index 9d3afdd9d..66820d31f 100644 --- a/src/app/pages/agenda/edit-event/edit-event.page.html +++ b/src/app/pages/agenda/edit-event/edit-event.page.html @@ -115,7 +115,7 @@
-
+
-
+
-
+
@@ -78,6 +78,49 @@
+ +
+
+
+ +
+
+ + + Reunião + Viagem + Conferência + Encontro + + + + + + + + Reunião + + + Viagem + + + Conferência + + + Encontro + + + + + +
+
+
+
@@ -201,6 +244,9 @@
+ + +
diff --git a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts index 7bd19add0..3ce4617a7 100644 --- a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts +++ b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts @@ -1,5 +1,5 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { ActivatedRoute, NavigationExtras, Router } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { AnimationController, ModalController, NavParams } from '@ionic/angular'; import { Event } from 'src/app/models/event.model' import { EventBody } from 'src/app/models/eventbody.model'; @@ -70,7 +70,6 @@ export class BookMeetingModalPage implements OnInit { Form: FormGroup; validateFrom = false - showLoader = false get dateStart () { @@ -145,6 +144,9 @@ export class BookMeetingModalPage implements OnInit { this.dateControlStart = new FormControl(moment(new Date())); this.dateControlEnd = new FormControl(moment(new Date(new Date().getTime() + 15 * 60000))); + + + this.postData.Categories = ['Reunião'] } ngOnInit() { @@ -206,6 +208,9 @@ export class BookMeetingModalPage implements OnInit { participantes: new FormControl(this.taskParticipants, [ Validators.required ]), + Categories: new FormControl(this.postData.Categories[0], [ + Validators.required + ]), }) } @@ -244,7 +249,7 @@ export class BookMeetingModalPage implements OnInit { AppointmentState: 0, TimeZone: 'UTC', Organizer: null, - Categories: null, + Categories: ['Reunião'], HasAttachments: true, EventRecurrence: null, } 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..f3f2bebab 100644 --- a/src/app/pages/publications/publications.page.ts +++ b/src/app/pages/publications/publications.page.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { Router, NavigationEnd } from '@angular/router'; import { ModalController, PopoverController } from '@ionic/angular'; import { PublicationFolder } from 'src/app/models/publicationfolder'; -import { ProcessesService } from 'src/app/services/processes.service'; import { PublicationsService } from 'src/app/services/publications.service'; import { NewActionPage } from './new-action/new-action.page'; import { ViewPublicationsPage } from './view-publications/view-publications.page'; @@ -13,7 +12,7 @@ import { LoadingService } from 'src/app/services/loading.service'; import { Publication } from 'src/app/models/publication'; import { ActionsOptionsPage } from 'src/app/shared/popover/actions-options/actions-options.page'; import { EditActionPage } from './edit-action/edit-action.page'; - +import { ToastService } from 'src/app/services/toast.service'; @Component({ selector: 'app-publications', @@ -61,6 +60,7 @@ export class PublicationsPage implements OnInit { private loading: LoadingService, private publications: PublicationsService, private popoverController:PopoverController, + private toastService: ToastService ) { this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"]; @@ -118,7 +118,7 @@ export class PublicationsPage implements OnInit { return window.innerWidth } - getActions(){ + getActions() { this.showLoader = true; this.publications.GetPublicationFolderList().subscribe(res=>{ this.publicationFolderList = res; @@ -136,7 +136,7 @@ export class PublicationsPage implements OnInit { DateEnd: this.theEndDate.getDate() +" de " + ( this.months[this.theEndDate.getMonth()])+" de " +this.theEndDate.getFullYear(), ActionType: data.ActionType, } - if(data.ActionType == "Evento"){ + if(data.ActionType == "Evento") { this.publicationsEventFolderList.push(folder); } else{ @@ -163,15 +163,27 @@ export class PublicationsPage implements OnInit { //this.refreshing() } - deleteAction(id?: string){ - this.publications.DeletePresidentialAction(id).toPromise(); + async deleteAction(id?: string){ + + const loader = this.toastService.loading(); + + try { + await this.publications.DeletePresidentialAction(id).toPromise(); + this.toastService.successMessage() + } catch(e) { + this.toastService.badRequest() + } + finally { + loader.remove() + } + this.refreshing() } async AddPublicationFolder(item?:any) { this.closeDesktopComponent(); - if(window.innerWidth <= 1024){ + if(window.innerWidth <= 1024) { const modal = await this.modalController.create({ component: NewActionPage, @@ -188,7 +200,6 @@ export class PublicationsPage implements OnInit { } else { this.desktopComponent.showAddActions = true; } - } @@ -360,6 +371,10 @@ export class PublicationsPage implements OnInit { if(res['data']=='edit'){ this.closeDesktopComponent(); this.desktopComponent.showEditActions = true; + } else if (res['data']=='delete') { + setTimeout(()=>{ + this.getActions(); + },1000) } }); } 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 b3fba5290..2b73bdb85 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.ts +++ b/src/app/shared/agenda/edit-event/edit-event.page.ts @@ -102,7 +102,7 @@ export class EditEventPage implements OnInit { public alertController: AlertController, private attachmentsService: AttachmentsService, private toastService: ToastService ) { - + } ngOnInit() { @@ -268,8 +268,13 @@ export class EditEventPage implements OnInit { "EventId": this.postEvent.EventId, "CalendarDestinationName": this.postEvent.CalendarName, } + console.log(body); - await this.eventsService.changeAgenda(body).toPromise(); + + try { + await this.eventsService.changeAgenda(body).toPromise(); + } catch (e) {} + } this.showLoader = false; this.toastService.successMessage() 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..d1cd4a1b4 100644 --- a/src/app/shared/popover/actions-options/actions-options.page.ts +++ b/src/app/shared/popover/actions-options/actions-options.page.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { ModalController, NavParams } from '@ionic/angular'; import { PublicationsService } from 'src/app/services/publications.service'; +import { ToastService } from 'src/app/services/toast.service'; @Component({ selector: 'app-actions-options', @@ -15,6 +16,7 @@ export class ActionsOptionsPage implements OnInit { private modalController: ModalController, private navParams: NavParams, private publicationsService: PublicationsService, + private toastService: ToastService ) { this.id = this.navParams.get('id'); } @@ -30,9 +32,21 @@ export class ActionsOptionsPage implements OnInit { this.modalController.dismiss('edit'); } - deleteAction(){ - this.publicationsService.DeletePresidentialAction(this.id).toPromise(); - this.close(); + async deleteAction() { + + const loader = this.toastService.loading(); + + try { + await this.publicationsService.DeletePresidentialAction(this.id).toPromise(); + this.modalController.dismiss('delete'); + } catch(e) { + this.toastService.badRequest() + } + finally { + loader.remove() + } + + } } 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 { diff --git a/src/app/shared/publication/view-publications/view-publications.page.html b/src/app/shared/publication/view-publications/view-publications.page.html index 7bd850c99..24dd457ad 100644 --- a/src/app/shared/publication/view-publications/view-publications.page.html +++ b/src/app/shared/publication/view-publications/view-publications.page.html @@ -9,7 +9,7 @@
{{item.Description}}

{{item.Detail}}

- +
@@ -47,7 +47,7 @@
{{publication.Title}}
-
{{publication.DatePublication | date: 'dd-MM-yy | h:mm'}}
+
{{publication.DatePublication | date: 'dd-MM-yy | hh:mm'}}

{{publication.Message}}