create event from attachment

This commit is contained in:
Peter Maquiran
2024-07-12 16:55:29 +01:00
parent da8ac83a5b
commit e952cc2278
14 changed files with 512 additions and 130 deletions
@@ -74,7 +74,7 @@
<div *ngIf="task.Note">
<h5 class="font-17-rem">Detalhes</h5>
<ion-item class="ion-no-margin ion-no-padding">
<pre class="width-100 text">{{ task.Note || fulltask?.workflowInstanceDataFields?.TaskMessage}} </pre>
<div #text class="width-100 text"></div>
</ion-item>
</div>
</div>
@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } 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"
@@ -12,6 +12,9 @@ import { SessionStore } from 'src/app/store/session.service';
import { LoginUserRespose } from 'src/app/models/user.model';
import { object } from 'zod';
import { element } from 'protractor';
import { task } from '../../../../models/ExpedientTaskModalPage';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
@Component({
selector: 'app-task-details',
@@ -34,17 +37,103 @@ export class TaskDetailsPage implements OnInit {
selectedIndex = 0
dropButton = true
loggeduser: LoginUserRespose;
@ViewChild('text', { static: false }) text: ElementRef;
constructor(
public ThemeService: ThemeService,
public DeviceService: DeviceService,
private DocumentViewerOptionService: DocumentViewerOptionService,
public p: PermissionService,
private modalController: ModalController,
private HeaderSettingsService: HeaderSettingsService
private HeaderSettingsService: HeaderSettingsService,
private sanitizer: DomSanitizer
) {
this.DeviceService.isDesktop();
this.loggeduser = SessionStore.user
// if(this.task.Note) {
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
// }
// if(this.fulltask?.workflowInstanceDataFields?.TaskMessage) {
// this.fulltask.workflowInstanceDataFields.TaskMessage = this.sanitizeHtml(this.fulltask.workflowInstanceDataFields.TaskMessage);
// }
setTimeout(() => {
console.log('change', this.task.Note);
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
(this.text.nativeElement as HTMLDivElement).innerHTML = this.decode(this.task.Note)
}, 10)
setTimeout(() => {
console.log('change', this.task.Note);
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
(this.text.nativeElement as HTMLDivElement).innerHTML = this.decode(this.task.Note)
}, 100)
setTimeout(() => {
console.log('change', this.task.Note);
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
(this.text.nativeElement as HTMLDivElement).innerHTML = this.decode(this.task.Note)
}, 500)
setTimeout(() => {
console.log('change', this.task.Note);
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
(this.text.nativeElement as HTMLDivElement).innerHTML = this.decode(this.task.Note)
}, 1000)
setTimeout(() => {
console.log('change', this.task.Note);
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
(this.text.nativeElement as HTMLDivElement).innerHTML = this.decode(this.task.Note)
}, 2000)
setTimeout(() => {
console.log('change', this.task.Note);
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
(this.text.nativeElement as HTMLDivElement).innerHTML = this.decode(this.task.Note)
}, 4000)
}
ngChange( ) {
console.log('change', this.task.Note)
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
}
decode(encodedString) {
// Create a temporary element to decode HTML entities
let tempElement = document.createElement('div');
tempElement.innerHTML = encodedString;
// Return the decoded string
return tempElement.textContent || tempElement.innerText || '';
}
sanitizeHtml(html: string): SafeHtml {
return this.sanitizer.bypassSecurityTrustHtml(html)
const decodedHtml = this.decodeHtml(html);
return this.sanitizer.bypassSecurityTrustHtml(decodedHtml);
}
decodeHtml(html: string): string {
const txt = document.createElement('textarea');
txt.innerHTML = html;
return txt.value;
}
ngOnInit() {