This commit is contained in:
Eudes Inácio
2021-07-30 08:32:58 +01:00
18 changed files with 202 additions and 40 deletions
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { PermissionService } from './permission.service';
describe('PermissionService', () => {
let service: PermissionService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(PermissionService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,46 @@
import { Injectable } from '@angular/core';
import { UserStore } from 'src/app/store/user.service'
@Injectable({
providedIn: 'root'
})
export class PermissionService {
userStore = UserStore
constructor() { }
userRole(args) {
let data: string[] = []
if(!Array.isArray(args) && typeof(args) == 'string') {
data = [args]
} else {
data = args
}
return data.includes(this.userStore.user.Profile)
}
role(args: any) {
let UserRoleIsValid = this.userRole(args)
return {
permissionAnyOf(role) {
if(!Array.isArray(args) && typeof(args) == 'string') {
role = [args]
}
if(!UserRoleIsValid) {return false }
return true
}
}
}
}
@@ -332,7 +332,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
async getDoc() { async getDoc() {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: SearchPage, component: SearchPage,
cssClass: 'modal modal-desktop modal-width-100-width-background', cssClass: 'modal modal-desktop modal-width-100-width-background modal-background',
componentProps: { componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect', type: 'AccoesPresidenciais & ArquivoDespachoElect',
showSearchInput: true, showSearchInput: true,
@@ -90,7 +90,7 @@
<p class="text-center exp-card-content">{{ despachoprstore.count }} <span class="title1">Documentos</span> </p> <p class="text-center exp-card-content">{{ despachoprstore.count }} <span class="title1">Documentos</span> </p>
</div> </div>
<div *ngIf="loggeduser.Profile == 'MDGPR'" (click)="openExpedientesPrPage(); selectedElement='ExpedientesPr'" [class.active]="selectedElement == 'ExpedientesPr'" class="exp-card-long justify-center width-100 white-background"> <div *ngIf="p.userRole(['MDGPR'])" (click)="openExpedientesPrPage(); selectedElement='ExpedientesPr'" [class.active]="selectedElement == 'ExpedientesPr'" class="exp-card-long justify-center width-100 white-background">
<div class="center-div"> <div class="center-div">
<div class="exp-card-icon"> <div class="exp-card-icon">
<ion-icon src="assets/images/icons-expediente-presidente.svg"></ion-icon> <ion-icon src="assets/images/icons-expediente-presidente.svg"></ion-icon>
@@ -20,6 +20,7 @@ import { PendentesStore } from 'src/app/store/pendestes-store.service';
import { PedidosStore } from 'src/app/store/pedidos-store.service'; import { PedidosStore } from 'src/app/store/pedidos-store.service';
import { ExpedienteprStore } from 'src/app/store/expedientepr-store.service'; import { ExpedienteprStore } from 'src/app/store/expedientepr-store.service';
import { DespachosprStore } from 'src/app/store/despachospr-store.service'; import { DespachosprStore } from 'src/app/store/despachospr-store.service';
import { PermissionService } from 'src/app/OtherService/permission.service';
@Component({ @Component({
selector: 'app-gabinete-digital', selector: 'app-gabinete-digital',
templateUrl: './gabinete-digital.page.html', templateUrl: './gabinete-digital.page.html',
@@ -99,7 +100,8 @@ export class GabineteDigitalPage implements OnInit {
private alertService: AlertService, private alertService: AlertService,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private router: Router, private router: Router,
authService: AuthService authService: AuthService,
public p: PermissionService
) { ) {
this.loggeduser = authService.ValidatedUser; this.loggeduser = authService.ValidatedUser;
@@ -123,6 +125,7 @@ export class GabineteDigitalPage implements OnInit {
ngOnInit() { ngOnInit() {
const pathname = window.location.pathname const pathname = window.location.pathname
this.LoadCounts(); this.LoadCounts();
@@ -3,10 +3,12 @@
</ion-header> </ion-header>
<ion-content> <ion-content>
<div class="d-md-none" *ngIf="hideRefreshBtn">
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)"> <ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-refresher-content> <ion-refresher-content>
</ion-refresher-content> </ion-refresher-content>
</ion-refresher> </ion-refresher>
</div>
<!-- Main container --> <!-- Main container -->
<div class="main-content d-flex height-100 background-white overflow-hidden border-t-radius "> <div class="main-content d-flex height-100 background-white overflow-hidden border-t-radius ">
@@ -26,7 +28,7 @@
<button class="btn-no-color" (click)="AddPublicationFolder()"> <button class="btn-no-color" (click)="AddPublicationFolder()">
<ion-icon slot="icon-only" src='assets/images/icons-add.svg'></ion-icon> <ion-icon slot="icon-only" src='assets/images/icons-add.svg'></ion-icon>
</button> </button>
<button *ngIf="hideRefreshBtn" class="btn-no-color" (click)="doRefresh($event)"> <button *ngIf="hideRefreshBtn" class="btn-no-color" (click)="refreshing()">
<ion-icon slot="icon-only" class="title-icon" name="reload-circle" title="Actualizar"></ion-icon> <ion-icon slot="icon-only" class="title-icon" name="reload-circle" title="Actualizar"></ion-icon>
</button> </button>
</div> </div>
@@ -108,7 +108,6 @@ export class PublicationsPage implements OnInit {
doRefresh(event) { doRefresh(event) {
this.getActions(); this.getActions();
setTimeout(() => { setTimeout(() => {
event.target.complete(); event.target.complete();
}, 250); }, 250);
+6 -1
View File
@@ -10,6 +10,7 @@ import { AuthConnstants } from '../config/auth-constants';
import { AlertController } from '@ionic/angular'; import { AlertController } from '@ionic/angular';
import { LocalstoreService } from '../store/localstore.service'; import { LocalstoreService } from '../store/localstore.service';
import { ToastService } from './toast.service'; import { ToastService } from './toast.service';
import { UserStore } from 'src/app/store/user.service'
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@@ -18,9 +19,10 @@ export class AuthService {
userData$ = new BehaviorSubject<any>(''); userData$ = new BehaviorSubject<any>('');
userId$ = new BehaviorSubject<any>(''); userId$ = new BehaviorSubject<any>('');
headers: HttpHeaders; headers: HttpHeaders;
public ValidatedUser:User; public ValidatedUser: User;
public ValidatedUserChat:any; public ValidatedUserChat:any;
opts:any; opts:any;
userStore = UserStore
constructor( constructor(
private http: HttpClient, private http: HttpClient,
@@ -74,7 +76,10 @@ export class AuthService {
response.BasicAuthKey = user.BasicAuthKey response.BasicAuthKey = user.BasicAuthKey
this.ValidatedUser = response; this.ValidatedUser = response;
console.log('response', response)
this.localstoreService.set('user', response) this.localstoreService.set('user', response)
this.userStore.reset(response)
this.storageService.store(AuthConnstants.USER, response); this.storageService.store(AuthConnstants.USER, response);
@@ -427,6 +427,7 @@ export class EditEventPage implements OnInit {
async getDoc() { async getDoc() {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: SearchPage, component: SearchPage,
cssClass: 'modal-width-100-width-background modal', cssClass: 'modal-width-100-width-background modal',
@@ -94,6 +94,7 @@ export class ViewEventPage implements OnInit {
loadEvent() { loadEvent() {
this.eventsService.getEvent(this.eventId).subscribe(res => { this.eventsService.getEvent(this.eventId).subscribe(res => {
console.log(res);
this.loadedEvent = res; this.loadedEvent = res;
this.today = new Date(res.StartDate); this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
@@ -109,7 +109,7 @@
</ion-list> </ion-list>
</div> </div>
<div *ngSwitchCase="'parecer'" class="d-flex height-100 align-center justify-content-center" > <div *ngSwitchCase="'parecer'" class="d-flex align-center justify-content-center" >
<div <div
*ngIf="!skeletonLoader && pedidosstore.listparecer.length == 0" *ngIf="!skeletonLoader && pedidosstore.listparecer.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center" class="empty-list d-flex height-100 align-center justify-content-center"
@@ -118,7 +118,7 @@
</div> </div>
</div> </div>
<div *ngSwitchCase="'deferimento'" class="d-flex height-100 align-center justify-content-center"> <div *ngSwitchCase="'deferimento'" class="d-flex align-center justify-content-center">
<div <div
*ngIf="!skeletonLoader && pedidosstore.listdeferimento.length == 0" *ngIf="!skeletonLoader && pedidosstore.listdeferimento.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center" class="empty-list d-flex height-100 align-center justify-content-center"
@@ -111,7 +111,7 @@ export class PedidosPage implements OnInit {
let task = { let task = {
"SerialNumber": element.serialNumber, "SerialNumber": element.serialNumber,
"Folio": element.workflowInstanceDataFields.Subject, "Folio": element.workflowInstanceDataFields.Subject,
"Senders": element.originator.email, "Senders": element.workflowInstanceDataFields.Sender,
"CreateDate": taskDate, "CreateDate": taskDate,
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
+3 -7
View File
@@ -10,13 +10,9 @@
<div class="div-logo height-fit-content"> <div class="div-logo height-fit-content">
<img src='assets/images/logo-no-bg.png' alt='logo'> <img src='assets/images/logo-no-bg.png' alt='logo'>
</div> </div>
<div class="div-profile"> <div class="div-profile" (click)="openProfile()">
<button class="btn-no-color" (click)="openProfile()"> <ion-icon class="icon" src='assets/images/icons-profile.svg'></ion-icon>
<ion-icon class="font-45" *ngIf="loggeduser.Profile == 'MDGPR'" src='assets/images/icons-profile.svg'></ion-icon> <ion-label class="profile-text">{{loggeduser.Profile}}</ion-label>
</button>
<button class="btn-no-color" (click)="openProfile()">
<ion-icon class="font-45" *ngIf="loggeduser.Profile == 'PR' " src='assets/images/icons-profile-pr-header.svg'></ion-icon>
</button>
</div> </div>
</div> </div>
@@ -9,9 +9,9 @@
<img src='assets/images/logo-no-bg.png' alt='logo'> <img src='assets/images/logo-no-bg.png' alt='logo'>
</div> </div>
<div class="div-profile" (click)="openProfile()"> <div class="div-profile cursor-pointer" (click)="openProfile()">
<ion-icon class="font-45" *ngIf="loggeduser.Profile == 'MDGPR'" src='assets/images/icons-profile.svg'></ion-icon> <ion-icon class="icon" src='assets/images/icons-profile.svg'></ion-icon>
<ion-icon class="font-45" *ngIf="loggeduser.Profile == 'PR' " src='assets/images/icons-profile-pr-header.svg'></ion-icon> <ion-label class="profile-text">{{loggeduser.Profile}}</ion-label>
</div> </div>
</div> </div>
+17 -1
View File
@@ -6,7 +6,7 @@ import { AES, enc, SHA1 } from 'crypto-js'
}) })
export class LocalstoreService { export class LocalstoreService {
private prefix = 'v12-' private prefix = 'v13-'
constructor() { constructor() {
@@ -58,3 +58,19 @@ export class LocalstoreService {
} }
export const localstoreService = new LocalstoreService() export const localstoreService = new LocalstoreService()
// Create WebSocket connection.
const socket = new WebSocket('ws://localhost:8080');
// Listen for messages
socket.addEventListener('message', function (event) {
console.log('Message from server ', event.data); // Message from server mobile first é fraco
var p = Promise.resolve(event.data);
p.then(function(v) {
console.log(v); // mobile first é fraco
});
});
+16
View File
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { UserService } from './user.service';
describe('UserService', () => {
let service: UserService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(UserService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+56
View File
@@ -0,0 +1,56 @@
import { Injectable } from '@angular/core';
import { localstoreService } from './localstore.service'
import { SHA1 } from 'crypto-js'
import { User } from '../models/user.model';
@Injectable({
providedIn: 'root'
})
export class UserService {
// main data
private _user: User = {
Authorization: "",
BasicAuthKey: "",
Email: "",
FullName: "",
Profile: "",
RoleDescription: "",
RoleID: 0,
SharedCalendars: [],
OwnerCalendars: [],
UserId: 0,
UserName: "",
}
// local storage keyName
private keyName: string;
constructor() {
this.keyName = (SHA1(this.constructor.name)).toString()
let restore = localstoreService.get(this.keyName, {})
this._user = restore.user || new User()
}
get user(): User {
return this._user || new User()
}
reset(user) {
this._user = user
this.save(this._user)
}
private save(user) {
setTimeout(()=>{
localstoreService.set(this.keyName,{
user,
})
}, 10)
}
}
export const UserStore = new UserService()
+6 -1
View File
@@ -1071,7 +1071,7 @@ ngx-mat-datetime-content{
} }
@media only screen and (max-width: 1024px) { @media only screen and (max-width: 767px) {
.calendar-segment-mdgpr:not(.calendar-segment-pr-force) { .calendar-segment-mdgpr:not(.calendar-segment-pr-force) {
.calendar-pr-event-type-Oficial { .calendar-pr-event-type-Oficial {
border-right: 3px solid transparent !important; border-right: 3px solid transparent !important;
@@ -1090,3 +1090,8 @@ ngx-mat-datetime-content{
} }
} }
} }
.modal-background {
background: #0000006b;
}