This commit is contained in:
Peter Maquiran
2023-08-08 13:43:24 +01:00
9 changed files with 227 additions and 49 deletions
+1
View File
@@ -234,6 +234,7 @@ export class HomePage implements OnInit {
logDeviceInfo = async () => {
const info = await Device.getInfo();
/* console.log('DEVICE INFO ',info); */
}
updateList() {
+33 -15
View File
@@ -66,29 +66,47 @@
<ion-list>
<div class="item cursor-pointer ion-no-padding ion-no-margin" lines="none"
*ngFor="let item of notificationdata; let i = index"
(click)="notificatinsRoutes(item.index,item.Service,item.Object,item.IdObject,item.FolderId)">
<div class="item-conten-{{item.Service}}-{{item.TypeAgenda}}-{{item.Role}}">
*ngFor="let item of notificationdata; let i = index">
<div *ngIf="item.read == false" class="item-conten-{{item.Service}}-{{item.TypeAgenda}}-{{item.Role}}" (click)="notificatinsRoutes(item.index,item.Service,item.Object,item.IdObject,item.FolderId,i)">
<div class="notification-item">
<img class="notification-icon" slot="end" *ngIf="item.Service == 'agenda'"
src="assets/images/icons-default-agenda.svg">
<img class="notification-icon" slot="end" *ngIf="item.Service == 'gabinete-digital'"
src="assets/images/icons-correspondencias.svg">
<img class="notification-icon" slot="end" *ngIf="item.Service == 'accoes'"
src="assets/images/icons-nav-accoes-active.svg">
<img class="notification-icon" slot="end" *ngIf="item.Service == 'chat'"
src="assets/images/icons-nav-agenda-active.svg">
<img class="notification-icon" slot="end" *ngIf = "item.Service == 'agenda'" src="assets/images/icons-default-agenda.svg" >
<img class="notification-icon" slot="end" *ngIf = "item.Service == 'gabinete-digital'" src="assets/images/icons-correspondencias.svg" >
<img class="notification-icon" slot="end" *ngIf = "item.Service == 'accoes'" src="assets/images/icons-nav-accoes-active.svg" >
<img class="notification-icon" slot="end" *ngIf = "item.Service == 'chat'" src="assets/images/icons-nav-agenda-active.svg" >
</div>
<div class="approve-event-time">
<p *ngIf="item.Service == 'agenda'">{{item.dateInit}}</p>
<p *ngIf="item.Service == 'agenda'">{{item.dateEnd}}</p>
<p *ngIf = "item.Service == 'agenda'">{{item.dateInit}}</p>
<p *ngIf = "item.Service == 'agenda'">{{item.dateEnd}}</p>
</div>
<div class="approve-event-detail">
<p *ngIf="item.Service == 'agenda'">{{item.Location}}</p>
<p *ngIf = "item.Service == 'agenda'">{{item.Location}}</p>
<h3 id="profile-title">{{item.title}}</h3>
<p id="profile-title" *ngIf="item.Service != 'agenda'">{{item.body}}</p>
<p id="profile-title" *ngIf = "item.Service != 'agenda'">{{item.body}}</p>
</div>
</div>
<div *ngIf="item.read == true" >
<div class="notification-item">
<img class="notification-icon-error" slot="end" src="assets/images/exclamation_mark.svg" >
</div>
<div class="approve-event-detail-error">
<p id="profile-title-error">Possivelmente esta tarefa não foi criada ou já foi executada. Deseja dar a notificação como lida?</p>
</div>
<div class="d-flex mt-10 width-100">
<ion-buttons slot="start" class="buttonSize" >
<button (click)="doNotKeppNotification(item.index)" class="btn-delete" fill="clear" >
<ion-label style="color:#d30a0a;">Sim</ion-label>
</button>
<button (click)="keppNotification(i)" class="btn-cancel" fill="clear" color="#fff" >
<ion-label>Não</ion-label>
</button>
</ion-buttons>
</div>
</div>
</div>
</ion-list>
+16
View File
@@ -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;
+105 -12
View File
@@ -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);
}
}
+1 -1
View File
@@ -138,7 +138,7 @@ export class LoginPage implements OnInit {
}
this.changeProfileService.runLogin();
// this.getToken();
/* this.getToken(); */
SessionStore.setInativity(true);
this.goback();
+21 -6
View File
@@ -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") {
+6 -2
View File
@@ -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()"
+39 -8
View File
@@ -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();
}
+5 -5
View File
@@ -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 <file>...\" 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"
}