This commit is contained in:
tiago.kayaya
2021-07-01 12:36:37 +01:00
parent d5c07799ad
commit d42efae2c7
8 changed files with 129 additions and 86 deletions
@@ -9,8 +9,8 @@
<button (click)="openAddNoteModal('Executado')" class="btn-cancel" shape="round" >Executado</button>
<button (click)="openDelegarModal(task)" class="btn-cancel" shape="round" >Delegar</button>
<div class="solid"></div>
<button (click)="openExpedientActionsModal('0',fulltask)" class="btn-ok" shape="round" >Efectuar Despacho</button>
<button (click)="openExpedientActionsModal('1',fulltask)" class="btn-cancel" shape="round" >Solicitar Parecer</button>
<button (click)="openTaskProcessModal('0',fulltask)" class="btn-ok" shape="round" >Efectuar Despacho</button>
<button (click)="openTaskProcessModal('1',fulltask)" class="btn-cancel" shape="round" >Solicitar Parecer</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<div class="solid"></div>
<button (click)="sendExpedienteToPending()" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
@@ -19,8 +19,8 @@
<button (click)="openAddNoteModal('Executado')" class="btn-cancel" shape="round" >Executado</button>
<button (click)="openDelegarModal(task)" class="btn-cancel" shape="round" >Delegar</button>
<div class="solid"></div>
<button (click)="openExpedientActionsModal('0',fulltask)" class="btn-ok" shape="round" >Efectuar Despacho</button>
<button (click)="openExpedientActionsModal('1',fulltask)" class="btn-cancel" shape="round" >Solicitar Parecer</button>
<button (click)="openTaskProcessModal('0',fulltask)" class="btn-ok" shape="round" >Efectuar Despacho</button>
<button (click)="openTaskProcessModal('1',fulltask)" class="btn-cancel" shape="round" >Solicitar Parecer</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<div class="solid"></div>
<button (click)="sendExpedienteToPending()" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
@@ -28,8 +28,8 @@
<div class="buttons" *ngIf="task.activityInstanceName == 'Concluir Despacho'">
<button (click)="openAddNoteModal('Arquivar')" class="btn-cancel" shape="round" >Arquivar</button>
<div class="solid"></div>
<button (click)="openExpedientActionsModal('0',fulltask)" class="btn-ok" shape="round" >Efectuar Despacho</button>
<button (click)="openExpedientActionsModal('1',fulltask)" class="btn-cancel" shape="round" >Solicitar Parecer</button>
<button (click)="openTaskProcessModal('0',fulltask)" class="btn-ok" shape="round" >Efectuar Despacho</button>
<button (click)="openTaskProcessModal('1',fulltask)" class="btn-cancel" shape="round" >Solicitar Parecer</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<div class="solid"></div>
<button (click)="sendExpedienteToPending()" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
@@ -40,7 +40,7 @@ export class DespachosOptionsPage implements OnInit {
this.goBack()
}
async openExpedientActionsModal(taskAction: any, task: any) {
async openTaskProcessModal(taskAction: any, task: any) {
this.popoverController.dismiss();
let classs;
if( window.innerWidth <= 800){
@@ -58,11 +58,7 @@ export class DespachosOptionsPage implements OnInit {
});
await modal.present();
modal.onDidDismiss().then(res=>{
console.log(res['data']);
if(res['data']=='openDiscart'){
console.log('open discart');
this.distartExpedientModal();
}
this.goBack();
});
}
@@ -275,16 +271,7 @@ export class DespachosOptionsPage implements OnInit {
}
goBack() {
let navigationExtras: NavigationExtras = {
queryParams: {
// "despachospr": true,
}
}
this.router.navigate(['/home/gabinete-digital/despachos'], navigationExtras);
// window.history.back()
this.router.navigate(['/home/gabinete-digital/despachos']);
}
}
@@ -9,7 +9,7 @@
<button (click)="openExpedientActionsModal('1',fulltask)" full class="btn-ok" shape="round" >Pedido de Parecer</button>
<button (click)="openExpedientActionsModal('2',fulltask)" full class="btn-ok" shape="round" >Pedido de Deferimento</button>
<button (click)="openBookMeetingModal()" full class="btn-ok" shape="round" >Marcar reunião</button>
<button (click)="distartExpedientModal()" full class="btn-ok" shape="round" >Descartar</button>
<button (click)="distartExpedientModal('descartar')" full class="btn-ok" shape="round" >Descartar</button>
<button (click)="sendExpedienteToPending()" full class="btn-ok" shape="round" *ngIf="showEnviarPendentes" >Enviar para pendentes</button>
<div class="solid"></div>
<button (click)="close()" full class="btn-cancel" shape="round" >Cancelar</button>
@@ -1,9 +1,11 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
import { ModalController, NavParams, PopoverController } from '@ionic/angular';
import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page';
import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page';
import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
import { ProcessesService } from 'src/app/services/processes.service';
import { ToastService } from 'src/app/services/toast.service';
@Component({
selector: 'app-opts-expediente',
@@ -14,6 +16,7 @@ export class OptsExpedientePage implements OnInit {
task:any;
fulltask: any;
profile:string;
caller:string;
showEnviarPendentes = false
@@ -22,20 +25,19 @@ export class OptsExpedientePage implements OnInit {
private modalController: ModalController,
private navParams: NavParams,
private processes: ProcessesService,
private toastService: ToastService,
private router: Router,
private activatedRoute: ActivatedRoute,
) {
this.task = this.navParams.get('task');
this.fulltask = this.navParams.get('fulltask');
this.showEnviarPendentes = this.navParams.get('showEnviarPendentes');
if(!this.showEnviarPendentes) this.showEnviarPendentes = false
if(this.task.Status != 'Pending'){
this.showEnviarPendentes = true;
}
}
ngOnInit() {
console.log(this.task);
this.profile = "mdgpr";
window.onresize = (event) => {
if( window.innerWidth >= 800){
this.popoverController.dismiss();
@@ -52,10 +54,50 @@ export class OptsExpedientePage implements OnInit {
}
}
goBack() {
if(this.task.Status == "Pending" && this.caller != 'events'){
if (window.innerWidth <= 800) {
this.router.navigate(['/home/gabinete-digital/pendentes']);
}
else {
let navigationExtras: NavigationExtras = {
queryParams: {
"pendentes": true,
}
}
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
}
}
else{
this.activatedRoute.paramMap.subscribe(params => {
switch (params["params"].caller) {
case 'events':
this.router.navigate(['/home',params["params"].caller]);
break;
case 'gabinete-digital':
let navigationExtras: NavigationExtras = {
queryParams: {
"expedientes": true,
}
}
if( window.innerWidth < 801) {
this.router.navigate(['/home/gabinete-digital/expediente']);
} else {
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
}
break;
}
});
}
}
sendExpedienteToPending() {
this.close();
this.processes.SetTaskToPending(this.task.SerialNumber).subscribe(res=>{
console.log(res);
this.close();
this.goBack();
});
}
@@ -92,45 +134,82 @@ export class OptsExpedientePage implements OnInit {
componentProps: {
taskAction: taskAction,
task: task,
profile: this.profile,
},
cssClass: classs,
});
await modal.present();
modal.onDidDismiss().then(res=>{
console.log(res['data']);
if(res['data']=='openDiscart'){
console.log('open discart');
this.distartExpedientModal();
let body = res['data'];
if(res['data']){
console.log('open discart')
this.distartExpedientModal(body);
}
else{
console.log('Not open');
}
});
}
async distartExpedientModal(){
this.close();
async distartExpedientModal(body:any){
const modal = await this.modalController.create({
component: DiscartExpedientModalPage,
componentProps: {
serialNumber: this.fulltask.serialNumber,
folderId: this.fulltask.workflowInstanceDataFields.FolderID,
action: 'complete',
},
cssClass: 'discart-expedient-modal',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then(res=>{
if(res['data']=='close'){
this.close();
/* console.log('2Expedient Discard closed2');
this.close();
this.openMenu(); */
modal.onDidDismiss().then( async (res)=>{
console.log(res['data']);
if(body == 'descartar'){
if(res['data']== 'Yes'){
let otherbody = {
"serialNumber": this.task.SerialNumber,
"action": "Passivo",
"ActionTypeId": 99999877,
"dataFields": {
"Note": "",
}
}
try {
await this.processes.CompleteTask(otherbody).toPromise()
this.toastService.successMessage('Processo descartado');
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
}
}
else if(res['data'] == 'No'){
//Do nothing
}
}
else{
if(res['data']== 'Yes'){
try {
await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage('Processo descartado');
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
}
this.goBack();
}
else if(res['data'] == 'No'){
console.log('Update');
try {
await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise();
this.toastService.successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest()
}
}
}
});
}