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;
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':