mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
add synchro
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { customTask, fullTask } from '../models/dailyworktask.model';
|
||||
import { customTask, fullTask, fullTaskList } from '../models/dailyworktask.model';
|
||||
import { AttachmentList } from '../models/Excludetask';
|
||||
import { PermissionService } from '../OtherService/permission.service';
|
||||
import { CustomTaskPipe } from '../pipes/custom-task.pipe';
|
||||
@@ -189,7 +189,7 @@ export class DespachoService {
|
||||
}
|
||||
|
||||
|
||||
async getList({updateStore = false}): Promise<customTask[]> {
|
||||
async getList({updateStore = false}): Promise<customTask[]> | null {
|
||||
|
||||
if (this.LoaderService.loading) {
|
||||
return this.despachoStore.list
|
||||
@@ -197,35 +197,32 @@ export class DespachoService {
|
||||
|
||||
this.LoaderService.push({})
|
||||
|
||||
let result: fullTask[] = []
|
||||
let result: fullTaskList[] = []
|
||||
let despachoList: customTask[] = [];
|
||||
|
||||
try {
|
||||
result = await this.processes.GetTasksList("Despacho", false).toPromise();
|
||||
result = result.filter((data:fullTaskList) => data.workflowInstanceDataFields.Status == "Active")
|
||||
result.forEach((element, index) => {
|
||||
|
||||
let task: customTask = this.customTaskPipe.transform(element);
|
||||
despachoList.push(task);
|
||||
|
||||
});
|
||||
|
||||
despachoList = this.sortArrayISODate(despachoList).reverse();
|
||||
|
||||
if(updateStore) {
|
||||
this.despachoStore.reset(despachoList);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
|
||||
} finally {
|
||||
this.LoaderService.pop({})
|
||||
}
|
||||
|
||||
|
||||
result = result.filter(data => data.workflowInstanceDataFields.Status == "Active")
|
||||
|
||||
let despachoList: customTask[] = new Array();
|
||||
|
||||
result.forEach((element, index) => {
|
||||
|
||||
let task: customTask = this.customTaskPipe.transform(element);
|
||||
despachoList.push(task);
|
||||
|
||||
});
|
||||
|
||||
despachoList = this.sortArrayISODate(despachoList).reverse();
|
||||
|
||||
if(updateStore) {
|
||||
this.despachoStore.reset(despachoList);
|
||||
return this.despachoStore.list
|
||||
}
|
||||
|
||||
return despachoList
|
||||
}
|
||||
|
||||
sortArrayISODate(myArray: any) {
|
||||
|
||||
@@ -17,7 +17,10 @@ export class AuthGuard implements CanActivate {
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
|
||||
if(window.location.pathname != '' && !SessionStore.exist) {
|
||||
if(!SessionStore.user.Inactivity) {
|
||||
this.router.navigate(['/inactivity']);
|
||||
}
|
||||
else if(window.location.pathname != '' && !SessionStore.exist) {
|
||||
this.router.navigate(['/']);
|
||||
return false
|
||||
} else {
|
||||
|
||||
@@ -16,6 +16,8 @@ export class InactivityGuard implements CanActivate {
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
|
||||
alert(SessionStore.exist +' '+SessionStore.user.Inactivity + ' '+ !SessionStore.hasPin)
|
||||
|
||||
if(SessionStore.exist && SessionStore.user.Inactivity && !SessionStore.hasPin) {
|
||||
// alert('stay set pin')
|
||||
return true
|
||||
|
||||
+19
-38
@@ -6,32 +6,18 @@ import { Component, OnInit, NgZone } from '@angular/core';
|
||||
import { Event } from '../models/event.model';
|
||||
import { NotificationsService } from '../services/notifications.service';
|
||||
import { WebNotificationsService } from '../services/webnotifications.service';
|
||||
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
|
||||
import { AlertController, Platform } from '@ionic/angular';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { ToDayEventStorage } from '../store/to-day-event-storage.service';
|
||||
import { DocumentCounterService } from 'src/app/OtherService/document-counter.service'
|
||||
import { PermissionService } from '../OtherService/permission.service';
|
||||
import { TotalDocumentStore } from '../store/total-document.service';
|
||||
import { connection } from '../services/socket/synchro.service';
|
||||
import { synchro } from '../services/socket/synchro.service';
|
||||
import { DespachoService } from '../Rules/despacho.service';
|
||||
import { ExpedienteGdStore } from '../store/expedientegd-store.service';
|
||||
import { InativityService } from '../services/inativity.service';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
|
||||
|
||||
|
||||
// import * as Sentry from "@sentry/browser";
|
||||
// import { Integrations } from "@sentry/tracing";
|
||||
|
||||
// Sentry.init({
|
||||
// dsn: "https://b374f7c7e09a49adb04197845ded60e9@o927946.ingest.sentry.io/5877459",
|
||||
// integrations: [new Integrations.BrowserTracing()],
|
||||
|
||||
// // Set tracesSampleRate to 1.0 to capture 100%
|
||||
// // of transactions for performance monitoring.
|
||||
// // We recommend adjusting this value in production
|
||||
// tracesSampleRate: 1.0,
|
||||
// });
|
||||
import { StorageService } from '../services/storage.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
@@ -72,7 +58,7 @@ export class HomePage implements OnInit {
|
||||
postEvent: any;
|
||||
folderId: string;
|
||||
|
||||
connection = connection
|
||||
synchro = synchro
|
||||
|
||||
constructor(
|
||||
private zone: NgZone,
|
||||
@@ -85,7 +71,8 @@ export class HomePage implements OnInit {
|
||||
public p: PermissionService,
|
||||
public documentCounterService: DocumentCounterService,
|
||||
private despachoRule: DespachoService,
|
||||
private inativityService: InativityService) {
|
||||
private inativityService: InativityService,
|
||||
private storageService: StorageService,) {
|
||||
|
||||
this.router.events.subscribe((val) => {
|
||||
document.querySelectorAll('ion-modal').forEach((e: any) => e.remove())
|
||||
@@ -93,7 +80,7 @@ export class HomePage implements OnInit {
|
||||
|
||||
this.updateList()
|
||||
|
||||
|
||||
window['platform'] = platform
|
||||
window['inactivity/function'] = () => {
|
||||
if(window.location.pathname != '/inactivity') {
|
||||
|
||||
@@ -103,25 +90,18 @@ export class HomePage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
var myWorker = new Worker(new URL('./nice.worker.js', import.meta.url) );
|
||||
|
||||
// if (typeof Worker !== 'undefined') {
|
||||
// // Create a new
|
||||
// const worker = new Worker(new URL('./nice.worker.ts', import.meta.url));
|
||||
// worker.onmessage = ({ data }) => {
|
||||
// console.log(`page got message: ${data}`);
|
||||
// };
|
||||
// worker.postMessage('hello');
|
||||
// } else {
|
||||
// // Web workers are not supported in this environment.
|
||||
// // You should add a fallback so that your program still executes correctly.
|
||||
// }
|
||||
myWorker.onmessage = function(oEvent) {
|
||||
console.log('Worker said : ' + oEvent.data);
|
||||
}
|
||||
|
||||
myWorker.postMessage('ali');
|
||||
|
||||
}
|
||||
|
||||
|
||||
refreshing() {
|
||||
|
||||
}
|
||||
refreshing() {}
|
||||
|
||||
ngOnInit() {
|
||||
/* this.network.checkNetworkConnection;
|
||||
@@ -137,9 +117,6 @@ export class HomePage implements OnInit {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
mobilefirstConnect() {
|
||||
|
||||
if(window['WLAuthorizationManager']) {
|
||||
@@ -178,12 +155,16 @@ export class HomePage implements OnInit {
|
||||
updateList() {
|
||||
|
||||
this.notificationsService.registerCallback(
|
||||
'despachos',
|
||||
'any',
|
||||
() => {
|
||||
this.despachoRule.getList({updateStore: true})
|
||||
}
|
||||
)
|
||||
|
||||
synchro.registerCallback('Notification', (DataArray)=> {
|
||||
alert('nice')
|
||||
}, 'any')
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
postMessage("I\'m working before postMessage(\'ali\').");
|
||||
|
||||
onmessage = function(oEvent) {
|
||||
postMessage('Hi ' + oEvent.data);
|
||||
};
|
||||
@@ -1,6 +0,0 @@
|
||||
// / <reference lib="webworker" />
|
||||
|
||||
addEventListener('message', ({ data }) => {
|
||||
const response = `worker response to ${data}`;
|
||||
//postMessage(response);
|
||||
});
|
||||
@@ -28,7 +28,7 @@
|
||||
</ion-buttons>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<ion-label>{{notificationdata.length}} novas notificações</ion-label>
|
||||
<ion-label (click)="asyncNotification()">{{notificationdata.length}} novas notificações</ion-label>
|
||||
</div>
|
||||
</ion-header>
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ export class ProfilePage implements OnInit {
|
||||
|
||||
notImplemented() { }
|
||||
|
||||
asyncNotification(){}
|
||||
|
||||
async getNotificationData(){
|
||||
this.storageservice.get("Notifications").then((value) => {
|
||||
console.log("Init get store", value)
|
||||
|
||||
@@ -67,6 +67,34 @@ export class fullTask {
|
||||
workflowName: string
|
||||
}
|
||||
|
||||
export interface fullTaskList {
|
||||
serialNumber: string;
|
||||
taskStartDate: string;
|
||||
workflowDisplayName: string;
|
||||
activityInstanceName: string;
|
||||
totalDocuments: number;
|
||||
workflowInstanceDataFields: {
|
||||
Subject: string;
|
||||
Sender: string;
|
||||
FolderID: number;
|
||||
DispatchDocId: number;
|
||||
Status: string;
|
||||
// all list
|
||||
ViewerRequest?: any
|
||||
Remetente?: any
|
||||
Agenda?: any // event to approve
|
||||
StartDate?: any // event to approve
|
||||
EndDate?: any // event to approve
|
||||
InstanceId?: string // event to approve
|
||||
Location?: string // event to approve
|
||||
IsAllDayEvent?: any // event to approve
|
||||
// pedidos
|
||||
DocIdDiferimento?: any
|
||||
// pedidos deferimento // Despacho do Presidente da República
|
||||
originator?: any
|
||||
}
|
||||
}
|
||||
|
||||
export class customFullTask {
|
||||
serialNumber: string;
|
||||
taskStartDate: string;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Component, OnInit, ViewChild, Inject, LOCALE_ID, Input } from '@angular/core';
|
||||
import { Component, OnInit, ViewChild, Inject, LOCALE_ID } from '@angular/core';
|
||||
import { CalendarComponent } from 'ionic2-calendar';
|
||||
import { AlertController, ModalController } from '@ionic/angular';
|
||||
import { formatDate } from '@angular/common';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
import { Event } from '../../models/event.model';
|
||||
import { Router, NavigationEnd } from '@angular/router';
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ContactsPage } from 'src/app/pages/chat/messages/contacts/contacts.page
|
||||
import { AlertService } from 'src/app/services/alert.service';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
import { connection } from 'src/app/services/socket/synchro.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { ChatOptionsPopoverPage } from 'src/app/shared/popover/chat-options-popover/chat-options-popover.page';
|
||||
import { MessagesOptionsPage } from 'src/app/shared/popover/messages-options/messages-options.page';
|
||||
@@ -33,7 +33,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
members:any;
|
||||
scrollingOnce:boolean = true;
|
||||
|
||||
connection = connection;
|
||||
synchro = synchro;
|
||||
chatMessageStore = ChatMessageStore
|
||||
chatUserStorage = ChatUserStorage
|
||||
|
||||
@@ -258,7 +258,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
if (res == 502) {
|
||||
// Connection timeout
|
||||
// happens when the connection was pending for too long
|
||||
// happens when the synchro was pending for too long
|
||||
// let's reconnect
|
||||
await this.serverLongPull();
|
||||
} else if (res != 200) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { AlertController } from '@ionic/angular';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
import crypto from 'crypto-js'
|
||||
import { LocalstoreService } from 'src/app/store/localstore.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
|
||||
@@ -40,7 +39,6 @@ export class LoginPage implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
|
||||
let userData = this.sessionStore.user
|
||||
|
||||
const loginPreference = userData?.LoginPreference
|
||||
|
||||
@@ -13,6 +13,7 @@ import { NavigationExtras,Router } from '@angular/router';
|
||||
import { ToastService } from '../services/toast.service';
|
||||
import { Optional } from '@angular/core';
|
||||
import { JsonStore } from './jsonStore.service';
|
||||
import { synchro } from './socket/synchro.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -39,15 +40,17 @@ export class NotificationsService {
|
||||
private toastService: ToastService,
|
||||
private zone: NgZone,
|
||||
private activeroute: ActivatedRoute,
|
||||
private jsonstore: JsonStore) {
|
||||
private jsonstore: JsonStore) { }
|
||||
|
||||
registerCallback(type: string, funx: Function, object: any = {} ) {
|
||||
|
||||
this.callbacks.push({type, funx})
|
||||
if(!object.hasOwnProperty('desktop') && object['desktop'] != false) {
|
||||
synchro.registerCallback('Notification',funx, type)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
registerCallback(type: string, funx: Function ) {
|
||||
this.callbacks.push({type, funx})
|
||||
}
|
||||
|
||||
getTokenByUserIdAndId(user, userID) {
|
||||
const geturl = environment.apiURL + 'notifications/user/' + userID;
|
||||
|
||||
@@ -216,6 +219,9 @@ export class NotificationsService {
|
||||
|
||||
console.log(message);
|
||||
var data = JSON.parse(message.payload);
|
||||
|
||||
synchro.$send(data)
|
||||
|
||||
console.log('data.Service', data.Service); // module
|
||||
console.log('data.IdObject', data.IdObject); // Object id
|
||||
console.log('data.Object', data.Object); // details
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ObjectQueryService } from './object-query.service';
|
||||
|
||||
describe('ObjectQueryService', () => {
|
||||
let service: ObjectQueryService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ObjectQueryService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,60 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ObjectQueryService {
|
||||
|
||||
data : any[] = []
|
||||
save: Function = () =>{}
|
||||
|
||||
constructor() {}
|
||||
|
||||
Update(select:Function, update:Function, data: any[] = this.data ) {
|
||||
|
||||
let changes = 0
|
||||
|
||||
data.forEach((e)=> {
|
||||
if(select(e)) {
|
||||
changes++
|
||||
update(e)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
if(changes != 0) {
|
||||
this.save()
|
||||
}
|
||||
}
|
||||
|
||||
select(select:Function, data: any[] = this.data ) {
|
||||
return data.filter((e)=>{
|
||||
return select(e)
|
||||
})
|
||||
}
|
||||
|
||||
Delete(select:Function, data: any[] = this.data) {
|
||||
|
||||
let changes = 0
|
||||
|
||||
data.forEach((e, index)=>{
|
||||
if(select(e)) {
|
||||
if (index > -1) {
|
||||
changes++
|
||||
data.splice(index, 1);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if(changes != 0) this.save()
|
||||
}
|
||||
|
||||
Insert(inert:any, data: any[] = this.data ) {
|
||||
data.push(inert)
|
||||
}
|
||||
|
||||
print() {
|
||||
console.log(this.data)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import { DocumentSetUpMeeting } from '../models/CallMeeting';
|
||||
import { Excludetask } from '../models/Excludetask';
|
||||
import { ExpedienteFullTask } from '../models/Expediente';
|
||||
import { GetTasksListType } from '../models/GetTasksListType';
|
||||
import { fullTaskList } from '../models/dailyworktask.model';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -24,7 +25,7 @@ export class ProcessesService {
|
||||
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
}
|
||||
|
||||
GetTasksList(processname: typeof GetTasksListType, onlycount:boolean): Observable<any>
|
||||
GetTasksList(processname: typeof GetTasksListType, onlycount:boolean): Observable<fullTaskList[]>
|
||||
{
|
||||
const geturl = environment.apiURL + 'tasks/List';
|
||||
let params = new HttpParams();
|
||||
@@ -37,7 +38,7 @@ export class ProcessesService {
|
||||
params: params
|
||||
};
|
||||
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
return this.http.get<fullTaskList[]>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
GetTaskListExpediente(onlycount1): Observable<ExpedienteFullTask[]> {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { BackgroundService } from '../background.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
export interface wss{
|
||||
|
||||
@@ -17,7 +19,7 @@ export interface wss{
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class SynchroService {
|
||||
class SynchroService {
|
||||
[x: string]: any;
|
||||
|
||||
private connection!: WebSocket;
|
||||
@@ -27,10 +29,12 @@ export class SynchroService {
|
||||
callback = function(){}
|
||||
private _connected = false;
|
||||
private BackgroundService = new BackgroundService()
|
||||
private callBacks: {
|
||||
type: 'Offline' | 'Online'
|
||||
callBacks: {
|
||||
type: 'Offline' | 'Online' | 'Onmessage' | 'Chat' | 'Notification' | 'Notifications' | '',
|
||||
object?: string
|
||||
funx: Function
|
||||
}[] = []
|
||||
private msgQueue = []
|
||||
|
||||
constructor(){}
|
||||
|
||||
@@ -55,10 +59,11 @@ export class SynchroService {
|
||||
this.url = `${wss.url}${wss.header.id}/${wss.header.jwt}/${wss.header.bluePrint}/${this.id}/`
|
||||
}
|
||||
|
||||
registerCallback(type: 'Offline' | 'Online', funx: Function) {
|
||||
registerCallback(type: 'Offline' | 'Online' | 'Onmessage' | 'Chat' | 'Notifications' | 'Notification', funx: Function, object='') {
|
||||
this.callBacks.push({
|
||||
type,
|
||||
funx
|
||||
funx,
|
||||
object
|
||||
})
|
||||
}
|
||||
|
||||
@@ -85,22 +90,72 @@ export class SynchroService {
|
||||
console.log('open ======================= welcome to socket server')
|
||||
this._connected = true
|
||||
|
||||
// send all saved data due to internet connection
|
||||
this.msgQueue.forEach((item, index, object) => {
|
||||
this.$send(item);
|
||||
object.splice(index, 1);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
public $send(object: any) {
|
||||
|
||||
let message = {
|
||||
message: '{"person.adress.country":"1Angola"}',
|
||||
username: '',
|
||||
idConnection: this.id
|
||||
if(!this._connected) { // save data to send when back online
|
||||
this.msgQueue.push(object)
|
||||
}
|
||||
|
||||
let sendData = JSON.stringify(Object.assign({}, message));
|
||||
let payload = {
|
||||
message: JSON.stringify(object) || '{"person.adress.country":"1Angola"}',
|
||||
username: SessionStore.user.FullName,
|
||||
idConnection: this.id
|
||||
}
|
||||
|
||||
|
||||
let sendData = JSON.stringify(payload);
|
||||
console.log(sendData)
|
||||
|
||||
this.connection.send(sendData);
|
||||
}
|
||||
|
||||
private onmessage = async (event: any)=> {
|
||||
|
||||
|
||||
let data = JSON.parse(event.data)
|
||||
let payload = JSON.parse(data.message)
|
||||
payload.message = JSON.parse(payload.message)
|
||||
const idConnection = payload.idConnection
|
||||
const username = payload.username
|
||||
|
||||
if(idConnection != this.id ) {
|
||||
|
||||
if(window['platform'].is('desktop') || this.platform.is('mobileweb')) {}
|
||||
else return false
|
||||
if(environment.production) return false
|
||||
|
||||
this.callBacks.forEach((e)=> {
|
||||
|
||||
if(payload.message[0]) {
|
||||
if(payload.message[0].Service && payload.message[0].Object && payload.message[0].IdObject) {
|
||||
if(e.type == '' && !e.object) {
|
||||
if(username == SessionStore.user.FullName) {
|
||||
e.funx(payload.message, data)
|
||||
}
|
||||
}
|
||||
|
||||
if(e.type == 'Notifications' ) {
|
||||
e.funx(payload.message, data)
|
||||
}
|
||||
|
||||
}
|
||||
} else if(payload.message.Service && payload.message.Object && payload.message.IdObject) {
|
||||
if(e.type == 'Notification' && e.object == payload.message.Object || e.type == 'Notification' && e.object == 'any' ) {
|
||||
e.funx(payload.message, data)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
this.callback()
|
||||
}
|
||||
|
||||
@@ -137,7 +192,8 @@ export class SynchroService {
|
||||
}
|
||||
|
||||
|
||||
export const connection = new SynchroService()
|
||||
connection.setUrl()
|
||||
connection.connect()
|
||||
export const synchro = new SynchroService()
|
||||
synchro.setUrl()
|
||||
synchro.connect()
|
||||
|
||||
window['synchro'] = synchro
|
||||
@@ -8,7 +8,7 @@ import { ChatOptionsPopoverPage } from 'src/app/shared/popover/chat-options-popo
|
||||
import { MessagesOptionsPage } from 'src/app/shared/popover/messages-options/messages-options.page';
|
||||
import { ContactsPage } from '../new-group/contacts/contacts.page';
|
||||
import { Router } from '@angular/router';
|
||||
import { connection } from 'src/app/services/socket/synchro.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { ChatOptionsFeaturesPage } from 'src/app/modals/chat-options-features/chat-options-features.page';
|
||||
import { ChatMessageStore } from 'src/app/store/chat/chat-message.service';
|
||||
import { ChatUserStorage } from 'src/app/store/chat/chat-user.service';
|
||||
@@ -39,7 +39,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
@Output() openNewEventPage:EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
|
||||
connection = connection;
|
||||
synchro = synchro;
|
||||
chatMessageStore = ChatMessageStore
|
||||
chatUserStorage = ChatUserStorage
|
||||
|
||||
@@ -152,7 +152,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
|
||||
sendMessage() {
|
||||
|
||||
this.connection.$send({})
|
||||
this.synchro.$send({})
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
|
||||
@@ -77,8 +77,14 @@
|
||||
</div>
|
||||
|
||||
<div class="div-profile d-flex cursor-pointer" (click)="openProfile()">
|
||||
|
||||
<ion-icon class="icon" src='assets/images/icons-profile.svg'></ion-icon>
|
||||
<ion-label class="profile-text">{{profileLabel(loggeduser.Profile)}}</ion-label>
|
||||
|
||||
<div class="profile-text">
|
||||
<ion-label>{{profileLabel(loggeduser.Profile)}}</ion-label>
|
||||
<div *ngIf="this.notificationLength > 0 && !production" class="icon-badge" style="right: -18px;top: -9px;" >{{this.notificationLength}}</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,7 @@ import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
import { ProfilePage } from 'src/app/modals/profile/profile.page';
|
||||
import { StorageService } from '../../services/storage.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
@@ -23,6 +24,8 @@ export class HeaderPage implements OnInit {
|
||||
notificationLength: 0;
|
||||
SessionStore = SessionStore
|
||||
|
||||
production = environment.production
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private modalController: ModalController,
|
||||
|
||||
@@ -26,7 +26,7 @@ export class ProfileComponent implements OnInit {
|
||||
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
|
||||
console.log(this.loggeduser.RoleDescription)
|
||||
// console.log(this.loggeduser.RoleDescription)
|
||||
|
||||
this.checkState()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { localstoreService } from './localstore.service'
|
||||
import { AES, enc, SHA1 } from 'crypto-js'
|
||||
import { SHA1 } from 'crypto-js'
|
||||
import { customTask } from '../models/dailyworktask.model';
|
||||
import { ObjectQueryService } from '../services/object-query.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -14,20 +15,85 @@ export class DespachoStoreService {
|
||||
private keyName: string;
|
||||
private _count = 0
|
||||
|
||||
ObjectQueryService = new ObjectQueryService()
|
||||
|
||||
constructor() {
|
||||
|
||||
this.keyName = (SHA1(this.constructor.name+ 'home/eventSource')).toString()
|
||||
|
||||
|
||||
window['ObjectQueryService'] = this.Query()
|
||||
|
||||
setTimeout(()=>{
|
||||
let restore = localstoreService.get(this.keyName, {})
|
||||
this._list = restore.list || []
|
||||
this._count = parseInt(restore.count) || 0
|
||||
}, 10)
|
||||
|
||||
|
||||
setTimeout(()=>{
|
||||
|
||||
// this.Query().Update(
|
||||
// (select:customTask): boolean => select.Folio == 'Formação',
|
||||
// (update:customTask) => update.Folio = 'Formação 5'
|
||||
// )
|
||||
|
||||
// this.Query().Update(
|
||||
// (select:customTask): boolean => select.Folio == 'Formação',
|
||||
// (update:customTask) => {
|
||||
// update.Folio = 'Formação 7';
|
||||
// update.DocumentURL = 'peter';
|
||||
// }
|
||||
// )
|
||||
|
||||
// this.Query().Update(
|
||||
// (select:customTask): boolean => select.Folio == 'Formação',
|
||||
// (update:customTask): customTask => ({
|
||||
// CreateDate: '',
|
||||
// DocId: 0,
|
||||
// DocumentURL: '',
|
||||
// DocumentsQty: '',
|
||||
// FolderID: 0,
|
||||
// Folio:' ',
|
||||
// Remetente: '',
|
||||
// Senders: '',
|
||||
// SerialNumber: '',
|
||||
// Status: '',
|
||||
// WorkflowName: '',
|
||||
// activityInstanceName: ''
|
||||
// })
|
||||
// )
|
||||
|
||||
// this.Query().Delete(
|
||||
// (select: customTask): boolean => select.DocId == 3 && select.DocId >= 1
|
||||
// )
|
||||
|
||||
}, 5000)
|
||||
|
||||
}
|
||||
|
||||
get list() {
|
||||
Query() {
|
||||
return {
|
||||
Update: (select:Function, update:Function) => {
|
||||
this.ObjectQueryService.Update(select, update, this._list )
|
||||
this.save({dynamicCount : true})
|
||||
},
|
||||
select: (select) => {
|
||||
this.ObjectQueryService.select(select, this._list )
|
||||
this.save({dynamicCount : true})
|
||||
},
|
||||
Delete : (select) => {
|
||||
this.ObjectQueryService.Delete(select, this._list )
|
||||
this.save({dynamicCount : true})
|
||||
},
|
||||
Insert: (insert: customTask | customTask[]) =>{
|
||||
this.ObjectQueryService.Insert(insert, this._list)
|
||||
this.save({dynamicCount : true})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ObjectQuery() {}
|
||||
|
||||
get list(): customTask[] {
|
||||
return this._list || []
|
||||
}
|
||||
|
||||
@@ -37,17 +103,20 @@ export class DespachoStoreService {
|
||||
|
||||
set count(value: number) {
|
||||
this._count = value
|
||||
this.save()
|
||||
this.save({})
|
||||
}
|
||||
|
||||
reset(eventsList: any) {
|
||||
this._list = eventsList
|
||||
|
||||
this.count = this._list.length
|
||||
this.save()
|
||||
this.save({dynamicCount:true})
|
||||
}
|
||||
|
||||
private save() {
|
||||
private save = ({dynamicCount = false})=> {
|
||||
|
||||
if(dynamicCount) {
|
||||
this._count = this._list.length
|
||||
}
|
||||
|
||||
setTimeout(()=>{
|
||||
localstoreService.set(this.keyName,{
|
||||
list: this._list,
|
||||
|
||||
@@ -13,7 +13,6 @@ class SessionService {
|
||||
private _user = new UserSession()
|
||||
// local storage keyName
|
||||
private keyName: string;
|
||||
private _needTovalidateUser = false
|
||||
|
||||
constructor() {
|
||||
|
||||
@@ -53,7 +52,7 @@ class SessionService {
|
||||
return this._user.PIN == SHA1(pin).toString()
|
||||
}
|
||||
|
||||
needTovalidateUser() {
|
||||
needToValidateUser() {
|
||||
return this._user.Inactivity
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ export const environment = {
|
||||
/* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */
|
||||
domain: 'gabinetedigital.local', //gabinetedigital.local
|
||||
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local
|
||||
defaultuserpwd: 'tabteste@006' //tabteste@006
|
||||
defaultuserpwd: 'tabteste@006', //tabteste@006,
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user