2021-05-27 13:11:10 +01:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
|
|
import { ActivatedRoute } from '@angular/router';
|
2021-06-08 15:59:06 +01:00
|
|
|
import { AnimationController, 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';
|
|
|
|
|
import { DarParecerPage } from 'src/app/modals/dar-parecer/dar-parecer.page';
|
|
|
|
|
import { DelegarPage } from 'src/app/modals/delegar/delegar.page';
|
|
|
|
|
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';
|
2021-06-08 15:59:06 +01:00
|
|
|
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
|
|
|
|
|
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
|
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;
|
|
|
|
|
serialnumber : string
|
|
|
|
|
showEnviarPendentes = false
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
private popoverController: PopoverController,
|
|
|
|
|
private modalController: ModalController,
|
|
|
|
|
private navParams: NavParams,
|
|
|
|
|
private processes: ProcessesService,
|
|
|
|
|
private activatedRoute: ActivatedRoute,
|
2021-06-08 15:59:06 +01:00
|
|
|
private animationController: AnimationController
|
2021-05-27 13:11:10 +01:00
|
|
|
) {
|
|
|
|
|
this.task = this.navParams.get('task');
|
|
|
|
|
this.fulltask = this.navParams.get('fulltask');
|
|
|
|
|
|
|
|
|
|
this.activatedRoute.queryParams.subscribe(params => {
|
|
|
|
|
if(params["serialNumber"]) {
|
|
|
|
|
this.serialnumber = params["serialNumber"];
|
|
|
|
|
// console.log(params["serialNumber"]);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.showEnviarPendentes = this.navParams.get('showEnviarPendentes');
|
|
|
|
|
|
|
|
|
|
if(!this.showEnviarPendentes) this.showEnviarPendentes = false
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
console.log(this.task);
|
|
|
|
|
this.profile = "mdgpr";
|
|
|
|
|
|
|
|
|
|
window.onresize = (event) => {
|
|
|
|
|
if( window.innerWidth >= 800){
|
|
|
|
|
this.popoverController.dismiss();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
close(){
|
|
|
|
|
if( window.innerWidth <= 1024){
|
|
|
|
|
this.popoverController.dismiss();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
this.modalController.dismiss();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sendExpedienteToPending(){
|
|
|
|
|
this.processes.SetTaskToPending(this.task.SerialNumber).subscribe(res=>{
|
|
|
|
|
console.log(res);
|
|
|
|
|
this.close();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async openBookMeetingModal(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: BookMeetingModalPage,
|
|
|
|
|
componentProps: {
|
|
|
|
|
task: this.task,
|
|
|
|
|
},
|
|
|
|
|
cssClass: classs,
|
|
|
|
|
backdropDismiss: false
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
|
|
|
|
modal.onDidDismiss();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async openExpedientActionsModal(taskAction: any, task: any) {
|
|
|
|
|
//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({
|
|
|
|
|
component: ExpedientTaskModalPage,
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async distartExpedientModal(){
|
|
|
|
|
console.log(this.fulltask);
|
|
|
|
|
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(); */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-28 15:45:41 +01:00
|
|
|
async repreciar(note:string, documents:any) {
|
2021-05-27 13:11:10 +01:00
|
|
|
let body = {
|
|
|
|
|
"serialNumber": this.serialnumber,
|
|
|
|
|
"action": "Reapreciação",
|
|
|
|
|
"ActionTypeId": 100000009,
|
|
|
|
|
"dataFields": {
|
|
|
|
|
"ReviewUserComment": note,
|
|
|
|
|
},
|
|
|
|
|
"AttachmentList" :documents,
|
|
|
|
|
}
|
2021-05-28 15:45:41 +01:00
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
await this.processes.CompleteTask(body).toPromise()
|
|
|
|
|
this.close();
|
|
|
|
|
this.successMessage()
|
|
|
|
|
} catch (error) {
|
|
|
|
|
this.badRequest()
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async openAddNoteModal(actionName:string) {
|
|
|
|
|
let classs;
|
|
|
|
|
if( window.innerWidth <= 800){
|
|
|
|
|
classs = 'modal modal-desktop'
|
|
|
|
|
} else {
|
|
|
|
|
classs = 'modal modal-desktop'
|
|
|
|
|
}
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: AddNotePage,
|
|
|
|
|
componentProps:{
|
|
|
|
|
},
|
|
|
|
|
cssClass: classs,
|
|
|
|
|
backdropDismiss: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await modal.present();
|
|
|
|
|
|
|
|
|
|
modal.onDidDismiss().then(res => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const DocumentToSave = res.data.documents.map((e) => {
|
|
|
|
|
return {
|
|
|
|
|
ApplicationId: e.ApplicationType,
|
|
|
|
|
SourceId: e.Id,
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let docs = {
|
|
|
|
|
ProcessInstanceID: "",
|
|
|
|
|
Attachments: DocumentToSave,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(res.data){
|
|
|
|
|
if(actionName == 'Solicitar Reapreciação') {
|
|
|
|
|
|
|
|
|
|
this.repreciar(res.data.note, docs);
|
|
|
|
|
}
|
|
|
|
|
else if(actionName == 'Arquivar'){
|
|
|
|
|
this.arquivar(res.data.note, docs);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-28 15:45:41 +01:00
|
|
|
async arquivar(note:string, documents:any) {
|
2021-05-27 13:11:10 +01:00
|
|
|
let body = {
|
|
|
|
|
"serialNumber": this.serialnumber,
|
|
|
|
|
"action": "Arquivo",
|
|
|
|
|
"ActionTypeId": 95,
|
|
|
|
|
"dataFields": {
|
|
|
|
|
"ReviewUserComment": note,
|
|
|
|
|
},
|
|
|
|
|
"AttachmentList" :documents,
|
|
|
|
|
}
|
2021-05-28 15:45:41 +01:00
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
await this.processes.CompleteTask(body).toPromise()
|
|
|
|
|
this.close();
|
|
|
|
|
this.successMessage()
|
|
|
|
|
} catch (error) {
|
|
|
|
|
this.badRequest()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async openDarParecer(task: any) {
|
|
|
|
|
console.log(task);
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
modal.onDidDismiss();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async openDelegarModal(task: any) {
|
|
|
|
|
console.log(task);
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
modal.onDidDismiss();
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-28 15:45:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
async successMessage(message?: string) {
|
|
|
|
|
|
2021-06-08 15:59:06 +01:00
|
|
|
const enterAnimation = (baseEl: any) => {
|
|
|
|
|
const backdropAnimation = this.animationController.create()
|
|
|
|
|
.addElement(baseEl.querySelector('ion-backdrop')!)
|
|
|
|
|
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
|
|
|
|
|
|
|
|
|
|
const wrapperAnimation = this.animationController.create()
|
|
|
|
|
.addElement(baseEl.querySelector('.modal-wrapper')!)
|
|
|
|
|
.keyframes([
|
|
|
|
|
{ offset: 0, opacity: '1', right: '-100%' },
|
|
|
|
|
{ offset: 1, opacity: '1', right: '0px' }
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
return this.animationController.create()
|
|
|
|
|
.addElement(baseEl)
|
|
|
|
|
.easing('ease-out')
|
|
|
|
|
.duration(500)
|
|
|
|
|
.addAnimation([backdropAnimation, wrapperAnimation]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const leaveAnimation = (baseEl: any) => {
|
|
|
|
|
return enterAnimation(baseEl).direction('reverse');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-05-28 15:45:41 +01:00
|
|
|
const modal = await this.modalController.create({
|
2021-06-08 15:59:06 +01:00
|
|
|
enterAnimation,
|
|
|
|
|
leaveAnimation,
|
|
|
|
|
component: SuccessMessagePage,
|
2021-05-28 15:45:41 +01:00
|
|
|
componentProps: {
|
|
|
|
|
message: message || 'Processo efetuado' ,
|
|
|
|
|
},
|
2021-06-08 15:59:06 +01:00
|
|
|
cssClass: 'notification-modal'
|
2021-05-28 15:45:41 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
modal.present()
|
|
|
|
|
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
modal.dismiss()
|
|
|
|
|
},3000)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-08 15:59:06 +01:00
|
|
|
async badRequest(message?) {
|
|
|
|
|
const enterAnimation = (baseEl: any) => {
|
|
|
|
|
const backdropAnimation = this.animationController.create()
|
|
|
|
|
.addElement(baseEl.querySelector('ion-backdrop')!)
|
|
|
|
|
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
|
|
|
|
|
|
|
|
|
|
const wrapperAnimation = this.animationController.create()
|
|
|
|
|
.addElement(baseEl.querySelector('.modal-wrapper')!)
|
|
|
|
|
.keyframes([
|
|
|
|
|
{ offset: 0, opacity: '1', right: '-100%' },
|
|
|
|
|
{ offset: 1, opacity: '1', right: '0px' }
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
return this.animationController.create()
|
|
|
|
|
.addElement(baseEl)
|
|
|
|
|
.easing('ease-out')
|
|
|
|
|
.duration(500)
|
|
|
|
|
.addAnimation([backdropAnimation, wrapperAnimation]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const leaveAnimation = (baseEl: any) => {
|
|
|
|
|
return enterAnimation(baseEl).direction('reverse');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-05-28 15:45:41 +01:00
|
|
|
const modal = await this.modalController.create({
|
2021-06-08 15:59:06 +01:00
|
|
|
enterAnimation,
|
|
|
|
|
leaveAnimation,
|
|
|
|
|
component: BadRequestPage,
|
2021-05-28 15:45:41 +01:00
|
|
|
componentProps: {
|
2021-06-08 15:59:06 +01:00
|
|
|
message: message || 'Processo efetuado' ,
|
2021-05-28 15:45:41 +01:00
|
|
|
},
|
2021-06-08 15:59:06 +01:00
|
|
|
cssClass: 'notification-modal'
|
2021-05-28 15:45:41 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
modal.present()
|
|
|
|
|
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
modal.dismiss()
|
|
|
|
|
},1000)
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-27 13:11:10 +01:00
|
|
|
}
|