-
{{ Document.Assunto || "Sem assunto" }} Rascunho
+
{{ Document.Assunto || "Sem assunto" }} Rascunho
{{ Document.Sender}}{{ Document.DocDate | date: 'dd-MM-yyyy HH:mm' }}
-
diff --git a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts
index b1cb8407e..049df18d8 100644
--- a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts
+++ b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts
@@ -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) {
diff --git a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts
index 99acd47cd..ce20a2236 100644
--- a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts
+++ b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts
@@ -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;
diff --git a/src/app/services/click-and-hold-directive.service.spec.ts b/src/app/services/click-and-hold-directive.service.spec.ts
new file mode 100644
index 000000000..50be15d2b
--- /dev/null
+++ b/src/app/services/click-and-hold-directive.service.spec.ts
@@ -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();
+ });
+});
diff --git a/src/app/services/click-and-hold-directive.service.ts b/src/app/services/click-and-hold-directive.service.ts
new file mode 100644
index 000000000..960d0dc16
--- /dev/null
+++ b/src/app/services/click-and-hold-directive.service.ts
@@ -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();
+ }
+}
diff --git a/src/app/services/device.service.ts b/src/app/services/device.service.ts
index bff5143c7..597004feb 100644
--- a/src/app/services/device.service.ts
+++ b/src/app/services/device.service.ts
@@ -10,7 +10,6 @@ export class DeviceService {
isTableDivice() {
-
return false;
}
diff --git a/src/app/services/directives/directives.module.ts b/src/app/services/directives/directives.module.ts
new file mode 100644
index 000000000..2f89fdbd4
--- /dev/null
+++ b/src/app/services/directives/directives.module.ts
@@ -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 { }
diff --git a/src/app/services/document-viewer-option.service.spec.ts b/src/app/services/document-viewer-option.service.spec.ts
new file mode 100644
index 000000000..22b770d8b
--- /dev/null
+++ b/src/app/services/document-viewer-option.service.spec.ts
@@ -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();
+ });
+});
diff --git a/src/app/services/document-viewer-option.service.ts b/src/app/services/document-viewer-option.service.ts
new file mode 100644
index 000000000..06e2e762f
--- /dev/null
+++ b/src/app/services/document-viewer-option.service.ts
@@ -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();
+
+ }
+
+}