action for mobile dropdown menu

This commit is contained in:
Peter Maquiran
2024-02-23 09:55:52 +01:00
parent 887e2e163a
commit 9b5c25139d
3 changed files with 32 additions and 19 deletions
@@ -5,7 +5,7 @@
<div *ngFor="let attachment of taskViewerAttachment; let i = index" <div *ngFor="let attachment of taskViewerAttachment; let i = index"
class="ion-no-margin ion-no-padding cursor-pointer attachment-list" class="pa-10 mx-10 card-text" class="ion-no-margin ion-no-padding cursor-pointer attachment-list" class="pa-10 mx-10 card-text"
[ngClass]="{'selected-card': i === selectedIndex}" > [ngClass]="{'selected-card': i === selectedIndex}" >
<div class="attachment" (mousedown)="startHold($event, attachment, i)" (mouseup)="endHold()" (click)="clickDocument(attachment, i )"> <div class="attachment" (touchstart)="startHold($event, attachment, i)" (touchend)="endHold()" (click)="clickDocument(attachment, i )">
<div *ngIf="attachment.Assunto" class="attach-title-item tex-left"> <div *ngIf="attachment.Assunto" class="attach-title-item tex-left">
{{ attachment.Assunto }}<span class="document-type" *ngIf="attachment.content != ''">Rascunho</span> {{ attachment.Assunto }}<span class="document-type" *ngIf="attachment.content != ''">Rascunho</span>
@@ -5,8 +5,6 @@ import { MiddlewareRepositoryService } from "src/app/shared/repository/middlewar
import { DeviceService } from "src/app/services/device.service" import { DeviceService } from "src/app/services/device.service"
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { ProcessesService } from 'src/app/services/processes.service'; import { ProcessesService } from 'src/app/services/processes.service';
import { Subject, fromEvent, interval } from 'rxjs';
import { switchMap, take } from 'rxjs/operators';
import { PermissionService } from 'src/app/services/permission.service'; import { PermissionService } from 'src/app/services/permission.service';
@Component({ @Component({
@@ -40,15 +38,21 @@ export class ViewerAttachmentPage implements OnInit {
const selectFirst = this.taskViewerAttachment[0] const selectFirst = this.taskViewerAttachment[0]
} }
isSelectedAttachmentIsDraft( attachment: ViewerAttachment) {
if(!attachment?.content) {
return false
} else if (attachment?.content == '') {
return false
} else {
return true
}
}
async clickDocument(viewerAttachment: ViewerAttachment, i) { async clickDocument(viewerAttachment: ViewerAttachment, i) {
if(!this.taskViewerAttachment[this.selectedIndex]?.content) { this.draft = this.isSelectedAttachmentIsDraft(this.taskViewerAttachment[this.selectedIndex])
this.draft = false
} else if (this.taskViewerAttachment[this.selectedIndex]?.content == '') {
this.draft = false
} else {
this.draft =true
}
let count = 0 let count = 0
try { try {
@@ -109,11 +113,6 @@ export class ViewerAttachmentPage implements OnInit {
this.clickDocument(task, this.selectedIndex) this.clickDocument(task, this.selectedIndex)
} }
somefunction() {
console.log('Saved tinymce')
}
private holdStart: number = 0; private holdStart: number = 0;
private holdEnd: number = 0; private holdEnd: number = 0;
private holdDuration: number = 500; // Adjust the duration needed for a "hold" private holdDuration: number = 500; // Adjust the duration needed for a "hold"
@@ -134,7 +133,10 @@ export class ViewerAttachmentPage implements OnInit {
console.log('Hold to click action triggered!'); console.log('Hold to click action triggered!');
console.log(event) console.log(event)
window['e'] = event; window['e'] = event;
(event as any).target.parentElement.querySelector('button').click()
if(!this.isSelectedAttachmentIsDraft(attachment)) {
(event as any).target.parentElement.querySelector('button').click()
}
this.isHoldTriggered = true; this.isHoldTriggered = true;
} }
}, this.holdDuration); }, this.holdDuration);
@@ -146,6 +148,10 @@ export class ViewerAttachmentPage implements OnInit {
this.isHoldTriggered = false; this.isHoldTriggered = false;
} }
openExpedientActionsModal(a: any, b:any) {} openExpedientActionsModal(taskAction, Document) {
openBookMeetingModal(a: any) {} window['TaskDetailsPage-openExpedientActionsModal'](taskAction, Document)
}
openBookMeetingModal(Document) {
window['TaskDetailsPage-openBookMeetingModal'](Document)
}
} }
@@ -39,6 +39,13 @@ export class TaskDetailsPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
window['TaskDetailsPage-openExpedientActionsModal']= (taskAction, Document) => {
this.openExpedientActionsModal(taskAction, Document)
}
window['TaskDetailsPage-openBookMeetingModal']= (Document) => {
this.openBookMeetingModal(Document)
}
} }
@@ -83,7 +90,7 @@ export class TaskDetailsPage implements OnInit {
}); });
modal.onDidDismiss().then( modal.onDidDismiss().then(
async(res)=>{} async(res) => {}
, (error) => { , (error) => {
console.log(error) console.log(error)
} }