This commit is contained in:
Peter Maquiran
2024-02-29 22:29:00 +01:00
parent af05727bb4
commit 3625a91894
9 changed files with 88 additions and 73 deletions
@@ -128,7 +128,6 @@ ion-menu{
.aside-right{
overflow: auto;
padding: 30px 20px 0 20px !important;
width: 100% !important;
.arrow-right{
display: flex;
@@ -3,7 +3,7 @@
<div class="d-flex overflow-x-auto pa-10 width-100" style="background-color: #d9d9d9;" *ngIf="showAttachmentList">
<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" [ngClass]="{'selected-attachment': i === selectedIndex}"
class="ion-no-margin ion-no-padding cursor-pointer attachment-list" class="pa-10 mx-10 card-text align-baseline" [ngClass]="{'selected-attachment': i === selectedIndex}"
>
<div class="attachment" >
@@ -15,15 +15,20 @@
</div>
</div>
<span class="document-type" *ngIf="isSelectedAttachmentIsDraft(attachment)">Rascunho</span>
<span class="document-type ml-20" (click)="clickDraft(i)" *ngIf="isSelectedAttachmentIsDraft(attachment)">Rascunho</span>
<br *ngIf="isSelectedAttachmentIsDraft(attachment)">
<div class="date d-flex justify-content-between" >
<div (click)="clickDocument(attachment, i )">
<div *ngIf="!isSelectedAttachmentIsDraft(attachment)" (click)="clickDocument(attachment, i )">
<button mat-icon-button aria-label="Example icon-button with a menu">
<ion-icon src="assets/images/icons-nav-actions.svg" class=" font-25-em "></ion-icon>
</button>
</div>
<div>
<div *ngIf="isSelectedAttachmentIsDraft(attachment)" (click)="clickDraft(i )">
<button mat-icon-button aria-label="Example icon-button with a menu">
<ion-icon src="assets/images/icons-nav-actions.svg" class=" font-25-em "></ion-icon>
</button>
</div>
<div *ngIf="!isSelectedAttachmentIsDraft(attachment)">
<button (click)="doSomething($event);" mat-icon-button [matMenuTriggerFor]="menu" aria-label="Example icon-button with a menu">
<mat-icon>more_vert</mat-icon>
</button>
@@ -63,7 +68,7 @@
*ngIf="taskViewerAttachment[selectedIndex].content"
class="container-img height-100 flex-1"
apiKey="wr5dk69kive0qr9ig6y5spqvlj3a0tsiwnzdsexnz241k69p"
[(ngModel)]="editorContent"
[(ngModel)]="taskViewerAttachment[selectedIndex].content"
[init]="{
save_onsavecallback: 'onSaveContent',
language: 'pt_PT',
@@ -81,7 +86,9 @@
bullist numlist outdent indent | removeformat | print | save | help ' }"
initialValue='{{content}}'
[(ngModel)]="content"
[(ngModel)]="taskViewerAttachment[selectedIndex].content"
(onSaveContent)="somefunction()"
(ngModelChange)="onEditorContentChange()"
></editor>
</div>
@@ -32,6 +32,7 @@ export class ViewerAttachmentPage implements OnInit {
private processes: ProcessesService,
private erroHandler: HttpErrorHandle,
public p: PermissionService,
private processService: ProcessesService,
) { }
ngOnInit() {
@@ -54,7 +55,7 @@ export class ViewerAttachmentPage implements OnInit {
firstLoad = true
async clickDocument(viewerAttachment: ViewerAttachment, i) {
this.draft = this.isSelectedAttachmentIsDraft(this.taskViewerAttachment[this.selectedIndex])
this.draft = false
let count = 0
this.loading = true
@@ -132,45 +133,13 @@ export class ViewerAttachmentPage implements OnInit {
ngOnChanges() {
const task = this.taskViewerAttachment[this.selectedIndex]
this.draft = this.isSelectedAttachmentIsDraft(this.taskViewerAttachment[this.selectedIndex])
if(!this.draft) {
this.clickDocument(task, this.selectedIndex)
}
private holdStart: number = 0;
private holdEnd: number = 0;
private holdDuration: number = 500; // Adjust the duration needed for a "hold"
private holdTimer: any;
private isHoldTriggered: boolean = false;
startHold(event: TouchEvent, attachment: any, index: number): void {
event.preventDefault();
this.holdStart = new Date().getTime();
// Handle your logic for the initial touch (if needed)
this.clickDocument(attachment, index);
this.holdTimer = setTimeout(() => {
const currentTime = new Date().getTime();
if (currentTime - this.holdStart >= this.holdDuration) {
// Your logic for "hold to click" action goes here
console.log('Hold to click action triggered!');
console.log(event)
window['e'] = event;
if(!this.isSelectedAttachmentIsDraft(attachment)) {
(event as any).target.parentElement.querySelector('button').click()
}
this.isHoldTriggered = true;
}
}, this.holdDuration);
}
endHold(): void {
clearTimeout(this.holdTimer);
this.holdEnd = new Date().getTime();
this.isHoldTriggered = false;
}
openExpedientActionsModal(taskAction, Document) {
window['TaskDetailsPage-openExpedientActionsModal'](taskAction, Document)
}
@@ -182,4 +151,52 @@ export class ViewerAttachmentPage implements OnInit {
e.stopPropagation();
// do other stuff...
}
saveDraft(selectedIndex) {
// Lógica que deseja executar em intervalos regulares
console.log('Intervalo de 3 segundos...');
const document = this.taskViewerAttachment[selectedIndex]
let objectDraft = {
"status": false,
"description": document.Assunto,
"content": document.content,
"path": document.path,
"ownerId": document.ownerId
}
this.processService.SaveDraftByID(document.DocId, objectDraft).subscribe((res) => {
console.log('Saved tinymce')
}, (error) => {
this.erroHandler.httpStatusHandle(error)
})
}
onEditorContentChange() {
const selectedIndex = this.selectedIndex
console.log('Autosave successful! Content saved to local storage1.');
if (this.saveTimeout) {
clearTimeout(this.saveTimeout);
}
this.saveTimeout = setTimeout(() => {
this.saveDraft(selectedIndex);
clearTimeout(this.saveTimeout);
}, 5000);
}
somefunction() {
console.log('Saved tinymce')
}
clickDraft(i: number) {
this.selectedIndex = i
this.draft = true
}
}
@@ -147,7 +147,6 @@ export class ListBoxService {
startDate.getMonth() != endDate.getMonth() ||
startDate.getDate() != endDate.getDate()) {
console.log("while", event)
const newDate = startDate.setDate(startDate.getDate()+ i)
let otherDays = this.dateService.getDay(newDate)
+2 -4
View File
@@ -51,14 +51,12 @@ export class DateService {
date.setDate(date.getDate() -1);
const _date = date.getDate();
const month = date.getMonth() + 1;
const _date = String(date.getDate()).padStart(2,'0');
const month = String(date.getMonth() + 1).padStart(2,'0');
const fullYear = date.getFullYear();
const formattedDate = `${fullYear}-${month}-${_date} 23:59`;
res.EndDate = formattedDate
console.log('reduze')
}
return res as any
+4 -9
View File
@@ -666,22 +666,17 @@ export class EventsService {
date.setDate(date.getDate() -1);
const _date = date.getDate();
const month = date.getMonth() + 1;
const _date = String(date.getDate()).padStart(2,'0');
const month = String(date.getMonth() + 1).padStart(2,'0');
const fullYear = date.getFullYear();
console.log({_date, month})
const formattedDate = `${fullYear}-${month}-${_date} 23:59`;
e.EndDate = formattedDate
console.log('reduze')
}
return e
})
console.log({calendar})
result = result.concat(calendar)
}