pull made

This commit is contained in:
Eudes Inácio
2023-02-06 09:45:44 +01:00
17 changed files with 875 additions and 172 deletions
+1
View File
@@ -100,6 +100,7 @@ export class HomePage implements OnInit {
document.querySelectorAll('ion-modal').forEach((e: any) => e.remove())
document.querySelectorAll('popover-viewport').forEach((e: any) => e.remove())
document.querySelectorAll('.loading-blocker').forEach((e: any) => e.remove())
document.querySelectorAll('ion-popover').forEach((e: any) => e.remove())
});
window['platform'] = platform
+5 -5
View File
@@ -3,12 +3,12 @@
</ion-header>
<!-- Progress bar -->
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<ion-content id="timeline-conteiner agenda-container pt-20" class="timeline ">
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="d-flex container-wrapper">
<div class="calendar-timeline d-flex flex-column height-100 bg-blue">
@@ -206,13 +206,13 @@ export class ApproveEventModalPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.toastService._successMessage()
this.toastService._successMessage('Evento enviado para revisão');
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
this.toastService._badRequest('Evento não enviado para revisão');
}
this.router.navigate(['/home/gabinete-digital/event-list']);
}
@@ -216,13 +216,14 @@ export class ApproveEventPage implements OnInit {
await this.processes.PostTaskAction(body).toPromise()
this.toastService._successMessage();
this.goBack();
this.toastService._successMessage('Evento Aprovar')
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
this.toastService._badRequest('Evento não aprovar')
}
}
finally {
@@ -266,14 +267,14 @@ export class ApproveEventPage implements OnInit {
this.offlineManager.storeRequestData('event-listRever', body);
});
this.toastService._successMessage('Pedido enviado');
this.toastService._successMessage('Evento enviado para revisão');
this.goBack();
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest();
this.toastService._badRequest('Evento não enviado para revisão');
}
} finally {
loader.remove()
@@ -299,7 +300,7 @@ export class ApproveEventPage implements OnInit {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
this.toastService._badRequest('Evento não rejeitado')
}
}
finally {
@@ -379,13 +380,14 @@ export class ApproveEventPage implements OnInit {
await this.processes.PostTaskAction(body).toPromise();
this.toastService._successMessage();
this.goBack();
this.toastService._successMessage('Evento enviado para revisão');
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest();
}
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não enviado para revisão');
}
} finally {
loader.remove()
}
@@ -166,6 +166,7 @@ export class GabineteDigitalPage implements OnInit {
}
this.LoadCounts();
this.updateAllProcess()
const pathname = window.location.pathname
this.router.events.forEach((event) => {
@@ -176,9 +177,11 @@ export class GabineteDigitalPage implements OnInit {
if(this.NotificationsService.active === false) {
this.checkRoutes();
this.LoadCounts();
this.updateAllProcess()
} else {
this.checkRoutes();
this.LoadCounts();
this.updateAllProcess()
}
}
})
@@ -786,7 +789,7 @@ export class GabineteDigitalPage implements OnInit {
if (event) {
setTimeout(() => {
event.target.complete();
event?.target?.complete();
}, 2000);
}
else {
-1
View File
@@ -35,7 +35,6 @@ export class BackgroundService {
e.funx()
}
})
this.status = 'offline'
}
paint() {
+50 -31
View File
@@ -12,7 +12,8 @@ import { EventTrigger } from '../services/eventTrigger.service';
import { SessionStore } from '../store/session.service';
import { ActionPerformed, PushNotificationSchema, PushNotifications, Token, } from '@capacitor/push-notifications';
import { notificationObject } from '../models/notifications';
import { v4 as uuidv4 } from 'uuid'
import { Capacitor } from '@capacitor/core';
@Injectable({
providedIn: 'root'
})
@@ -30,6 +31,7 @@ export class NotificationsService {
}} = {}
active = false
isPushNotificationsAvailable = Capacitor.isPluginAvailable('PushNotifications');
constructor(
private http: HttpClient,
@@ -83,44 +85,53 @@ export class NotificationsService {
}
requestPermissions() {
PushNotifications.requestPermissions().then(result => {
if (result.receive === 'granted') {
// Register with Apple / Google to receive push via APNS/FCM
PushNotifications.register();
} else {
// Show some error
}
});
if(!this.isPushNotificationsAvailable) {
return false
}
PushNotifications.requestPermissions().then(result => {
if (result.receive === 'granted') {
// Register with Apple / Google to receive push via APNS/FCM
PushNotifications.register();
} else {
// Show some error
}
});
}
getAndpostToken(username) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
const geturl = environment.apiURL + 'notifications/token';
PushNotifications.addListener('registration',
(token: Token) => {
const headers = { 'Authorization': SessionStore.user.BasicAuthKey };
const body = {
UserId: SessionStore.user.UserId,
TokenId: token.value,
Status: 1,
Service: 1
};
if(!this.isPushNotificationsAvailable) {
return false
}
this.http.post<Tokenn>(`${geturl}`, body, { headers }).subscribe(data => {
this.active = true
console.log(data)
}, (error) => {
console.log(error)
})
}
);
}
const geturl = environment.apiURL + 'notifications/token';
PushNotifications.addListener('registration',
(token: Token) => {
const headers = { 'Authorization': SessionStore.user.BasicAuthKey };
const body = {
UserId: SessionStore.user.UserId,
TokenId: token.value,
Status: 1,
Service: 1
};
this.http.post<Tokenn>(`${geturl}`, body, { headers }).subscribe(data => {
this.active = true
console.log(data)
}, (error) => {
console.log(error)
})
}
);
}
registrationError() {
if(!this.isPushNotificationsAvailable) {
return false
}
PushNotifications.addListener('registrationError',
(error: any) => {
this.active = false
@@ -129,6 +140,10 @@ export class NotificationsService {
}
onReciveForeground() {
if(!this.isPushNotificationsAvailable) {
return false
}
console.log('foregrund');
PushNotifications.addListener('pushNotificationReceived',
(notification: PushNotificationSchema) => {
@@ -156,6 +171,10 @@ export class NotificationsService {
}
onReciveBackground() {
if(!this.isPushNotificationsAvailable) {
return false
}
console.log('fbackgrund');
PushNotifications.addListener('pushNotificationActionPerformed',
(notification: ActionPerformed) => {
@@ -87,9 +87,14 @@ export class ApproveEventPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise()
this.modalController.dismiss(serialNumber);
this.toastService._successMessage()
this.toastService._successMessage('Evento aprovar')
} catch (error) {
this.toastService._badRequest()
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não aprovar')
}
} finally {
this.close()
loader.remove()
@@ -108,7 +113,13 @@ export class ApproveEventPage implements OnInit {
await this.processes.PostTaskAction(body).toPromise()
this.toastService._successMessage('Evento rejeitado')
} catch (error) {
this.toastService._badRequest('Processo não efectuado')
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não rejeitado')
}
} finally {
loader.remove()
this.close()
@@ -196,7 +207,7 @@ export class ApproveEventPage implements OnInit {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest();
this.toastService._badRequest('Evento não enviado para revisão');
}
} finally {
loader.remove()
@@ -42,7 +42,6 @@ export class EventsToApprovePage implements OnInit {
}
ngOnInit() {
// console.log('ERROR LEGN',this.eventsMDGPRList.length)
this.segment = this.loggeduser.Profile;
this.LoadToApproveEvents();
@@ -127,7 +126,7 @@ export class EventsToApprovePage implements OnInit {
doRefresh(event) {
if (event) {
setTimeout(() => {
event.target.complete();
event?.target?.complete();
}, 2000);
}
+17 -12
View File
@@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import { localstoreService } from './localstore.service'
import { AES, enc, SHA1 } from 'crypto-js'
import { isArray } from 'ionic-angular/umd/util/util';
@Injectable({
providedIn: 'root'
@@ -24,8 +25,8 @@ export class EventoaprovacaoStoreService {
setTimeout(()=>{
let restoreMd = localstoreService.get(this.keyNamemd, {})
let restorePr = localstoreService.get(this.keyNamepr, {})
let restoreMd = localstoreService.get(this.keyNamemd, [])
let restorePr = localstoreService.get(this.keyNamepr, [])
this._listPr = restorePr.listPr || []
this._listMd = restoreMd.lisMd || []
@@ -36,8 +37,8 @@ export class EventoaprovacaoStoreService {
}
get listpr() { return this._listPr }
get listmd() { return this._listMd }
get listpr() { return this._listPr || [] }
get listmd() { return this._listMd || [] }
get count() { return this._count || 0 }
set count(value: number) {
@@ -55,20 +56,24 @@ export class EventoaprovacaoStoreService {
}
resetpr(eventsList: any) {
this._listPr = eventsList
if(Array.isArray(eventsList)) {
this._listPr = eventsList
this.countPr = this._listPr.length
this.count = this.countPr + this.countMd
this.countPr = this._listPr.length
this.count = this.countPr + this.countMd
this.savePr()
this.savePr()
}
}
resetmd(eventsList: any) {
this._listMd = eventsList
if(Array.isArray(eventsList)) {
this._listMd = eventsList
this.countMd = this._listMd.length
this.count = this.countPr + this.countMd
this.saveMd()
this.countMd = this._listMd.length
this.count = this.countPr + this.countMd
this.saveMd()
}
}
private saveMd() {
+29
View File
@@ -149,6 +149,35 @@ class SessionService {
return initials;
}
clearPermission() {
this.permission = {
Agenda: {
access: false
},
Gabinete: {
access: false,
pr_tasks: false,
md_tasks: false,
aprove_event: false
},
Actions: {
access : false,
create : false,
delete : false,
edit : false,
createPost : false,
deletePost : false,
editPost : false
},
Chat: {
access: false
}
}
}
setPermission() {}
}