Add validation for mobile

This commit is contained in:
Peter Maquiran
2021-07-05 15:37:27 +01:00
parent ba2af92a6d
commit 9d7b7e541b
2 changed files with 69 additions and 73 deletions
@@ -199,73 +199,69 @@ export class CreateProcessPage implements OnInit {
this.dispatchFolder.SubjectTypes = this.selectedTypes; this.dispatchFolder.SubjectTypes = this.selectedTypes;
switch (this.loggeduser.Profile) { switch (this.loggeduser.Profile) {
case 'MDGPR': 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 { switch (this.taskType) {
await this.processes.postParecer(this.postData).toPromise(); case '0':
this.FinalizarParecer('Pedido de Parecer enviado'); this.postData = {
} DistributionType: "Paralelo",
catch (error) { CountryCode: 'AO',
this.toastService.badRequest('Processo não efectuado'); Priority: this.postData.Priority,
} UserEmail: this.loggeduser.Email,
UsersSelected: attendees,
break; DispatchFolder: this.dispatchFolder,
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(); console.log('this.postData', this.postData, this.taskType);
}
else { try {
this.toastService.badRequest('Lista de intervenientes vazia. Por favor, adicione 1 ou mais intervenientes.'); 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; break;
case 'PR': case 'PR':
@@ -62,14 +62,14 @@ export class DespachosPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
//Inicializar segment //Inicializar segment
this.segment = "despachos"; this.segment = "despachos";
this.LoadList(); this.LoadList();
this.router.events.forEach((event) => { this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) { if(event instanceof NavigationEnd && event.url == this.router.url) {
this.doRefresh(); this.doRefresh();
} }
}); });
} }