mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Merge with peter changes
This commit is contained in:
+5
-1
@@ -42,4 +42,8 @@ src/app/architect/
|
||||
src/environments/environment.e2e.ts
|
||||
.env
|
||||
platforms_
|
||||
_platforms
|
||||
_platforms
|
||||
|
||||
|
||||
src/app/store/notification.service.spec.ts
|
||||
src/app/store/notification.service.ts
|
||||
@@ -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,12 +16,9 @@ export class InactivityGuard implements CanActivate {
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
|
||||
if(SessionStore.exist && SessionStore.user.Inactivity && !SessionStore.hasPin) {
|
||||
// alert('stay set pin')
|
||||
if(SessionStore.exist && SessionStore.user.Inactivity && !SessionStore.hasPin ) {
|
||||
return true
|
||||
|
||||
} else if(SessionStore.exist && !SessionStore.user.Inactivity) {
|
||||
// alert('stay conform')
|
||||
return true
|
||||
} else {
|
||||
this.router.navigate(['/home/events']);
|
||||
|
||||
+19
-37
@@ -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,8 +80,9 @@ export class HomePage implements OnInit {
|
||||
|
||||
this.updateList()
|
||||
|
||||
|
||||
window['platform'] = platform
|
||||
window['inactivity/function'] = () => {
|
||||
|
||||
if(window.location.pathname != '/inactivity') {
|
||||
|
||||
const pathname = window.location.pathname
|
||||
@@ -103,25 +91,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 +118,6 @@ export class HomePage implements OnInit {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
mobilefirstConnect() {
|
||||
|
||||
if(window['WLAuthorizationManager']) {
|
||||
@@ -184,6 +162,10 @@ export class HomePage implements OnInit {
|
||||
}
|
||||
)
|
||||
|
||||
synchro.registerCallback('Notification', (notification)=> {
|
||||
console.log('notification====== £=======£==========£======', notification)
|
||||
}, '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);
|
||||
});
|
||||
@@ -546,7 +546,7 @@ export class CreateProcessPage implements OnInit {
|
||||
taskParticipants: this.taskParticipants,
|
||||
taskParticipantsCc: this.taskParticipantsCc
|
||||
},
|
||||
cssClass: 'attendee',
|
||||
cssClass: 'attendee modal-desktop',
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { EditProfilePage } from './edit-profile/edit-profile.page';
|
||||
import { JsonStore } from '../../services/jsonStore.service';
|
||||
import { StorageService } from '../../services/storage.service';
|
||||
import { NotificationsService } from '../../services/notifications.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-profile',
|
||||
@@ -65,6 +66,8 @@ export class ProfilePage implements OnInit {
|
||||
|
||||
notImplemented() { }
|
||||
|
||||
asyncNotification(){}
|
||||
|
||||
async getNotificationData(){
|
||||
this.storageservice.get("Notifications").then((value) => {
|
||||
console.log("Init get store", value)
|
||||
@@ -201,10 +204,10 @@ export class ProfilePage implements OnInit {
|
||||
}
|
||||
|
||||
logout() {
|
||||
window.localStorage.clear();
|
||||
|
||||
SessionStore.setInativity(false)
|
||||
|
||||
setTimeout(() => {
|
||||
this.router.navigateByUrl('/', { replaceUrl: true });
|
||||
this.router.navigate(['/inactivity']);
|
||||
}, 100)
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -127,6 +127,7 @@ export interface EventToApproveEdit {
|
||||
MDEmail: string;
|
||||
IsAllDayEvent: boolean;
|
||||
Status: string;
|
||||
Category: string
|
||||
EventType: string;
|
||||
IsRecurring: boolean;
|
||||
ParticipantsList: ParticipantsList[];
|
||||
@@ -140,4 +141,59 @@ export interface EventToApproveEdit {
|
||||
InstanceId?: string;
|
||||
}
|
||||
|
||||
// ================================================================================
|
||||
// // ================================================================================
|
||||
// export interface EventToApproveDetails {
|
||||
// serialNumber: string;
|
||||
// originator: {
|
||||
// email: string;
|
||||
// manager: string;
|
||||
// displayName: string;
|
||||
// fqn: string;
|
||||
// username: string;
|
||||
// }[]
|
||||
// actions: string[];
|
||||
// activityInstanceName: string;
|
||||
// workflowInstanceFolio: string;
|
||||
// taskStartDate: string;
|
||||
// workflowID: number;
|
||||
// workflowInstanceID: number;
|
||||
// workflowName: string;
|
||||
// workflowDisplayName: string;
|
||||
// formURL: string;
|
||||
// workflowInstanceDataFields: {
|
||||
// Body: string;
|
||||
// Location: string;
|
||||
// Subject: string;
|
||||
// StartDate: string;
|
||||
// EndDate: string;
|
||||
// Participants: string;
|
||||
// CC: string;
|
||||
// Private: boolean;
|
||||
// ReviewUserComment: string;
|
||||
// MDName: string;
|
||||
// MDEmail: string;
|
||||
// OriginatorComments: string;
|
||||
// Agenda: string;
|
||||
// EventType: string;
|
||||
// TimeZone: string;
|
||||
// EventID: string;
|
||||
// HasAttachments: boolean;
|
||||
// ParticipantsList: {
|
||||
// $type?: any;
|
||||
// EmailAddress: string;
|
||||
// Name: string;
|
||||
// IsRequired: boolean;
|
||||
// }[]
|
||||
// EventOrganizer: string;
|
||||
// CreatEvent: string;
|
||||
// IsAllDayEvent: boolean;
|
||||
// MDwxUserID: number;
|
||||
// SerializedItem: string;
|
||||
// DeserializedItem: string;
|
||||
// Status: string;
|
||||
// Message: string;
|
||||
// InstanceId: string;
|
||||
// }
|
||||
// totalDocuments?: any;
|
||||
// Documents?: any;
|
||||
// }
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -265,7 +265,7 @@ export class EditEventPage implements OnInit {
|
||||
taskParticipants: this.taskParticipants,
|
||||
taskParticipantsCc: this.taskParticipantsCc
|
||||
},
|
||||
cssClass: 'attendee',
|
||||
cssClass: 'modal attendee modal-desktop',
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
@@ -279,8 +279,13 @@ export class EditEventPage implements OnInit {
|
||||
const newAttendees: EventPerson[] = data['taskParticipants'];
|
||||
const newAttendeesCC: EventPerson[] = data['taskParticipantsCc'];
|
||||
|
||||
this.setIntervenient(newAttendees);
|
||||
this.setIntervenientCC(newAttendeesCC);
|
||||
if(newAttendees.length) {
|
||||
this.setIntervenient(newAttendees);
|
||||
}
|
||||
if(newAttendeesCC) {
|
||||
this.setIntervenientCC(newAttendeesCC);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -296,9 +296,9 @@ export class NewEventPage implements OnInit {
|
||||
const modal = await this.modalController.create({
|
||||
component: AttendeesPageModal,
|
||||
componentProps: {
|
||||
eventAttendees: this.postEvent.Attendees,
|
||||
adding: this.adding,
|
||||
taskParticipants: this.taskParticipants
|
||||
taskParticipants: this.taskParticipants,
|
||||
taskParticipantsCc: this.taskParticipantsCc
|
||||
},
|
||||
cssClass: 'attendee modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
@@ -308,19 +308,27 @@ export class NewEventPage implements OnInit {
|
||||
|
||||
modal.onDidDismiss().then((data) => {
|
||||
|
||||
if(data){
|
||||
if(data) {
|
||||
data = data['data'];
|
||||
if(data) {
|
||||
|
||||
const newAttendees: EventPerson[] = data['taskParticipants'];
|
||||
const newAttendeesCC: EventPerson[] = data['taskParticipantsCc'];
|
||||
const newAttendees: EventPerson[] = data['taskParticipants'];
|
||||
const newAttendeesCC: EventPerson[] = data['taskParticipantsCc'];
|
||||
|
||||
if(newAttendees.length) {
|
||||
this.setIntervenient(newAttendees);
|
||||
}
|
||||
if(newAttendeesCC) {
|
||||
this.setIntervenientCC(newAttendeesCC);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.setIntervenient(newAttendees);
|
||||
this.setIntervenientCC(newAttendeesCC);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setIntervenient(data){
|
||||
setIntervenient(data) {
|
||||
this.taskParticipants = data;
|
||||
this.postEvent.Attendees = data;
|
||||
}
|
||||
@@ -329,7 +337,7 @@ export class NewEventPage implements OnInit {
|
||||
this.taskParticipantsCc = data;
|
||||
}
|
||||
|
||||
addParticipants(){
|
||||
addParticipants() {
|
||||
this.adding = 'intervenient'
|
||||
this.openAttendees();
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -461,7 +461,10 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
|
||||
|
||||
let despachos = await this.despachoRule.getList({updateStore: true})
|
||||
this.despachoStore.reset(despachos)
|
||||
if(despachos) {
|
||||
this.despachoStore.reset(despachos)
|
||||
}
|
||||
|
||||
|
||||
let pareceres = await this.processesbackend.GetTasksList("Pedido de Parecer", false).toPromise();
|
||||
let pareceresPr = await this.processesbackend.GetTasksList("Pedido de Parecer do Presidente", false).toPromise();
|
||||
|
||||
@@ -79,10 +79,12 @@ export class InactivityPage implements OnInit {
|
||||
await this.authService.SetSession(attempt, this.userattempt);
|
||||
await this.authService.loginChat(this.userattempt);
|
||||
await this.getToken();
|
||||
SessionStore.setInativity(true)
|
||||
|
||||
this.goback()
|
||||
} else {
|
||||
SessionStore.delete()
|
||||
window.localStorage.clear();
|
||||
await this.authService.SetSession(attempt, this.userattempt);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Network } from '@ionic-native/network/ngx';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { fromEvent, merge, of, Observable } from 'rxjs';
|
||||
import { mapTo } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class NetworkService {
|
||||
|
||||
constructor(
|
||||
private network: Network) { }
|
||||
|
||||
checkNetworkConnection(){
|
||||
this.network.onConnect().subscribe((value) => {
|
||||
|
||||
document.body.style.setProperty(`--color`, "#0782C9");
|
||||
|
||||
console.log('network connected!',value);
|
||||
});
|
||||
}
|
||||
|
||||
checkNetworkDisconnection(){
|
||||
this.network.onDisconnect().subscribe((value) => {
|
||||
document.body.style.setProperty(`--color`, "#eeeb30");
|
||||
console.log('network was disconnected :-('),value;
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -168,9 +171,13 @@ export class NotificationsService {
|
||||
console.log('Push notification recived: failure ' + error.responseText);
|
||||
console.log(JSON.stringify(error));
|
||||
}
|
||||
);
|
||||
)
|
||||
} else {
|
||||
console.log('not called')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log('not called')
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -216,6 +223,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
|
||||
|
||||
+5
-5
@@ -1,16 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NetworkService } from './network.service';
|
||||
import { ObjectQueryService } from './object-query.service';
|
||||
|
||||
describe('NavigationService', () => {
|
||||
let service: NetworkService;
|
||||
describe('ObjectQueryService', () => {
|
||||
let service: ObjectQueryService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(NetworkService);
|
||||
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
|
||||
@@ -87,6 +87,48 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div">
|
||||
<div class="ion-item-class-2">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-input-class" [class.input-error]="Form?.get('Categories')?.invalid && validateFrom ">
|
||||
|
||||
<ion-select placeholder="Selecione tipo de evento*"
|
||||
class="d-block d-md-none"
|
||||
[(ngModel)]="eventProcess.workflowInstanceDataFields.Category"
|
||||
interface="action-sheet"
|
||||
Cancel-text="Cancelar" required>
|
||||
<ion-select-option value="Reunião">Reunião</ion-select-option>
|
||||
<ion-select-option value="Viagem">Viagem</ion-select-option>
|
||||
<ion-select-option value="Conferência">Conferência</ion-select-option>
|
||||
<ion-select-option value="Encontro">Encontro</ion-select-option>
|
||||
</ion-select>
|
||||
|
||||
|
||||
<mat-form-field class="d-none d-md-block" appearance="none" class="width-100" placeholder="Sample Type" required>
|
||||
<!-- <input matInput type="text" > -->
|
||||
<mat-select [(ngModel)]="eventProcess.workflowInstanceDataFields.Category" >
|
||||
<mat-option value="Reunião">
|
||||
Reunião
|
||||
</mat-option>
|
||||
<mat-option value="Viagem">
|
||||
Viagem
|
||||
</mat-option>
|
||||
<mat-option value="Conferência">
|
||||
Conferência
|
||||
</mat-option>
|
||||
<mat-option value="Encontro">
|
||||
Encontro
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="Form && validateFrom" >
|
||||
<div *ngIf="Form.get('participantes').invalid " class="input-errror-message">
|
||||
<div *ngIf="Form.get('participantes').errors?.required">
|
||||
|
||||
@@ -72,6 +72,7 @@ export class EditEventToApprovePage implements OnInit {
|
||||
workflowInstanceDataFields:{
|
||||
Body: "",
|
||||
OccurrenceType: '',
|
||||
Category: '',
|
||||
LastOccurrence: '',
|
||||
IsRecurring: false,
|
||||
ParticipantsList: [],
|
||||
@@ -146,7 +147,7 @@ export class EditEventToApprovePage implements OnInit {
|
||||
|
||||
async getTask() {
|
||||
|
||||
this.processes.GetTask(this.serialNumber).subscribe( result =>{
|
||||
this.processes.GetTask(this.serialNumber).subscribe( (result) =>{
|
||||
this.eventProcess = result
|
||||
|
||||
this.restoreDatepickerData()
|
||||
@@ -302,6 +303,7 @@ export class EditEventToApprovePage implements OnInit {
|
||||
LastOccurrence: this.eventProcess.workflowInstanceDataFields.LastOccurrence,
|
||||
},
|
||||
ParticipantsList: this.eventProcess.workflowInstanceDataFields.ParticipantsList,
|
||||
Category: this.eventProcess.workflowInstanceDataFields.Category
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
123123
|
||||
<div class="container-div">
|
||||
<div class="ion-item-class-2 width-100 d-flex">
|
||||
<div class="ion-icon-class">
|
||||
|
||||
@@ -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":
|
||||
|
||||
@@ -68,6 +68,49 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container-div width-100">
|
||||
<div class="ion-item-class-2">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-input-class" [class.input-error]="Form?.get('Categories')?.invalid && validateFrom ">
|
||||
|
||||
<ion-select placeholder="Selecione tipo de evento*"
|
||||
class="d-block d-md-none"
|
||||
[(ngModel)]="eventProcess.workflowInstanceDataFields.Category"
|
||||
interface="action-sheet"
|
||||
Cancel-text="Cancelar" required>
|
||||
<ion-select-option value="Reunião">Reunião</ion-select-option>
|
||||
<ion-select-option value="Viagem">Viagem</ion-select-option>
|
||||
<ion-select-option value="Conferência">Conferência</ion-select-option>
|
||||
<ion-select-option value="Encontro">Encontro</ion-select-option>
|
||||
</ion-select>
|
||||
|
||||
|
||||
<mat-form-field class="d-none d-md-block" appearance="none" class="width-100" placeholder="Sample Type" required>
|
||||
<!-- <input matInput type="text" > -->
|
||||
<mat-select [(ngModel)]="eventProcess.workflowInstanceDataFields.Category" >
|
||||
<mat-option value="Reunião">
|
||||
Reunião
|
||||
</mat-option>
|
||||
<mat-option value="Viagem">
|
||||
Viagem
|
||||
</mat-option>
|
||||
<mat-option value="Conferência">
|
||||
Conferência
|
||||
</mat-option>
|
||||
<mat-option value="Encontro">
|
||||
Encontro
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div width-100">
|
||||
<div class="ion-item-class-2 width-100">
|
||||
<div class="ion-icon-class">
|
||||
|
||||
@@ -68,6 +68,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
workflowInstanceDataFields:{
|
||||
Body: "",
|
||||
OccurrenceType: '',
|
||||
Category: '',
|
||||
LastOccurrence: '',
|
||||
ParticipantsList: [],
|
||||
Agenda: '',
|
||||
@@ -132,41 +133,42 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
async getTask() {
|
||||
|
||||
const result = await this.processes.GetTask(this.serialNumber).toPromise();
|
||||
console.log(result);
|
||||
console.log(result);
|
||||
|
||||
this.eventProcess = result
|
||||
this.eventProcess.workflowInstanceDataFields.Category = result.workflowInstanceDataFields.EventType
|
||||
|
||||
this.startDate = new Date(this.eventProcess.workflowInstanceDataFields.StartDate);
|
||||
this.endDate = new Date(this.eventProcess.workflowInstanceDataFields.EndDate);
|
||||
this.startDate = new Date(this.eventProcess.workflowInstanceDataFields.StartDate);
|
||||
this.endDate = new Date(this.eventProcess.workflowInstanceDataFields.EndDate);
|
||||
|
||||
// description
|
||||
let body : any =this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '')
|
||||
this.eventProcess.workflowInstanceDataFields.Body = body
|
||||
this.Location = this.eventProcess.workflowInstanceDataFields.Location
|
||||
// description
|
||||
let body : any =this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '')
|
||||
this.eventProcess.workflowInstanceDataFields.Body = body
|
||||
this.Location = this.eventProcess.workflowInstanceDataFields.Location
|
||||
|
||||
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
|
||||
try {
|
||||
this.getAttachments()
|
||||
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
|
||||
try {
|
||||
this.getAttachments()
|
||||
|
||||
} catch (error) {
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) {
|
||||
this.isRecurring = "Não se repete";
|
||||
}
|
||||
else {
|
||||
this.isRecurring = "Repete";
|
||||
}
|
||||
|
||||
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
|
||||
if(e.IsRequired) {
|
||||
this.taskParticipants.push(e);
|
||||
} else {
|
||||
this.taskParticipantsCc.push(e);
|
||||
}
|
||||
|
||||
|
||||
if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) {
|
||||
this.isRecurring = "Não se repete";
|
||||
}
|
||||
else {
|
||||
this.isRecurring = "Repete";
|
||||
}
|
||||
|
||||
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
|
||||
if(e.IsRequired) {
|
||||
this.taskParticipants.push(e);
|
||||
} else {
|
||||
this.taskParticipantsCc.push(e);
|
||||
}
|
||||
})
|
||||
})
|
||||
/* }) */
|
||||
}
|
||||
|
||||
@@ -254,6 +256,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
LastOccurrence: this.eventProcess.workflowInstanceDataFields.LastOccurrence,
|
||||
},
|
||||
ParticipantsList: this.eventProcess.workflowInstanceDataFields.ParticipantsList,
|
||||
Category: this.eventProcess.workflowInstanceDataFields.Category
|
||||
}
|
||||
|
||||
console.log(event);
|
||||
@@ -307,14 +310,19 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
|
||||
modal.onDidDismiss().then((data) => {
|
||||
|
||||
if(data){
|
||||
if(data) {
|
||||
data = data['data'];
|
||||
|
||||
const newAttendees: EventPerson[] = data['taskParticipants'];
|
||||
const newAttendeesCC: EventPerson[] = data['taskParticipantsCc'];
|
||||
|
||||
this.setIntervenient(newAttendees);
|
||||
this.setIntervenientCC(newAttendeesCC);
|
||||
if(newAttendees.length) {
|
||||
this.setIntervenient(newAttendees);
|
||||
}
|
||||
if(newAttendeesCC) {
|
||||
this.setIntervenientCC(newAttendeesCC);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ProfilePage } from 'src/app/modals/profile/profile.page';
|
||||
import { StorageService } from '../../services/storage.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { NotificationsService } from '../../services/notifications.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
@@ -24,6 +25,8 @@ export class HeaderPage implements OnInit {
|
||||
notificationLength: 0;
|
||||
SessionStore = SessionStore
|
||||
|
||||
production = environment.production
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private modalController: ModalController,
|
||||
@@ -46,8 +49,6 @@ export class HeaderPage implements OnInit {
|
||||
} else {
|
||||
this.UpdateNotificationCount();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -154,7 +155,8 @@ export class HeaderPage implements OnInit {
|
||||
componentProps: {
|
||||
}
|
||||
});
|
||||
return await modal.present();
|
||||
await modal.present();
|
||||
|
||||
}
|
||||
|
||||
async dynamicSearch() {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -73,6 +72,7 @@ class SessionService {
|
||||
return false
|
||||
}
|
||||
return this._user.PIN.length >= 2
|
||||
|
||||
}
|
||||
|
||||
reset(user) {
|
||||
|
||||
@@ -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