to many changes

This commit is contained in:
Eudes Inácio
2023-02-27 17:39:10 +01:00
parent fcd1989334
commit 46387d4977
30 changed files with 329 additions and 160 deletions
@@ -81,6 +81,14 @@
<button (click)="Assinar()" class="btn-cancel" shape="round" >Assinado</button>
<div class="solid"></div>
</div>
<div class="buttons">
<button (click)="openAddNoteModal('Arquivo')" class="btn-cancel" shape="round" >Arquivar</button>
<div class="solid"></div>
</div>
<div class="buttons">
<button (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar Despacho</button>
<div class="solid"></div>
</div>
</div>
<div *ngIf="!task">
@@ -10,6 +10,11 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag
import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service';
import {HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
import { DespachoService } from 'src/app/Rules/despacho.service'
import { AttachmentList } from 'src/app/models/Excludetask';
import { CreateProcessPage } from 'src/app/modals/create-process/create-process.page';
import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page';
@Component({
selector: 'app-diploma-assinar',
@@ -38,7 +43,8 @@ export class DiplomaAssinarPage implements OnInit {
private toastService: ToastService,
private RouteService: RouteService,
public ThemeService: ThemeService,
private httpErroHandle: HttpErrorHandle
private httpErroHandle: HttpErrorHandle,
private despachoService: DespachoService,
) {
this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].SerialNumber) {
@@ -182,6 +188,133 @@ export class DiplomaAssinarPage implements OnInit {
}
async openAddNoteModal(actionName: string) {
let classs;
if (window.innerWidth <= 800) {
classs = 'modal modal-desktop'
} else {
classs = 'add-note-modal-no-height'
}
const modal = await this.modalController.create({
component: AddNotePage,
componentProps: {
showAttachmentBtn: true,
actionName: actionName
},
cssClass: classs,
backdropDismiss: true
});
await modal.present();
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);
this.goBack(); */
}
else if (actionName == 'Arquivo') {
await this.arquivar(res.data.note, docs);
this.goBack();
}
else if (actionName == 'Reexecução') {
/* await this.reexecute(res.data.note, docs);
this.goBack(); */
} else if(actionName == 'Gerar Diploma') {
/* await this.generateDiploma(res.data.note, docs);
this.goBack(); */
}
}
});
}
async arquivar(note: string, documents: AttachmentList) {
const loader = this.toastService.loading()
try {
await this.despachoService.arquivar(note, documents, this.serialnumber).toPromise()
this.httpErroHandle.httpsSucessMessagge('Arquivar')
this.close();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
}
finally {
loader.remove()
}
}
async openExpedientActionsModal(taskAction: any, task: any) {
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,
});
await modal.present();
modal.onDidDismiss().then(async (res) => {
if (res['data'] == 'openDiscart') {
await this.distartExpedientModal();
}
this.goBack();
});
}
async distartExpedientModal() {
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();
/*
this.close();
this.openMenu(); */
}
});
}
toDateString(e) {
return new Date(e).toDateString()
}
@@ -185,12 +185,12 @@ export class DiplomasGerarPage implements OnInit {
const loader = this.toastService.loading()
this.despachoService.sendExpedienteToPending(this.serialnumber).subscribe(res => {
this.goBack();
this.toastService.successMessage()
this.httpErroHandle.httpsSucessMessagge('Enviar para Pendentes')
loader.remove()
},
error => {
loader.remove()
this.toastService.badRequest("Processo não enviado para despacho")
this.httpErroHandle.httpStatusHandle(error)
});
}
@@ -309,16 +309,11 @@ export class DiplomasGerarPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService._successMessage(false, ()=>{
this.httpErroHandle.httpsSucessMessagge('Assinado',() => {
this.goBack();
})
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
this.httpErroHandle.httpStatusHandle(error)
}
finally {
loader.remove()
@@ -79,8 +79,8 @@
<div *ngIf="task" class="aside-right flex-column height-100 overflow-y-auto">
<div class="buttons" *ngIf="task.activityInstanceName == 'Revisar Diploma'">
<button (click)="tempMethod('Arquivo')" class="btn-cancel" shape="round" >Arquivar</button>
<button (click)="tempMethod('Despacho')" class="btn-cancel" shape="round" >Efectuar Despacho</button>
<button (click)="openAddNoteModal('Arquivo')" class="btn-cancel" shape="round" >Arquivar</button>
<button (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efectuar Despacho</button>
<button (click)="openAddNoteModal('Solicitar assinatura')" class="btn-cancel" shape="round" >Solicitar assinatura do Presidente</button>
<button (click)="openAddNoteModal('Solicitar alteração')" class="btn-cancel" shape="round" >Solicitar alteração</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
@@ -16,6 +16,10 @@ import { BackgroundService } from 'src/app/services/background.service';
import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { AttachmentList } from 'src/app/models/Excludetask';
import { DespachoService } from 'src/app/Rules/despacho.service'
import { CreateProcessPage } from 'src/app/modals/create-process/create-process.page';
import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page';
@Component({
@@ -52,7 +56,8 @@ export class DiplomaPage implements OnInit {
private backgroundservice: BackgroundService,
private platform: Platform,
public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle
private httpErrorHandle: HttpErrorHandle,
private despachoService: DespachoService
) {
this.activatedRoute.paramMap.subscribe(params => {
//
@@ -395,6 +400,9 @@ export class DiplomaPage implements OnInit {
else if (actionName == 'Concluir diploma') {
await this.finish(res.data.note, docs);
this.goBack();
} else if (actionName == 'Arquivo') {
await this.arquivar(res.data.note, docs);
this.goBack();
}
}
});
@@ -419,6 +427,24 @@ export class DiplomaPage implements OnInit {
modal.onDidDismiss();
}
async arquivar(note: string, documents: AttachmentList) {
const loader = this.toastService.loading()
try {
await this.despachoService.arquivar(note, documents, this.serialNumber).toPromise()
this.httpErrorHandle.httpsSucessMessagge('Arquivar')
this.close();
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
}
finally {
loader.remove()
}
}
close() {
this.modalController.dismiss();
}
@@ -427,5 +453,61 @@ export class DiplomaPage implements OnInit {
console.log(actionname)
}
async openExpedientActionsModal(taskAction: any, task: any) {
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,
});
await modal.present();
modal.onDidDismiss().then(async (res) => {
if (res['data'] == 'openDiscart') {
await this.distartExpedientModal();
}
this.goBack();
});
}
async distartExpedientModal() {
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();
/*
this.close();
this.openMenu(); */
}
});
}
}
@@ -11,6 +11,7 @@ import { EventActionsPopoverPage } from '../../../agenda/event-actions-popover/e
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { ToastService } from 'src/app/services/toast.service';
import { ThemeService } from 'src/app/services/theme.service'
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({
selector: 'app-approve-event-modal',
@@ -40,7 +41,8 @@ export class ApproveEventModalPage implements OnInit {
private activatedRoute: ActivatedRoute,
private iab: InAppBrowser,
private toastService: ToastService,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle
) {
@@ -101,18 +103,13 @@ export class ApproveEventModalPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise()
this.toastService._successMessage('Evento aprovado', ()=>{
this.httpErrorHandle.httpsSucessMessagge('Aprovar', ()=>{
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
})
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não aprovado')
}
this.httpErrorHandle.httpStatusHandle(error)
}
finally {
loader.remove()
@@ -128,7 +125,7 @@ export class ApproveEventModalPage implements OnInit {
async rejectTask(serialNumber:string) {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
let body = { "serialNumber": serialNumber, "action": "Descartar" }
const loader = this.toastService.loading()
@@ -299,7 +299,7 @@ export class ApproveEventPage implements OnInit {
}
async rejeitar(serialNumber: string) {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
let body = { "serialNumber": serialNumber, "action": "Descartar" }
const loader = this.toastService.loading()
try {
@@ -384,16 +384,10 @@ export class ApproveEventPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService._successMessage();
this.goBack();
this.toastService._successMessage('Evento enviado para revisão');
this.httpErrorHandle.httpsSucessMessagge('Rever')
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não enviado para revisão');
}
this.httpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
@@ -333,18 +333,13 @@ export class ExpedienteDetailPage implements OnInit {
const loader = this.toastService.loading()
this.processes.SetTaskToPending(this.serialNumber).subscribe(res => {
this.toastService._successMessage('Processo enviado para pendentes')
this.httpErroHandle.httpsSucessMessagge('Enviar para Pendentes')
this.goBack();
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 enviado para pendentes')
}
this.httpErroHandle.httpStatusHandle(error)
});
}