2021-05-27 13:11:10 +01:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2022-10-12 17:01:09 +01:00
|
|
|
import { ActivatedRoute } from '@angular/router';
|
2022-04-26 16:14:55 +01:00
|
|
|
import { ModalController, NavParams, PopoverController } from '@ionic/angular';
|
2021-05-27 13:11:10 +01:00
|
|
|
import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
|
2021-08-17 13:04:30 +01:00
|
|
|
import { CreateProcessPage } from 'src/app/modals/create-process/create-process.page';
|
2021-05-27 13:11:10 +01:00
|
|
|
import { DarParecerPage } from 'src/app/modals/dar-parecer/dar-parecer.page';
|
|
|
|
|
import { DelegarPage } from 'src/app/modals/delegar/delegar.page';
|
|
|
|
|
import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page';
|
|
|
|
|
import { ProcessesService } from 'src/app/services/processes.service';
|
2021-06-15 15:09:20 +01:00
|
|
|
import { ToastService } from 'src/app/services/toast.service';
|
2021-08-20 15:43:37 +01:00
|
|
|
import { PedidoService } from 'src/app/Rules/pedido.service';
|
2022-03-28 15:46:07 +01:00
|
|
|
import { PermissionService } from 'src/app/services/permission.service';
|
2021-11-10 11:32:36 +01:00
|
|
|
import { NewGroupPage } from 'src/app/pages/chat/new-group/new-group.page';
|
2023-01-30 17:41:27 +01:00
|
|
|
import { ForwardPage } from 'src/app/modals/forward/forward.page';
|
2021-08-20 15:43:37 +01:00
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-request-options',
|
|
|
|
|
templateUrl: './request-options.page.html',
|
|
|
|
|
styleUrls: ['./request-options.page.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class RequestOptionsPage implements OnInit {
|
|
|
|
|
|
|
|
|
|
task:any;
|
|
|
|
|
fulltask: any;
|
|
|
|
|
profile:string;
|
2021-09-06 16:19:34 +01:00
|
|
|
serialNumber : string;
|
|
|
|
|
showEnviarPendentes = false;
|
2021-05-27 13:11:10 +01:00
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
private popoverController: PopoverController,
|
|
|
|
|
private modalController: ModalController,
|
|
|
|
|
private navParams: NavParams,
|
|
|
|
|
private processes: ProcessesService,
|
|
|
|
|
private activatedRoute: ActivatedRoute,
|
2021-07-06 16:10:03 +01:00
|
|
|
private toastService: ToastService,
|
2021-08-11 10:52:31 +01:00
|
|
|
public p: PermissionService,
|
2021-11-10 11:32:36 +01:00
|
|
|
private pedidoService: PedidoService,
|
2021-08-20 14:23:48 +01:00
|
|
|
) {
|
2021-05-27 13:11:10 +01:00
|
|
|
this.task = this.navParams.get('task');
|
|
|
|
|
this.fulltask = this.navParams.get('fulltask');
|
2021-08-20 14:23:48 +01:00
|
|
|
this.serialNumber = this.navParams.get('serialNumber');
|
2021-09-03 15:43:22 +01:00
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
this.activatedRoute.queryParams.subscribe(params => {
|
|
|
|
|
if(params["serialNumber"]) {
|
2021-08-20 14:23:48 +01:00
|
|
|
this.serialNumber = params["serialNumber"];
|
2022-04-28 09:32:27 +01:00
|
|
|
//
|
2021-05-27 13:11:10 +01:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2021-08-20 14:23:48 +01:00
|
|
|
if(this.task.serialNumber) {
|
|
|
|
|
this.serialNumber = this.task.serialNumber
|
|
|
|
|
} else if (this.task.SerialNumber) {
|
|
|
|
|
this.serialNumber = this.task.SerialNumber
|
|
|
|
|
}
|
2021-08-09 15:19:32 +01:00
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
this.showEnviarPendentes = this.navParams.get('showEnviarPendentes');
|
|
|
|
|
|
|
|
|
|
if(!this.showEnviarPendentes) this.showEnviarPendentes = false
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
this.profile = "mdgpr";
|
2021-09-03 15:43:22 +01:00
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
window.onresize = (event) => {
|
|
|
|
|
if( window.innerWidth >= 800){
|
|
|
|
|
this.popoverController.dismiss();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-17 17:02:41 +01:00
|
|
|
close() {
|
2021-08-23 11:08:58 +01:00
|
|
|
this.popoverController.dismiss('close')
|
2021-05-27 13:11:10 +01:00
|
|
|
}
|
2021-09-03 15:43:22 +01:00
|
|
|
cancel(){
|
|
|
|
|
this.popoverController.dismiss();
|
|
|
|
|
}
|
2021-05-27 13:11:10 +01:00
|
|
|
|
2021-08-17 17:02:41 +01:00
|
|
|
sendExpedienteToPending() {
|
2022-07-15 12:01:14 +01:00
|
|
|
const loader = this.toastService.loading()
|
2021-05-27 13:11:10 +01:00
|
|
|
this.processes.SetTaskToPending(this.task.SerialNumber).subscribe(res=>{
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2021-11-09 15:37:59 +01:00
|
|
|
this.toastService._successMessage()
|
2021-05-27 13:11:10 +01:00
|
|
|
this.close();
|
2022-07-15 12:01:14 +01:00
|
|
|
loader.remove()
|
2022-12-19 15:48:40 +01:00
|
|
|
}, ()=> {
|
2022-07-15 12:01:14 +01:00
|
|
|
loader.remove()
|
2021-07-17 21:22:03 +01:00
|
|
|
|
2021-11-09 15:37:59 +01:00
|
|
|
this.toastService._badRequest('Processo não encontrado')
|
2021-05-27 13:11:10 +01:00
|
|
|
});
|
2021-09-03 15:43:22 +01:00
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async openBookMeetingModal(task: any) {
|
2021-06-22 15:39:28 +01:00
|
|
|
this.popoverController.dismiss();
|
2021-05-27 13:11:10 +01:00
|
|
|
let classs;
|
2021-08-17 17:02:41 +01:00
|
|
|
if( window.innerWidth <= 800) {
|
2021-05-27 13:11:10 +01:00
|
|
|
classs = 'book-meeting-modal modal modal-desktop'
|
|
|
|
|
} else {
|
|
|
|
|
classs = 'modal modal-desktop showAsideOptions'
|
|
|
|
|
}
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: BookMeetingModalPage,
|
|
|
|
|
componentProps: {
|
|
|
|
|
task: this.task,
|
|
|
|
|
},
|
|
|
|
|
cssClass: classs,
|
|
|
|
|
backdropDismiss: false
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
|
|
|
|
modal.onDidDismiss();
|
|
|
|
|
}
|
2021-11-10 11:32:36 +01:00
|
|
|
|
2021-12-10 12:31:37 +01:00
|
|
|
async openNewGroupPage(){
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: NewGroupPage,
|
|
|
|
|
cssClass: 'modal modal-desktop',
|
|
|
|
|
componentProps: {
|
|
|
|
|
name: this.task.Folio,
|
|
|
|
|
task: this.task,
|
|
|
|
|
documents: this.fulltask.Documents,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
|
|
|
|
modal.onDidDismiss().then( () => {
|
|
|
|
|
this.popoverController.dismiss('close');
|
|
|
|
|
});
|
2021-11-10 11:32:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async newGroup(){
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: NewGroupPage,
|
|
|
|
|
cssClass: 'modal modal-desktop',
|
|
|
|
|
componentProps: {
|
|
|
|
|
name: this.task.Folio,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
|
|
|
|
modal.onDidDismiss();
|
|
|
|
|
}
|
2021-05-27 13:11:10 +01:00
|
|
|
|
|
|
|
|
async openExpedientActionsModal(taskAction: any, task: any) {
|
2021-08-17 14:47:57 +01:00
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
//this.modalController.dismiss();
|
|
|
|
|
let classs;
|
|
|
|
|
if( window.innerWidth <= 800) {
|
|
|
|
|
classs = 'modal modal-desktop'
|
|
|
|
|
} else {
|
|
|
|
|
classs = 'modal modal-desktop showAsideOptions'
|
|
|
|
|
}
|
|
|
|
|
const modal = await this.modalController.create({
|
2021-08-17 13:04:30 +01:00
|
|
|
component: CreateProcessPage,
|
2021-05-27 13:11:10 +01:00
|
|
|
componentProps: {
|
|
|
|
|
taskAction: taskAction,
|
|
|
|
|
task: task,
|
|
|
|
|
profile: this.profile,
|
2021-08-17 13:04:30 +01:00
|
|
|
fulltask: this.fulltask
|
2021-05-27 13:11:10 +01:00
|
|
|
},
|
|
|
|
|
cssClass: classs,
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
2021-08-17 13:04:30 +01:00
|
|
|
modal.onDidDismiss().then(res=> {
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2021-08-17 14:47:57 +01:00
|
|
|
if(res['data']=='openDiscart') {
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2021-09-03 15:43:22 +01:00
|
|
|
|
2021-08-20 12:39:27 +01:00
|
|
|
} else {
|
|
|
|
|
this.popoverController.dismiss('close')
|
2021-05-27 13:11:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-28 15:45:41 +01:00
|
|
|
async repreciar(note:string, documents:any) {
|
2021-09-03 15:43:22 +01:00
|
|
|
let body = {
|
|
|
|
|
"serialNumber": this.serialNumber,
|
2021-05-27 13:11:10 +01:00
|
|
|
"action": "Reapreciação",
|
|
|
|
|
"ActionTypeId": 100000009,
|
|
|
|
|
"dataFields": {
|
|
|
|
|
"ReviewUserComment": note,
|
|
|
|
|
},
|
|
|
|
|
"AttachmentList" :documents,
|
|
|
|
|
}
|
2021-05-28 15:45:41 +01:00
|
|
|
|
2021-07-12 11:13:29 +01:00
|
|
|
const loader = this.toastService.loading()
|
|
|
|
|
|
2021-09-03 15:43:22 +01:00
|
|
|
try {
|
2021-05-28 15:45:41 +01:00
|
|
|
await this.processes.CompleteTask(body).toPromise()
|
|
|
|
|
this.close();
|
2021-11-09 15:37:59 +01:00
|
|
|
this.toastService._successMessage()
|
2021-05-28 15:45:41 +01:00
|
|
|
} catch (error) {
|
2023-02-02 12:01:18 +01:00
|
|
|
if(error.status == 0) {
|
|
|
|
|
this.toastService._badRequest('sem conexão ao servidor')
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
this.toastService._badRequest()
|
|
|
|
|
}
|
2021-09-03 15:43:22 +01:00
|
|
|
}
|
2021-07-12 11:13:29 +01:00
|
|
|
finally {
|
|
|
|
|
loader.remove()
|
2021-05-28 15:45:41 +01:00
|
|
|
}
|
|
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async openAddNoteModal(actionName:string) {
|
2021-08-20 15:43:37 +01:00
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
let classs;
|
|
|
|
|
if( window.innerWidth <= 800){
|
|
|
|
|
classs = 'modal modal-desktop'
|
|
|
|
|
} else {
|
|
|
|
|
classs = 'modal modal-desktop'
|
|
|
|
|
}
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: AddNotePage,
|
|
|
|
|
componentProps:{
|
2021-08-19 16:39:26 +01:00
|
|
|
showAttachmentBtn: true,
|
2021-05-27 13:11:10 +01:00
|
|
|
},
|
|
|
|
|
cssClass: classs,
|
|
|
|
|
backdropDismiss: true
|
|
|
|
|
});
|
2021-09-03 15:43:22 +01:00
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
await modal.present();
|
2021-09-03 15:43:22 +01:00
|
|
|
|
2021-07-16 19:32:13 +01:00
|
|
|
modal.onDidDismiss().then(async (res) => {
|
2021-05-27 13:11:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
const DocumentToSave = res.data.documents.map((e) => {
|
|
|
|
|
return {
|
|
|
|
|
ApplicationId: e.ApplicationType,
|
|
|
|
|
SourceId: e.Id,
|
|
|
|
|
}
|
|
|
|
|
});
|
2021-09-03 15:43:22 +01:00
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
let docs = {
|
|
|
|
|
ProcessInstanceID: "",
|
|
|
|
|
Attachments: DocumentToSave,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-08-20 15:43:37 +01:00
|
|
|
if(res.data) {
|
2021-05-27 13:11:10 +01:00
|
|
|
if(actionName == 'Solicitar Reapreciação') {
|
|
|
|
|
|
2021-07-16 19:32:13 +01:00
|
|
|
await this.repreciar(res.data.note, docs);
|
2021-05-27 13:11:10 +01:00
|
|
|
}
|
2021-08-20 14:23:48 +01:00
|
|
|
else if(actionName == 'Arquivar') {
|
2021-07-16 19:32:13 +01:00
|
|
|
await this.arquivar(res.data.note, docs);
|
2021-08-20 14:23:48 +01:00
|
|
|
this.popoverController.dismiss('close')
|
2021-05-27 13:11:10 +01:00
|
|
|
}
|
|
|
|
|
}
|
2021-08-20 15:43:37 +01:00
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-28 15:45:41 +01:00
|
|
|
async arquivar(note:string, documents:any) {
|
2021-08-20 15:43:37 +01:00
|
|
|
|
|
|
|
|
const loader = this.toastService.loading()
|
2021-05-28 15:45:41 +01:00
|
|
|
|
2021-09-03 15:43:22 +01:00
|
|
|
try {
|
2021-08-20 15:43:37 +01:00
|
|
|
await this.pedidoService.arquivar({serialNumber: this.serialNumber,
|
|
|
|
|
documents,
|
|
|
|
|
note
|
|
|
|
|
}).toPromise()
|
|
|
|
|
|
2021-11-09 15:37:59 +01:00
|
|
|
this.toastService._successMessage('Processo arquivado')
|
2021-05-28 15:45:41 +01:00
|
|
|
} catch (error) {
|
2023-02-02 12:01:18 +01:00
|
|
|
if(error.status == 0) {
|
|
|
|
|
this.toastService._badRequest('sem conexão ao servidor')
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
this.toastService._badRequest('Processo não arquivado')
|
|
|
|
|
}
|
2021-08-20 15:43:37 +01:00
|
|
|
} finally {
|
|
|
|
|
loader.remove()
|
2021-05-28 15:45:41 +01:00
|
|
|
}
|
|
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async openDarParecer(task: any) {
|
2021-09-03 15:43:22 +01:00
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
let classs;
|
|
|
|
|
if( window.innerWidth <= 800){
|
|
|
|
|
classs = 'book-meeting-modal modal modal-desktop'
|
|
|
|
|
} else {
|
|
|
|
|
classs = 'modal modal-desktop showAsideOptions'
|
|
|
|
|
}
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: DarParecerPage,
|
|
|
|
|
componentProps: {
|
|
|
|
|
serialNumber: this.task.SerialNumber,
|
|
|
|
|
ProcessInstanceID: this.task.ProcessInstanceID,
|
|
|
|
|
},
|
|
|
|
|
cssClass: classs,
|
|
|
|
|
backdropDismiss: false
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
2021-08-17 17:02:41 +01:00
|
|
|
modal.onDidDismiss().then( () => {
|
|
|
|
|
this.popoverController.dismiss('close');
|
|
|
|
|
});
|
|
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
}
|
|
|
|
|
|
2023-01-30 17:41:27 +01:00
|
|
|
async openForwardModal(tasK: any) {
|
|
|
|
|
let classs;
|
|
|
|
|
if (window.innerWidth <= 800) {
|
|
|
|
|
classs = 'book-meeting-modal modal modal-desktop'
|
|
|
|
|
} else {
|
|
|
|
|
classs = 'modal modal-desktop showAsideOptions'
|
|
|
|
|
}
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: ForwardPage,
|
|
|
|
|
componentProps: {
|
|
|
|
|
task: this.task,
|
|
|
|
|
},
|
|
|
|
|
cssClass: classs,
|
|
|
|
|
backdropDismiss: false
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
|
|
|
|
modal.onDidDismiss().then(() => {
|
|
|
|
|
this.popoverController.dismiss('close');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
async openDelegarModal(task: any) {
|
2021-08-20 14:23:48 +01:00
|
|
|
|
2021-09-03 15:43:22 +01:00
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
let classs;
|
|
|
|
|
if( window.innerWidth <= 800){
|
|
|
|
|
classs = 'book-meeting-modal modal modal-desktop'
|
|
|
|
|
} else {
|
|
|
|
|
classs = 'modal modal-desktop showAsideOptions'
|
|
|
|
|
}
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: DelegarPage,
|
|
|
|
|
componentProps: {
|
|
|
|
|
task: this.task,
|
|
|
|
|
},
|
|
|
|
|
cssClass: classs,
|
|
|
|
|
backdropDismiss: false
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
2021-08-20 15:43:37 +01:00
|
|
|
modal.onDidDismiss().then( async (res)=> {
|
2021-09-03 15:43:22 +01:00
|
|
|
|
2021-08-20 15:43:37 +01:00
|
|
|
if(res['data']=='close') {
|
|
|
|
|
this.popoverController.dismiss('close');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
2021-05-27 13:11:10 +01:00
|
|
|
}
|
|
|
|
|
|
2021-05-28 15:45:41 +01:00
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
}
|