mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
fix create process from attachment
This commit is contained in:
@@ -92,6 +92,7 @@ import { tokenInterceptor } from './interceptors/token.interceptors';
|
||||
|
||||
import { InputFilterDirective } from './services/directives/input-filter.directive';
|
||||
import { VisibilityDirective } from './services/directives/visibility.directive';
|
||||
import { ClickAndHoldDirectiveService } from './services/click-and-hold-directive.service';
|
||||
|
||||
// import { ServiceWorkerModule } from '@angular/service-worker';
|
||||
// import { AngularFireModule } from '@angular/fire';
|
||||
@@ -121,7 +122,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
|
||||
SentrySibling.init
|
||||
);
|
||||
@NgModule({
|
||||
declarations: [AppComponent, PopupQuestionPipe, InputFilterDirective],
|
||||
declarations: [AppComponent, PopupQuestionPipe, InputFilterDirective, ClickAndHoldDirectiveService],
|
||||
imports: [BrowserModule,
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
|
||||
@@ -172,7 +172,10 @@ export class ViewDocumentPage implements OnInit {
|
||||
taskAction: taskAction, // check
|
||||
task: this.task, // check
|
||||
document: this.Document, // nope
|
||||
aplicationId: this.Document.ApplicationId || this.Document.ApplicationID // check
|
||||
aplicationId: this.Document.ApplicationId || this.Document.ApplicationID, // check
|
||||
applicationId: this.applicationId,
|
||||
docId: this.docId,
|
||||
createProcessFromFile: true,
|
||||
},
|
||||
cssClass: classs,
|
||||
});
|
||||
|
||||
@@ -11,6 +11,8 @@ import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import { TaskDetailsPageModule } from 'src/app/shared/gabinete-digital/generic/task-details/task-details.module'
|
||||
import { ViewerAttachmentPageModule } from '../../viewer-attachment/viewer-attachment.module';
|
||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
import { ClickAndHoldDirectiveService } from 'src/app/services/click-and-hold-directive.service';
|
||||
import { DirectivesModule } from 'src/app/services/directives/directives.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -22,9 +24,10 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
TaskDetailsPageModule,
|
||||
SharedModule,
|
||||
FontAwesomeModule,
|
||||
DirectivesModule
|
||||
],
|
||||
declarations: [
|
||||
DespachoPage,
|
||||
DespachoPage, ClickAndHoldDirectiveService
|
||||
]
|
||||
})
|
||||
export class DespachoPageModule {}
|
||||
|
||||
@@ -87,16 +87,16 @@
|
||||
<div class="bottom-content width-100 flex-1" [ngClass]="{'expand': !DeviceService.isDesktop()}">
|
||||
<ion-list *ngIf="DeviceService.isDesktop()">
|
||||
<h5 class="font-17-rem">Documentos Anexados</h5>
|
||||
<ion-item class="ion-no-margin ion-no-padding cursor-pointer" *ngFor="let Document of mergedArray; let i = index" (click)="clickDocumentUPdateIndex(i)" [ngClass]="{'selected-card': i === selectedIndex}">
|
||||
<ion-item appClickAndHold (clickAndHold)="onButtonHold()" class="ion-no-margin ion-no-padding cursor-pointer" *ngFor="let Document of mergedArray; let i = index" (click)=" selectedIndex = i" [ngClass]="{'selected-card': i === selectedIndex}">
|
||||
<ion-label class="d-block" >
|
||||
<div class="d-flex" >
|
||||
|
||||
<div class="flex-1">
|
||||
<p class="attach-title-item overflow-hidden">{{ Document.Assunto || "Sem assunto" }} <span class="document-type" >Rascunho</span></p>
|
||||
<p class="attach-title-item overflow-hidden">{{ Document.Assunto || "Sem assunto" }} <span class="document-type" *ngIf="Document.content != ''">Rascunho</span></p>
|
||||
<p class="overflow-hidden"><span class="span-left">{{ Document.Sender}}</span><span class="span-right">{{ Document.DocDate | date: 'dd-MM-yyyy HH:mm' }}</span></p>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-center align-center font-25" (click)="clickAttachment()">
|
||||
<div class="d-flex justify-center align-center font-25" (click)="clickDocumentUPdateIndex(Document.DocId, Document, Document.content);">
|
||||
<fa-icon icon="ellipsis-v" class="menu-icon font-awesome-1"></fa-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -23,6 +23,11 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { TaskService } from 'src/app/services/task.service'
|
||||
import { TinyMCEPage } from 'src/app/tiny-mce/tiny-mce.page';
|
||||
import { DeviceService } from "src/app/services/device.service"
|
||||
import { DocumentViewerOptionService } from "src/app/services/document-viewer-option.service";
|
||||
|
||||
import { fromEvent, merge, interval, Subscription } from 'rxjs';
|
||||
import { takeUntil, filter, switchMap, take } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despacho',
|
||||
templateUrl: './despacho.page.html',
|
||||
@@ -68,7 +73,8 @@ export class DespachoPage implements OnInit {
|
||||
public ThemeService: ThemeService,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
public TaskService: TaskService,
|
||||
public DeviceService: DeviceService
|
||||
public DeviceService: DeviceService,
|
||||
private DocumentViewerOptionService: DocumentViewerOptionService
|
||||
|
||||
|
||||
) {
|
||||
@@ -247,9 +253,22 @@ export class DespachoPage implements OnInit {
|
||||
// getFromDb() {
|
||||
|
||||
// }
|
||||
|
||||
clickDocumentUPdateIndex(index) {
|
||||
return this.selectedIndex = index
|
||||
onButtonHold() {
|
||||
// alert("nice!")
|
||||
}
|
||||
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 viewDocument(docId: string, Document, content) {
|
||||
|
||||
+32
-6
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { ModalController, NavParams } from '@ionic/angular';
|
||||
import { Despacho } from 'src/app/models/despacho.model';
|
||||
@@ -27,6 +27,7 @@ import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { RouteService } from 'src/app/services/route.service';
|
||||
import { TaskService } from 'src/app/services/task.service'
|
||||
import { z } from 'zod';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -41,6 +42,12 @@ const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
}
|
||||
|
||||
|
||||
const MySchema = z.object({
|
||||
applicationId: z.any(),
|
||||
docId: z.any(),
|
||||
});
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-expedient-task-modal',
|
||||
templateUrl: './expedient-task-modal.page.html',
|
||||
@@ -59,6 +66,8 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
taskType:string;
|
||||
task: task;
|
||||
aplicationId = null
|
||||
docId!: string
|
||||
createProcessFromFile: false
|
||||
|
||||
taskParticipants: any = [];
|
||||
taskParticipantsCc: any = [];
|
||||
@@ -121,14 +130,31 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
this.loggeduser = SessionStore.user;
|
||||
this.task = this.navParams.get('task');
|
||||
|
||||
|
||||
|
||||
this.SearchFolder = this.navParams.get('SearchFolder');
|
||||
this.aplicationId = this.navParams.get('aplicationId')
|
||||
this.document = this.navParams.get('document')
|
||||
this.aplicationId = this.navParams.get('aplicationId') | this.navParams.get('applicationId')
|
||||
this.docId = this.navParams.get('docId')
|
||||
this.createProcessFromFile = this.navParams.get('createProcessFromFile') || false;
|
||||
|
||||
this.document = this.navParams.get('document');
|
||||
this.taskType = this.navParams.get('taskAction');
|
||||
|
||||
|
||||
if(this.createProcessFromFile) {
|
||||
try {
|
||||
MySchema.parse({
|
||||
applicationId: this.aplicationId,
|
||||
docId: this.docId
|
||||
});
|
||||
|
||||
this.task.workflowInstanceDataFields.SourceSecFsID = this.aplicationId; //361
|
||||
this.task.workflowInstanceDataFields.SourceType = 'DOC'; //FOLDER
|
||||
this.task.workflowInstanceDataFields.SourceID = this.docId; //FolderId
|
||||
|
||||
} catch (error) {
|
||||
console.error('Validation failed params, expediente-task-modal:', error.errors);
|
||||
}
|
||||
}
|
||||
|
||||
// try {
|
||||
// if(this.document) {
|
||||
// const doc: any = this.document
|
||||
@@ -475,7 +501,7 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
this.validateField = true;
|
||||
this.toastService._badRequest('Por favor selecione um assunto');
|
||||
} */
|
||||
|
||||
|
||||
/* }
|
||||
else{
|
||||
this.validateField = true;
|
||||
|
||||
@@ -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