mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
dix bugs
This commit is contained in:
@@ -0,0 +1,430 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { CreateProcessPage } from 'src/app/modals/create-process/create-process.page';
|
||||
import { DelegarPage } from 'src/app/modals/delegar/delegar.page';
|
||||
import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
|
||||
import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page';
|
||||
import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { RouteService } from 'src/app/services/route.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { TaskService } from 'src/app/services/task.service'
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-despachos-pr-options',
|
||||
templateUrl: './despachos-pr-options.page.html',
|
||||
styleUrls: ['./despachos-pr-options.page.scss'],
|
||||
})
|
||||
export class DespachosPrOptionsPage implements OnInit {
|
||||
|
||||
|
||||
task: any;
|
||||
fulltask: any;
|
||||
serialNumber: string;
|
||||
profile: string
|
||||
environment = environment
|
||||
|
||||
constructor(private activateRoute: ActivatedRoute,
|
||||
private processes: ProcessesService,
|
||||
private router: Router,
|
||||
private modalController: ModalController,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private toastService: ToastService,
|
||||
private RouteService: RouteService,
|
||||
public p: PermissionService,
|
||||
public ThemeService: ThemeService,
|
||||
public TaskService: TaskService,
|
||||
private httpErroHandle: HttpErrorHandle,
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.profile = "mdgpr";
|
||||
|
||||
this.activatedRoute.queryParams.subscribe(params => {
|
||||
if(params["serialNumber"]) {
|
||||
this.serialNumber = params["serialNumber"];
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if(this.task.serialNumber) {
|
||||
this.serialNumber = this.task.serialNumber
|
||||
} else if(this.task.SerialNumber) {
|
||||
this.serialNumber = this.task.SerialNumber
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
close () {
|
||||
this.goBack()
|
||||
}
|
||||
|
||||
|
||||
async openExpedientActionsModal(taskAction: any, task: any) {
|
||||
// this.modalController.dismiss();
|
||||
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: CreateProcessPage,
|
||||
componentProps: {
|
||||
taskAction: taskAction,
|
||||
task: task,
|
||||
profile: this.profile,
|
||||
fulltask: this.fulltask
|
||||
},
|
||||
cssClass: classs,
|
||||
});
|
||||
|
||||
modal.onDidDismiss().then( (res)=> {
|
||||
|
||||
if(res['data']=='openDiscart') {
|
||||
|
||||
|
||||
this.distartExpedientModal();
|
||||
|
||||
} else {
|
||||
this.goBack()
|
||||
}
|
||||
|
||||
this.modalController.dismiss('close')
|
||||
|
||||
}, (error) => {
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
sendExpedienteToPending() {
|
||||
const loader = this.toastService.loading()
|
||||
this.processes.SetTaskToPending(this.serialNumber).subscribe(res=>{
|
||||
|
||||
this.httpErroHandle.httpsSucessMessagge('Enviar para Pendentes')
|
||||
this.modalController.dismiss('close')
|
||||
loader.remove()
|
||||
},(error)=>{
|
||||
loader.remove()
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
|
||||
this.toastService._badRequest('Processo não encontrado')
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async distartExpedientModal() {
|
||||
this.modalController.dismiss();
|
||||
|
||||
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
|
||||
});
|
||||
|
||||
modal.onDidDismiss().then(res=>{
|
||||
if(res['data']=='close'){
|
||||
this.close();
|
||||
/*
|
||||
this.close();
|
||||
this.openMenu(); */
|
||||
}
|
||||
this.modalController.dismiss('close')
|
||||
|
||||
}, (error) => {
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
|
||||
async openBookMeetingModal(task: any) {
|
||||
this.modalController.dismiss();
|
||||
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,
|
||||
fulltask:this.fulltask
|
||||
},
|
||||
cssClass: classs,
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
modal.onDidDismiss().then(
|
||||
()=> {},
|
||||
(error) => {
|
||||
console.log(error)
|
||||
}
|
||||
)
|
||||
|
||||
await modal.present();
|
||||
|
||||
}
|
||||
|
||||
async openDelegarModal(task: any) {
|
||||
this.modalController.dismiss();
|
||||
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
|
||||
});
|
||||
|
||||
modal.onDidDismiss().then(res => {
|
||||
if(res) {
|
||||
const data = res.data;
|
||||
if(data == 'close') {
|
||||
this.goBack();
|
||||
}
|
||||
}
|
||||
|
||||
}, (error) => {
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
async generateDiploma(note:string, documents:any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Reencaminhar",
|
||||
"ActionTypeId": 99999839,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.toastService._successMessage()
|
||||
this.close();
|
||||
} catch (error) {
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
|
||||
this.toastService._badRequest()
|
||||
}
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async openAddNoteModal(actionName:string) {
|
||||
this.modalController.dismiss();
|
||||
let classs;
|
||||
if( window.innerWidth <= 800){
|
||||
classs = 'modal modal-desktop'
|
||||
} else {
|
||||
classs = 'modal modal-desktop'
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
component: AddNotePage,
|
||||
componentProps: {
|
||||
showAttachmentBtn: true,
|
||||
actionName:actionName
|
||||
},
|
||||
cssClass: classs,
|
||||
backdropDismiss: true
|
||||
});
|
||||
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
|
||||
if(res.data){
|
||||
|
||||
|
||||
|
||||
const DocumentToSave = res.data.documents.map((e) => {
|
||||
return {
|
||||
ApplicationId: e.ApplicationType,
|
||||
SourceId: e.Id,
|
||||
}
|
||||
});
|
||||
|
||||
let docs = {
|
||||
ProcessInstanceID: "",
|
||||
Attachments: DocumentToSave,
|
||||
}
|
||||
|
||||
if(actionName == 'Executado') {
|
||||
await this.executado(res.data.note, docs);
|
||||
}
|
||||
else if(actionName == 'Arquivar') {
|
||||
await this.arquivar(res.data.note, docs);
|
||||
}
|
||||
else if(actionName == 'Gerar Diploma') {
|
||||
await this.generateDiploma(res.data.note, docs);
|
||||
}
|
||||
else if(actionName == 'Reexecução') {
|
||||
await this.reexecutar(res.data.note, docs);
|
||||
}
|
||||
else if(actionName == 'Concluido') {
|
||||
await this.concluir(res.data.note, docs);
|
||||
}
|
||||
|
||||
this.goBack();
|
||||
}
|
||||
}, (error) => {
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
|
||||
async concluir(note:string, documents:any){
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Arquivo",
|
||||
"ActionTypeId": 95,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.httpErroHandle.httpsSucessMessagge('Concluir Despacho')
|
||||
this.close();
|
||||
} catch (error) {
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
|
||||
this.toastService._badRequest()
|
||||
}
|
||||
}
|
||||
finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async arquivar(note:string, documents:any){
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Arquivo",
|
||||
"ActionTypeId": 95,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.toastService.successMessage('Processo arquivado')
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não arquivado')
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async executado(note:string, documents:any){
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Conhecimento",
|
||||
"ActionTypeId": 104,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.httpErroHandle.httpsSucessMessagge('Executado')
|
||||
this.close();
|
||||
this.toastService.successMessage()
|
||||
} catch(error) {
|
||||
this.toastService.badRequest()
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async reexecutar(note:string, documents:any){
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Reexecução",
|
||||
"ActionTypeId": 100000010,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.httpErroHandle.httpsSucessMessagge('Reexecução')
|
||||
this.toastService.successMessage()
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest()
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
}
|
||||
|
||||
goBack() {
|
||||
this.RouteService.goBack();
|
||||
this.TaskService.loadDiplomas()
|
||||
}
|
||||
|
||||
cancle() {
|
||||
this.modalController.dismiss()
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user