diff --git a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html index b6e653e88..4f25ed658 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html +++ b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html @@ -109,7 +109,7 @@
-
+
@@ -120,9 +120,9 @@
-
- - +
+ +
diff --git a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts index e70b621a9..26eef1363 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts +++ b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts @@ -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(){ this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{ console.log(res); @@ -282,6 +323,12 @@ export class DespachoPrPage implements OnInit { else if(actionName == 'Gerar Diploma'){ 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); + } } }); } diff --git a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts index 10188bd70..f3fd7dbb1 100644 --- a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts @@ -95,7 +95,7 @@ export class ExpedientTaskModalPage implements OnInit { Message: '', SourceSecFsId: this.task.workflowInstanceDataFields.FsId, //361 SourceType: 'DOC', //FOLDER - SourceId: this.task.workflowInstanceDataFields.DocId, //FolderId + SourceId: this.task.workflowInstanceDataFields.DocIdD, //FolderId DeadlineType: '', SubjectTypes: ['99999844'], @@ -115,6 +115,8 @@ export class ExpedientTaskModalPage implements OnInit { } ngOnInit() { + console.log(this.postData); + this.taskDate = new Date(this.task.taskStartDate); if(!this.task.hasOwnProperty('isEvent')) { this.getAttachments(); @@ -176,96 +178,100 @@ export class ExpedientTaskModalPage implements OnInit { }); docs.Attachments = DocumentToSave; this.dispatchFolder.SubjectTypes = this.selectedTypes; - if(this.taskParticipants.length > 0) { + switch (this.loggeduser.Profile) { case 'MDGPR': - switch (this.taskType) { - case '0': - this.postData = { - DistributionType: "Paralelo", - CountryCode: 'AO', - Priority: this.postData.Priority, - UserEmail: this.user, - UsersSelected: attendees, - DispatchFolder: this.dispatchFolder, - AttachmentList: docs, - //SubjectTypes: [], - } - try { - this.taskResult = await this.processes.postDespatcho(this.postData).toPromise(); - await this.successMessage('Processo efetuado') - } catch (error) { - await this.badRequest('Processo não efetuado') - } - console.log('this.taskResult', this.taskResult); - let action_despacho = { - "serialNumber": this.task.serialNumber, - "action": "Tratado", - "ActionTypeId": 94, - "dataFields": { - "Note": "", + if(this.taskParticipants.length > 0) { + switch (this.taskType) { + case '0': + this.postData = { + DistributionType: "Paralelo", + CountryCode: 'AO', + Priority: this.postData.Priority, + UserEmail: this.user, + UsersSelected: attendees, + DispatchFolder: this.dispatchFolder, + AttachmentList: docs, + //SubjectTypes: [], } - } - this.modalController.dismiss(action_despacho); - break; - - case '1': - this.postData = { - DistributionType: "Paralelo", - CountryCode: 'AO', - Priority: this.postData.Priority, - UserEmail: this.user, - UsersSelected: attendees, - DispatchFolder: this.dispatchFolder, - AttachmentList: docs - } - - try { - await this.successMessage('Processo efetuado') - } catch (error) { - await this.badRequest('Processo não efetuado') - } - - let action_parecer = { - "serialNumber": this.task.serialNumber, - "action": "Tratado", - "ActionTypeId": 92, - "dataFields": { - "Note": "", + try { + this.taskResult = await this.processes.postDespatcho(this.postData).toPromise(); + await this.successMessage('Processo efetuado') + } catch (error) { + await this.badRequest('Processo não efetuado') } - } - this.modalController.dismiss(action_parecer); - break; - case '2': - this.postData = { - DistributionType: "Paralelo", - CountryCode: 'AO', - Priority: this.postData.Priority, - UserEmail: this.user, - UsersSelected: attendees, - DispatchFolder: this.dispatchFolder, - AttachmentList: docs - } - //console.log(this.postData); - try { - this.taskResult = await this.processes.postDeferimento(this.postData).toPromise() - await this.successMessage('Processo efetuado') - } catch (error) { - await this.badRequest('Processo não efetuado') - } - console.log('this.taskResult', this.taskResult); - let action_deferimento = { - "serialNumber": this.task.serialNumber, - "action": "Tratado", - "ActionTypeId": 93, - "dataFields": { - "Note": "", + console.log('this.taskResult', this.taskResult); + let action_despacho = { + "serialNumber": this.task.serialNumber, + "action": "Tratado", + "ActionTypeId": 94, + "dataFields": { + "Note": "", + } + } + this.modalController.dismiss(action_despacho); + break; + + case '1': + this.postData = { + DistributionType: "Paralelo", + CountryCode: 'AO', + Priority: this.postData.Priority, + UserEmail: this.user, + UsersSelected: attendees, + DispatchFolder: this.dispatchFolder, + AttachmentList: docs + } + + try { + await this.successMessage('Processo efetuado') + } catch (error) { + await this.badRequest('Processo não efetuado') + } + + let action_parecer = { + "serialNumber": this.task.serialNumber, + "action": "Tratado", + "ActionTypeId": 92, + "dataFields": { + "Note": "", + } + } + this.modalController.dismiss(action_parecer); + break; + case '2': + this.postData = { + DistributionType: "Paralelo", + CountryCode: 'AO', + Priority: this.postData.Priority, + UserEmail: this.user, + UsersSelected: attendees, + DispatchFolder: this.dispatchFolder, + AttachmentList: docs + } + //console.log(this.postData); + try { + this.taskResult = await this.processes.postDeferimento(this.postData).toPromise() + await this.successMessage('Processo efetuado') + } catch (error) { + await this.badRequest('Processo não efetuado') + } + console.log('this.taskResult', this.taskResult); + let action_deferimento = { + "serialNumber": this.task.serialNumber, + "action": "Tratado", + "ActionTypeId": 93, + "dataFields": { + "Note": "", } } this.modalController.dismiss(action_deferimento); - break; + break; } - + } + else { + this.alertController.presentAlert("Lista de intervenientes vazia. Por favor, adicione 1 ou mais intervenientes."); + } break; case 'PR': switch (this.taskType) { @@ -280,6 +286,7 @@ export class ExpedientTaskModalPage implements OnInit { AttachmentList: docs, //SubjectTypes: [], } + console.log(this.postData); try { this.taskResult = await this.processes.postDespatchoPr(this.postData).toPromise(); await this.successMessage('Processo efetuado') @@ -328,11 +335,6 @@ export class ExpedientTaskModalPage implements OnInit { } break; } - } - else { - this.alertController.presentAlert("Lista de intervenientes vazia. Por favor, adicione 1 ou mais intervenientes."); - } - } getAttachments() {