+
+
+
+
@@ -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()"
>
diff --git a/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.ts b/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.ts
index af0560682..013ec4f51 100644
--- a/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.ts
+++ b/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.ts
@@ -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)
+ }
- 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
+ }
}
diff --git a/src/app/services/agenda/list-box.service.ts b/src/app/services/agenda/list-box.service.ts
index 74b1ca0c1..5f8335b3c 100644
--- a/src/app/services/agenda/list-box.service.ts
+++ b/src/app/services/agenda/list-box.service.ts
@@ -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)
diff --git a/src/app/services/date.service.ts b/src/app/services/date.service.ts
index cb7ba1882..f08209a47 100644
--- a/src/app/services/date.service.ts
+++ b/src/app/services/date.service.ts
@@ -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
diff --git a/src/app/services/events.service.ts b/src/app/services/events.service.ts
index 4deb5b735..1011c14d8 100644
--- a/src/app/services/events.service.ts
+++ b/src/app/services/events.service.ts
@@ -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)
}
diff --git a/src/app/tiny-mce/tiny-mce.page.ts b/src/app/tiny-mce/tiny-mce.page.ts
index ba9ccfb9b..609d4b09c 100644
--- a/src/app/tiny-mce/tiny-mce.page.ts
+++ b/src/app/tiny-mce/tiny-mce.page.ts
@@ -95,7 +95,7 @@ export class TinyMCEPage implements OnDestroy {
if (this.saveTimeout) {
clearTimeout(this.saveTimeout);
}
-
+
this.saveTimeout = setTimeout(() => {
this.saveDraft();
clearTimeout(this.saveTimeout);