mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Merge branch 'developer' of https://bitbucket.org/equilibriumito/gabinete-digital into developer
This commit is contained in:
@@ -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() {
|
||||
const modal = await this.modalController.create({
|
||||
component: SearchPage,
|
||||
cssClass: 'modal modal-desktop modal-width-100-width-background',
|
||||
cssClass: 'modal modal-desktop modal-width-100-width-background modal-background',
|
||||
componentProps: {
|
||||
type: 'AccoesPresidenciais & ArquivoDespachoElect',
|
||||
showSearchInput: true,
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
<p class="text-center exp-card-content">{{ despachoprstore.count }} <span class="title1">Documentos</span> </p>
|
||||
</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="exp-card-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 { ExpedienteprStore } from 'src/app/store/expedientepr-store.service';
|
||||
import { DespachosprStore } from 'src/app/store/despachospr-store.service';
|
||||
import { PermissionService } from 'src/app/OtherService/permission.service';
|
||||
@Component({
|
||||
selector: 'app-gabinete-digital',
|
||||
templateUrl: './gabinete-digital.page.html',
|
||||
@@ -99,9 +100,10 @@ export class GabineteDigitalPage implements OnInit {
|
||||
private alertService: AlertService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
authService: AuthService
|
||||
authService: AuthService,
|
||||
public p: PermissionService
|
||||
) {
|
||||
|
||||
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
|
||||
window.onresize = (event) => {
|
||||
@@ -123,6 +125,7 @@ export class GabineteDigitalPage implements OnInit {
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
const pathname = window.location.pathname
|
||||
this.LoadCounts();
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
|
||||
<ion-refresher-content>
|
||||
</ion-refresher-content>
|
||||
</ion-refresher>
|
||||
<div class="d-md-none" *ngIf="hideRefreshBtn">
|
||||
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
|
||||
<ion-refresher-content>
|
||||
</ion-refresher-content>
|
||||
</ion-refresher>
|
||||
</div>
|
||||
|
||||
<!-- Main container -->
|
||||
<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()">
|
||||
<ion-icon slot="icon-only" src='assets/images/icons-add.svg'></ion-icon>
|
||||
</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>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -108,7 +108,6 @@ export class PublicationsPage implements OnInit {
|
||||
|
||||
doRefresh(event) {
|
||||
this.getActions();
|
||||
|
||||
setTimeout(() => {
|
||||
event.target.complete();
|
||||
}, 250);
|
||||
|
||||
@@ -10,6 +10,7 @@ import { AuthConnstants } from '../config/auth-constants';
|
||||
import { AlertController } from '@ionic/angular';
|
||||
import { LocalstoreService } from '../store/localstore.service';
|
||||
import { ToastService } from './toast.service';
|
||||
import { UserStore } from 'src/app/store/user.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -18,9 +19,10 @@ export class AuthService {
|
||||
userData$ = new BehaviorSubject<any>('');
|
||||
userId$ = new BehaviorSubject<any>('');
|
||||
headers: HttpHeaders;
|
||||
public ValidatedUser:User;
|
||||
public ValidatedUser: User;
|
||||
public ValidatedUserChat:any;
|
||||
opts:any;
|
||||
userStore = UserStore
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
@@ -74,7 +76,10 @@ export class AuthService {
|
||||
response.BasicAuthKey = user.BasicAuthKey
|
||||
this.ValidatedUser = response;
|
||||
|
||||
console.log('response', response)
|
||||
|
||||
this.localstoreService.set('user', response)
|
||||
this.userStore.reset(response)
|
||||
|
||||
this.storageService.store(AuthConnstants.USER, response);
|
||||
|
||||
|
||||
@@ -427,6 +427,7 @@ export class EditEventPage implements OnInit {
|
||||
|
||||
|
||||
async getDoc() {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: SearchPage,
|
||||
cssClass: 'modal-width-100-width-background modal',
|
||||
|
||||
@@ -94,6 +94,7 @@ export class ViewEventPage implements OnInit {
|
||||
|
||||
loadEvent() {
|
||||
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
||||
console.log(res);
|
||||
this.loadedEvent = res;
|
||||
this.today = new Date(res.StartDate);
|
||||
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
|
||||
@@ -110,14 +111,14 @@ export class ViewEventPage implements OnInit {
|
||||
this.toastService.badRequest('não é possível vizualizar este event no modo offline')
|
||||
} else {
|
||||
this.toastService.badRequest('Este evento já não existe na sua agenda')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
;
|
||||
}
|
||||
|
||||
async deleteEvent(){
|
||||
|
||||
|
||||
if (this.loadedEvent.IsRecurring) {
|
||||
|
||||
} else {
|
||||
@@ -130,7 +131,7 @@ export class ViewEventPage implements OnInit {
|
||||
}
|
||||
|
||||
async deleteRecurringEvent() {
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: EliminateEventPage,
|
||||
componentProps: {},
|
||||
|
||||
@@ -27,15 +27,15 @@
|
||||
refreshingText="A actualizar...">
|
||||
</ion-refresher-content>
|
||||
</ion-refresher>
|
||||
|
||||
|
||||
<div class="width-100 overflow-y-auto height-100" [ngSwitch]="segment">
|
||||
<ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar>
|
||||
<div *ngIf="pedidosstore.listparecer.length >= 1">
|
||||
<ion-list *ngSwitchCase="'parecer'">
|
||||
<!-- *ngFor = "let task of pedidosstore.listparecer; let i = index"
|
||||
(click)="viewExpedientDetail(task.SerialNumber)" -->
|
||||
<div
|
||||
class="expediente ion-no-padding ion-no-margin cursor-pointer"
|
||||
<div
|
||||
class="expediente ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor = "let task of pedidosstore.listparecer"
|
||||
(click)="goToPedido(task.SerialNumber)"
|
||||
>
|
||||
@@ -61,7 +61,7 @@
|
||||
<span class="label">{{task.activityInstanceName}}</span>
|
||||
</div>
|
||||
<div class="exp-date">
|
||||
|
||||
|
||||
{{ task.CreateDate }}
|
||||
|
||||
<ion-label>{{ task.CreateDate | date: 'dd-MM-yy' }}</ion-label>
|
||||
@@ -75,7 +75,7 @@
|
||||
<div *ngIf="pedidosstore.listdeferimento.length >= 1">
|
||||
<ion-list *ngSwitchCase="'deferimento'">
|
||||
<div
|
||||
class="expediente ion-no-padding ion-no-margin cursor-pointer"
|
||||
class="expediente ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor = "let task of pedidosstore.listdeferimento"
|
||||
(click)="goToPedido(task.SerialNumber)"
|
||||
>
|
||||
@@ -109,18 +109,18 @@
|
||||
</ion-list>
|
||||
</div>
|
||||
|
||||
<div *ngSwitchCase="'parecer'" class="d-flex height-100 align-center justify-content-center" >
|
||||
<div
|
||||
*ngIf="!skeletonLoader && pedidosstore.listparecer.length == 0"
|
||||
<div *ngSwitchCase="'parecer'" class="d-flex align-center justify-content-center" >
|
||||
<div
|
||||
*ngIf="!skeletonLoader && pedidosstore.listparecer.length == 0"
|
||||
class="empty-list d-flex height-100 align-center justify-content-center"
|
||||
>
|
||||
<span>Lista vazia</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngSwitchCase="'deferimento'" class="d-flex height-100 align-center justify-content-center">
|
||||
<div
|
||||
*ngIf="!skeletonLoader && pedidosstore.listdeferimento.length == 0"
|
||||
<div *ngSwitchCase="'deferimento'" class="d-flex align-center justify-content-center">
|
||||
<div
|
||||
*ngIf="!skeletonLoader && pedidosstore.listdeferimento.length == 0"
|
||||
class="empty-list d-flex height-100 align-center justify-content-center"
|
||||
>
|
||||
<span>Lista vazia</span>
|
||||
@@ -128,7 +128,7 @@
|
||||
</div>
|
||||
|
||||
<div *ngIf="skeletonLoader && pedidosstore.listparecer.length == 0 && skeletonLoader && pedidosstore.listdeferimento.length == 0 ">
|
||||
|
||||
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
<ion-thumbnail slot="end">
|
||||
|
||||
@@ -111,7 +111,7 @@ export class PedidosPage implements OnInit {
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": element.workflowInstanceDataFields.Subject,
|
||||
"Senders": element.originator.email,
|
||||
"Senders": element.workflowInstanceDataFields.Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": element.workflowInstanceDataFields.Remetente,
|
||||
|
||||
@@ -10,13 +10,9 @@
|
||||
<div class="div-logo height-fit-content">
|
||||
<img src='assets/images/logo-no-bg.png' alt='logo'>
|
||||
</div>
|
||||
<div class="div-profile">
|
||||
<button class="btn-no-color" (click)="openProfile()">
|
||||
<ion-icon class="font-45" *ngIf="loggeduser.Profile == 'MDGPR'" src='assets/images/icons-profile.svg'></ion-icon>
|
||||
</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 class="div-profile" (click)="openProfile()">
|
||||
<ion-icon class="icon" src='assets/images/icons-profile.svg'></ion-icon>
|
||||
<ion-label class="profile-text">{{loggeduser.Profile}}</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
<img src='assets/images/logo-no-bg.png' alt='logo'>
|
||||
</div>
|
||||
|
||||
<div class="div-profile" (click)="openProfile()">
|
||||
<ion-icon class="font-45" *ngIf="loggeduser.Profile == 'MDGPR'" 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>
|
||||
<div class="div-profile cursor-pointer" (click)="openProfile()">
|
||||
<ion-icon class="icon" src='assets/images/icons-profile.svg'></ion-icon>
|
||||
<ion-label class="profile-text">{{loggeduser.Profile}}</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { AES, enc, SHA1 } from 'crypto-js'
|
||||
})
|
||||
export class LocalstoreService {
|
||||
|
||||
private prefix = 'v12-'
|
||||
private prefix = 'v13-'
|
||||
|
||||
constructor() {
|
||||
|
||||
@@ -58,3 +58,19 @@ export class 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
|
||||
});
|
||||
|
||||
});
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
@@ -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
@@ -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-pr-event-type-Oficial {
|
||||
border-right: 3px solid transparent !important;
|
||||
@@ -1090,3 +1090,8 @@ ngx-mat-datetime-content{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.modal-background {
|
||||
background: #0000006b;
|
||||
}
|
||||
Reference in New Issue
Block a user