mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
pull made
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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">
|
||||
|
||||
+2
-2
@@ -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 {
|
||||
|
||||
@@ -35,7 +35,6 @@ export class BackgroundService {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
this.status = 'offline'
|
||||
}
|
||||
|
||||
paint() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('./firebase-messaging-sw.js')
|
||||
.then(function(registration) {
|
||||
}).catch(function(err) {
|
||||
});
|
||||
}
|
||||
// Scripts for firebase and firebase messaging
|
||||
|
||||
importScripts('https://www.gstatic.com/firebasejs/8.2.0/firebase-app.js');
|
||||
importScripts('https://www.gstatic.com/firebasejs/8.2.0/firebase-messaging.js');
|
||||
|
||||
@@ -36,4 +28,33 @@ messaging.onBackgroundMessage(function(payload) {
|
||||
|
||||
self.registration.showNotification(notificationTitle,
|
||||
notificationOptions);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
self.addEventListener('install', function(event) {
|
||||
self.skipWaiting();
|
||||
console.log('Installed', event);
|
||||
});
|
||||
|
||||
self.addEventListener('activate', function(event) {
|
||||
console.log('Activated', event);
|
||||
});
|
||||
|
||||
self.addEventListener('push', function(event) {
|
||||
|
||||
var uid = "EXISTS_IN_CORE.JS";
|
||||
var token = "ALSO_EXISTS_IN_CORE.JS";
|
||||
|
||||
console.log("Push recieved - we need to know the uid and token here, from core.js");
|
||||
});
|
||||
|
||||
self.addEventListener('message', function(event){
|
||||
var data = JSON.parse(event.data);
|
||||
|
||||
console.log("SW Received Message:");
|
||||
console.log(data);
|
||||
|
||||
self.userID = data.uid;
|
||||
self.userToken = data.token;
|
||||
|
||||
});
|
||||
@@ -48,36 +48,6 @@
|
||||
}
|
||||
</script> -->
|
||||
|
||||
<script>
|
||||
if (navigator.serviceWorker) {
|
||||
navigator.serviceWorker.register("assets/firebase-messaging-sw.js").then(function(reg) {
|
||||
window.pushReg = reg;
|
||||
if (reg.installing) {
|
||||
console.info('Service worker installing');
|
||||
} else if (reg.waiting) {
|
||||
console.info('Service worker installed');
|
||||
} else if (reg.active) {
|
||||
console.info('Service worker active');
|
||||
}
|
||||
if (!(reg.showNotification)) {
|
||||
console.info('Notifications aren\'t supported on service workers.');
|
||||
}
|
||||
// Check if push messaging is supported
|
||||
if (!('PushManager' in window)) {
|
||||
console.info("Push messaging isn't supported.");
|
||||
}
|
||||
|
||||
if (Notification.permission === 'denied') {
|
||||
console.info('The user has blocked notifications.');
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error(JSON.stringify(err));
|
||||
});
|
||||
} else {
|
||||
console.info("Service workers aren't supported in this browser.");
|
||||
}
|
||||
</script>
|
||||
|
||||
<meta name="color-scheme" content="light dark" />
|
||||
<meta name="viewport" content="viewport-fit=cover, width=device-width, height=device-hight, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<meta name="format-detection" content="telephone=no" />
|
||||
|
||||
Reference in New Issue
Block a user