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 f1afe609f..e6aa1b9f1 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 @@ -227,7 +227,7 @@ export class ExpedientTaskModalPage implements OnInit { // async saveTask() { - if(this.loggeduser.Profile == 'MDGPR') { + if(this.loggeduser.Profile != 'PR') { this.injectValidation() this.runValidation() @@ -485,6 +485,112 @@ export class ExpedientTaskModalPage implements OnInit { break; } break; + default: + if(this.taskParticipants.length > 0) { + switch (this.taskType) { + case '0': // Despacho + this.postData = { + DistributionType: "Paralelo", + CountryCode: 'AO', + Priority: this.postData.Priority, + UserEmail: this.loggeduser.Email, + UsersSelected: attendees, + DispatchFolder: this.dispatchFolder, + AttachmentList: docs, + } + + let action_despacho = { + "serialNumber": this.task.serialNumber, + "action": "Tratado", + "ActionTypeId": 94, + "dataFields": { + "Note": "", + } + } + + + + try { + + this.taskResult = await this.processes.postDespatcho(this.postData).toPromise(); + await this.toastService._successMessage('Processo efetuado'); + this.modalController.dismiss(action_despacho); + + } catch (error) { + await this.toastService._badRequest('Processo não efetuado') + } finally { + loader.remove() + } + + + break; + + case '1': // Parecer + this.postData = { + DistributionType: "Paralelo", + CountryCode: 'AO', + Priority: this.postData.Priority, + UserEmail: this.loggeduser.Email, + UsersSelected: attendees, + DispatchFolder: this.dispatchFolder, + AttachmentList: docs + } + + let action_parecer = { + "serialNumber": this.task.serialNumber, + "action": "Tratado", + "ActionTypeId": 92, + "dataFields": { + "Note": "", + } + } + + try { + this.taskResult = await this.processes.postParecer(this.postData).toPromise(); + await this.toastService._successMessage('Pedido enviado'); + this.modalController.dismiss(action_parecer); + + } catch (error) { + await this.toastService._badRequest('Processo não efetuado') + } finally { + loader.remove() + } + break; + case '2': // Deferimento + this.postData = { + DistributionType: "Paralelo", + CountryCode: 'AO', + Priority: this.postData.Priority, + UserEmail: this.loggeduser.Email, + UsersSelected: attendees, + DispatchFolder: this.dispatchFolder, + AttachmentList: docs + } + // + let action_deferimento = { + "serialNumber": this.task.serialNumber, + "action": "Tratado", + "ActionTypeId": 93, + "dataFields": { + "Note": "", + } + } + + try { + + this.taskResult = await this.processes.postDeferimento(this.postData).toPromise(); + this.toastService._successMessage('Processo efetuado'); + this.modalController.dismiss(action_deferimento); + } catch (error) { + await this.toastService._badRequest('Processo não efetuado') + } finally { + loader.remove() + } + + + break; + } + } } }