This commit is contained in:
Peter Maquiran
2021-09-28 11:31:10 +01:00
parent 9e21bdb452
commit c2243c8029
13 changed files with 171 additions and 21 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
<name>gabinete digital</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
<content original-src="index.html" src="http://localhost:8101" />
<content original-src="index.html" src="http://localhost:8100" />
<access origin="*" />
<allow-navigation href="*" />
<allow-navigation href="*" />
+3
View File
@@ -20,6 +20,9 @@
<div>
<!-- Calendar is here -->
{{ loggeduser.Profile }} {{ profile }}
<div class="calendar-segment-{{profile}}" [class.calendar-segment-pr-force]="loggeduser.Profile =='PR'">
<div class="calendar-container" [style.height]="calendarHeight">
+29 -10
View File
@@ -27,6 +27,7 @@ import { ToastService } from 'src/app/services/toast.service';
import { eventSource } from 'src/app/models/agenda/eventSource';
import { CalendarStore } from 'src/app/store/calendar.service';
import { ListBoxService } from 'src/app/services/agenda/list-box.service';
import { ChangeProfileService } from 'src/app/services/change-profile.service';
@Component({
selector: 'app-agenda',
@@ -166,13 +167,32 @@ export class AgendaPage implements OnInit {
authService: AuthService,
private dateAdapter: DateAdapter<any>,
private toastService: ToastService,
private listBoxService: ListBoxService
private listBoxService: ListBoxService,
private changeProfileService: ChangeProfileService
) {
this.dateAdapter.setLocale('es');
this.dateAdapter.setLocale('es');
this.locale = 'pt'
this.loggeduser = authService.ValidatedUser;
this.changeProfileService.registerCallback(()=>{
this.loggeduser = authService.ValidatedUser;
this.tigerUpdate()
if(this.loggeduser.Profile == 'MDGPR') {
this.mobileComponent.showEventList = true;
this.profile = "mdgpr";
} else {
this.profile = "pr";
}
})
if(this.loggeduser.Profile == 'MDGPR') {
this.mobileComponent.showEventList = true;
this.profile = "mdgpr";
} else {
this.profile = "pr";
}
this.calendarHeight = "320px";
this.showCalendar = true;
@@ -182,10 +202,14 @@ export class AgendaPage implements OnInit {
this.showTimelineFilterState = false;
this.showTimeline = false;
if(this.loggeduser.Profile == 'MDGPR') {
this.mobileComponent.showEventList = true;
}
this.tigerUpdate()
window['year'] = this.changeYear
}
tigerUpdate() {
setTimeout(()=>{
try {
this.myCal.update();
@@ -195,15 +219,10 @@ export class AgendaPage implements OnInit {
this.updateEventListBox()
}, 1000)
window['year'] = this.changeYear
}
ngOnInit() {
this.profile = "mdgpr";
const pathname = window.location.pathname
@@ -89,6 +89,7 @@
<!-- This is the box view -->
<div *ngSwitchCase="'boxview'" class="aside overflow-y-auto d-flex flex-wrap width-100 height-100">
<div *ngIf="hideInMobile" (click)="openAllProcessesPage()" [class.active]="selectedElement == 'allProcessesTag'" class="box-hover exp-card d-flex flex-column" >
<div class="d-flex justify-center">
<!-- <ion-icon src="assets/images/icons-agenda.svg"></ion-icon> -->
@@ -21,6 +21,7 @@ import { DeplomasStore } from 'src/app/store/deplomas.service';
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
import { NotificationsService } from 'src/app/services/notifications.service';
import { DespachoService } from 'src/app/Rules/despacho.service';
import { ChangeProfileService } from 'src/app/services/change-profile.service';
@Component({
selector: 'app-gabinete-digital',
@@ -118,10 +119,17 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
public p: PermissionService,
public waitForDomService: WaitForDomService,
private notificationsService: NotificationsService,
private despachoRule: DespachoService
private despachoRule: DespachoService,
private changeProfileService: ChangeProfileService
) {
this.loggeduser = authService.ValidatedUser;
this.changeProfileService.registerCallback(()=>{
this.loggeduser = authService.ValidatedUser;
})
window.onresize = (event) => {
// if not mobile remove all component
if( window.innerWidth < 701){
@@ -202,7 +210,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
allProcessesList = allProcessesList.filter( element => element.activityInstanceName != 'Diploma Assinado')
}
console.log(allProcessesList);
console.log('allProcessesList', allProcessesList);
this.skeletonLoader = true;
+6 -1
View File
@@ -8,6 +8,7 @@ import { AlertController } from '@ionic/angular';
import { NotificationsService } from 'src/app/services/notifications.service';
import { SessionStore } from 'src/app/store/session.service';
import { ClearStoreService } from 'src/app/services/clear-store.service';
import { ChangeProfileService } from 'src/app/services/change-profile.service';
@Component({
selector: 'app-login',
@@ -33,7 +34,8 @@ export class LoginPage implements OnInit {
private authService: AuthService,
private toastService: ToastService,
public alertController: AlertController,
private clearStoreService: ClearStoreService
private clearStoreService: ClearStoreService,
private changeProfileService: ChangeProfileService
) {
}
@@ -99,7 +101,10 @@ export class LoginPage implements OnInit {
this.clearStoreService.clear()
SessionStore.delete()
window.localStorage.clear();
await this.authService.SetSession(attempt, this.userattempt);
this.changeProfileService.run()
await this.authService.loginChat(this.userattempt);
this.router.navigate(['/pin']);
}
+1 -1
View File
@@ -44,7 +44,7 @@ export class AuthService {
async login(user: UserForm, {saveSession = true}): Promise<LoginUserRespose> {
user.BasicAuthKey = 'Basic ' + btoa(user.username + ':' + this.aesencrypt.encrypt(user.password,user.username ));
this.headers = this.headers.set('Authorization',user.BasicAuthKey);
this.headers = this.headers.set('Authorization', user.BasicAuthKey);
this.opts = {
headers: this.headers,
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ChangeProfileService } from './change-profile.service';
describe('ChangeProfileService', () => {
let service: ChangeProfileService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ChangeProfileService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,42 @@
import { Injectable } from '@angular/core';
import { v4 as uuidv4 } from 'uuid'
@Injectable({
providedIn: 'root'
})
export class ChangeProfileService {
callbacks: {
funx: Function
id: string
}[] = []
constructor() { }
registerCallback(funx: Function, object: any = {} ) {
const id = uuidv4()
this.callbacks.push({funx, id})
return id;
}
deleteCallback(id) {
this.callbacks.forEach((e, index)=> {
if(e.id == id) {
if (index > -1) {
this.callbacks.splice(index, 1)
}
}
})
}
run() {
this.callbacks.forEach((e, index)=> {
e.funx()
})
}
}
+7
View File
@@ -8,6 +8,8 @@ import { PedidosStore } from 'src/app/store/pedidos-store.service';
import { DespachosprStore } from 'src/app/store/despachospr-store.service';
import { DeplomasStore } from '../store/deplomas.service';
import { CalendarStore } from 'src/app/store/calendar.service';
import { ToDayEventStorage } from '../store/to-day-event-storage.service';
import { TotalDocumentStore } from 'src/app/store/total-document.service';
@Injectable({
providedIn: 'root'
@@ -17,6 +19,7 @@ export class ClearStoreService {
constructor() { }
clear() {
DespachoStore.reset([])
EventoAprovacaoStore.resetmd([])
EventoAprovacaoStore.resetpr([])
@@ -29,5 +32,9 @@ export class ClearStoreService {
DeplomasStore.resetDiplomasList([])
DeplomasStore.resetDiplomasReview([])
CalendarStore.delete()
CalendarStore.ResetList([])
ToDayEventStorage.reset([])
TotalDocumentStore.resetCount(0)
}
}
+19 -4
View File
@@ -6,6 +6,7 @@ import { environment } from 'src/environments/environment';
import { AuthService } from '../services/auth.service';
import { LoginUserRespose, UserSession } from '../models/user.model';
import { EventList } from '../models/agenda/AgendaEventList';
import { ChangeProfileService } from './change-profile.service';
@Injectable({
@@ -27,8 +28,13 @@ export class EventsService {
headersSharedPessoal: HttpHeaders;
//lastloadedevent: Event;
constructor(private http: HttpClient, user: AuthService) {
this.loggeduser = user.ValidatedUser;
constructor(
private http: HttpClient,
public user: AuthService,
private changeProfileService: ChangeProfileService)
{
this.loggeduser = this.user.ValidatedUser;
this.headersMdOficial = new HttpHeaders();
this.headersMdPessoal = new HttpHeaders();
@@ -39,6 +45,17 @@ export class EventsService {
this.headersSharedOficial = new HttpHeaders();
this.headersSharedPessoal = new HttpHeaders();
this.setHeader()
this.changeProfileService.registerCallback(()=>{
this.loggeduser = this.user.ValidatedUser;
this.setHeader()
})
}
setHeader() {
if(this.loggeduser){
if(this.loggeduser.Profile == 'MDGPR') {
@@ -89,8 +106,6 @@ export class EventsService {
this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
}
}
/* getAllEvents(startdate:string, enddate:string): Observable<Event[]>{
+20 -2
View File
@@ -9,6 +9,7 @@ import { Excludetask } from '../models/Excludetask';
import { ExpedienteFullTask } from '../models/Expediente';
import { GetTasksListType } from '../models/GetTasksListType';
import { fullTaskList } from '../models/dailyworktask.model';
import { ChangeProfileService } from './change-profile.service';
@Injectable({
providedIn: 'root'
@@ -19,8 +20,25 @@ export class ProcessesService {
loggeduser: LoginUserRespose;
headers: HttpHeaders;
constructor(private http: HttpClient, user: AuthService) {
this.loggeduser = user.ValidatedUser;
constructor(
private http: HttpClient,
public user: AuthService,
private changeProfileService: ChangeProfileService
) {
this.loggeduser = this.user.ValidatedUser;
this.setHeader()
this.changeProfileService.registerCallback(()=>{
this.loggeduser = this.user.ValidatedUser;
this.setHeader()
})
}
setHeader() {
this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
}
+16
View File
@@ -1192,6 +1192,22 @@ ngx-mat-datetime-content{
}
}
.calendar-segment-pr-force {
.calendar-mdgpr-event-type-Pessoal {
border-top: 3px solid transparent !important;
}
.calendar-mdgpr-event-type-Oficial {
border-left: 3px solid transparent !important;
}
.calendar-pr-event-type-Oficial{
border-right: 3px solid #99e47b !important;
}
.calendar-pr-event-type-Pessoal{
border-bottom: 3px solid #958bfc !important;
}
}
.modal-background {
background: #0000006b;