mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
fix create process from attachment
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ClickAndHoldDirectiveService } from './click-and-hold-directive.service';
|
||||
|
||||
describe('ClickAndHoldDirectiveService', () => {
|
||||
let service: ClickAndHoldDirectiveService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ClickAndHoldDirectiveService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
import { Directive, ElementRef, EventEmitter, HostListener, Output } from '@angular/core';
|
||||
import { interval, Subject } from 'rxjs';
|
||||
import { takeUntil, tap } from 'rxjs/operators';
|
||||
|
||||
@Directive({
|
||||
selector: '[appClickAndHold]'
|
||||
})
|
||||
export class ClickAndHoldDirectiveService {
|
||||
|
||||
@Output() clickAndHold = new EventEmitter();
|
||||
|
||||
private destroy$ = new Subject();
|
||||
|
||||
constructor(private el: ElementRef) {
|
||||
// alert("ncie!")
|
||||
}
|
||||
|
||||
@HostListener('mousedown') onMouseDown() {
|
||||
this.startTimer();
|
||||
}
|
||||
|
||||
@HostListener('mouseup') onMouseUp() {
|
||||
this.stopTimer();
|
||||
}
|
||||
|
||||
@HostListener('mouseleave') onMouseLeave() {
|
||||
this.stopTimer();
|
||||
}
|
||||
|
||||
private startTimer() {
|
||||
interval(100)
|
||||
.pipe(
|
||||
takeUntil(this.destroy$),
|
||||
tap(() => this.clickAndHold.emit())
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
private stopTimer() {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ export class DeviceService {
|
||||
|
||||
|
||||
isTableDivice() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ClickAndHoldDirectiveService } from '../click-and-hold-directive.service';
|
||||
|
||||
|
||||
|
||||
@NgModule({
|
||||
//declarations: [ClickAndHoldDirectiveService],
|
||||
imports: [
|
||||
CommonModule
|
||||
],
|
||||
//exports: [ClickAndHoldDirectiveService]
|
||||
})
|
||||
export class DirectivesModule { }
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DocumentViewerOptionService } from './document-viewer-option.service';
|
||||
|
||||
describe('DocumentViewerOptionService', () => {
|
||||
let service: DocumentViewerOptionService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(DocumentViewerOptionService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,147 @@
|
||||
import { Component, Injectable, OnInit } from '@angular/core';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { NavParams } from '@ionic/angular';
|
||||
import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage';
|
||||
import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { EventDetailsDocumentsOptionsPage } from 'src/app/shared/popover/event-details-documents-options/event-details-documents-options.page';
|
||||
import { AlertController, ModalController } from '@ionic/angular';
|
||||
import { SearchList } from 'src/app/models/search-document';
|
||||
import { DocumentSetUpMeetingPage } from '../modals/document-set-up-meeting/document-set-up-meeting.page';
|
||||
|
||||
|
||||
|
||||
|
||||
class CreateProcessFromProcess {}
|
||||
|
||||
|
||||
class createProcessFromAttachment {}
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'any'
|
||||
})
|
||||
export class DocumentViewerOptionService {
|
||||
|
||||
|
||||
trustedUrl: any;
|
||||
file: any;
|
||||
applicationId: any;
|
||||
docId: any
|
||||
task: ExpedientTaskModalPageNavParamsTask;
|
||||
Document: any
|
||||
loader = true
|
||||
attachment: SearchList[] = [];
|
||||
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController
|
||||
) {}
|
||||
|
||||
|
||||
setData({file, applicationId, docId, Document, task, attachment = null}) {
|
||||
this.file = file
|
||||
this.applicationId = applicationId
|
||||
this.docId = docId
|
||||
this.Document = Document
|
||||
this.task = task
|
||||
this.attachment = attachment
|
||||
}
|
||||
|
||||
async openOptions() {
|
||||
const modal = await this.modalController.create({
|
||||
component: EventDetailsDocumentsOptionsPage,
|
||||
cssClass: 'model aside-modal search-submodal',
|
||||
componentProps: {
|
||||
content: "", // check
|
||||
Document:this.Document // check
|
||||
}
|
||||
});
|
||||
await modal.present();
|
||||
|
||||
modal.onDidDismiss().then((res)=>{
|
||||
|
||||
if(res.data) {
|
||||
if(res.data.component == 'openBookMeetingModal') {
|
||||
this.openBookMeetingModal()
|
||||
} else if(res.data.component == 'openExpedientActionsModal') {
|
||||
this.openExpedientActionsModal(res.data.taskAction)
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}, (error) => {
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
async openBookMeetingModal() {
|
||||
//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.workflowInstanceDataFields.Subject, // check
|
||||
document: this.Document, // document
|
||||
},
|
||||
cssClass: classs,
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
modal.onDidDismiss().then(res=>{
|
||||
//this.RouteService.goBack();
|
||||
}, (error) => {
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
// efetuar despacho
|
||||
|
||||
async openExpedientActionsModal( taskAction: any) {
|
||||
|
||||
let classs;
|
||||
if( window.innerWidth < 701) {
|
||||
classs = 'modal modal-desktop'
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
// check passing
|
||||
|
||||
//console.log('this.Document----------openExpedientActionsModal', this.Document)
|
||||
const modal = await this.modalController.create({
|
||||
component: ExpedientTaskModalPage,
|
||||
componentProps: {
|
||||
taskAction: taskAction, // check
|
||||
task: this.task, // check
|
||||
document: this.Document, // nope
|
||||
aplicationId: this.Document.ApplicationId || this.Document.ApplicationID, // check
|
||||
applicationId: this.applicationId,
|
||||
docId: this.docId,
|
||||
createProcessFromFile: true,
|
||||
},
|
||||
cssClass: classs,
|
||||
});
|
||||
|
||||
modal.onDidDismiss().then(
|
||||
async(res)=>{}
|
||||
, (error) => {
|
||||
console.log(error)
|
||||
}
|
||||
);
|
||||
|
||||
await modal.present();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user