mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
158 lines
3.9 KiB
TypeScript
158 lines
3.9 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { ActivatedRoute } from '@angular/router';
|
|
import { AnimationController, ModalController, PopoverController } from '@ionic/angular';
|
|
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 { ProcessesService } from 'src/app/services/processes.service';
|
|
import { ToastService } from 'src/app/services/toast.service';
|
|
import { BadRequestPage } from '../bad-request/bad-request.page';
|
|
import { SuccessMessagePage } from '../success-message/success-message.page';
|
|
|
|
@Component({
|
|
selector: 'app-deploma-options',
|
|
templateUrl: './deploma-options.page.html',
|
|
styleUrls: ['./deploma-options.page.scss'],
|
|
})
|
|
export class DeplomaOptionsPage implements OnInit {
|
|
|
|
|
|
serialnumber: string;
|
|
profile: string;
|
|
task: any
|
|
fulltask: any
|
|
|
|
|
|
constructor(public popoverController: PopoverController,
|
|
private modalController: ModalController,
|
|
private activatedRoute: ActivatedRoute,
|
|
private processes: ProcessesService,
|
|
private animationController: AnimationController,
|
|
private toastService: ToastService) {
|
|
this.activatedRoute.queryParams.subscribe(params => {
|
|
if(params["serialNumber"]) {
|
|
this.serialnumber = params["serialNumber"];
|
|
console.log(params["serialNumber"]);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
ngOnInit() {
|
|
}
|
|
|
|
|
|
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 => {
|
|
if(res.data){
|
|
|
|
|
|
const DocumentToSave = res.data.documents.map((e) => {
|
|
return {
|
|
ApplicationId: e.ApplicationType,
|
|
SourceId: e.Id,
|
|
}
|
|
});
|
|
|
|
let docs = {
|
|
ProcessInstanceID: "",
|
|
Attachments: DocumentToSave,
|
|
}
|
|
|
|
|
|
if(actionName == 'Solicitar assinatura'){
|
|
this.askSignature(res.data.note, docs);
|
|
this.goBack();
|
|
}
|
|
else if(actionName == 'Solicitar alteração'){
|
|
this.askToChange(res.data.note, docs);
|
|
this.goBack();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
async askToChange(note:string, documents:any){
|
|
let body = {
|
|
"serialNumber": this.serialnumber,
|
|
"action": "Retificar",
|
|
"ActionTypeId": 99999841,
|
|
"dataFields": {
|
|
"ReviewUserComment": note,
|
|
},
|
|
"AttachmentList" :documents,
|
|
}
|
|
|
|
try {
|
|
await this.processes.CompleteTask(body).toPromise()
|
|
this.close();
|
|
this.toastService.successMessage()
|
|
} catch (error) {
|
|
this.toastService.badRequest()
|
|
}
|
|
}
|
|
|
|
|
|
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 askSignature(note:string, documents:any) {
|
|
let body = {
|
|
"serialNumber": this.serialnumber,
|
|
"action": "Aprovar",
|
|
"ActionTypeId": 99999840,
|
|
"dataFields": {
|
|
"ReviewUserComment": note,
|
|
},
|
|
"AttachmentList" :documents,
|
|
}
|
|
try {
|
|
await this.processes.CompleteTask(body).toPromise()
|
|
this.close();
|
|
this.toastService.successMessage()
|
|
} catch (error) {
|
|
this.toastService.badRequest()
|
|
}
|
|
}
|
|
|
|
|
|
goBack() {
|
|
this.close()
|
|
}
|
|
|
|
|
|
close(){}
|
|
|
|
}
|