mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Improve
This commit is contained in:
@@ -19,7 +19,7 @@ import { NgxMatDateFormats } from '@angular-material-components/datetime-picker'
|
||||
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
|
||||
import { PermissionService } from 'src/app/OtherService/permission.service';
|
||||
import { DespachoService } from 'src/app/Rules/despacho.service';
|
||||
|
||||
import { PedidoService } from 'src/app/Rules/pedido.service'
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -94,7 +94,8 @@ export class CreateProcessPage implements OnInit {
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,
|
||||
public p: PermissionService,
|
||||
private despachoService: DespachoService
|
||||
private despachoService: DespachoService,
|
||||
private pedidoService: PedidoService
|
||||
) {
|
||||
this.loggeduser = userAuth.ValidatedUser;
|
||||
this.task = this.navParams.get('task');
|
||||
@@ -163,9 +164,9 @@ export class CreateProcessPage implements OnInit {
|
||||
this.subjectTypes = res;
|
||||
});
|
||||
}
|
||||
|
||||
cancelTask() {
|
||||
this.modalController.dismiss(null);
|
||||
|
||||
}
|
||||
|
||||
runValidation() {
|
||||
@@ -263,7 +264,7 @@ export class CreateProcessPage implements OnInit {
|
||||
}
|
||||
|
||||
break;
|
||||
case '1':
|
||||
case '1': // pedido de Parecer
|
||||
this.postData = {
|
||||
DistributionType: "Paralelo",
|
||||
CountryCode: 'AO',
|
||||
@@ -275,16 +276,19 @@ export class CreateProcessPage implements OnInit {
|
||||
console.log(this.postData);
|
||||
|
||||
try {
|
||||
await this.processes.postParecer(this.postData).toPromise();
|
||||
await this.FinalizarParecer(loader, 'Pedido de Parecer enviado');
|
||||
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':
|
||||
case '2': // Pedido de Deferimento
|
||||
this.postData = {
|
||||
DistributionType: "Paralelo",
|
||||
CountryCode: 'AO',
|
||||
@@ -296,11 +300,15 @@ export class CreateProcessPage implements OnInit {
|
||||
console.log(this.postData);
|
||||
|
||||
try {
|
||||
await this.processes.postDeferimento(this.postData).toPromise();
|
||||
await this.FinalizarDeferimento(loader, 'Pedido de deferimento enviado');
|
||||
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;
|
||||
@@ -310,7 +318,7 @@ export class CreateProcessPage implements OnInit {
|
||||
|
||||
case 'PR':
|
||||
switch (this.taskType) {
|
||||
case '0':
|
||||
case '0': // Despacho PR
|
||||
this.postData = {
|
||||
DistributionType: "Paralelo",
|
||||
CountryCode: 'AO',
|
||||
@@ -333,7 +341,7 @@ export class CreateProcessPage implements OnInit {
|
||||
}
|
||||
|
||||
break;
|
||||
case '1':
|
||||
case '1': // Pedido de Parecer
|
||||
this.postData = {
|
||||
DistributionType: "Paralelo",
|
||||
CountryCode: 'AO',
|
||||
@@ -345,17 +353,19 @@ export class CreateProcessPage implements OnInit {
|
||||
console.log(this.postData);
|
||||
|
||||
try {
|
||||
await this.processes.postParecer(this.postData).toPromise();
|
||||
await this.executado(loader);
|
||||
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) {
|
||||
loader.remove()
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
break;
|
||||
case '2':
|
||||
case '2': // Pedido de Deferimento
|
||||
this.postData = {
|
||||
DistributionType: "Paralelo",
|
||||
CountryCode: 'AO',
|
||||
@@ -367,13 +377,15 @@ export class CreateProcessPage implements OnInit {
|
||||
console.log(this.postData);
|
||||
|
||||
try {
|
||||
await this.processes.postDeferimento(this.postData).toPromise();
|
||||
await this.executado(loader);
|
||||
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) {
|
||||
loader.remove()
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -383,55 +395,6 @@ export class CreateProcessPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async executado(loader:HTMLDivElement, message?) {
|
||||
|
||||
let body;
|
||||
|
||||
if(this.task.activityInstanceName =='Tarefa de Despacho' || this.task.activityInstanceName =='Reexecutar Despacho') {
|
||||
|
||||
body = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Conhecimento",
|
||||
"ActionTypeId": 104,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": '',
|
||||
},
|
||||
"AttachmentList" :null,
|
||||
}
|
||||
}
|
||||
else if(this.task.activityInstanceName =='Concluir Despacho' || this.task.activityInstanceName == 'Concluir Parecer') {
|
||||
|
||||
body = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Despacho",
|
||||
"ActionTypeId": 94,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": '',
|
||||
},
|
||||
"AttachmentList" :null,
|
||||
}
|
||||
} else {
|
||||
body = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Despacho",
|
||||
"ActionTypeId": 94,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": '',
|
||||
},
|
||||
"AttachmentList" :null,
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise();
|
||||
this.toastService.successMessage(message);
|
||||
this.modalController.dismiss();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não efectuado');
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
}
|
||||
|
||||
async FinalizarDespacho(loader: HTMLDivElement, message?) {
|
||||
|
||||
@@ -479,81 +442,6 @@ export class CreateProcessPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async FinalizarParecer(loader: HTMLDivElement, message?) {
|
||||
let body;
|
||||
|
||||
if(this.task.activityInstanceName =='Concluir Deferimento' ||
|
||||
this.task.activityInstanceName =='Reapreciar Deferimento'
|
||||
){
|
||||
body = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Parecer",
|
||||
"ActionTypeId": 92,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": message,
|
||||
},
|
||||
"AttachmentList" :null,
|
||||
}
|
||||
}
|
||||
else 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,
|
||||
"action": "Parecer",
|
||||
"ActionTypeId": 96,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": message,
|
||||
},
|
||||
"AttachmentList" :null,
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
console.log(body);
|
||||
|
||||
await this.processes.CompleteTask(body).toPromise();
|
||||
this.toastService.successMessage(message)
|
||||
} catch (e) {
|
||||
this.toastService.badRequest()
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async FinalizarDeferimento(loader: HTMLDivElement, message?) {
|
||||
if(this.task.activityInstanceName =='Reapreciar Deferimento') {
|
||||
let body = {
|
||||
"serialNumber": this.task.serialNumber,
|
||||
"action": "Parecer",
|
||||
"ActionTypeId": 92,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": '',
|
||||
},
|
||||
"AttachmentList" :null,
|
||||
}
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise();
|
||||
this.toastService.successMessage(message)
|
||||
|
||||
} catch (e) {
|
||||
this.toastService.badRequest()
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async addParticipants() {
|
||||
|
||||
this.adding = "intervenient";
|
||||
@@ -666,7 +554,6 @@ export class CreateProcessPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
|
||||
dynamicSetIntervenient({taskParticipants, taskParticipantsCc}){
|
||||
this.taskParticipants = taskParticipants;
|
||||
this.taskParticipantsCc = taskParticipantsCc;
|
||||
|
||||
Reference in New Issue
Block a user