This commit is contained in:
tiago.kayaya
2021-05-26 13:33:25 +01:00
parent e1997b7a37
commit b2dbc41a08
3 changed files with 141 additions and 92 deletions
@@ -109,7 +109,7 @@
</div> </div>
<div *ngIf="task" class="aside-right flex-column height-100"> <div *ngIf="task" class="aside-right flex-column height-100">
<div class="buttons" *ngIf="task.ctivityInstanceName == 'Tarefa de Despacho'"> <div class="buttons" *ngIf="task.activityInstanceName == 'Tarefa de Despacho'">
<button (click)="openAddNoteModal('Executado')" class="btn-cancel" shape="round" >Executado</button> <button (click)="openAddNoteModal('Executado')" class="btn-cancel" shape="round" >Executado</button>
<button (click)="openDelegarModal(task)" class="btn-cancel" shape="round" >Delegar</button> <button (click)="openDelegarModal(task)" class="btn-cancel" shape="round" >Delegar</button>
<button (click)="openAddNoteModal('Gerar Diploma')" class="btn-cancel" shape="round" >Gerar Diploma </button> <button (click)="openAddNoteModal('Gerar Diploma')" class="btn-cancel" shape="round" >Gerar Diploma </button>
@@ -120,9 +120,9 @@
<div class="solid"></div> <div class="solid"></div>
<button (click)="sendExpedienteToPending()" class="btn-cancel" shape="round" >Enviar para Pendentes</button> <button (click)="sendExpedienteToPending()" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
</div> </div>
<div class="buttons" *ngIf="task.ctivityInstanceName == 'Concluir Despacho'"> <div class="buttons" *ngIf="task.activityInstanceName == 'Concluir Despacho'">
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar como Concluído</button> <button (click)="openAddNoteModal('Concluido')" class="btn-cancel" shape="round" >Marcar como Concluído</button>
<button (click)="sendExpedienteToPending()" class="btn-cancel" shape="round" >Enviar para Reexecução</button> <button (click)="openAddNoteModal('Reexecução')" class="btn-cancel" shape="round" >Enviar para Reexecução</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button> <button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<button (click)="sendExpedienteToPending()" class="btn-cancel" shape="round" >Enviar para Pendentes</button> <button (click)="sendExpedienteToPending()" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
</div> </div>
@@ -231,6 +231,47 @@ export class DespachoPrPage implements OnInit {
} }
async concluir(note:string, documents:any){
let body = {
"serialNumber": this.serialnumber,
"action": "Executado",
"ActionTypeId": 104,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
try {
await this.processes.CompleteTask(body);
this.successMessage()
this.close();
} catch (error) {
this.badRequest()
}
}
async reexecutar(note:string, documents:any){
let body = {
"serialNumber": this.serialnumber,
"action": "Reexecutar",
"ActionTypeId": 100000010,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
try {
await this.processes.CompleteTask(body);
this.successMessage()
this.close();
} catch (error) {
this.badRequest()
}
}
sendExpedienteToPending(){ sendExpedienteToPending(){
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{ this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
console.log(res); console.log(res);
@@ -282,6 +323,12 @@ export class DespachoPrPage implements OnInit {
else if(actionName == 'Gerar Diploma'){ else if(actionName == 'Gerar Diploma'){
this.generateDiploma(res.data.note, docs); this.generateDiploma(res.data.note, docs);
} }
else if(actionName == 'Concluido'){
this.concluir(res.data.note, docs);
}
else if(actionName == 'Reexecução'){
this.reexecutar(res.data.note, docs);
}
} }
}); });
} }
@@ -95,7 +95,7 @@ export class ExpedientTaskModalPage implements OnInit {
Message: '', Message: '',
SourceSecFsId: this.task.workflowInstanceDataFields.FsId, //361 SourceSecFsId: this.task.workflowInstanceDataFields.FsId, //361
SourceType: 'DOC', //FOLDER SourceType: 'DOC', //FOLDER
SourceId: this.task.workflowInstanceDataFields.DocId, //FolderId SourceId: this.task.workflowInstanceDataFields.DocIdD, //FolderId
DeadlineType: '', DeadlineType: '',
SubjectTypes: ['99999844'], SubjectTypes: ['99999844'],
@@ -115,6 +115,8 @@ export class ExpedientTaskModalPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
console.log(this.postData);
this.taskDate = new Date(this.task.taskStartDate); this.taskDate = new Date(this.task.taskStartDate);
if(!this.task.hasOwnProperty('isEvent')) { if(!this.task.hasOwnProperty('isEvent')) {
this.getAttachments(); this.getAttachments();
@@ -176,9 +178,10 @@ export class ExpedientTaskModalPage implements OnInit {
}); });
docs.Attachments = DocumentToSave; docs.Attachments = DocumentToSave;
this.dispatchFolder.SubjectTypes = this.selectedTypes; this.dispatchFolder.SubjectTypes = this.selectedTypes;
if(this.taskParticipants.length > 0) {
switch (this.loggeduser.Profile) { switch (this.loggeduser.Profile) {
case 'MDGPR': case 'MDGPR':
if(this.taskParticipants.length > 0) {
switch (this.taskType) { switch (this.taskType) {
case '0': case '0':
this.postData = { this.postData = {
@@ -265,7 +268,10 @@ export class ExpedientTaskModalPage implements OnInit {
this.modalController.dismiss(action_deferimento); this.modalController.dismiss(action_deferimento);
break; break;
} }
}
else {
this.alertController.presentAlert("Lista de intervenientes vazia. Por favor, adicione 1 ou mais intervenientes.");
}
break; break;
case 'PR': case 'PR':
switch (this.taskType) { switch (this.taskType) {
@@ -280,6 +286,7 @@ export class ExpedientTaskModalPage implements OnInit {
AttachmentList: docs, AttachmentList: docs,
//SubjectTypes: [], //SubjectTypes: [],
} }
console.log(this.postData);
try { try {
this.taskResult = await this.processes.postDespatchoPr(this.postData).toPromise(); this.taskResult = await this.processes.postDespatchoPr(this.postData).toPromise();
await this.successMessage('Processo efetuado') await this.successMessage('Processo efetuado')
@@ -329,11 +336,6 @@ export class ExpedientTaskModalPage implements OnInit {
break; break;
} }
} }
else {
this.alertController.presentAlert("Lista de intervenientes vazia. Por favor, adicione 1 ou mais intervenientes.");
}
}
getAttachments() { getAttachments() {
this.attachmentsService.getAttachmentsBySerial(this.task.serialNumber).subscribe(res=>{ this.attachmentsService.getAttachmentsBySerial(this.task.serialNumber).subscribe(res=>{