This commit is contained in:
Peter Maquiran
2021-07-14 08:41:35 +01:00
7 changed files with 219 additions and 217 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);
}
runValidation() {
@@ -192,7 +192,7 @@ export class CreateProcessPage implements OnInit {
})
}
async saveTask() {
this.injectValidation()
@@ -200,7 +200,7 @@ export class CreateProcessPage implements OnInit {
if(this.Form.invalid) return false
if(this.postData.Priority=='99999861') {
this.dispatchFolder.DeadlineType = 'Normal';
}
@@ -213,10 +213,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,
@@ -238,7 +238,7 @@ export class CreateProcessPage implements OnInit {
switch (this.loggeduser.Profile) {
case 'MDGPR':
switch (this.taskType) {
case '0':
this.postData = {
@@ -257,7 +257,7 @@ export class CreateProcessPage implements OnInit {
} catch (error) {
this.toastService.badRequest('Processo não efectuado');
}
break;
case '1':
this.postData = {
@@ -269,7 +269,7 @@ export class CreateProcessPage implements OnInit {
DispatchFolder: this.dispatchFolder,
}
console.log(this.postData);
try {
await this.processes.postParecer(this.postData).toPromise();
this.FinalizarParecer(loader, 'Pedido de Parecer enviado');
@@ -277,7 +277,7 @@ export class CreateProcessPage implements OnInit {
catch (error) {
this.toastService.badRequest('Processo não efectuado');
}
break;
case '2':
this.postData = {
@@ -289,7 +289,7 @@ export class CreateProcessPage implements OnInit {
DispatchFolder: this.dispatchFolder,
}
console.log(this.postData);
try {
await this.processes.postDeferimento(this.postData).toPromise();
this.FinalizarDeferimento(loader, 'Pedido de deferimento enviado');
@@ -300,9 +300,9 @@ export class CreateProcessPage implements OnInit {
break;
}
this.modalController.dismiss();
break;
case 'PR':
switch (this.taskType) {
case '0':
@@ -315,14 +315,14 @@ export class CreateProcessPage implements OnInit {
DispatchFolder: this.dispatchFolder,
}
console.log('this.postData', this.postData, this.taskType);
try {
await this.processes.postDespatcho(this.postData).toPromise();
this.executado(loader, 'Despacho criado');
} catch (error) {
this.toastService.badRequest('Processo não efectuado');
}
break;
case '1':
this.postData = {
@@ -334,16 +334,16 @@ export class CreateProcessPage implements OnInit {
DispatchFolder: this.dispatchFolder,
}
console.log(this.postData);
try {
await this.processes.postParecer(this.postData).toPromise();
this.executado(loader);
this.toastService.successMessage('Pedido de Parecer criado');
}
}
catch (error) {
this.toastService.badRequest('Processo não efectuado');
}
break;
case '2':
this.postData = {
@@ -355,16 +355,16 @@ export class CreateProcessPage implements OnInit {
DispatchFolder: this.dispatchFolder,
}
console.log(this.postData);
try {
await this.processes.postDeferimento(this.postData).toPromise();
this.executado(loader);
this.toastService.successMessage('Pedido de Deferimento criado');
}
}
catch (error) {
this.toastService.badRequest('Processo não efectuado');
}
break;
}
this.modalController.dismiss();
@@ -378,21 +378,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": {
@@ -414,37 +414,37 @@ export class CreateProcessPage implements OnInit {
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);
@@ -462,8 +462,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": {
@@ -472,9 +472,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": {
@@ -484,8 +484,8 @@ export class CreateProcessPage implements OnInit {
}
}
else{
body = {
"serialNumber": this.task.serialNumber,
body = {
"serialNumber": this.task.serialNumber,
"action": "Parecer",
"ActionTypeId": 96,
"dataFields": {
@@ -496,6 +496,8 @@ export class CreateProcessPage implements OnInit {
}
try {
console.log(body);
await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage(message)
} catch (e) {
@@ -528,14 +530,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({
@@ -552,7 +554,7 @@ export class CreateProcessPage implements OnInit {
await modal.present();
modal.onDidDismiss().then((data) => {
if(data) {
data = data['data'];
@@ -567,7 +569,7 @@ export class CreateProcessPage implements OnInit {
this.showAttendees=true
}
}
async addParticipantsCc() {
this.adding = "CC";
@@ -590,7 +592,7 @@ export class CreateProcessPage implements OnInit {
await modal.present();
modal.onDidDismiss().then((data) => {
if(data) {
data = data['data'];
@@ -601,7 +603,7 @@ export class CreateProcessPage implements OnInit {
this.setIntervenientCC(newAttendeesCC);
}
});
} else {
this.showAttendees=true
}
@@ -619,14 +621,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'])
}
});
}
@@ -635,10 +637,10 @@ export class CreateProcessPage implements OnInit {
if(this.adding == "intervenient"){
this.taskParticipants = data;
} else if (this.adding == "CC") {
this.taskParticipantsCc = data;
}
}
@@ -650,7 +652,7 @@ export class CreateProcessPage implements OnInit {
async setIntervenient(data) {
this.taskParticipants = data;
}
async setIntervenientCC(data) {
this.taskParticipantsCc = data;
}
@@ -711,4 +713,4 @@ export class CreateProcessPage implements OnInit {
});
}
}
}