This commit is contained in:
Peter Maquiran
2021-08-06 16:20:50 +01:00
parent 0af8c41d8a
commit 3fca0c848c
3 changed files with 103 additions and 4 deletions
+1 -1
View File
@@ -44,7 +44,7 @@
</div>
<div class="content">
{{ toDayEventStorage.eventsList | json}}
<!-- {{ toDayEventStorage.eventsList | json}} -->
<ion-list>
<ion-item class="cursor-pointer" lines="none" *ngFor="let event of toDayEventStorage.eventsList"
@@ -94,15 +94,15 @@
<div *ngIf="task" class="aside-right flex-column height-100">
<div class="buttons">
<div class="option-desc"> <div>Enviar para o PR</div> </div>
<!-- <button (click)="openAddNoteModal('Aprovar')" class="btn-cancel" shape="round" >Avaliação Superior</button> -->
<button (click)="openAddNoteModal('Aprovar')" class="btn-cancel" shape="round" >Avaliação Superior</button>
<div class="option-desc"> <div>Solicitar revisão</div> </div>
<!-- <button (click)="openAddNoteModal('Revisão')" class="btn-cancel" shape="round" >Mandar para Revisão</button> -->
<button (click)="openAddNoteModal('Revisão')" class="btn-cancel" shape="round" >Mandar para Revisão</button>
<div class="option-desc"> <div>Outras opções</div> </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)="openExpedientActionsModal('2',fulltask)" class="btn-cancel" shape="round" >Pedido de Deferimento</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<!-- <button (click)="attachDocument()" class="btn-cancel" shape="round" >Anexar Documentos</button> -->
<button (click)="attachDocument()" class="btn-cancel" shape="round" >Anexar Documentos</button>
<button (click)="distartExpedientModal('descartar')" class="btn-cancel" shape="round" >Descartar</button>
<div class="solid"></div>
</div>
@@ -16,6 +16,7 @@ import { ToastService } from 'src/app/services/toast.service';
import { Location } from '@angular/common';
import { SearchPage } from 'src/app/pages/search/search.page';
import { SearchDocument } from 'src/app/models/search-document';
import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
@Component({
selector: 'app-expediente-detail',
@@ -79,6 +80,104 @@ export class ExpedienteDetailPage implements OnInit {
this.toastService.presentToast('Não foi possível fazer login"');
}
async approve(note:string, documents:any){
let body = {
"serialNumber": this.serialnumber,
"action": "Aprovar",
"ActionTypeId": 100000004 ,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
console.log(body);
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise();
this.close();
this.toastService.successMessage('Processo aprovado')
} catch(error) {
this.toastService.badRequest('Processo não aprovado')
} finally {
loader.remove()
}
}
async sendToReview(note:string, documents:any){
let body = {
"serialNumber": this.serialnumber,
"action": "Retificar",
"ActionTypeId": 99999877,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.toastService.successMessage()
} catch(error) {
this.toastService.badRequest()
} finally {
loader.remove()
}
}
async openAddNoteModal(actionName:string) {
let classs;
if( window.innerWidth < 801) {
classs = 'modal modal-desktop'
} else {
classs = 'add-note-modal'
}
const modal = await this.modalController.create({
component: AddNotePage,
componentProps:{
showAttachmentBtn: false,
},
cssClass: classs,
//backdropDismiss: true
});
await modal.present();
modal.onDidDismiss().then(res => {
console.log(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 == 'Aprovar'){
this.approve(res.data.note, docs);
}
else if(actionName == 'Revisão'){
this.sendToReview(res.data.note, docs);
}
this.goBack();
}
});
}
goBack() {
this.location.back();
/* if(this.task.Status == "Pending" && this.caller != 'events'){