This commit is contained in:
tiago.kayaya
2021-07-13 17:39:23 +01:00
parent 3bbab397be
commit 1c7cf39689
7 changed files with 224 additions and 222 deletions
@@ -96,7 +96,7 @@ export class CreateProcessPage implements OnInit {
this.task = this.navParams.get('task');
console.log('task', this.task)
this.taskType = this.navParams.get('taskAction');
this.postData = new Despacho();
@@ -115,7 +115,7 @@ export class CreateProcessPage implements OnInit {
SubjectTypes: this.selectedTypes,
NumberPDPP: this.task.workflowInstanceDataFields.DispatchNumber,
};
this.postData.DispatchFolder = this.dispatchFolder;
this.postData.UsersSelected = this.participants;
/* By Default TypeDeadline should be 'Normal' */
@@ -134,7 +134,7 @@ export class CreateProcessPage implements OnInit {
setTimeout(() => {
this.selectedTypes = ['99999850'];
}, 500);
console.log(this.postData.DispatchFolder.SubjectTypes);
this.taskDate = new Date(this.task.taskStartDate);
}
@@ -154,7 +154,7 @@ export class CreateProcessPage implements OnInit {
//this.router.navigate(['/home/gabinete-digital/expediente']);
this.modalController.dismiss(null);
}
getSubjectType() {
this.processes.GetSubjectType().subscribe(res=>{
console.log(res);
@@ -163,7 +163,7 @@ export class CreateProcessPage implements OnInit {
}
cancelTask() {
this.modalController.dismiss(null);
}
@@ -193,7 +193,7 @@ export class CreateProcessPage implements OnInit {
})
}
async saveTask() {
this.injectValidation()
@@ -201,7 +201,7 @@ export class CreateProcessPage implements OnInit {
if(this.Form.invalid) return false
if(this.postData.Priority=='99999861') {
this.dispatchFolder.DeadlineType = 'Normal';
}
@@ -214,10 +214,10 @@ export class CreateProcessPage implements OnInit {
else if(this.postData.Priority=='99999864') {
this.dispatchFolder.DeadlineType = 'Urgentíssimo';
}
let attendees = this.taskParticipants.concat(this.taskParticipantsCc);
console.log(attendees);
attendees = attendees.map(function(val) {
return {
UserEmail: val.EmailAddress,
@@ -239,7 +239,7 @@ export class CreateProcessPage implements OnInit {
switch (this.loggeduser.Profile) {
case 'MDGPR':
switch (this.taskType) {
case '0':
this.postData = {
@@ -260,7 +260,7 @@ export class CreateProcessPage implements OnInit {
this.toastService.badRequest('Processo não efectuado');
loader.remove()
}
break;
case '1':
this.postData = {
@@ -272,17 +272,17 @@ export class CreateProcessPage implements OnInit {
DispatchFolder: this.dispatchFolder,
}
console.log(this.postData);
try {
await this.processes.postParecer(this.postData).toPromise();
this.FinalizarParecer('Pedido de Parecer enviado');
loader.remove()
}
}
catch (error) {
this.toastService.badRequest('Processo não efectuado');
loader.remove()
}
break;
case '2':
this.postData = {
@@ -294,12 +294,12 @@ export class CreateProcessPage implements OnInit {
DispatchFolder: this.dispatchFolder,
}
console.log(this.postData);
try {
await this.processes.postDeferimento(this.postData).toPromise();
this.FinalizarDeferimento('Pedido de deferimento enviado');
loader.remove()
}
}
catch (error) {
this.toastService.badRequest('Processo não efectuado');
loader.remove()
@@ -307,9 +307,9 @@ export class CreateProcessPage implements OnInit {
break;
}
this.modalController.dismiss();
break;
case 'PR':
switch (this.taskType) {
case '0':
@@ -322,7 +322,7 @@ export class CreateProcessPage implements OnInit {
DispatchFolder: this.dispatchFolder,
}
console.log('this.postData', this.postData, this.taskType);
try {
await this.processes.postDespatcho(this.postData).toPromise();
loader.remove()
@@ -331,7 +331,7 @@ export class CreateProcessPage implements OnInit {
loader.remove()
this.toastService.badRequest('Processo não efectuado');
}
break;
case '1':
this.postData = {
@@ -343,18 +343,18 @@ export class CreateProcessPage implements OnInit {
DispatchFolder: this.dispatchFolder,
}
console.log(this.postData);
try {
await this.processes.postParecer(this.postData).toPromise();
this.executado();
loader.remove()
this.toastService.successMessage('Pedido de Parecer criado');
}
}
catch (error) {
loader.remove()
this.toastService.badRequest('Processo não efectuado');
}
break;
case '2':
this.postData = {
@@ -366,18 +366,18 @@ export class CreateProcessPage implements OnInit {
DispatchFolder: this.dispatchFolder,
}
console.log(this.postData);
try {
await this.processes.postDeferimento(this.postData).toPromise();
this.executado();
loader.remove()
this.toastService.successMessage('Pedido de Deferimento criado');
}
}
catch (error) {
loader.remove()
this.toastService.badRequest('Processo não efectuado');
}
break;
}
this.modalController.dismiss();
@@ -391,21 +391,21 @@ export class CreateProcessPage implements OnInit {
let body;
if(this.task.activityInstanceName =='Tarefa de Despacho' || this.task.activityInstanceName =='Reexecutar Despacho') {
body = {
"serialNumber": this.task.serialNumber,
"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,
"serialNumber": this.task.serialNumber,
"action": "Despacho",
"ActionTypeId": 94,
"dataFields": {
@@ -424,40 +424,40 @@ export class CreateProcessPage implements OnInit {
}
async FinalizarDespacho(message?) {
let body;
if(this.task.activityInstanceName =='Tarefa de Despacho' ||
if(this.task.activityInstanceName =='Tarefa de Despacho' ||
this.task.activityInstanceName =='Reexecutar Despacho') {
body = {
"serialNumber": this.task.serialNumber,
"serialNumber": this.task.serialNumber,
"action": "Conhecimento",
"ActionTypeId": 104,
"dataFields": {
"ReviewUserComment": '',
},
"AttachmentList" :null,
}
}
}
else if(this.task.activityInstanceName =='Concluir Despacho' ||
this.task.activityInstanceName == 'Concluir Parecer' ||
else if(this.task.activityInstanceName =='Concluir Despacho' ||
this.task.activityInstanceName == 'Concluir Parecer' ||
this.task.activityInstanceName =='Concluir Deferimento' ||
this.task.activityInstanceName =='Reapreciar Deferimento'
) {
body = {
"serialNumber": this.task.serialNumber,
"serialNumber": this.task.serialNumber,
"action": "Despacho",
"ActionTypeId": 94,
"dataFields": {
"ReviewUserComment": '',
},
"AttachmentList" :null,
}
}
}
console.log(body);
try {
await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage(message);
@@ -473,8 +473,8 @@ export class CreateProcessPage implements OnInit {
if(this.task.activityInstanceName =='Concluir Deferimento' ||
this.task.activityInstanceName =='Reapreciar Deferimento'
){
body = {
"serialNumber": this.task.serialNumber,
body = {
"serialNumber": this.task.serialNumber,
"action": "Parecer",
"ActionTypeId": 92,
"dataFields": {
@@ -483,9 +483,9 @@ export class CreateProcessPage implements OnInit {
"AttachmentList" :null,
}
}
if(this.task.activityInstanceName =='Tarefa de Despacho'){
body = {
"serialNumber": this.task.serialNumber,
else if(this.task.activityInstanceName =='Tarefa de Despacho'){
body = {
"serialNumber": this.task.serialNumber,
"action": "Conhecimento",
"ActionTypeId": 92,
"dataFields": {
@@ -495,8 +495,8 @@ export class CreateProcessPage implements OnInit {
}
}
else{
body = {
"serialNumber": this.task.serialNumber,
body = {
"serialNumber": this.task.serialNumber,
"action": "Parecer",
"ActionTypeId": 96,
"dataFields": {
@@ -507,6 +507,8 @@ export class CreateProcessPage implements OnInit {
}
try {
console.log(body);
await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage(message)
} catch (e) {
@@ -517,8 +519,8 @@ export class CreateProcessPage implements OnInit {
async FinalizarDeferimento(message?){
if(this.task.activityInstanceName =='Reapreciar Deferimento'){
let body = {
"serialNumber": this.task.serialNumber,
let body = {
"serialNumber": this.task.serialNumber,
"action": "Parecer",
"ActionTypeId": 92,
"dataFields": {
@@ -534,14 +536,14 @@ export class CreateProcessPage implements OnInit {
}
}
}
async addParticipants() {
this.adding = "intervenient";
this.contacts = this.taskParticipants;
if(window.innerWidth <=800) {
this.showAttendees=false;
const modal = await this.modalController.create({
@@ -558,7 +560,7 @@ export class CreateProcessPage implements OnInit {
await modal.present();
modal.onDidDismiss().then((data) => {
if(data) {
data = data['data'];
@@ -573,7 +575,7 @@ export class CreateProcessPage implements OnInit {
this.showAttendees=true
}
}
async addParticipantsCc() {
this.adding = "CC";
@@ -596,7 +598,7 @@ export class CreateProcessPage implements OnInit {
await modal.present();
modal.onDidDismiss().then((data) => {
if(data) {
data = data['data'];
@@ -607,7 +609,7 @@ export class CreateProcessPage implements OnInit {
this.setIntervenientCC(newAttendeesCC);
}
});
} else {
this.showAttendees=true
}
@@ -625,14 +627,14 @@ export class CreateProcessPage implements OnInit {
cssClass: 'discart-expedient-modal',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then(res=>{
if(res['data']=='close'){
console.log('Expedient Discard closed');
this.modalController.dismiss(res['data'])
}
});
}
@@ -641,10 +643,10 @@ export class CreateProcessPage implements OnInit {
if(this.adding == "intervenient"){
this.taskParticipants = data;
} else if (this.adding == "CC") {
this.taskParticipantsCc = data;
}
}
@@ -656,7 +658,7 @@ export class CreateProcessPage implements OnInit {
async setIntervenient(data) {
this.taskParticipants = data;
}
async setIntervenientCC(data) {
this.taskParticipantsCc = data;
}
@@ -717,4 +719,4 @@ export class CreateProcessPage implements OnInit {
});
}
}
}