From 9d7b7e541b3de43b3902ca7908db091d63d2ee54 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Mon, 5 Jul 2021 15:37:27 +0100 Subject: [PATCH] Add validation for mobile --- .../create-process/create-process.page.ts | 126 +++++++++--------- .../despachos/despachos.page.ts | 16 +-- 2 files changed, 69 insertions(+), 73 deletions(-) diff --git a/src/app/modals/create-process/create-process.page.ts b/src/app/modals/create-process/create-process.page.ts index a1e807243..3d70e3e03 100644 --- a/src/app/modals/create-process/create-process.page.ts +++ b/src/app/modals/create-process/create-process.page.ts @@ -199,73 +199,69 @@ export class CreateProcessPage implements OnInit { this.dispatchFolder.SubjectTypes = this.selectedTypes; switch (this.loggeduser.Profile) { case 'MDGPR': - if(this.taskParticipants.length > 0) { - switch (this.taskType) { - case '0': - this.postData = { - DistributionType: "Paralelo", - CountryCode: 'AO', - Priority: this.postData.Priority, - UserEmail: this.loggeduser.Email, - UsersSelected: attendees, - DispatchFolder: this.dispatchFolder, - } - console.log('this.postData', this.postData, this.taskType); - - try { - await this.processes.postDespatcho(this.postData).toPromise(); - this.FinalizarDespacho('Despacho criado'); - } catch (error) { - this.toastService.badRequest('Processo não efectuado'); - } - - break; - case '1': - this.postData = { - DistributionType: "Paralelo", - CountryCode: 'AO', - Priority: this.postData.Priority, - UserEmail: this.loggeduser.Email, - UsersSelected: attendees, - DispatchFolder: this.dispatchFolder, - } - console.log(this.postData); - try { - await this.processes.postParecer(this.postData).toPromise(); - this.FinalizarParecer('Pedido de Parecer enviado'); - } - catch (error) { - this.toastService.badRequest('Processo não efectuado'); - } - - break; - case '2': - this.postData = { - DistributionType: "Paralelo", - CountryCode: 'AO', - Priority: this.postData.Priority, - UserEmail: this.loggeduser.Email, - UsersSelected: attendees, - DispatchFolder: this.dispatchFolder, - } - console.log(this.postData); - - try { - await this.processes.postDeferimento(this.postData).toPromise(); - this.FinalizarDeferimento('Pedido de deferimento enviado'); - } - catch (error) { - this.toastService.badRequest('Processo não efectuado'); - } - break; + switch (this.taskType) { + case '0': + this.postData = { + DistributionType: "Paralelo", + CountryCode: 'AO', + Priority: this.postData.Priority, + UserEmail: this.loggeduser.Email, + UsersSelected: attendees, + DispatchFolder: this.dispatchFolder, } - this.modalController.dismiss(); - } - else { - this.toastService.badRequest('Lista de intervenientes vazia. Por favor, adicione 1 ou mais intervenientes.'); - } - + console.log('this.postData', this.postData, this.taskType); + + try { + await this.processes.postDespatcho(this.postData).toPromise(); + this.FinalizarDespacho('Despacho criado'); + } catch (error) { + this.toastService.badRequest('Processo não efectuado'); + } + + break; + case '1': + this.postData = { + DistributionType: "Paralelo", + CountryCode: 'AO', + Priority: this.postData.Priority, + UserEmail: this.loggeduser.Email, + UsersSelected: attendees, + DispatchFolder: this.dispatchFolder, + } + console.log(this.postData); + + try { + await this.processes.postParecer(this.postData).toPromise(); + this.FinalizarParecer('Pedido de Parecer enviado'); + } + catch (error) { + this.toastService.badRequest('Processo não efectuado'); + } + + break; + case '2': + this.postData = { + DistributionType: "Paralelo", + CountryCode: 'AO', + Priority: this.postData.Priority, + UserEmail: this.loggeduser.Email, + UsersSelected: attendees, + DispatchFolder: this.dispatchFolder, + } + console.log(this.postData); + + try { + await this.processes.postDeferimento(this.postData).toPromise(); + this.FinalizarDeferimento('Pedido de deferimento enviado'); + } + catch (error) { + this.toastService.badRequest('Processo não efectuado'); + } + break; + } + this.modalController.dismiss(); + break; case 'PR': diff --git a/src/app/shared/gabinete-digital/despachos/despachos.page.ts b/src/app/shared/gabinete-digital/despachos/despachos.page.ts index 31f37ccf1..3257653da 100644 --- a/src/app/shared/gabinete-digital/despachos/despachos.page.ts +++ b/src/app/shared/gabinete-digital/despachos/despachos.page.ts @@ -62,14 +62,14 @@ export class DespachosPage implements OnInit { } ngOnInit() { - //Inicializar segment - this.segment = "despachos"; - this.LoadList(); - this.router.events.forEach((event) => { - if(event instanceof NavigationEnd && event.url == this.router.url) { - this.doRefresh(); - } - }); + //Inicializar segment + this.segment = "despachos"; + this.LoadList(); + this.router.events.forEach((event) => { + if(event instanceof NavigationEnd && event.url == this.router.url) { + this.doRefresh(); + } + }); }