diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index a64d4988d..73dc21b82 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -139,6 +139,14 @@ const routes: Routes = [ path: 'edit-event-to-approve', loadChildren: () => import('./shared/agenda/edit-event-to-approve/edit-event-to-approve.module').then( m => m.EditEventToApprovePageModule) }, + { + path: 'actions-options', + loadChildren: () => import('./shared/popover/actions-options/actions-options.module').then( m => m.ActionsOptionsPageModule) + }, + { + path: 'edit-action', + loadChildren: () => import('./shared/publication/edit-action/edit-action.module').then( m => m.EditActionPageModule) + }, diff --git a/src/app/guards/auth.guard.spec.ts b/src/app/guards/auth.guard.spec.ts new file mode 100644 index 000000000..68889d22d --- /dev/null +++ b/src/app/guards/auth.guard.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { AuthGuard } from './auth.guard'; + +describe('AuthGuard', () => { + let guard: AuthGuard; + + beforeEach(() => { + TestBed.configureTestingModule({}); + guard = TestBed.inject(AuthGuard); + }); + + it('should be created', () => { + expect(guard).toBeTruthy(); + }); +}); diff --git a/src/app/guards/auth.guard.ts b/src/app/guards/auth.guard.ts new file mode 100644 index 000000000..3c81d0d9f --- /dev/null +++ b/src/app/guards/auth.guard.ts @@ -0,0 +1,25 @@ +import { Injectable } from '@angular/core'; +import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from '@angular/router'; +import { Observable } from 'rxjs'; + +@Injectable({ + providedIn: 'root' +}) +export class AuthGuard implements CanActivate { + constructor( + private router:Router + ){} + + canActivate( + route: ActivatedRouteSnapshot, + state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { + + if(window.location.pathname != '' && !localStorage.getItem('UserData')) { + this.router.navigate(['/']); + return false + } else { + return true + } + } + +} diff --git a/src/app/home/home-routing.module.ts b/src/app/home/home-routing.module.ts index cd42571d5..6a3858af9 100644 --- a/src/app/home/home-routing.module.ts +++ b/src/app/home/home-routing.module.ts @@ -1,5 +1,6 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; +import { AuthGuard } from '../guards/auth.guard'; import { HomeGuard } from '../guards/home.guard'; import { GroupMessagesPage } from '../pages/chat/group-messages/group-messages.page'; import { MessagesPage } from '../pages/chat/messages/messages.page'; @@ -36,6 +37,15 @@ const routes: Routes = [ }, ] }, + { + path:'expedientes-pr', + children: [ + { + path:':SerialNumber/:caller', + loadChildren: ()=> import('../pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.module').then(m => m.ExpedientePrPageModule), + }, + ] + }, ] }, { @@ -46,7 +56,8 @@ const routes: Routes = [ loadChildren: ()=> import('../pages/events/attachments/attachments.module').then(m => m.AttachmentsPageModule) }, - ] + ], + }, { path: 'attendees', @@ -55,7 +66,8 @@ const routes: Routes = [ path:'', loadChildren: ()=> import('../pages/events/attendees/attendees.module').then(m => m.AttendeesPageModule) }, - ] + ], + }, { path: 'attendees-modal', @@ -64,7 +76,8 @@ const routes: Routes = [ path:'', loadChildren: ()=> import('../shared/event/attendee-modal/attendee-modal.module').then(m => m.AttendeeModalPageModule) }, - ] + ], + }, { path: 'login', @@ -73,7 +86,8 @@ const routes: Routes = [ path:'', loadChildren: ()=> import('../pages/login/login.module').then(m => m.LoginPageModule) }, - ] + ], + }, { path: 'agenda', @@ -120,7 +134,8 @@ const routes: Routes = [ } ] }, - ] + ], + }, { path: 'gabinete-digital', @@ -154,6 +169,45 @@ const routes: Routes = [ }, ] }, + { + path: 'expedientes-pr', + children: [ + { + path: '', + loadChildren: ()=> import('../pages/gabinete-digital/expedientes-pr/expedientes-pr.module').then(m => m.ExpedientesPrPageModule), + }, + { + path:':SerialNumber/:caller', + loadChildren: ()=> import('../pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.module').then(m => m.ExpedientePrPageModule), + }, + ] + }, + { + path: 'despachos', + children: [ + { + path: '', + loadChildren: ()=> import('../pages/gabinete-digital/despachos/despachos.module').then(m => m.DespachosPageModule), + }, + { + path:':SerialNumber/:caller', + loadChildren: ()=> import('../pages/gabinete-digital/despachos/despacho/despacho.module').then(m => m.DespachoPageModule), + }, + ] + }, + { + path: 'pedidos', + children: [ + { + path: '', + loadChildren: ()=> import('../pages/gabinete-digital/pedidos/pedidos.module').then(m => m.PedidosPageModule), + }, + { + path:':SerialNumber/:caller', + loadChildren: ()=> import('../pages/gabinete-digital/pedidos/pedido/pedido.module').then(m => m.PedidoPageModule), + }, + ] + }, { path:'event-list', children: [ @@ -181,7 +235,9 @@ const routes: Routes = [ } ] } - ] + ], + + }, { path: 'search', @@ -190,7 +246,8 @@ const routes: Routes = [ path:'', loadChildren: ()=> import('../pages/search/search.module').then(m => m.SearchPageModule) } - ] + ], + }, { path: 'publications', @@ -220,7 +277,8 @@ const routes: Routes = [ path: 'request-options', loadChildren: () => import('../shared/popover/request-options/request-options.module').then( m => m.RequestOptionsPageModule) }, - ] + ], + }, { path: 'chat', @@ -264,7 +322,8 @@ const routes: Routes = [ ] }, - ] + ], + }, { path: 'document-detail', @@ -273,14 +332,17 @@ const routes: Routes = [ path:'', loadChildren: ()=> import('../modals/document-detail/document-detail.module').then(m => m.DocumentDetailPageModule) }, - ] + ], + }, - ] + ], + canActivate: [AuthGuard] + }, { path: '', redirectTo: '/home/events', - pathMatch: 'full' + pathMatch: 'full', } ]; diff --git a/src/app/modals/create-process/create-process.page.html b/src/app/modals/create-process/create-process.page.html index 833699d1f..229c9aaf2 100644 --- a/src/app/modals/create-process/create-process.page.html +++ b/src/app/modals/create-process/create-process.page.html @@ -29,30 +29,12 @@
- + Normal (4 dias para a execução da tarefa) Urgente (2 dias para a execução da tarefa) Muito Urgente (1 dia para a execução da tarefa) Urgentíssimo (8 horas para a execução da tarefa) - - - - - Normal - - - Urgente - - - Muito Urgente - - - Urgentíssimo - - - -
diff --git a/src/app/modals/create-process/create-process.page.ts b/src/app/modals/create-process/create-process.page.ts index 52fe388c5..a1e807243 100644 --- a/src/app/modals/create-process/create-process.page.ts +++ b/src/app/modals/create-process/create-process.page.ts @@ -435,6 +435,17 @@ export class CreateProcessPage implements OnInit { "AttachmentList" :null, } } + if(this.task.activityInstanceName =='Tarefa de Despacho'){ + body = { + "serialNumber": this.task.serialNumber, + "action": "Conhecimento", + "ActionTypeId": 92, + "dataFields": { + "ReviewUserComment": message, + }, + "AttachmentList" :null, + } + } else{ body = { "serialNumber": this.task.serialNumber, diff --git a/src/app/modals/document-detail/document-detail.page.html b/src/app/modals/document-detail/document-detail.page.html index 3dc1ed785..1bce97e89 100644 --- a/src/app/modals/document-detail/document-detail.page.html +++ b/src/app/modals/document-detail/document-detail.page.html @@ -1,41 +1,3 @@ - - - - Menu - - - - - - - Efectuar Despacho - - - - Pedido de Parecer - - - - Pedido de Deferimento - - - - Marcar reunião - - - - Descartar - - - - Enviar para pendentes - - - - -
- -
diff --git a/src/app/models/publicationfolder.ts b/src/app/models/publicationfolder.ts index 8d9a4ecb4..19366e297 100644 --- a/src/app/models/publicationfolder.ts +++ b/src/app/models/publicationfolder.ts @@ -1,5 +1,5 @@ export class PublicationFolder { - ProcessId: number; + ProcessId: string; Description: string; Detail: string; DateBegin: string; diff --git a/src/app/pages/agenda/agenda.page.html b/src/app/pages/agenda/agenda.page.html index 73fdf8642..be3532bcf 100644 --- a/src/app/pages/agenda/agenda.page.html +++ b/src/app/pages/agenda/agenda.page.html @@ -123,8 +123,8 @@ - @@ -417,7 +417,7 @@ > - +
- + +
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 b86920f94..b91f3358e 100644 --- a/src/app/pages/agenda/edit-event/edit-event.page.ts +++ b/src/app/pages/agenda/edit-event/edit-event.page.ts @@ -47,10 +47,12 @@ export class EditEventPage implements OnInit { private eventsService: EventsService, public alertController: AlertController, private attachmentsService: AttachmentsService, - private animationController: AnimationController, private toastService: ToastService, private router: Router, ) { + + + this.isEventEdited = false; this.postEvent = this.navParams.get('event'); this.caller = this.navParams.get('caller'); diff --git a/src/app/pages/events/edit-event/edit-event.page.ts b/src/app/pages/events/edit-event/edit-event.page.ts index 787ae3e99..22b43307b 100644 --- a/src/app/pages/events/edit-event/edit-event.page.ts +++ b/src/app/pages/events/edit-event/edit-event.page.ts @@ -48,6 +48,7 @@ export class EditEventPage implements OnInit { private iab: InAppBrowser) { this.loadedEvent = new Event(); this.loadedEvent.Body = new EventBody(); + } ngOnInit() { diff --git a/src/app/pages/events/events.page.ts b/src/app/pages/events/events.page.ts index 9f2d50d46..39e6ba261 100644 --- a/src/app/pages/events/events.page.ts +++ b/src/app/pages/events/events.page.ts @@ -310,18 +310,35 @@ export class EventsPage implements OnInit { } goToExpediente(SerialNumber:any){ - this.router.navigate(['/home/events/expediente', SerialNumber, 'events']); + if(this.loggeduser.Profile == 'MDGPR'){ + this.router.navigate(['/home/events/expediente', SerialNumber, 'events']); + } + else if(this.loggeduser.Profile == 'PR'){ + this.router.navigate(['/home/events/expedientes-pr', SerialNumber, 'events']); + } } viewExpedientListPage(){ - if( window.innerWidth <= 1024){ - this.router.navigate(['/home/gabinete-digital/expediente']); + if(this.loggeduser.Profile == 'MDGPR'){ + if( window.innerWidth < 801){ + this.router.navigate(['/home/gabinete-digital/expediente']); + } + else{ + let navigationExtras: NavigationExtras = { queryParams: {"expedientes": true,} }; + this.router.navigate(['/home/gabinete-digital'], navigationExtras); + } } - else{ - let navigationExtras: NavigationExtras = { queryParams: {"expedientes": true,} }; - this.router.navigate(['/home/gabinete-digital'], navigationExtras); + else if(this.loggeduser.Profile == 'PR'){ + if( window.innerWidth < 801){ + this.router.navigate(['/home/gabinete-digital/expedientes-pr']); + } + else{ + let navigationExtras: NavigationExtras = { queryParams: {"expedientes-pr": true,} }; + this.router.navigate(['/home/gabinete-digital'], navigationExtras); + } } } + } diff --git a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts index 36632cd8e..2e21d36b6 100644 --- a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts +++ b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts @@ -39,6 +39,7 @@ export class DespachoPage implements OnInit { fulltask: any; eventsList: Event[] = []; serialnumber: string; + caller:string; profile: string; intervenientes: any; cc: any = []; @@ -58,11 +59,16 @@ export class DespachoPage implements OnInit { private toastService: ToastService, ) { - this.activatedRoute.queryParams.subscribe(params => { - if(params["serialNumber"]) { - this.serialnumber = params["serialNumber"]; - console.log(params["serialNumber"]); + this.activatedRoute.paramMap.subscribe(params => { + console.log(params["params"]); + + if(params["params"].SerialNumber) { + this.serialnumber = params["params"].SerialNumber; } + if(params["params"].caller) { + this.caller = params["params"].caller; + } + }); } @@ -88,15 +94,30 @@ export class DespachoPage implements OnInit { } goBack() { - if (window.innerWidth <= 800) { - this.router.navigate(['/home/gabinete-digital/despachos']); - } else { - let navigationExtras: NavigationExtras = { - queryParams: { - 'despachos': true + if(this.task.Status == "Pending" && this.caller == 'gabinete-digital'){ + if (window.innerWidth <= 800) { + this.router.navigate(['/home/gabinete-digital/pendentes']); + } + else { + let navigationExtras: NavigationExtras = { + queryParams: { + "pendentes": true, + } } + this.router.navigate(['/home/gabinete-digital'], navigationExtras); + } + } + else{ + if (window.innerWidth <= 800) { + this.router.navigate(['/home/gabinete-digital/despachos']); + } else { + let navigationExtras: NavigationExtras = { + queryParams: { + 'despachos': true + } + } + this.router.navigate(['/home/gabinete-digital'], navigationExtras); } - this.router.navigate(['/home/gabinete-digital'], navigationExtras); } } @@ -117,6 +138,7 @@ export class DespachoPage implements OnInit { "WorkflowName": res.workflowDisplayName, "DeadlineType": res.workflowInstanceDataFields.DeadlineType, "activityInstanceName": res.activityInstanceName, + "Status": res.workflowInstanceDataFields.Status, } this.fulltask = res; console.log(this.task); @@ -267,6 +289,8 @@ export class DespachoPage implements OnInit { } async sendExpedienteToPending() { + console.log(this.serialnumber); + this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{ console.log(res); this.close(); @@ -405,7 +429,9 @@ export class DespachoPage implements OnInit { backdropDismiss: false }); await modal.present(); - modal.onDidDismiss(); + modal.onDidDismiss().then(res=>{ + this.goBack(); + }); } async distartExpedientModal(){ diff --git a/src/app/pages/gabinete-digital/despachos/despachos.page.html b/src/app/pages/gabinete-digital/despachos/despachos.page.html index 1f676176d..e280ad930 100644 --- a/src/app/pages/gabinete-digital/despachos/despachos.page.html +++ b/src/app/pages/gabinete-digital/despachos/despachos.page.html @@ -33,7 +33,7 @@
diff --git a/src/app/pages/gabinete-digital/despachos/despachos.page.ts b/src/app/pages/gabinete-digital/despachos/despachos.page.ts index 1ea664a91..73962cf15 100644 --- a/src/app/pages/gabinete-digital/despachos/despachos.page.ts +++ b/src/app/pages/gabinete-digital/despachos/despachos.page.ts @@ -146,16 +146,8 @@ export class DespachosPage implements OnInit { }, 2000); } - async viewExpedientDetail(serialNumber:any) { - - let navigationExtras: NavigationExtras = { - queryParams: { - "serialNumber": serialNumber, - } - }; - - this.router.navigate(['/home/gabinete-digital/despachos/despacho'], navigationExtras); - + async GoToDespacho(serialNumber:any) { + this.router.navigate(['/home/gabinete-digital/despachos',serialNumber,'gabinete-digital']); } docIndex(index: number) { diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts index b09faabf3..e5271162e 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts @@ -45,7 +45,6 @@ export class ExpedienteDetailPage implements OnInit { constructor( - private activateRoute: ActivatedRoute, private processes: ProcessesService, private iab: InAppBrowser, private attachments: AttachmentsService, @@ -59,35 +58,17 @@ export class ExpedienteDetailPage implements OnInit { private toastService: ToastService, private animationController: AnimationController, ) { - - this.activateRoute.paramMap.subscribe(params => { - console.log(params["params"]); - + this.activatedRoute.paramMap.subscribe(params => { if(params["params"].SerialNumber) { this.serialnumber = params["params"].SerialNumber; } if(params["params"].caller) { this.caller = params["params"].caller; } - }); - } ngOnInit() { - this.profile = "mdgpr"; - - this.activateRoute.paramMap.subscribe(paramMap => { - if (!paramMap["params"].SerialNumber) { - console.log('HERE'); - - return; - } - console.log(paramMap); - - this.LoadTaskDetail(this.serialnumber); - this.LoadRelatedEvents(this.serialnumber); - }); this.LoadTaskDetail(this.serialnumber); this.LoadRelatedEvents(this.serialnumber); } @@ -115,7 +96,6 @@ export class ExpedienteDetailPage implements OnInit { } } else{ - console.log('HERE'); this.activatedRoute.paramMap.subscribe(params => { switch (params["params"].caller) { case 'events': @@ -155,8 +135,6 @@ export class ExpedienteDetailPage implements OnInit { async LoadTaskDetail(serial: string) { this.processes.GetTask(serial).subscribe(res => { - /* console.log(res); */ - this.task = { "SerialNumber": res.serialNumber, "Folio": res.workflowInstanceDataFields.Subject, @@ -171,11 +149,7 @@ export class ExpedienteDetailPage implements OnInit { "WorkflowName": res.workflowDisplayName, "Status": res.workflowInstanceDataFields.Status, } - - //console.log('task', this.task); - this.fulltask = res; - //console.log('GetTask', res); let thedate = new Date(this.task.CreateDate); this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]); @@ -188,8 +162,6 @@ export class ExpedienteDetailPage implements OnInit { this.cc = users.filter(user=>{ return user.Type == 'CC'; }); - console.log(users); - }) }); @@ -201,14 +173,12 @@ export class ExpedienteDetailPage implements OnInit { async LoadRelatedEvents(serial: string) { if (this.eventsList == null) { this.attachments.getAttachmentsBySerial(serial).subscribe(res => { - console.log(res); res.forEach(att => { if (this.eventsList == null) { this.eventsList = new Array(); } this.events.getEvent(att.ParentId).subscribe(event => { this.eventsList.push(event); - console.log(this.eventsList); }); }); }); @@ -217,7 +187,6 @@ export class ExpedienteDetailPage implements OnInit { viewDocument(){ this.processes.GetDocumentUrl(this.task.DocId, this.task.FsId).subscribe(res=>{ - console.log(res); const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1"); const browser = this.iab.create(url,"_blank"); browser.show(); diff --git a/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.ts b/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.ts index a3a79cfe8..c033ff438 100644 --- a/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.ts +++ b/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.ts @@ -38,13 +38,14 @@ export class ExpedientePrPage implements OnInit { fulltask: any; eventsList: Event[]; serialnumber: string; + caller:string; profile: string; intervenientes: any; cc: any = []; loggeduser: User; - constructor(private activateRoute: ActivatedRoute, + constructor( private processes: ProcessesService, private iab: InAppBrowser, private attachments: AttachmentsService, @@ -52,7 +53,6 @@ export class ExpedientePrPage implements OnInit { private menu: MenuController, private router: Router, private modalController: ModalController, - private alertService: AlertService, public popoverController: PopoverController, private activatedRoute: ActivatedRoute, private userAuth: AuthService, @@ -61,10 +61,12 @@ export class ExpedientePrPage implements OnInit { ) { this.loggeduser = userAuth.ValidatedUser; - this.activatedRoute.queryParams.subscribe(params => { - if(params["serialNumber"]) { - this.serialnumber = params["serialNumber"]; - console.log(params["serialNumber"]); + this.activatedRoute.paramMap.subscribe(params => { + if(params["params"].SerialNumber) { + this.serialnumber = params["params"].SerialNumber; + } + if(params["params"].caller) { + this.caller = params["params"].caller; } }); } @@ -73,7 +75,7 @@ export class ExpedientePrPage implements OnInit { this.profile = "mdgpr"; console.log(this.serialnumber); - this.activateRoute.paramMap.subscribe(paramMap => { + this.activatedRoute.paramMap.subscribe(paramMap => { if (!paramMap.has('SerialNumber')) { return; } @@ -90,15 +92,42 @@ export class ExpedientePrPage implements OnInit { } goBack() { - let navigationExtras: NavigationExtras = { - queryParams: { - "expedientes-pr": true, + if(this.task.Status == "Pending" && this.caller != 'events'){ + if (window.innerWidth <= 800) { + this.router.navigate(['/home/gabinete-digital/pendentes']); + } + else { + let navigationExtras: NavigationExtras = { + queryParams: { + "pendentes": true, + } + } + this.router.navigate(['/home/gabinete-digital'], navigationExtras); } - }; - this.router.navigate(['/home/gabinete-digital'], navigationExtras); - - - + } + else{ + this.activatedRoute.paramMap.subscribe(params => { + switch (params["params"].caller) { + case 'events': + this.router.navigate(['/home',params["params"].caller]); + break; + + case 'gabinete-digital': + let navigationExtras: NavigationExtras = { + queryParams: { + "expedientes-pr": true, + } + } + if( window.innerWidth < 801) { + this.router.navigate(['/home/gabinete-digital/expedientes-pr']); + } else { + this.router.navigate(['/home/gabinete-digital'], navigationExtras); + } + break; + + } + }); + } } sendExpedienteToPending(){ @@ -332,14 +361,14 @@ export class ExpedientePrPage implements OnInit { } } - try { - await this.processes.CompleteTask(otherbody).toPromise(); - this.toastService.successMessage('Processo descartado') + try { + await this.processes.CompleteTask(otherbody).toPromise() + this.toastService.successMessage('Processo descartado'); + this.goBack(); } catch (error) { this.toastService.badRequest('Processo não descartado') } - } else if(res['data'] == 'No'){ //Do nothing @@ -347,30 +376,24 @@ export class ExpedientePrPage implements OnInit { } else{ if(res['data']== 'Yes'){ - + try { + await this.processes.CompleteTask(body).toPromise(); + this.toastService.successMessage('Processo descartado'); + this.goBack(); + } catch (error) { + this.toastService.badRequest('Processo não descartado') + } + this.goBack(); + } + else if(res['data'] == 'No'){ + console.log('Update'); try { - //await this.processes.CompleteTask(body).toPromise() - this.toastService.successMessage() + await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise(); + this.toastService.successMessage(); this.goBack(); } catch (error) { this.toastService.badRequest() } - - - - - } - else if(res['data'] == 'No'){ - console.log('Update'); - - try { - await this.processes.UpdateTaskStatus(this.task.FolderId); - this.toastService.successMessage() - } catch (error) { - this.toastService.badRequest() - } - - } } }); diff --git a/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts b/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts index 9676e9706..c12c8b06f 100644 --- a/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts +++ b/src/app/pages/gabinete-digital/expedientes-pr/expedientes-pr.page.ts @@ -36,10 +36,10 @@ export class ExpedientesPrPage implements OnInit { private router: Router, ) { this.loggeduser = authService.ValidatedUser; + this.LoadList(); } ngOnInit() { - this.LoadList(); this.router.events.forEach((event) => { if(event instanceof NavigationEnd && event.url == this.router.url) { this.LoadList(); @@ -47,15 +47,6 @@ export class ExpedientesPrPage implements OnInit { }); } - notImplemented(){ - this.alertService.presentAlert('Funcionalidade em desenvolvimento'); - } - - openExpedientDetailPage(data){ - console.log(data); - this.openExpedientDetail.emit(data); - } - LoadList(){ this.showLoader = true; switch (this.loggeduser.Profile) { @@ -124,13 +115,7 @@ export class ExpedientesPrPage implements OnInit { } goToExpediente(serialNumber:any){ - let navigationExtras: NavigationExtras = { - queryParams: { - "serialNumber": serialNumber, - "profile": this.loggeduser.Profile - } - }; - this.router.navigate(['/home/gabinete-digital/expedientes-pr/expediente-pr'], navigationExtras); + this.router.navigate(['/home/gabinete-digital/expedientes-pr',serialNumber,'gabinete-digital']); } async viewExpedientDetail(serialNumber:any) { diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.scss b/src/app/pages/gabinete-digital/gabinete-digital.page.scss index 197e3afa9..63a27d761 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.scss +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.scss @@ -104,17 +104,11 @@ ion-content{ width: 173px; height: 200px; margin: 7px; - //margin: 8px; padding: 30px 5px 30px 5px; border-radius: 15px; box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07); background: white; - //border: solid 1px #e9e9e9; - /* --background-color: #ffffff !important; */ - // background-color: #ffffff !important; float: left; - //border: 1px solid red; - //justify-content: center; } .exp-card-long{ cursor: pointer; @@ -125,7 +119,6 @@ ion-content{ width: 360px; margin: 7px 20px; border-radius: 15px; - // background-color: #ffffff !important; padding: 7px; border: blue !important; @@ -229,7 +222,6 @@ ion-content{ width: 35%; justify-content: flex-start !important; border-right: 1px solid #d8d8d8; - border: 1px solid red; .aside{ background:transparent; diff --git a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts index 2bb5e61b7..60b0a4e80 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts +++ b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts @@ -58,14 +58,18 @@ export class PedidoPage implements OnInit { private animationController: AnimationController, private toastService: ToastService,) { this.loggeduser = authService.ValidatedUser; - this.activatedRoute.queryParams.subscribe(params => { - if(params["serialNumber"]) { - this.serialnumber = params["serialNumber"]; - } - if(params["caller"]) { - this.caller = params["caller"]; - } - }); + + this.activatedRoute.paramMap.subscribe(params => { + console.log(params["params"]); + + if(params["params"].SerialNumber) { + this.serialnumber = params["params"].SerialNumber; + } + if(params["params"].caller) { + this.caller = params["params"].caller; + } + + }); } ngOnInit() { diff --git a/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts b/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts index 81e0fcec0..12af1ddce 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts +++ b/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts @@ -81,12 +81,7 @@ export class PedidosPage implements OnInit { } goToPedido(serialNumber:any){ - let navigationExtras: NavigationExtras = { - queryParams: { - "serialNumber": serialNumber, - } - }; - this.router.navigate(['/home/gabinete-digital/pedidos/pedido'], navigationExtras); + this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']); } notImplemented(){ diff --git a/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts b/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts index fff07e2cc..5b26ddcc8 100644 --- a/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts +++ b/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts @@ -129,78 +129,17 @@ export class PendentesPage implements OnInit { async viewTaskDetails(serialNumber:string, workflowName:string) { if(workflowName == 'Despacho'){ - this.goToDespacho(serialNumber); + this.router.navigate(['/home/gabinete-digital/despachos',serialNumber,'gabinete-digital']); } else if(workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento'){ - this.goToPedido(serialNumber); + this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']); } else if(workflowName == 'Expediente'){ - this.goToExpediente(serialNumber); + this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']); } } - - goToDespacho(serialNumber:any){ - let navigationExtras: NavigationExtras = { - queryParams: { - "serialNumber": serialNumber, - "from": "pendentes" - } - }; - this.router.navigate(['/home/gabinete-digital/despachos/despacho'], navigationExtras); - } - - goToPedido(serialNumber:any) { - let navigationExtras: NavigationExtras = { - queryParams: { - "serialNumber": serialNumber, - "from": "pendentes" - } - }; - this.router.navigate(['/home/gabinete-digital/pedidos/pedido'], navigationExtras); - } - - goToExpediente(serialNumber:any){ - this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']); - } - - - async openDespacho(serialNumber:string){ - - const modal = await this.modalController.create({ - component: DespachoPage, - componentProps:{ - enterAnimation: "", - serialNumber: serialNumber, - profile: this.profile, - }, - cssClass: 'modal modal-desktop', - }); - await modal.present(); - modal.onDidDismiss().then((res)=>{ - console.log('refresh list'); - this.LoadList(); - }); - } - - async openPedido(serialNumber:string){ - - const modal = await this.modalController.create({ - component: PedidoPage, - componentProps:{ - enterAnimation: "", - serialNumber: serialNumber, - profile: this.profile, - }, - cssClass: 'modal modal-desktop', - }); - await modal.present(); - modal.onDidDismiss().then((res)=>{ - console.log('refresh list'); - this.LoadList(); - }); - } } \ No newline at end of file diff --git a/src/app/pages/login/login.page.html b/src/app/pages/login/login.page.html index 4f8568efd..c63aa3c63 100644 --- a/src/app/pages/login/login.page.html +++ b/src/app/pages/login/login.page.html @@ -1,6 +1,6 @@
-
+
@@ -32,7 +32,7 @@
-
+
@@ -41,8 +41,8 @@
- Digite o PIN - Digite o novo PIN + Digite o PIN + Digite o novo PIN
@@ -70,11 +70,11 @@
-
+
Entrar com senha
-
+
Limpar
diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 50b902e5c..d59e0bcad 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -1,25 +1,12 @@ import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { AuthService } from 'src/app/services/auth.service'; -import { User, UserForm } from 'src/app/models/user.model'; +import { UserForm } from 'src/app/models/user.model'; import { ToastService } from 'src/app/services/toast.service'; import { environment } from 'src/environments/environment'; -import { AlertController, AnimationController, ModalController } from '@ionic/angular'; -import { StorageService } from 'src/app/services/storage.service'; -import { AuthConnstants } from 'src/app/config/auth-constants'; -import { PhotoService } from 'src/app/services/photo.service'; +import { AlertController } from '@ionic/angular'; import { NotificationsService } from 'src/app/services/notifications.service'; -import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import crypto from 'crypto-js' -import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; -import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; - -//import { Token } from '../../models/token.model'; -//import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx'; - -/* import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed } from '@capacitor/core'; -const { PushNotifications } = Plugins; -*/ @Component({ selector: 'app-login', @@ -34,43 +21,51 @@ export class LoginPage implements OnInit { userattempt: UserForm; code = [] - setPint = false - pin = false + hasPin: boolean + loginPreference: string + hasSession = false + setPin = false - userLoginPreference: any constructor( - private http: HttpClient, private notificatinsservice: NotificationsService, private router: Router, private authService: AuthService, - private storageService: StorageService, private toastService: ToastService, - private photoService: PhotoService, - public alertController: AlertController, - private modalController: ModalController, - private animationController: AnimationController, - - //private fcm: FCM + public alertController: AlertController ) { - let userData = JSON.parse(localStorage.getItem('UserData')) || {} - - if (userData.hasOwnProperty('loginPreference')) { - this.userLoginPreference = userData.loginPreference - this.pin = true - - } else { - - this.userLoginPreference = '' - this.setPint = false - this.pin = false - - } - } - ngOnInit() {} + ngOnInit() { + + // App has session + if(!localStorage.getItem('UserData')) { + this.hasSession = false + } else { + this.hasSession = true + // this.router.navigate(['/home/events']); + } + + let userData = JSON.parse(localStorage.getItem('UserData')) || {} + + const loginPreference = userData?.loginPreference + const pin = userData?.PIN + + if (pin) { + this.hasPin = true + } else { + this.hasPin = false + } + + if (loginPreference) { + this.loginPreference = loginPreference + + } else { + this.loginPreference = '' + } + + } //Function to validade the login inputs validateUsername() { @@ -114,13 +109,14 @@ export class LoginPage implements OnInit { } */ getToken() { - this.notificatinsservice.getAndpostToken(this.username); + this.notificatinsservice.getAndpostToken(this.username); } async Login() { if (this.validateUsername()) { if(this.validatePassword()){ + this.userattempt = { username: this.username, password: this.password, @@ -128,26 +124,24 @@ export class LoginPage implements OnInit { BasicAuthKey: "" } let attempt = await this.authService.login(this.userattempt); - console.log(JSON.stringify(attempt)); if (attempt) { - //this.loginRocketChat(); this.authService.loginChat(this.userattempt); this.getToken(); + this.hasSession = true + this.hasPin = false + this.setPin = true - if(!this.pin) { - this.setPint = true - this.pin = true + if(!this.hasPin || this.hasPin) { } else { this.router.navigate(['/home/events']); } - } else { this.toastService.badRequest('O nome de utilizador e/ou palavra-passe estão incorretas ou verifique a sua conexão com a internet e volte a tentar'); } } - else{ + else { this.toastService.badRequest('Por favor, insira a sua palavra-passe'); } } @@ -158,7 +152,6 @@ export class LoginPage implements OnInit { setCode(code: string) { - if(this.code.length < 4) { this.code.push(code) } @@ -168,25 +161,32 @@ export class LoginPage implements OnInit { const code = this.code.join('') const encrypted = crypto.SHA1(code) - if(this.setPint) { + if(!this.hasPin) { + // alert('storePin') this.storePin() } else { + // alert('pinLogin') this.pinLogin() } } - } clearCode() { this.code =[] } - pinLogin() { + pinLogin() { const code = this.code.join('') const encrypted = crypto.SHA1(code) + let userData = JSON.parse(localStorage.getItem('UserData')) || {} + const pin = userData?.PIN + + //if( encrypted == pin) { + if( encrypted == localStorage.getItem('PIN')) { + //this.toastService.successMessage() this.router.navigate(['/home/events']); } else { @@ -200,6 +200,12 @@ export class LoginPage implements OnInit { const code = this.code.join('') const encrypted = crypto.SHA1(code) + let userData: Object = JSON.parse(localStorage.getItem('UserData')) || {} + + userData['PIN'] = encrypted + + + localStorage.setItem('UserData', JSON.stringify(userData) ) localStorage.setItem('PIN', encrypted) @@ -207,50 +213,4 @@ export class LoginPage implements OnInit { } - - - async badRequest(message?: string, callback?) { - - - const enterAnimation = (baseEl: any) => { - const backdropAnimation = this.animationController.create() - .addElement(baseEl.querySelector('ion-backdrop')!) - .fromTo('opacity', '0.01', 'var(--backdrop-opacity)'); - - const wrapperAnimation = this.animationController.create() - .addElement(baseEl.querySelector('.modal-wrapper')!) - .keyframes([ - { offset: 0, opacity: '1', right: '-100%' }, - { offset: 1, opacity: '1', right: '0px' } - ]); - - return this.animationController.create() - .addElement(baseEl) - .easing('ease-out') - .duration(500) - .addAnimation([backdropAnimation, wrapperAnimation]); - } - - const leaveAnimation = (baseEl: any) => { - return enterAnimation(baseEl).direction('reverse'); - } - - - const modal = await this.modalController.create({ - enterAnimation, - leaveAnimation, - component: BadRequestPage, - componentProps: { - message: message || 'Processo não efetuado' , - }, - cssClass: 'notification-modal' - }); - - modal.present() - - setTimeout(()=> { - modal.dismiss() - },3000) - } - } \ No newline at end of file diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index 1a2f3e9db..43c264baf 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -66,7 +66,7 @@ export class NewPublicationPage implements OnInit { this.clear(); // this.takePicture(); } - takePicture(){ + takePicture() { const options: CameraOptions = { quality: 90, destinationType: this.camera.DestinationType.DATA_URL, @@ -177,16 +177,11 @@ export class NewPublicationPage implements OnInit { FileBase64: this.capturedImage, FileExtension: 'jpeg', } - - /* console.log('Create'); - console.log(this.publication); */ - this.publications.CreatePublication(this.folderId, this.publication).toPromise(); - this.close(); - try { console.log(this.publication); - await this.publications.CreatePublication(this.folderId, this.publication).toPromise() + await this.publications.CreatePublication(this.folderId, this.publication).toPromise(); + this.close(); this.toastService.successMessage("Publicação criado") diff --git a/src/app/pages/publications/publications.module.ts b/src/app/pages/publications/publications.module.ts index 6439f05ae..245306b66 100644 --- a/src/app/pages/publications/publications.module.ts +++ b/src/app/pages/publications/publications.module.ts @@ -18,6 +18,7 @@ import { NewPublicationPageModule } from 'src/app/shared/publication/new-publica import { NewActionPageModule } from 'src/app/shared/publication/new-action/new-action.module'; import { PublicationDetailPageModule } from 'src/app/shared/publication/view-publications/publication-detail/publication-detail.module'; import { HeaderPageModule } from 'src/app/shared/header/header.module'; +import { EditActionPageModule } from 'src/app/shared/publication/edit-action/edit-action.module'; @NgModule({ @@ -32,6 +33,7 @@ import { HeaderPageModule } from 'src/app/shared/header/header.module'; NewPublicationPageModule, PublicationDetailPageModule, NewActionPageModule, + EditActionPageModule, ], declarations: [ PublicationsPage, diff --git a/src/app/pages/publications/publications.page.html b/src/app/pages/publications/publications.page.html index 5df09a9ab..3c7eef106 100644 --- a/src/app/pages/publications/publications.page.html +++ b/src/app/pages/publications/publications.page.html @@ -34,17 +34,19 @@
-
-
- -
-
- -

{{viagem.Description}}

-

{{viagem.Detail}}

-
+
+
+ +
+
+ +

{{viagem.Description}}

+

{{viagem.Detail}}

+
+
+ +
-
+

{{evento.Description}}

+
+ +
@@ -70,7 +75,8 @@ desktopComponent.showViewPublication == false && desktopComponent.showAddNewPublication == false && desktopComponent.showPublicationDetail == false && - desktopComponent.showAddActions == false + desktopComponent.showAddActions == false && + desktopComponent.showEditActions == false )">
Nenhuma ação presidencial selecionada
@@ -116,6 +122,16 @@ (closeDesktopComponent)="closeDesktopComponent($event)" > + + + +
diff --git a/src/app/pages/publications/publications.page.scss b/src/app/pages/publications/publications.page.scss index f161f91d4..51eddcc14 100644 --- a/src/app/pages/publications/publications.page.scss +++ b/src/app/pages/publications/publications.page.scss @@ -104,44 +104,65 @@ ion-toolbar{ width: 100% !important; padding: 0 0px 0 0px !important; border-bottom: 1px solid #ebebeb; + align-items: center; + justify-content: space-between; + flex-direction: row; + + .item-icon{ + //margin-top: 28px; + width: 45px; + float: left; + font-size: 40px; + + .item-icon ion-icon{ + color: #061b52; + } + } + .item-icon2{ + //margin-top: 23px; + width: 45px; + float: left; + font-size: 40px; + } + + .item-content{ + width: 100%; + padding: 15px 0 15px 10px; + overflow: auto; + + p{ + white-space: nowrap; + overflow: hidden !important; + text-overflow: ellipsis !important; + } + + .item-content-date{ + color: #797979; + font-size: 13px; + margin: 0 !important; + padding: 0 !important; + } + .item-content-title{ + color: #0d89d1; + font-size: 15px; + margin: 0 !important; + padding: 0 !important; + } + .item-content-detail{ + color: #000000; + font-size: 13px; + margin: 0 !important; + padding: 0 !important; + } + } + + .item-options{ + + width: 25px; + font-size: 20px; + } } - .item-icon{ - margin-top: 28px; - width: 45px; - float: left; - font-size: 40px; - } - .item-icon2{ - margin-top: 23px; - width: 45px; - float: left; - font-size: 40px; - } - .item-icon ion-icon{ - color: #061b52; - } - .item-content{ - float: left; - padding: 15px 0 15px 10px; - } - .item-content-date{ - color: #797979; - font-size: 13px; - margin: 0 !important; - padding: 0 !important; - } - .item-content-title{ - color: #0d89d1; - font-size: 15px; - margin: 0 !important; - padding: 0 !important; - } - .item-content-detail{ - color: #000000; - font-size: 13px; - margin: 0 !important; - padding: 0 !important; - } + @@ -154,4 +175,7 @@ ion-toolbar{ .aside-left{ width: 35%; } + .item-options{ + display: block !important; + } } diff --git a/src/app/pages/publications/publications.page.ts b/src/app/pages/publications/publications.page.ts index 096bb77eb..4781abae5 100644 --- a/src/app/pages/publications/publications.page.ts +++ b/src/app/pages/publications/publications.page.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { Router, NavigationEnd } from '@angular/router'; -import { ModalController } from '@ionic/angular'; +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'; @@ -11,6 +11,7 @@ import { Animation, AnimationController } from '@ionic/angular'; import { LoadingController } from '@ionic/angular'; 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'; @Component({ @@ -38,7 +39,8 @@ export class PublicationsPage implements OnInit { showViewPublication: false, showAddNewPublication: false, showPublicationDetail: false, - showAddActions: false + showAddActions: false, + showEditActions: false } folderId: string; @@ -56,6 +58,7 @@ export class PublicationsPage implements OnInit { private animationController: AnimationController, private loading: LoadingService, private publications: PublicationsService, + private popoverController:PopoverController, ) { 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"]; @@ -263,6 +266,10 @@ export class PublicationsPage implements OnInit { this.desktopComponent.showPublicationDetail = true; } + + async updateDesktopComponent(e?:any){ + this.getActions(); + } async closeDesktopComponent (xx?: any){ @@ -272,7 +279,52 @@ export class PublicationsPage implements OnInit { showAddNewPublication: false, showPublicationDetail: false, showAddActions: false, + showEditActions: false, } } + async openOptions(id?: string) { + this.folderId = id; + const enterAnimation = (baseEl: any) => { + const backdropAnimation = this.animationController.create() + .addElement(baseEl.querySelector('ion-backdrop')!) + .fromTo('opacity', '0.01', 'var(--backdrop-opacity)'); + + const wrapperAnimation = this.animationController.create() + .addElement(baseEl.querySelector('.modal-wrapper')!) + .keyframes([ + { offset: 0, opacity: '1', right: '-100%' }, + { offset: 1, opacity: '1', right: '0px' } + ]); + + return this.animationController.create() + .addElement(baseEl) + .easing('ease-out') + .duration(500) + .addAnimation([backdropAnimation, wrapperAnimation]); + } + + const leaveAnimation = (baseEl: any) => { + return enterAnimation(baseEl).direction('reverse'); + } + + const modal = await this.modalController.create({ + enterAnimation, + leaveAnimation, + component: ActionsOptionsPage, + cssClass: 'model profile-modal search-submodal', + componentProps: { + id: id, + }, + //translucent: true + }); + await modal.present(); + modal.onDidDismiss().then(res =>{ + if(res['data']=='edit'){ + this.closeDesktopComponent(); + this.desktopComponent.showEditActions = true; + } + }); + } + } \ No newline at end of file diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts index 192700c27..d41e65fac 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -66,7 +66,7 @@ export class ViewPublicationsPage implements OnInit { } getPublicationDetail(){ - this.publications.GetPublicationFolderById(this.folderId).subscribe(res=>{ + this.publications.GetPresidentialAction(this.folderId).subscribe(res=>{ console.log(res); this.item = res; }); diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index 7fd25e3ea..91a224426 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -28,6 +28,8 @@ export class AuthService { public alertController: AlertController, ) { + + this.headers = new HttpHeaders(); if (localStorage.getItem("user") != null) { diff --git a/src/app/services/events.service.ts b/src/app/services/events.service.ts index a17062b26..52381241d 100644 --- a/src/app/services/events.service.ts +++ b/src/app/services/events.service.ts @@ -41,55 +41,59 @@ export class EventsService { - if(this.loggeduser.Profile == 'MDGPR'){ + if(this.loggeduser){ + if(this.loggeduser.Profile == 'MDGPR'){ - this.loggeduser.OwnerCalendars.forEach(calendar =>{ - if(calendar.CalendarName == 'Oficial'){ - this.headersMdOficial = this.headersMdOficial.set('Authorization', this.loggeduser.BasicAuthKey); - this.headersMdOficial = this.headersMdOficial.set('CalendarId', calendar.CalendarId); - this.headersMdOficial = this.headersMdOficial.set('CalendarRoleId', calendar.CalendarRoleId); - } - else if(calendar.CalendarName == 'Pessoal'){ - this.headersMdPessoal = this.headersMdPessoal.set('Authorization', this.loggeduser.BasicAuthKey); - this.headersMdPessoal = this.headersMdPessoal.set('CalendarId', calendar.CalendarId); - this.headersMdPessoal = this.headersMdPessoal.set('CalendarRoleId', calendar.CalendarRoleId); - - } - }); - - this.loggeduser.SharedCalendars.forEach(sharedCalendar =>{ - if(sharedCalendar.CalendarName == 'Oficial'){ - this.headersSharedOficial = this.headersSharedOficial.set('Authorization', this.loggeduser.BasicAuthKey); - this.headersSharedOficial = this.headersSharedOficial.set('CalendarId', sharedCalendar.CalendarId); - this.headersSharedOficial = this.headersSharedOficial.set('CalendarRoleId', sharedCalendar.CalendarRoleId); - } - else if(sharedCalendar.CalendarName == 'Pessoal'){ - this.headersSharedPessoal = this.headersSharedPessoal.set('Authorization', this.loggeduser.BasicAuthKey); - this.headersSharedPessoal = this.headersSharedPessoal.set('CalendarId', sharedCalendar.CalendarId); - this.headersSharedPessoal = this.headersSharedPessoal.set('CalendarRoleId', sharedCalendar.CalendarRoleId); - } - }); - - } - else if(this.loggeduser.Profile == 'PR'){ - - this.loggeduser.OwnerCalendars.forEach(calendar =>{ - if(calendar.CalendarName == 'Oficial'){ - this.headersPrOficial = this.headersPrOficial.set('Authorization', this.loggeduser.BasicAuthKey); - this.headersPrOficial = this.headersPrOficial.set('CalendarId', calendar.CalendarId); - this.headersPrOficial = this.headersPrOficial.set('CalendarRoleId', calendar.CalendarRoleId); - } - else if(calendar.CalendarName == 'Pessoal'){ - this.headersPrPessoal = this.headersPrPessoal.set('Authorization', this.loggeduser.BasicAuthKey); - this.headersPrPessoal = this.headersPrPessoal.set('CalendarId', calendar.CalendarId); - this.headersPrPessoal = this.headersPrPessoal.set('CalendarRoleId', calendar.CalendarRoleId); - - } - }); + this.loggeduser.OwnerCalendars.forEach(calendar =>{ + if(calendar.CalendarName == 'Oficial'){ + this.headersMdOficial = this.headersMdOficial.set('Authorization', this.loggeduser.BasicAuthKey); + this.headersMdOficial = this.headersMdOficial.set('CalendarId', calendar.CalendarId); + this.headersMdOficial = this.headersMdOficial.set('CalendarRoleId', calendar.CalendarRoleId); + } + else if(calendar.CalendarName == 'Pessoal'){ + this.headersMdPessoal = this.headersMdPessoal.set('Authorization', this.loggeduser.BasicAuthKey); + this.headersMdPessoal = this.headersMdPessoal.set('CalendarId', calendar.CalendarId); + this.headersMdPessoal = this.headersMdPessoal.set('CalendarRoleId', calendar.CalendarRoleId); + + } + }); + + this.loggeduser.SharedCalendars.forEach(sharedCalendar =>{ + if(sharedCalendar.CalendarName == 'Oficial'){ + this.headersSharedOficial = this.headersSharedOficial.set('Authorization', this.loggeduser.BasicAuthKey); + this.headersSharedOficial = this.headersSharedOficial.set('CalendarId', sharedCalendar.CalendarId); + this.headersSharedOficial = this.headersSharedOficial.set('CalendarRoleId', sharedCalendar.CalendarRoleId); + } + else if(sharedCalendar.CalendarName == 'Pessoal'){ + this.headersSharedPessoal = this.headersSharedPessoal.set('Authorization', this.loggeduser.BasicAuthKey); + this.headersSharedPessoal = this.headersSharedPessoal.set('CalendarId', sharedCalendar.CalendarId); + this.headersSharedPessoal = this.headersSharedPessoal.set('CalendarRoleId', sharedCalendar.CalendarRoleId); + } + }); + + } + else if(this.loggeduser.Profile == 'PR'){ + + this.loggeduser.OwnerCalendars.forEach(calendar =>{ + if(calendar.CalendarName == 'Oficial'){ + this.headersPrOficial = this.headersPrOficial.set('Authorization', this.loggeduser.BasicAuthKey); + this.headersPrOficial = this.headersPrOficial.set('CalendarId', calendar.CalendarId); + this.headersPrOficial = this.headersPrOficial.set('CalendarRoleId', calendar.CalendarRoleId); + } + else if(calendar.CalendarName == 'Pessoal'){ + this.headersPrPessoal = this.headersPrPessoal.set('Authorization', this.loggeduser.BasicAuthKey); + this.headersPrPessoal = this.headersPrPessoal.set('CalendarId', calendar.CalendarId); + this.headersPrPessoal = this.headersPrPessoal.set('CalendarRoleId', calendar.CalendarRoleId); + + } + }); + } + + this.headers = new HttpHeaders(); + this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); } - this.headers = new HttpHeaders(); - this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); + } /* getAllEvents(startdate:string, enddate:string): Observable{ @@ -245,9 +249,7 @@ export class EventsService { getEvent(eventid: string): Observable{ let geturl = environment.apiURL + 'calendar/GetEvent'; let params = new HttpParams(); - console.log(eventid); - params = params.set("EventId", eventid); let options = { diff --git a/src/app/services/processes.service.ts b/src/app/services/processes.service.ts index 1ec0cd1b6..67863f0c8 100644 --- a/src/app/services/processes.service.ts +++ b/src/app/services/processes.service.ts @@ -244,7 +244,6 @@ export class ProcessesService { } GetDocumentDetails(DocId:string, FsId:string){ - console.log(DocId); const geturl = environment.apiURL + 'search/documents'; let params = new HttpParams(); diff --git a/src/app/services/publications.service.ts b/src/app/services/publications.service.ts index 84f2e7483..9b5b4da46 100644 --- a/src/app/services/publications.service.ts +++ b/src/app/services/publications.service.ts @@ -29,7 +29,7 @@ export class PublicationsService { return this.http.get(`${geturl}`, options); } - GetPublicationFolderById(id:any){ + GetPresidentialAction(id:any){ const geturl = environment.apiURL + 'presidentialActions/'+id; let options = { @@ -38,6 +38,15 @@ export class PublicationsService { return this.http.get(`${geturl}`, options); } + UpdatePresidentialAction(body:any){ + const geturl = environment.apiURL + 'presidentialActions'; + + let options = { + headers: this.headers, + }; + return this.http.put(`${geturl}`, body, options); + } + CreatePublicationFolder(body:any){ const geturl = environment.apiURL + 'presidentialActions'; let options = { @@ -58,15 +67,11 @@ export class PublicationsService { }); } - DeletePublicationFolderById(id:any){ - const geturl = environment.apiURL + 'presidentialActions'; - let params = new HttpParams(); - - params = params.set("id", id); - + DeletePresidentialAction(id:any){ + const geturl = environment.apiURL + 'presidentialActions/'+id; + let options = { headers: this.headers, - params: params }; return this.http.delete(`${geturl}`, options); } diff --git a/src/app/shared/agenda/approve-event/approve-event.page.ts b/src/app/shared/agenda/approve-event/approve-event.page.ts index 5a3de6de5..dc8895e20 100644 --- a/src/app/shared/agenda/approve-event/approve-event.page.ts +++ b/src/app/shared/agenda/approve-event/approve-event.page.ts @@ -55,7 +55,6 @@ export class ApproveEventPage implements OnInit { this.getTask(); this.getAttachments(); - // console.log(this.showAside); } notImplemented() { @@ -79,7 +78,7 @@ export class ApproveEventPage implements OnInit { }) } - async approveTask(serialNumber:string){ + async approveTask(serialNumber:string) { let body = { "serialNumber": serialNumber, "action": "Aprovar" } try { @@ -101,8 +100,6 @@ export class ApproveEventPage implements OnInit { }); */ } - - async rejectTask(serialNumber:string) { let body = { "serialNumber": serialNumber, "action": "Rejeitar" } @@ -117,13 +114,13 @@ export class ApproveEventPage implements OnInit { } } - - async getAttachments(){ + + async getAttachments() { this.loadedAttachments = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise(); } - viewDocument(sourceId){ + viewDocument(sourceId) { this.processes.GetDocumentUrl(sourceId, '8').subscribe(res=>{ /* console.log(res); */ const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1"); @@ -143,7 +140,7 @@ export class ApproveEventPage implements OnInit { return await popover.present(); } - async emendTask(serialNumber:string){ + async emendTask(serialNumber:string) { console.log('Desktop'); const modal = await this.modalController.create({ @@ -186,7 +183,7 @@ export class ApproveEventPage implements OnInit { //this.goBack(); } - goToEventsToApprove(){ + goToEventsToApprove() { let navigationExtras: NavigationExtras = { queryParams: { "eventos": true, @@ -196,32 +193,10 @@ export class ApproveEventPage implements OnInit { } + /** @description edit event to aprove */ async editar(serialNumber: string) { - if(window.innerWidth > 800){ - console.log('DESTOP'); - - this.EditApproveEventDismiss.emit(); - } - else{ - /* const modal = await this.modalController.create({ - component: EditEventToApproveComponent, - componentProps: { - serialNumber: serialNumber, - InstanceId:this.InstanceId - }, - cssClass: 'modal modal-desktop', - // backdropDismiss: false - }); - await modal.present(); - modal.onDidDismiss().then(res => { - this.getTask(); - this.getAttachments(); - }); */ - } + + this.EditApproveEventDismiss.emit(); } - - - - } diff --git a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html index 00b8d3014..aef08ebf8 100644 --- a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html +++ b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html @@ -13,26 +13,43 @@
- +
-
+ +
+ +
+
+
+ Campo obrigatório. +
+
+ O campo deve ter pelo menos 4 caracteres. +
+
+
+
-
+
- -
+ +
+
+
+ Campo obrigatório. +
+
+
@@ -67,6 +84,14 @@
+ +
+
+
+ Adicionar participant. +
+
+
diff --git a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts index 687e93447..774c84205 100644 --- a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts +++ b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; -import { FormControl } from '@angular/forms'; +import { FormControl, FormGroup, Validators } from '@angular/forms'; import { AlertController, ModalController } from '@ionic/angular'; import * as moment from 'moment'; import { Attachment } from 'src/app/models/attachment.model'; @@ -11,6 +11,7 @@ import { EventsService } from 'src/app/services/events.service'; import { ProcessesService } from 'src/app/services/processes.service'; import { ToastService } from 'src/app/services/toast.service'; import { NgxMatDateFormats } from '@angular-material-components/datetime-picker'; +import { removeDuplicate } from 'src/plugin/removeDuplicate.js' const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { parse: { @@ -41,7 +42,6 @@ export class EditEventToApprovePage implements OnInit { public stepHour = 1; public stepMinute = 5; public stepSecond = 5; - public dateControlStart = new FormControl(moment("DD MM YYYY hh")); public dateControlEnd = new FormControl(moment("DD MM YYYY hh")); @@ -59,8 +59,6 @@ export class EditEventToApprovePage implements OnInit { @ViewChild('fim') fim: any; @ViewChild('inicio') inicio: any; @ViewChild('picker1') picker1: any; - - @Input() serialNumber: string loadedAttachments: Attachment[]= [] @@ -88,20 +86,18 @@ export class EditEventToApprovePage implements OnInit { show = false isRecurring:string; isEventEdited: boolean; - segment:string = "true"; profile:string; eventAttendees: EventPerson[]; loadedEventAttachments: Attachment[]; - taskParticipants: any = []; - taskParticipantsCc: any = []; adding: "intervenient" | "CC" = "intervenient"; - Location = '' - showAttendees = false; - InstanceId: string + InstanceId: string; + + Form: FormGroup; + validateFrom = false @Output() openAttendeesComponent = new EventEmitter(); @Output() clearContact = new EventEmitter(); @@ -109,6 +105,11 @@ export class EditEventToApprovePage implements OnInit { @Output() setIntervenientCC = new EventEmitter(); @Output() closeComponent = new EventEmitter(); + @Input() saveData: any; + @Input() serialNumber: string + @Input() taskParticipants: EventPerson[]; + @Input() taskParticipantsCc: EventPerson[]; + constructor( private modalController: ModalController, private eventsService: EventsService, @@ -117,64 +118,67 @@ export class EditEventToApprovePage implements OnInit { private processes:ProcessesService, private toastService: ToastService, ) { - - /* this.serialNumber = this.navParams.get('serialNumber'); */ - this.isEventEdited = false; } ngOnInit() { - if(!this.restoreTemporaryData()){ - + if(this.restoreTemporaryData()){ + this.setOtherData() } else { - alert('restore!!') + this.getTask(); + } - this.getTask(); - - // console.log(this.serialNumber); } async getTask() { - // console.log('this.eventProcess', this.eventProcess); - const result = await this.processes.GetTask(this.serialNumber).subscribe( result =>{ - this.eventProcess = result - - this.restoreDatepickerData() - - console.log(this.eventProcess.workflowInstanceDataFields.Subject) + this.processes.GetTask(this.serialNumber).subscribe( result =>{ + this.eventProcess = result + + this.restoreDatepickerData() // description let body : any =this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '') this.eventProcess.workflowInstanceDataFields.Body = body - this.Location = this.eventProcess.workflowInstanceDataFields.Location this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId this.getAttachments() - - if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) { - this.isRecurring = "Não se repete"; - } - else { - this.isRecurring = "Repete"; - } + + this.setOtherData() - if(this.eventProcess.workflowInstanceDataFields.ParticipantsList) { - this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => { - if(e.IsRequired) { - this.taskParticipants.push(e); - } else { - this.taskParticipantsCc.push(e); - } - }) - } - + this.saveTemporaryData() }) } + setOtherData() { + if(this.eventProcess.workflowInstanceDataFields.ParticipantsList) { + this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => { + if(e.IsRequired) { + this.taskParticipants.push(e); + } else { + this.taskParticipantsCc.push(e); + } + }) + } + + this.taskParticipants = removeDuplicate(this.taskParticipants) + this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc) + + if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) { + this.isRecurring = "Não se repete"; + } + else { + this.isRecurring = "Repete"; + } + + this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId + + this.getAttachments() + } + close() { window['temp.path:/shared/agenda/edit-event-to-approve.ts'] = {} @@ -187,11 +191,52 @@ export class EditEventToApprovePage implements OnInit { //this.deleteTemporaryData(); } - save() { + + runValidation() { + this.validateFrom = true + } + + injectValidation() { + + this.Form = new FormGroup({ + Subject: new FormControl(this.eventProcess.workflowInstanceDataFields.Subject, [ + Validators.required, + // Validators.minLength(4) + ]), + Location: new FormControl(this.eventProcess.workflowInstanceDataFields.Location, [ + Validators.required, + ]), + //CalendarName: new FormControl(this.postEvent.CalendarName), + // Categories: new FormControl(this.postEvent.Categories[0], [ + // Validators.required + // ]), + dateStart: new FormControl(this.dateStart, [ + Validators.required + ]), + dateEnd: new FormControl(this.dateEnd, [ + Validators.required + ]), + // IsRecurring: new FormControl(this.postEvent.IsRecurring, [ + // Validators.required + // ]), + participantes: new FormControl(this.taskParticipantsCc.concat(this.taskParticipants), [ + Validators.required + ]), + + }) + } + + save() { + + this.injectValidation() + this.runValidation() + + if(this.Form.invalid) return false + // set dates to eventProcess object this.getDatepickerData() - this.taskParticipantsCc.forEach(e=>{ + this.taskParticipantsCc.forEach( e => { e.IsRequired = false }) @@ -223,7 +268,6 @@ export class EditEventToApprovePage implements OnInit { ReviewUserComment: '' } - console.log(event); this.eventsService.postEventToApproveEdit(event).subscribe(()=>{ this.toastService.successMessage('Evento editado'); @@ -231,7 +275,6 @@ export class EditEventToApprovePage implements OnInit { this.toastService.badRequest('Evento não editado'); }) - this.loadedAttachments.forEach((document:any)=>{ if(document['action'] == 'add') { delete document.action @@ -251,7 +294,6 @@ export class EditEventToApprovePage implements OnInit { }) - this.modalController.dismiss(); } @@ -278,8 +320,8 @@ export class EditEventToApprovePage implements OnInit { // } dynamicSetIntervenient({taskParticipants, taskParticipantsCc}) { - this.taskParticipants = taskParticipants; - this.taskParticipantsCc = taskParticipantsCc; + this.taskParticipants = removeDuplicate(taskParticipants) ; + this.taskParticipantsCc = removeDuplicate(taskParticipantsCc) ; } @@ -297,8 +339,6 @@ export class EditEventToApprovePage implements OnInit { async addParticipantsCC() { - //this.saveTemporaryData(); - this.openAttendeesComponent.emit({ type: "CC" }); @@ -333,7 +373,6 @@ export class EditEventToApprovePage implements OnInit { } - async getAttachments() { let result: any = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise(); diff --git a/src/app/shared/agenda/edit-event/edit-event.page.html b/src/app/shared/agenda/edit-event/edit-event.page.html index 0d792ce3e..a7627682e 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.html +++ b/src/app/shared/agenda/edit-event/edit-event.page.html @@ -13,15 +13,27 @@
-
+ +
+
+
+
+ Campo obrigatório. +
+
+ O campo deve ter pelo menos 4 caracteres. +
+
+
+
-
+
@@ -30,8 +42,19 @@ Campo obrigatório --> -
+ +
+
+
+ Campo obrigatório. +
+
+ O campo deve ter pelo menos 4 caracteres. +
+
+
+
@@ -40,7 +63,7 @@
- + Oficial @@ -62,7 +85,7 @@
- + @@ -91,7 +114,7 @@
- +
- +
- + Não se repete @@ -161,13 +184,21 @@
+ +
+
+
+ Adicionar participant. +
+
+
-
+
@@ -190,7 +221,7 @@
-
+
diff --git a/src/app/shared/agenda/edit-event/edit-event.page.scss b/src/app/shared/agenda/edit-event/edit-event.page.scss index 285021125..e91c29131 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.scss +++ b/src/app/shared/agenda/edit-event/edit-event.page.scss @@ -201,4 +201,10 @@ ion-content{ .close-button { display: block !important; } +} + + + +.materia-top { + padding-top: 7px; } \ No newline at end of file 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 82437eff7..34e38c31d 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.ts +++ b/src/app/shared/agenda/edit-event/edit-event.page.ts @@ -10,7 +10,7 @@ import { SearchPage } from 'src/app/pages/search/search.page'; import { AttachmentsService } from 'src/app/services/attachments.service'; import { Attachment } from 'src/app/models/attachment.model'; import { ToastService } from 'src/app/services/toast.service'; -import { FormControl } from '@angular/forms'; +import { FormControl, FormGroup, Validators } from '@angular/forms'; import * as moment from 'moment'; @Component({ @@ -20,7 +20,6 @@ import * as moment from 'moment'; }) export class EditEventPage implements OnInit { - stEvent: Event; isRecurring:string; isEventEdited: boolean; @@ -44,6 +43,9 @@ export class EditEventPage implements OnInit { public stepMinute = 5; public stepSecond = 5; + Form: FormGroup; + validateFrom = false + @Input() taskParticipants: EventPerson[]; @Input() taskParticipantsCc: EventPerson[]; @Input() profile:string; @@ -86,7 +88,6 @@ export class EditEventPage implements OnInit { public stepMinutes = [1, 5, 10, 15, 20, 25]; public stepSeconds = [1, 5, 10, 15, 20, 25]; - constructor( private modalController: ModalController, private eventsService: EventsService, @@ -96,12 +97,11 @@ export class EditEventPage implements OnInit { } ngOnInit() { - - if(!this.restoreTemporaryData()){ + if(!this.restoreTemporaryData()) { // clear - if(this.postEvent){ + if(this.postEvent) { if( this.postEvent.Body){ if(typeof(this.postEvent.Body.Text) == 'string'){ this.postEvent.Body.Text = this.postEvent.Body.Text.replace(/<[^>]+>/g, ''); @@ -128,7 +128,7 @@ export class EditEventPage implements OnInit { this.isEventEdited = false; - if(this.postEvent.IsRecurring == false){ + if(this.postEvent.IsRecurring == false) { this.isRecurring = "Não se repete"; } else{ @@ -139,7 +139,6 @@ export class EditEventPage implements OnInit { this.getAttachments(this.postEvent.EventId); this.restoreDatepickerData() - } close() { @@ -151,8 +150,49 @@ export class EditEventPage implements OnInit { this.deleteTemporaryData(); } + + runValidation() { + this.validateFrom = true + } + + injectValidation() { + + this.Form = new FormGroup({ + Subject: new FormControl(this.postEvent.Subject, [ + Validators.required, + // Validators.minLength(4) + ]), + Location: new FormControl(this.postEvent.Location, [ + Validators.required, + ]), + CalendarName: new FormControl(this.postEvent.CalendarName), + Categories: new FormControl(this.postEvent.Categories[0], [ + Validators.required + ]), + dateStart: new FormControl(this.dateStart, [ + Validators.required + ]), + dateEnd: new FormControl(this.dateEnd, [ + Validators.required + ]), + IsRecurring: new FormControl(this.postEvent.IsRecurring, [ + Validators.required + ]), + participantes: new FormControl(this.taskParticipantsCc.concat(this.taskParticipants), [ + Validators.required + ]), + + }) + } + + async save() { + this.injectValidation() + this.runValidation() + + if(this.Form.invalid) return false + this.getDatepickerData() this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc); @@ -190,7 +230,6 @@ export class EditEventPage implements OnInit { this.clearContact.emit(); } - async addParticipantsCc() { this.saveTemporaryData(); @@ -245,7 +284,6 @@ export class EditEventPage implements OnInit { return false; } - } deleteTemporaryData(){ diff --git a/src/app/shared/agenda/event-list/event-list.page.ts b/src/app/shared/agenda/event-list/event-list.page.ts index 4fad35895..15ec45d77 100644 --- a/src/app/shared/agenda/event-list/event-list.page.ts +++ b/src/app/shared/agenda/event-list/event-list.page.ts @@ -15,8 +15,8 @@ export class EventListPage implements OnInit { // [desktop] event list to approve showLoader: boolean; - eventsPRList: any; - eventsMDGPRList: any; + eventsPRList: any = [] + eventsMDGPRList: any = [] eventPerson: EventPerson; eventBody: EventBody; categories: string[]; diff --git a/src/app/shared/agenda/new-event/new-event.page.html b/src/app/shared/agenda/new-event/new-event.page.html index d095b64d7..55376a244 100644 --- a/src/app/shared/agenda/new-event/new-event.page.html +++ b/src/app/shared/agenda/new-event/new-event.page.html @@ -14,7 +14,7 @@
-
+
@@ -35,23 +35,23 @@
-
+
-
-
-
- Campo obrigatório. -
-
- O campo deve ter pelo menos 4 caracteres. -
+
+
+
+ Campo obrigatório. +
+
+ O campo deve ter pelo menos 4 caracteres.
+
@@ -150,7 +150,7 @@ @@ -190,12 +190,20 @@
+
+
+
+ Adicionar participant. +
+
+
+
-
+
@@ -218,7 +226,7 @@
-
+
diff --git a/src/app/shared/agenda/new-event/new-event.page.scss b/src/app/shared/agenda/new-event/new-event.page.scss index f7dbbd685..0e05a84b1 100644 --- a/src/app/shared/agenda/new-event/new-event.page.scss +++ b/src/app/shared/agenda/new-event/new-event.page.scss @@ -214,4 +214,5 @@ .materia-top { padding-top: 7px; -} \ No newline at end of file +} + diff --git a/src/app/shared/agenda/new-event/new-event.page.ts b/src/app/shared/agenda/new-event/new-event.page.ts index a3bf1ec21..681ac04e3 100644 --- a/src/app/shared/agenda/new-event/new-event.page.ts +++ b/src/app/shared/agenda/new-event/new-event.page.ts @@ -62,7 +62,7 @@ export class NewEventPage implements OnInit { public touchUi = false; public enableMeridian = false; public minDate = new Date(); - public maxDate = ''; + public endMinDate = new Date(new Date().getTime() + 15 * 60000); public stepHour = 1; public stepMinute = 5; public stepSecond = 5; @@ -94,7 +94,7 @@ export class NewEventPage implements OnInit { @ViewChild('inicio') inicio: any; @ViewChild('picker1') picker1: any; - Form: any = {} + Form: FormGroup; validateFrom = false @@ -125,11 +125,8 @@ export class NewEventPage implements OnInit { private modalController: ModalController, private eventService: EventsService, private attachmentsService: AttachmentsService, - private animationController: AnimationController, private toastService: ToastService, private userService: AuthService, - private http: HttpClient, - private zone: NgZone, private dateAdapter: DateAdapter, // private translate: TranslateService ) { @@ -212,7 +209,6 @@ export class NewEventPage implements OnInit { }) } - this.taskParticipants = removeDuplicate(this.taskParticipants); this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc); @@ -237,7 +233,7 @@ export class NewEventPage implements OnInit { this.Form = new FormGroup({ Subject: new FormControl(this.postEvent.Subject, [ Validators.required, - Validators.minLength(4) + // Validators.minLength(4) ]), Location: new FormControl(this.postEvent.Location, [ Validators.required, @@ -255,16 +251,13 @@ export class NewEventPage implements OnInit { IsRecurring: new FormControl(this.postEvent.IsRecurring, [ Validators.required ]), - participantes: new FormControl(this.participantes, [ + participantes: new FormControl(this.taskParticipantsCc.concat(this.taskParticipants), [ Validators.required ]), }) } - get participantes() { - return this.taskParticipantsCc.concat(this.taskParticipants) - } openInicio() { let input: any = document.querySelector('#new-inicio') @@ -327,10 +320,10 @@ export class NewEventPage implements OnInit { async save() { + this.injectValidation() this.runValidation() - // dont runt this function - // if (!this.Form.valid) return false + if(this.Form.invalid) return false this.getDatepickerData() diff --git a/src/app/shared/event/attendee-modal/attendee-modal.page.ts b/src/app/shared/event/attendee-modal/attendee-modal.page.ts index e6011df58..0c3a952e6 100644 --- a/src/app/shared/event/attendee-modal/attendee-modal.page.ts +++ b/src/app/shared/event/attendee-modal/attendee-modal.page.ts @@ -3,6 +3,7 @@ import { ModalController } from '@ionic/angular'; import { ContactsService } from 'src/app/services/contacts.service'; import { EventPerson } from 'src/app/models/eventperson.model'; import { removeDuplicate } from 'src/plugin/removeDuplicate.js' + @Component({ selector: 'app-attendee-modal', templateUrl: './attendee-modal.page.html', @@ -35,16 +36,14 @@ export class AttendeePage implements OnInit { private modalCtrl: ModalController, private contactsService: ContactsService ) { - this.LtaskParticipants = this.taskParticipants; - this.LtaskParticipantsCc = this.taskParticipantsCc; - + this.LtaskParticipants = removeDuplicate(this.taskParticipants); + this.LtaskParticipantsCc = removeDuplicate(this.taskParticipantsCc); } ngOnChanges(){ - this.LtaskParticipants = this.taskParticipants; - this.LtaskParticipantsCc = this.taskParticipantsCc; + this.LtaskParticipants = removeDuplicate(this.taskParticipants); + this.LtaskParticipantsCc = removeDuplicate(this.taskParticipantsCc); } - currentPath = window.location.pathname; @Input() adding: "intervenient" | "CC"; diff --git a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.ts b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.ts index 406b8384c..c4882f5a6 100644 --- a/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.ts +++ b/src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.ts @@ -122,7 +122,7 @@ export class EditEventToApproveComponent implements OnInit { private animationController: AnimationController, private toastService: ToastService, ) { - + // Edit event to approve this.serialNumber = this.navParams.get('serialNumber'); this.isEventEdited = false; diff --git a/src/app/shared/headers/header-no-search/profile/profile.page.html b/src/app/shared/headers/header-no-search/profile/profile.page.html index 6d54d67b5..0d6d6415b 100644 --- a/src/app/shared/headers/header-no-search/profile/profile.page.html +++ b/src/app/shared/headers/header-no-search/profile/profile.page.html @@ -7,9 +7,9 @@
Perfil
-
+
@@ -24,7 +24,7 @@
-