mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
166 lines
5.0 KiB
TypeScript
166 lines
5.0 KiB
TypeScript
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
import { customTask } from 'src/app/models/dailyworktask.model';
|
|
import { ThemeService } from 'src/app/services/theme.service'
|
|
import { DeviceService } from "src/app/services/device.service"
|
|
import { DocumentViewerOptionService } from "src/app/services/document-viewer-option.service";
|
|
import { PermissionService } from 'src/app/services/permission.service';
|
|
import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
|
|
import { ModalController } from '@ionic/angular';
|
|
import { DocumentSetUpMeetingPage } from 'src/app/modals/document-set-up-meeting/document-set-up-meeting.page';
|
|
import { HeaderSettingsService } from "src/app/services/header-settings.service"
|
|
import { SessionStore } from 'src/app/store/session.service';
|
|
import { LoginUserRespose } from 'src/app/models/user.model';
|
|
import { object } from 'zod';
|
|
import { element } from 'protractor';
|
|
|
|
@Component({
|
|
selector: 'app-task-details',
|
|
templateUrl: './task-details.page.html',
|
|
styleUrls: ['./task-details.page.scss'],
|
|
})
|
|
export class TaskDetailsPage implements OnInit {
|
|
|
|
@Input() task = new customTask();
|
|
@Input() intervenientes = []
|
|
@Input() cc = []
|
|
@Input() customDate = ''
|
|
@Input() mergedArray = []
|
|
@Input() fulltask = null
|
|
|
|
@Output() openOptions = new EventEmitter<any>();
|
|
@Output() goBack = new EventEmitter<any>();
|
|
@Output() viewDocument = new EventEmitter<any>();
|
|
|
|
selectedIndex = 0
|
|
dropButton = true
|
|
loggeduser: LoginUserRespose;
|
|
constructor(
|
|
public ThemeService: ThemeService,
|
|
public DeviceService: DeviceService,
|
|
private DocumentViewerOptionService: DocumentViewerOptionService,
|
|
public p: PermissionService,
|
|
private modalController: ModalController,
|
|
private HeaderSettingsService: HeaderSettingsService
|
|
) {
|
|
this.DeviceService.isDesktop();
|
|
this.loggeduser = SessionStore.user
|
|
|
|
}
|
|
|
|
ngOnInit() {
|
|
|
|
this.filterCoverPage();
|
|
|
|
window['TaskDetailsPage-openExpedientActionsModal'] = (taskAction, Document) => {
|
|
this.openExpedientActionsModal(taskAction, Document)
|
|
}
|
|
|
|
window['TaskDetailsPage-openBookMeetingModal'] = (Document) => {
|
|
this.openBookMeetingModal(Document)
|
|
}
|
|
}
|
|
|
|
|
|
clickDocumentUPdateIndex(docId: string, Document, content) {
|
|
this.DocumentViewerOptionService.setData({
|
|
file: {
|
|
title: Document.Assunto,
|
|
url: '',
|
|
title_link: '',
|
|
},
|
|
Document,
|
|
applicationId: Document.ApplicationId,
|
|
docId: Document.DocId || Document.SourceId,
|
|
task: this.fulltask
|
|
});
|
|
this.DocumentViewerOptionService.openOptions();
|
|
}
|
|
|
|
|
|
async openExpedientActionsModal(taskAction: any, Document) {
|
|
|
|
let classs;
|
|
if (window.innerWidth < 701) {
|
|
classs = 'modal modal-desktop'
|
|
} else {
|
|
classs = 'modal modal-desktop showAsideOptions'
|
|
}
|
|
// check passing
|
|
console.log('this.Document----------openExpedientActionsModal', Document)
|
|
const modal = await this.modalController.create({
|
|
component: ExpedientTaskModalPage,
|
|
componentProps: {
|
|
taskAction: taskAction, // check
|
|
task: this.fulltask, // check
|
|
document: Document, // nope
|
|
aplicationId: Document.ApplicationId || Document.ApplicationID, // check
|
|
applicationId: Document.ApplicationId || Document.ApplicationID,
|
|
docId: Document.docId || Document.DocId,
|
|
createProcessFromFile: true,
|
|
},
|
|
cssClass: classs,
|
|
});
|
|
|
|
modal.onDidDismiss().then(
|
|
async (res) => { }
|
|
, (error) => {
|
|
console.log(error)
|
|
}
|
|
);
|
|
|
|
await modal.present();
|
|
|
|
}
|
|
|
|
async openBookMeetingModal(Document) {
|
|
//console.log('this.Document----------', this.Document)
|
|
let classs;
|
|
if (window.innerWidth < 701) {
|
|
classs = 'book-meeting-modal modal modal-desktop'
|
|
} else {
|
|
classs = 'modal modal-desktop showAsideOptions'
|
|
}
|
|
|
|
// check passing
|
|
const modal = await this.modalController.create({
|
|
component: DocumentSetUpMeetingPage,
|
|
componentProps: {
|
|
subject: this.task.Subject, // check
|
|
document: Document, // document
|
|
},
|
|
cssClass: classs,
|
|
backdropDismiss: false
|
|
});
|
|
|
|
modal.onDidDismiss().then(res => {
|
|
//this.RouteService.goBack();
|
|
}, (error) => {
|
|
console.log(error)
|
|
});
|
|
|
|
await modal.present();
|
|
}
|
|
|
|
changeDropButton() {
|
|
this.dropButton = !this.dropButton;
|
|
this.HeaderSettingsService.hideHeader = !this.dropButton
|
|
}
|
|
|
|
onOndestroy() {
|
|
this.HeaderSettingsService.hideHeader == false
|
|
}
|
|
|
|
filterCoverPage() {
|
|
/* Method that filter the cover page of PR expediente */
|
|
if (this.loggeduser.Profile == 'PR' && this.task.WorkflowName == "Expediente") {
|
|
try {
|
|
console.log('Merge array 1', this.mergedArray)
|
|
this.mergedArray = this.mergedArray.filter(element => element!.DocTypeId != 99999992);
|
|
console.log('Merge array 2', this.mergedArray)
|
|
} catch (error) {
|
|
console.info('error filtering cover page', error)
|
|
}
|
|
}
|
|
}
|
|
}
|