diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index e11d52aa3..046881b4e 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -234,6 +234,7 @@ export class HomePage implements OnInit { logDeviceInfo = async () => { const info = await Device.getInfo(); + /* console.log('DEVICE INFO ',info); */ } updateList() { diff --git a/src/app/modals/profile/profile.page.html b/src/app/modals/profile/profile.page.html index 4f026b5a7..5dce1dd93 100644 --- a/src/app/modals/profile/profile.page.html +++ b/src/app/modals/profile/profile.page.html @@ -66,29 +66,47 @@
-
+ *ngFor="let item of notificationdata; let i = index"> + +
- - - - + + + +
-

{{item.dateInit}}

-

{{item.dateEnd}}

+

{{item.dateInit}}

+

{{item.dateEnd}}

-

{{item.Location}}

+

{{item.Location}}

{{item.title}}

-

{{item.body}}

+

{{item.body}}

+ +
+
+ +
+ +
+

Possivelmente esta tarefa não foi criada ou já foi executada. Deseja dar a notificação como lida?

+
+ +
+ + + + +
+ +
diff --git a/src/app/modals/profile/profile.page.scss b/src/app/modals/profile/profile.page.scss index 00469f587..f0029c55c 100644 --- a/src/app/modals/profile/profile.page.scss +++ b/src/app/modals/profile/profile.page.scss @@ -147,6 +147,11 @@ ion-list { .notification-icon { font-size: rem(35) !important; } + + .notification-icon-error { + width: 30px !important; + height: 30px !important; + } .approve-event-time { width: fit-content !important; float: left; @@ -161,6 +166,17 @@ ion-list { text-overflow: ellipsis; } } + + .approve-event-detail-error { + width: calc(100% - 115px) !important; + float: left; + #profile-title-error { + display: flex; + width: 250px; + font-size: small + ; + } + } .notification-label-MD-official { float: right; width: 5px; diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts index d50e7b92b..3172432d5 100644 --- a/src/app/modals/profile/profile.page.ts +++ b/src/app/modals/profile/profile.page.ts @@ -10,6 +10,8 @@ import { SessionStore } from 'src/app/store/session.service'; import { EventTrigger } from '../../services/eventTrigger.service'; import { ThemeService } from 'src/app/services/theme.service' import { environment } from 'src/environments/environment'; +import { ProcessesService } from 'src/app/services/processes.service'; +import { EventsService } from 'src/app/services/events.service'; @Component({ selector: 'app-profile', @@ -34,6 +36,9 @@ export class ProfilePage implements OnInit { logoutOut = false notificationStatus = ''; environment = environment + taskExist = true; + taskNotExist = false; + SessionStore = SessionStore; constructor( @@ -45,7 +50,9 @@ export class ProfilePage implements OnInit { private platform: Platform, private eventTriger: EventTrigger, public ThemeService: ThemeService, - private notificationService: NotificationsService + private notificationService: NotificationsService, + private processesService: ProcessesService, + private eventsService: EventsService ) { @@ -96,6 +103,7 @@ export class ProfilePage implements OnInit { this.DataArray = [] value.forEach((element, i) => { + console.log('Getnotifications',element, i ) let notificationObject; if (element.notification) { @@ -112,7 +120,8 @@ export class ProfilePage implements OnInit { Location: element.data.Location, TypeAgenda: element.data.TypeAgenda, Role: element.data.Role, - Status: element.data.Status + Status: element.data.Status, + read: false, } } else if (element.data) { @@ -129,7 +138,8 @@ export class ProfilePage implements OnInit { Location: element.data.Location, TypeAgenda: element.data.TypeAgenda, Role: element.data.Role, - Status: element.data.Status + Status: element.data.Status, + read: false, } } else { @@ -147,14 +157,15 @@ export class ProfilePage implements OnInit { dateEnd: element.dateEnd, dateInit: element.dateInit, index: element.index, - title: element.title + title: element.title, + read: false, } } } this.DataArray.push(notificationObject) }); - this.notificationdata = this.DataArray + this.notificationdata = this.DataArray.reverse(); }).catch((error) => { console.error('storage getnotification: ', error) }) @@ -173,22 +184,95 @@ export class ProfilePage implements OnInit { return time; } - notificatinsRoutes = (index, Service, Object, IdObject, FolderId) => { + notificatinsRoutes = (index, Service, Object, IdObject, FolderId,i) => { + + console.log(index, i) + + if(Service === "agenda") { + this.eventsService.getEvent(IdObject).subscribe((task) => { + + if (Service === "agenda" && IdObject.length > 10) { + this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda'])); + + } else if (Service === "agenda" && Object === "event-list") { + //this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'agenda'])); + this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', IdObject, 'agenda'])); + + } + + this.deleteNotification(index); + + }, (error) => { + this.notificationdata[i].read = true; + }) + + } else if (Service === "gabinete-digital") { + + this.processesService.GetTask(IdObject).subscribe((task) => { + + if (Service === "gabinete-digital" && Object === "expedientes") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', IdObject, 'gabinete-digital'])); + } else if (Service === "gabinete-digital" && Object === "despachos") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', IdObject, 'gabinete-digital'], { replaceUrl: true })); + }else if (Service === "gabinete-digital" && Object === "parecer") { + + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', IdObject, 'gabinete-digital'])); + } + else if (Service === "gabinete-digital" && Object === "deferimento") { + + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', IdObject, 'gabinete-digital'])); + } + else if (Service === "gabinete-digital" && Object === "despachos-pr") { + + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', IdObject, 'gabinete-digital'])); + } + + this.deleteNotification(index); + + }, (error) => { + this.notificationdata[i].read = true; + }) - if (Service === "agenda" && IdObject.length > 10) { + } else if( Service === "accoes") { + if (Service === "accoes" && Object === "accao") { + this.zone.run(() => this.router.navigate(['/home/publications', IdObject])); + this.deleteNotification(index); + } + else if (Service === "accoes" && Object === "publicacao") { + this.zone.run(() => this.router.navigate(['/home/publications/view-publications', FolderId, IdObject])); + this.deleteNotification(index); + } + + } else if (Service === "chat") { + let navigationExtras: NavigationExtras = { queryParams: { "roomId": IdObject, } }; + this.zone.run(() => this.router.navigate(['/home/chat'], navigationExtras)); + this.deleteNotification(index); + } + + + /* if (Service === "agenda" && IdObject.length > 10) { this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda'])); } - else if (Service === "gabinete-digital" && Object === "expediente") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', IdObject, 'gabinete-digital'])); + else if (Service === "gabinete-digital" && Object === "expedientes") { + this.processesService.GetTask(IdObject).subscribe((task) => { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', IdObject, 'gabinete-digital'])); + }, (error) => { + this.notificationdata[i].read = true; + }) } else if (Service === "agenda" && Object === "event-list") { //this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'agenda'])); this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', IdObject, 'agenda'])); } else if (Service === "gabinete-digital" && Object === "despachos") { + this.processesService.GetTask(IdObject).subscribe((task) => { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', IdObject, 'gabinete-digital'], { replaceUrl: true })); + }, (error) => { + this.notificationdata[i].read = true; + }) - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', IdObject, 'gabinete-digital'], { replaceUrl: true })); + } else if (Service === "gabinete-digital" && Object === "parecer") { @@ -220,10 +304,10 @@ export class ProfilePage implements OnInit { } else if (Service === "chat") { let navigationExtras: NavigationExtras = { queryParams: { "roomId": IdObject, } }; this.zone.run(() => this.router.navigate(['/home/chat'], navigationExtras)); - } + } */ // this.notificationservice.tempClearArray(); - this.deleteNotification(index); + @@ -317,4 +401,13 @@ export class ProfilePage implements OnInit { } } + + keppNotification(index) { + this.notificationdata[index].read = false; + } + + doNotKeppNotification(index) { + this.deleteNotification(index); + } + } diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 058fc3590..2953e60d6 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -138,7 +138,7 @@ export class LoginPage implements OnInit { } this.changeProfileService.runLogin(); - // this.getToken(); + /* this.getToken(); */ SessionStore.setInativity(true); this.goback(); diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index 698c5f41a..23eb8bf2b 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -138,7 +138,7 @@ export class NotificationsService { PushNotifications.addListener('pushNotificationReceived', (notification: PushNotificationSchema) => { this.active = true - + console.log('NOtification Listener', notification) this.storenotification(notification) this.eventtrigger.publishSomeData({ notification: "recive" @@ -148,7 +148,6 @@ export class NotificationsService { } else { this.afMessaging.messages.subscribe((notification) => { - this.storenotification(notification) this.storenotification(notification) this.notificationReceived.emit(); this.eventtrigger.publishSomeData({ @@ -160,11 +159,27 @@ export class NotificationsService { } storenotification(notification) { - console.log(notification) + console.log('Store Notification ',notification) this.storageService.get("Notifications").then((store) => { store.push(notification) - this.storageService.store("Notifications", store) + console.log('Store Notification ',store) + + const result = store.reduce((accumulator, current) => { + let exists = accumulator.find(item => { + return item.id === current.id; + }); + if(!exists) { + accumulator = accumulator.concat(current); + } + return accumulator; + }, []); + + console.log(result); + + + + this.storageService.store("Notifications", result) }).catch((error) => { if (!error) { this.storageService.store("Notifications", [notification]) @@ -180,7 +195,7 @@ export class NotificationsService { PushNotifications.addListener('pushNotificationActionPerformed', (notification: ActionPerformed) => { this.active = true - console.log(notification) + console.log('NOtification Listener Backgroud', notification) /* this.DataArray.push(notification.notification) this.storageService.store("Notifications", this.DataArray) @@ -241,7 +256,7 @@ export class NotificationsService { this.zone.run(() => this.router.navigate(['/home/agenda', notification.notification.data.IdObject, 'agenda'])); } - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expediente") { + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes") { this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', notification.notification.data.IdObject, 'gabinete-digital'])); } else if (notification.notification.data.Service === "agenda" && notification.notification.data.Object === "event-list") { diff --git a/src/app/tiny-mce/tiny-mce.page.html b/src/app/tiny-mce/tiny-mce.page.html index f0eb39fd2..11b8ee213 100644 --- a/src/app/tiny-mce/tiny-mce.page.html +++ b/src/app/tiny-mce/tiny-mce.page.html @@ -22,17 +22,21 @@ apiKey="wr5dk69kive0qr9ig6y5spqvlj3a0tsiwnzdsexnz241k69p" [(ngModel)]="editorContent" [init]="{ + save_onsavecallback: 'onSaveContent', + language: 'pt_PT', height: 600, menubar: false, + autosave_interval:30, plugins: [ - 'advlist autolink lists link image charmap print preview anchor', + 'advlist autolink autosave lists link image charmap print preview anchor', 'searchreplace visualblocks code fullscreen', 'insertdatetime media table paste code help wordcount print' ], toolbar: 'undo redo | formatselect | bold italic backcolor | \ alignleft aligncenter alignright alignjustify | \ - bullist numlist outdent indent | removeformat | print | help' }" + bullist numlist outdent indent | removeformat | print | save | help ' }" + initialValue='{{content}}' [(ngModel)]="content" (onSaveContent)="somefunction()" diff --git a/src/app/tiny-mce/tiny-mce.page.ts b/src/app/tiny-mce/tiny-mce.page.ts index 9775dc01d..bc2042f4f 100644 --- a/src/app/tiny-mce/tiny-mce.page.ts +++ b/src/app/tiny-mce/tiny-mce.page.ts @@ -1,13 +1,15 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnDestroy, OnInit } from '@angular/core'; import { NavParams } from '@ionic/angular'; import { EventDetailsDocumentsOptionsPage } from '../shared/popover/event-details-documents-options/event-details-documents-options.page'; import { AlertController, ModalController } from '@ionic/angular'; +import { ProcessesService } from '../services/processes.service'; +import { HttpErrorHandle } from '../services/http-error-handle.service'; @Component({ selector: 'app-tiny-mce', templateUrl: './tiny-mce.page.html', styleUrls: ['./tiny-mce.page.scss'], }) -export class TinyMCEPage implements OnInit { +export class TinyMCEPage implements OnDestroy { @@ -16,6 +18,9 @@ export class TinyMCEPage implements OnInit { content: "" editorContent: ""; value: ""; + private intervalId: any; + private intervalTime: number = 30000; + loadingTiny = true @@ -23,19 +28,22 @@ export class TinyMCEPage implements OnInit { constructor( private navParams: NavParams, private modalController: ModalController, - + private processService: ProcessesService, + private erroHandler: HttpErrorHandle + ) { this.Document = this.navParams.get('Document') this.content = this.navParams.get('content') this.waitForTiny(); + this.saveDraft(); } waitForTiny() { const tiny: HTMLDivElement = document.querySelector('.tox-tinymce') - if(tiny) { + if (tiny) { this.doneWaitForTiny(tiny) } else { setTimeout(() => { @@ -49,16 +57,39 @@ export class TinyMCEPage implements OnInit { this.loadingTiny = true } - ngOnInit() { - this.value = "" + ngOnDestroy() { + // Certifique-se de limpar o intervalo quando o componente é destruído + if (this.intervalId) { + clearInterval(this.intervalId); + } } close() { this.modalController.dismiss() } + saveDraft() { + this.intervalId = setInterval(() => { + // Lógica que deseja executar em intervalos regulares + console.log('Intervalo de 30 segundos...'); + console.log(document) + let objectDraft = { + "status": false, + "description": this.Document.Assunto, + "content": this.content, + "path": this.Document.path, + "ownerId": this.Document.ownerId + } + this.processService.SaveDraftByID(this.Document.DocId, objectDraft).subscribe((res) => { + window['tinyupdate']() + }, (error) => { + this.erroHandler.httpStatusHandle(error) + }) + }, this.intervalTime); + } + somefunction() { - console.log(this.content) + } async openOptions() { @@ -72,7 +103,7 @@ export class TinyMCEPage implements OnInit { }); - modal.onDidDismiss().then((res)=>{},() => {}) + modal.onDidDismiss().then((res) => { }, () => { }) await modal.present(); } diff --git a/version/git-version.ts b/version/git-version.ts index e511b4ab0..abd8d0386 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,12 +1,12 @@ export let versionData = { - "shortSHA": "67a69d2e4", - "SHA": "67a69d2e4724ac828c2c0e09649b593ca6a2d021", + "shortSHA": "d2f1aa194", + "SHA": "d2f1aa194924a7b7bfe26812b7c71bbf8c009108", "branch": "developer", "lastCommitAuthor": "'Peter Maquiran'", - "lastCommitTime": "'Tue Aug 8 09:43:26 2023 +0100'", + "lastCommitTime": "'Tue Aug 8 13:38:50 2023 +0100'", "lastCommitMessage": "fix", - "lastCommitNumber": "5128", + "lastCommitNumber": "5129", "change": "", - "changeStatus": "On branch developer\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/pages/chat/chat.page.html\n\tmodified: src/app/pages/chat/chat.page.scss\n\tmodified: src/app/services/chat/room.service.ts\n\tmodified: src/global.scss", + "changeStatus": "On branch developer\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/app/home/home.page.ts\n\tmodified: src/app/modals/profile/profile.page.html\n\tmodified: src/app/modals/profile/profile.page.scss\n\tmodified: src/app/modals/profile/profile.page.ts\n\tmodified: src/app/pages/login/login.page.ts\n\tmodified: src/app/services/notifications.service.ts\n\tmodified: src/app/tiny-mce/tiny-mce.page.html\n\tmodified: src/app/tiny-mce/tiny-mce.page.ts\n\tmodified: version/git-version.ts", "changeAuthor": "peter.maquiran" } \ No newline at end of file