mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
pull made
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlertController, AnimationController } from '@ionic/angular';
|
||||
import { ChatService } from './chat.service';
|
||||
import { ToastService } from './toast.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -9,6 +11,8 @@ export class AlertService {
|
||||
constructor(
|
||||
public alertController: AlertController,
|
||||
private animationController: AnimationController,
|
||||
private chatService: ChatService,
|
||||
private toastService: ToastService,
|
||||
) { }
|
||||
|
||||
async presentAlert(message:string) {
|
||||
@@ -30,10 +34,37 @@ export class AlertService {
|
||||
});
|
||||
|
||||
await alert.present();
|
||||
|
||||
|
||||
setTimeout(()=>{
|
||||
alert.dismiss();
|
||||
}, 2500);
|
||||
}
|
||||
|
||||
async confirmDeleteMessage(body:any) {
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Apagar a mensagem?',
|
||||
buttons: [
|
||||
{
|
||||
text: 'Cancelar',
|
||||
role: 'cancel',
|
||||
cssClass: 'secondary',
|
||||
handler: () => {
|
||||
//console.log('Confirm Cancel');
|
||||
}
|
||||
}, {
|
||||
text: 'Apagar',
|
||||
handler: () => {
|
||||
const loader = this.toastService.loading();
|
||||
this.chatService.deleteMessage(body).subscribe(res=>{
|
||||
loader.remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
await alert.present();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -52,6 +52,7 @@ export class ChatService {
|
||||
getAllChannels(){
|
||||
return this.http.get(environment.apiChatUrl+'channels.list', this.options);
|
||||
}
|
||||
|
||||
getAllUserChannels(){
|
||||
return this.http.get(environment.apiChatUrl+'channels.list.joined', this.options);
|
||||
}
|
||||
@@ -59,6 +60,7 @@ export class ChatService {
|
||||
getAllRooms(){
|
||||
return this.http.get(environment.apiChatUrl+'rooms.get', this.options);
|
||||
}
|
||||
|
||||
getRoomInfo(roomId:any){
|
||||
let params = new HttpParams();
|
||||
params = params.set("roomId", roomId);
|
||||
@@ -110,6 +112,14 @@ export class ChatService {
|
||||
}
|
||||
return this.http.post(environment.apiChatUrl+'chat.sendMessage', body, opts);
|
||||
}
|
||||
|
||||
deleteMessage(body:any){
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
}
|
||||
return this.http.post(environment.apiChatUrl+'chat.delete', body, opts);
|
||||
}
|
||||
|
||||
leaveRoom(body:any){
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ClearStoreService } from './clear-store.service';
|
||||
|
||||
describe('ClearStoreService', () => {
|
||||
let service: ClearStoreService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ClearStoreService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,40 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { DespachoStore } from 'src/app/store/despacho-store.service';
|
||||
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
|
||||
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
|
||||
import { PendentesStore } from 'src/app/store/pendestes-store.service';
|
||||
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'
|
||||
})
|
||||
export class ClearStoreService {
|
||||
|
||||
constructor() { }
|
||||
|
||||
clear() {
|
||||
|
||||
DespachoStore.reset([])
|
||||
EventoAprovacaoStore.resetmd([])
|
||||
EventoAprovacaoStore.resetpr([])
|
||||
ExpedienteGdStore.reset([])
|
||||
PendentesStore.reset([])
|
||||
PedidosStore.resetdeferimento([])
|
||||
PedidosStore.resetparecer([])
|
||||
DespachosprStore.reset([])
|
||||
DeplomasStore.resetDiplomasAssinadoList([])
|
||||
DeplomasStore.resetDiplomasList([])
|
||||
DeplomasStore.resetDiplomasReview([])
|
||||
CalendarStore.delete()
|
||||
CalendarStore.ResetList([])
|
||||
ToDayEventStorage.reset([])
|
||||
TotalDocumentStore.resetCount(0)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,9 @@ import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { AuthService } from '../services/auth.service';
|
||||
import { LoginUserRespose, UserSession } from '../models/user.model';
|
||||
import { UserSession } from '../models/user.model';
|
||||
import { EventList } from '../models/agenda/AgendaEventList';
|
||||
import { ChangeProfileService } from './change-profile.service';
|
||||
|
||||
|
||||
@Injectable({
|
||||
@@ -25,10 +26,14 @@ export class EventsService {
|
||||
|
||||
headersSharedOficial: HttpHeaders;
|
||||
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 +44,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 +105,6 @@ export class EventsService {
|
||||
this.headers = new HttpHeaders();
|
||||
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* getAllEvents(startdate:string, enddate:string): Observable<Event[]>{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -307,4 +325,19 @@ export class ProcessesService {
|
||||
return this.http.post<any>(`${url}`,body, options);
|
||||
}
|
||||
|
||||
getFileBase64(DocId: string | number) {
|
||||
let url = environment.apiURL + 'ecm/document/file';
|
||||
|
||||
let params = new HttpParams();
|
||||
|
||||
params = params.set("docid", DocId);
|
||||
|
||||
let options: any = {
|
||||
headers: this.headers,
|
||||
params
|
||||
}
|
||||
|
||||
return this.http.get<any>(`${url}`, options);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,9 @@ class SynchroService {
|
||||
}[] = []
|
||||
private msgQueue = []
|
||||
|
||||
constructor(){}
|
||||
constructor() {
|
||||
// alert(SessionStore.user.FullName)
|
||||
}
|
||||
|
||||
get connected() {
|
||||
return this._connected
|
||||
|
||||
Reference in New Issue
Block a user