mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
save
This commit is contained in:
@@ -267,64 +267,149 @@ export class CreateProcessPage implements OnInit {
|
|||||||
this.dispatchFolder.SubjectTypes = this.selectedTypes;
|
this.dispatchFolder.SubjectTypes = this.selectedTypes;
|
||||||
const loader = this.toastService.loading()
|
const loader = this.toastService.loading()
|
||||||
|
|
||||||
switch (this.loggeduser.Profile) {
|
|
||||||
case 'MDGPR':
|
|
||||||
|
|
||||||
switch (this.taskType) {
|
if(this.loggeduser.Profile != 'PR') {
|
||||||
case '0': // Despacho
|
switch (this.taskType) {
|
||||||
this.postData = {
|
case '0': // Despacho
|
||||||
DistributionType: "Paralelo",
|
this.postData = {
|
||||||
CountryCode: 'AO',
|
DistributionType: "Paralelo",
|
||||||
Priority: this.postData.Priority,
|
CountryCode: 'AO',
|
||||||
UserEmail: this.loggeduser.Email,
|
Priority: this.postData.Priority,
|
||||||
UsersSelected: attendees,
|
UserEmail: this.loggeduser.Email,
|
||||||
DispatchFolder: this.dispatchFolder,
|
UsersSelected: attendees,
|
||||||
|
DispatchFolder: this.dispatchFolder,
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.processes.postDespatcho(this.postData).toPromise();
|
||||||
|
await this.despachoService.EfectuarDespacho({serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise();
|
||||||
|
|
||||||
|
this.modalController.dismiss();
|
||||||
|
this.toastService._successMessage('Despacho criado');
|
||||||
|
} catch (error) {
|
||||||
|
this.toastService._badRequest('Processo não efectuado');
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
loader.remove()
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '1': // pedido de Parecer
|
||||||
|
this.postData = {
|
||||||
|
DistributionType: "Paralelo",
|
||||||
|
CountryCode: 'AO',
|
||||||
|
Priority: this.postData.Priority,
|
||||||
|
UserEmail: this.loggeduser.Email,
|
||||||
|
UsersSelected: attendees,
|
||||||
|
DispatchFolder: this.dispatchFolder,
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if(this.task.activityInstanceName == 'Tarefa de Despacho' || this.task.activityInstanceName == 'Reexecutar Despacho') {
|
||||||
|
await this.despachoService.createParecer(this.postData).toPromise();
|
||||||
|
await this.despachoService.solicitarParecer({ serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise();
|
||||||
|
} else {
|
||||||
|
await this.pedidoService.createParecer(this.postData).toPromise();
|
||||||
|
await this.pedidoService.taskCompleteParecer({serialNumber:this.task.serialNumber}).toPromise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.modalController.dismiss();
|
||||||
|
this.toastService._successMessage('Pedido de Parecer enviado');
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
this.toastService._badRequest('Processo não efectuado');
|
||||||
|
} finally {
|
||||||
|
loader.remove()
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '2': // Pedido de Deferimento
|
||||||
|
this.postData = {
|
||||||
|
DistributionType: "Paralelo",
|
||||||
|
CountryCode: 'AO',
|
||||||
|
Priority: this.postData.Priority,
|
||||||
|
UserEmail: this.loggeduser.Email,
|
||||||
|
UsersSelected: attendees,
|
||||||
|
DispatchFolder: this.dispatchFolder,
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.pedidoService.createDeferimento(this.postData).toPromise();
|
||||||
|
await this.pedidoService.taskCompleteDeferimento({serialNumber:this.task.serialNumber}).toPromise();
|
||||||
|
|
||||||
|
this.modalController.dismiss();
|
||||||
|
this.toastService._successMessage('Pedido de Deferimento criado');
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
this.toastService._badRequest('Processo não efectuado');
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
loader.remove()
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (this.loggeduser.Profile == 'PR') {
|
||||||
|
switch (this.taskType) {
|
||||||
|
case '0': // Despacho PR
|
||||||
|
this.postData = {
|
||||||
|
DistributionType: "Paralelo",
|
||||||
|
CountryCode: 'AO',
|
||||||
|
Priority: this.postData.Priority,
|
||||||
|
UserEmail: this.loggeduser.Email,
|
||||||
|
UsersSelected: attendees,
|
||||||
|
DispatchFolder: this.dispatchFolder,
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.postData.DispatchFolder.Message){
|
||||||
try {
|
try {
|
||||||
await this.processes.postDespatcho(this.postData).toPromise();
|
await this.despachoService.createDespacho(this.postData).toPromise();
|
||||||
await this.despachoService.EfectuarDespacho({serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise();
|
await this.despachoService.CompleteTask({serialNumber: this.task.serialNumber}).toPromise();
|
||||||
|
|
||||||
this.modalController.dismiss();
|
this.modalController.dismiss();
|
||||||
this.toastService._successMessage('Despacho criado');
|
this.toastService._successMessage('Despacho criado');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.toastService._badRequest('Processo não efectuado');
|
this.toastService._badRequest('Processo não efectuado');
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
loader.remove()
|
//loader.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.validateField = true;
|
||||||
|
this.toastService._badRequest('Por favor adicione uma descrição');
|
||||||
|
}
|
||||||
|
loader.remove();
|
||||||
|
break;
|
||||||
|
case '1': // Pedido de Parecer
|
||||||
|
this.postData = {
|
||||||
|
DistributionType: "Paralelo",
|
||||||
|
CountryCode: 'AO',
|
||||||
|
Priority: this.postData.Priority,
|
||||||
|
UserEmail: this.loggeduser.Email,
|
||||||
|
UsersSelected: attendees,
|
||||||
|
DispatchFolder: this.dispatchFolder,
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if(this.task.activityInstanceName == 'Tarefa de Despacho' || this.task.activityInstanceName == 'Reexecutar Despacho') {
|
||||||
|
await this.despachoService.createParecer(this.postData).toPromise();
|
||||||
|
await this.despachoService.solicitarParecer({ serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise();
|
||||||
|
} else {
|
||||||
|
await this.pedidoService.createParecer(this.postData).toPromise();
|
||||||
|
await this.pedidoService.taskCompleteParecer({serialNumber:this.task.serialNumber}).toPromise();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
this.modalController.dismiss();
|
||||||
case '1': // pedido de Parecer
|
this.toastService._successMessage('Pedido de Parecer criado');
|
||||||
this.postData = {
|
}
|
||||||
DistributionType: "Paralelo",
|
catch (error) {
|
||||||
CountryCode: 'AO',
|
this.toastService._badRequest('Processo não efectuado');
|
||||||
Priority: this.postData.Priority,
|
} finally {
|
||||||
UserEmail: this.loggeduser.Email,
|
loader.remove()
|
||||||
UsersSelected: attendees,
|
}
|
||||||
DispatchFolder: this.dispatchFolder,
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
break;
|
||||||
if(this.task.activityInstanceName == 'Tarefa de Despacho' || this.task.activityInstanceName == 'Reexecutar Despacho') {
|
case '2': // Pedido de Deferimento
|
||||||
await this.despachoService.createParecer(this.postData).toPromise();
|
|
||||||
await this.despachoService.solicitarParecer({ serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise();
|
|
||||||
} else {
|
|
||||||
await this.pedidoService.createParecer(this.postData).toPromise();
|
|
||||||
await this.pedidoService.taskCompleteParecer({serialNumber:this.task.serialNumber}).toPromise();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.modalController.dismiss();
|
|
||||||
this.toastService._successMessage('Pedido de Parecer enviado');
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
this.toastService._badRequest('Processo não efectuado');
|
|
||||||
} finally {
|
|
||||||
loader.remove()
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case '2': // Pedido de Deferimento
|
|
||||||
this.postData = {
|
this.postData = {
|
||||||
DistributionType: "Paralelo",
|
DistributionType: "Paralelo",
|
||||||
CountryCode: 'AO',
|
CountryCode: 'AO',
|
||||||
@@ -343,102 +428,12 @@ export class CreateProcessPage implements OnInit {
|
|||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
this.toastService._badRequest('Processo não efectuado');
|
this.toastService._badRequest('Processo não efectuado');
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
loader.remove()
|
loader.remove()
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'PR':
|
|
||||||
switch (this.taskType) {
|
|
||||||
case '0': // Despacho PR
|
|
||||||
this.postData = {
|
|
||||||
DistributionType: "Paralelo",
|
|
||||||
CountryCode: 'AO',
|
|
||||||
Priority: this.postData.Priority,
|
|
||||||
UserEmail: this.loggeduser.Email,
|
|
||||||
UsersSelected: attendees,
|
|
||||||
DispatchFolder: this.dispatchFolder,
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.postData.DispatchFolder.Message){
|
|
||||||
try {
|
|
||||||
await this.despachoService.createDespacho(this.postData).toPromise();
|
|
||||||
await this.despachoService.CompleteTask({serialNumber: this.task.serialNumber}).toPromise();
|
|
||||||
|
|
||||||
this.modalController.dismiss();
|
|
||||||
this.toastService._successMessage('Despacho criado');
|
|
||||||
} catch (error) {
|
|
||||||
this.toastService._badRequest('Processo não efectuado');
|
|
||||||
} finally {
|
|
||||||
//loader.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.validateField = true;
|
|
||||||
this.toastService._badRequest('Por favor adicione uma descrição');
|
|
||||||
}
|
|
||||||
loader.remove();
|
|
||||||
break;
|
|
||||||
case '1': // Pedido de Parecer
|
|
||||||
this.postData = {
|
|
||||||
DistributionType: "Paralelo",
|
|
||||||
CountryCode: 'AO',
|
|
||||||
Priority: this.postData.Priority,
|
|
||||||
UserEmail: this.loggeduser.Email,
|
|
||||||
UsersSelected: attendees,
|
|
||||||
DispatchFolder: this.dispatchFolder,
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
if(this.task.activityInstanceName == 'Tarefa de Despacho' || this.task.activityInstanceName == 'Reexecutar Despacho') {
|
|
||||||
await this.despachoService.createParecer(this.postData).toPromise();
|
|
||||||
await this.despachoService.solicitarParecer({ serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise();
|
|
||||||
} else {
|
|
||||||
await this.pedidoService.createParecer(this.postData).toPromise();
|
|
||||||
await this.pedidoService.taskCompleteParecer({serialNumber:this.task.serialNumber}).toPromise();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.modalController.dismiss();
|
|
||||||
this.toastService._successMessage('Pedido de Parecer criado');
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
this.toastService._badRequest('Processo não efectuado');
|
|
||||||
} finally {
|
|
||||||
loader.remove()
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case '2': // Pedido de Deferimento
|
|
||||||
this.postData = {
|
|
||||||
DistributionType: "Paralelo",
|
|
||||||
CountryCode: 'AO',
|
|
||||||
Priority: this.postData.Priority,
|
|
||||||
UserEmail: this.loggeduser.Email,
|
|
||||||
UsersSelected: attendees,
|
|
||||||
DispatchFolder: this.dispatchFolder,
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await this.pedidoService.createDeferimento(this.postData).toPromise();
|
|
||||||
await this.pedidoService.taskCompleteDeferimento({serialNumber:this.task.serialNumber}).toPromise();
|
|
||||||
|
|
||||||
this.modalController.dismiss();
|
|
||||||
this.toastService._successMessage('Pedido de Deferimento criado');
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
this.toastService._badRequest('Processo não efectuado');
|
|
||||||
} finally {
|
|
||||||
loader.remove()
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user