diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts
index 5e74dc460..51d3aafc0 100644
--- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts
+++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts
@@ -705,12 +705,12 @@ export class GabineteDigitalPage implements OnInit {
this.pendentesstore.reset(pendentes);
this.updateAllProcess()
- let depachoAPI: any = await this.processesbackend.GetTasksList("Despacho do Presidente da República", false).toPromise();
+ let depachoAPI = await this.processesbackend.GetTasksList("Despacho do Presidente da República", false).toPromise();
if(SessionStore.user.Profile != 'PR') {
- let depacho = depachoAPI.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
+ let depacho: any = depachoAPI.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
depacho = depacho.filter(data => data.workflowInstanceDataFields.Status == "Active");
depacho = depacho.map((e)=> this.customTaskPipe.transform(e))
@@ -719,7 +719,7 @@ export class GabineteDigitalPage implements OnInit {
this.updateAllProcess()
} else if(SessionStore.user.Profile == 'PR') {
- let depacho = depachoAPI.filter(data => data.activityInstanceName == "Concluir Despacho").filter(data => data.workflowInstanceDataFields.Status == "Active")
+ let depacho: any = depachoAPI.filter(data => data.activityInstanceName == "Concluir Despacho").filter(data => data.workflowInstanceDataFields.Status == "Active")
depacho = depacho.map((e)=> this.customTaskPipe.transform(e))
this.despachoprstore.reset(depacho)
this.updateAllProcess()
@@ -771,12 +771,14 @@ export class GabineteDigitalPage implements OnInit {
}))
- let diplomasAssinar = depachoAPI.filter(data => data.activityInstanceName == "Assinar Diploma");
-
+ let diplomasAssinar: any = depachoAPI.filter(data => data.activityInstanceName == "Assinar Diploma");
+ diplomasAssinar = diplomasAssinar.map((element) => this.expedienteTaskPipe.transform(element))
this.deplomasStore.resetDiplomasParaAssinar(diplomasAssinar)
- let diplomasAssinados = depachoAPI.filter(data => data.activityInstanceName == "Diploma Assinado");
+ let diplomasAssinados: any = depachoAPI.filter(data => data.activityInstanceName == "Diploma Assinado");
+ diplomasAssinados = diplomasAssinados.map((element) => this.expedienteTaskPipe.transform(element))
this.deplomasStore.resetDiplomasAssinadoList(diplomasAssinados)
+
this.updateAllProcess()
this.loadCount = true
@@ -789,7 +791,10 @@ export class GabineteDigitalPage implements OnInit {
if (event) {
setTimeout(() => {
- event?.target?.complete();
+ try {
+ event?.target?.complete();
+ } catch(error) {}
+
}, 2000);
}
else {
diff --git a/src/app/pipes/expediente-task.pipe.ts b/src/app/pipes/expediente-task.pipe.ts
index 39d756770..cd3a82b45 100644
--- a/src/app/pipes/expediente-task.pipe.ts
+++ b/src/app/pipes/expediente-task.pipe.ts
@@ -16,6 +16,7 @@ export class ExpedienteTaskPipe implements PipeTransform {
"SerialNumber": fullTask.serialNumber,
"taskStartDate": fullTask.taskStartDate,
"Subject": fullTask.workflowInstanceDataFields.Subject,
+ "Folio": fullTask.workflowInstanceDataFields.Subject,
"Senders": fullTask.workflowInstanceDataFields.Sender,
"CreateDate": date,
"DocumentsQty": fullTask.totalDocuments,
diff --git a/src/app/services/active-tab.service.spec.ts b/src/app/services/active-tab.service.spec.ts
new file mode 100644
index 000000000..8815e356e
--- /dev/null
+++ b/src/app/services/active-tab.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { ActiveTabService } from './active-tab.service';
+
+describe('ActiveTabService', () => {
+ let service: ActiveTabService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(ActiveTabService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/services/active-tab.service.ts b/src/app/services/active-tab.service.ts
new file mode 100644
index 000000000..bba6b7c8e
--- /dev/null
+++ b/src/app/services/active-tab.service.ts
@@ -0,0 +1,49 @@
+import { Injectable } from '@angular/core';
+import { Router } from '@angular/router';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class ActiveTabService {
+
+ pages = {
+ chat: false,
+ agenda: false,
+ publication: false,
+ home: false,
+ gabinete: false
+ }
+
+ constructor(private router: Router) {
+
+ this.detectActiveTab()
+
+ this.router.events.subscribe((val) => {
+ this.detectActiveTab()
+ });
+ }
+
+
+ detectActiveTab() {
+ this.setFalseToAllPage();
+ const pathName = window.location.pathname
+
+ if(pathName.startsWith('/home/agenda')) {
+ this.pages.agenda = true
+ } else if (pathName.startsWith('/home/events')) {
+ this.pages.home = true
+ } else if (pathName.startsWith('/home/gabinete-digital')) {
+ this.pages.gabinete = true
+ } else if (pathName.startsWith('/home/publications')) {
+ this.pages.publication = true
+ } else if (pathName.startsWith('/home/chat')) {
+ this.pages.chat = true
+ }
+ }
+
+ setFalseToAllPage() {
+ for( const page in this.pages) {
+ this.pages[page] = false
+ }
+ }
+}
diff --git a/src/app/services/chat/chat-system.service.ts b/src/app/services/chat/chat-system.service.ts
index 4e666deaf..f6bc9eab7 100644
--- a/src/app/services/chat/chat-system.service.ts
+++ b/src/app/services/chat/chat-system.service.ts
@@ -95,6 +95,13 @@ export class ChatSystemService {
this.loadChat();
}
+
+ document.addEventListener('resume', function () {
+ if(this._dm?.length == 0 && this._group?.length == 0) {
+ this.getAllRooms();
+ }
+ });
+
}
loadChat() {
diff --git a/src/app/services/chat/message.service.ts b/src/app/services/chat/message.service.ts
index 364e8fdab..d4f93829a 100644
--- a/src/app/services/chat/message.service.ts
+++ b/src/app/services/chat/message.service.ts
@@ -480,7 +480,7 @@ export class MessageService {
return SessionStore.user.ChatData.data.userId == this.u._id
}
- private getChatObj() {
+ getChatObj() {
return {
channels: this.channels,
mentions: this.mentions,
diff --git a/src/app/services/chat/room.service.ts b/src/app/services/chat/room.service.ts
index d603a9858..0ed0aea47 100644
--- a/src/app/services/chat/room.service.ts
+++ b/src/app/services/chat/room.service.ts
@@ -125,7 +125,7 @@ export class RoomService {
this.hasLoadHistory = false
this.subscribeAttempt = false
}
- })
+ });
}
@@ -174,11 +174,7 @@ export class RoomService {
this.calDateDuration();
- (async () => {
- await this.restoreMessageFromDB()
- await this.loadHistory({})
- })()
-
+
if(this.customFields?.countDownDate) {
this.countDownDate(this.customFields.countDownDate);
}
@@ -327,7 +323,7 @@ export class RoomService {
if(!found) {
ChatMessage.origin = 'stream'
- const message = await this.prepareCreate({message: ChatMessage, save: true});
+ const message = await this.prepareCreate({message: ChatMessage, save: false});
this.registerSendMessage(message)
message.from = 'stream'
@@ -348,7 +344,10 @@ export class RoomService {
}
if(this.hasLoadHistory == true) {
+ this.messages.push(message)
await message.addMessageDB()
+ } else {
+ this.messagesBeforeOfflineAPI.push(message)
}
if(this.chatOpen == false) {
@@ -503,7 +502,6 @@ export class RoomService {
if(previousLastMessage) {
this.lastMessage = previousLastMessage;
- // console.log("last message"+ previousLastMessage)
this.calDateDuration(previousLastMessage._updatedAt)
this.sortRoomList()
}
@@ -736,12 +734,11 @@ export class RoomService {
setTimeout(() => {
this.scrollDown()
}, 50)
-
}
}
// runs onces only
-
+ loadHistoryCount = 0
async loadHistory({limit = 1000, forceUpdate = false }) {
if(forceUpdate == false) {
@@ -752,33 +749,37 @@ export class RoomService {
this.hasLoadHistory = true
+ await this.restoreMessageFromDB()
const chatHistory: chatHistory = await this.RochetChatConnectorService.loadHistory(this.id, limit)
if(chatHistory?.result?.messages) {
- const messagesId = this.messages.map((message)=> message._id)
const users = this.getUsersByStatus('online')
for(let message of chatHistory.result.messages.reverse()) {
- if (!messagesId.includes(message._id)) {
- message.origin = 'history'
- message.from = 'History'
- const messagesToSave = await this.prepareMessageCreateIfNotExist({message: message});
- if(messagesToSave != null) {
- messagesToSave.received = users.map((user) => user._id)
- messagesToSave.addMessageDB()
-
- // console.log('add history', message)
- } else {
- // console.log('exit')
- }
- } else {
- // console.log('exit')
+ message.origin = 'history'
+ message.from = 'History'
+ const messagesToSave = await this.prepareMessageCreateIfNotExist({message: message});
+ if(messagesToSave != null) {
+
+ messagesToSave.received = users.map((user) => user._id)
+ messagesToSave.addMessageDB()
}
+
}
+ for( const message of this.messagesBeforeOfflineAPI) {
+ const messagesToSave = await this.prepareMessageCreateIfNotExist({message: message});
+ if(messagesToSave != null) {
+
+ messagesToSave.received = users.map((user) => user._id)
+ messagesToSave.addMessageDB()
+ }
+ }
+ this.messagesBeforeOfflineAPI = []
+
setTimeout(() => {
this.scrollDown()
}, 50)
@@ -824,8 +825,10 @@ export class RoomService {
wewMessage.setData(message)
wewMessage.loadHistory = this.hasLoadHistory
- this.messages.push(wewMessage)
-
+ if(save) {
+ this.messages.push(wewMessage)
+ }
+
return wewMessage
}
@@ -842,17 +845,17 @@ export class RoomService {
private findMessageBy_id (id) {
for( let m of this.messages) {
- if(m._id == id) {
+ if(m?._id == id) {
return true
}
}
-
+
return false
}
private findMessageBy_localReference (localReference) {
for( let m of this.messages) {
- if(m.localReference == localReference) {
+ if(m?.localReference == localReference) {
return true
}
}
@@ -893,7 +896,7 @@ export class RoomService {
async prepareMessageCreateIfNotExist({message}) {
message = this.fix_updatedAt(message)
- let found = await this.findMessageBy_id(message._id) || this.findMessageBy_localReference(message.localReference)
+ let found = await this.findMessageBy_id(message._id) || await this.findMessageBy_localReference(message.localReference)
// || await this.findMessageInDBByData({_id:message._id, localReference:message.localReference })
if (!found) {
diff --git a/src/app/services/events.service.ts b/src/app/services/events.service.ts
index ef0237780..d56956843 100644
--- a/src/app/services/events.service.ts
+++ b/src/app/services/events.service.ts
@@ -259,7 +259,7 @@ export class EventsService {
console.log('ROLE',e.Role, e.FullName)
- if(!this.calendarNamesAry.includes(e.FullName)) {
+ if(!this.calendarNamesAry.find(x => x.Role == e.Role)) {
/* if(e.Role == "Presidente da República") {
this.calendarNamesAry.push(e.Role)
console.log('PR ROLE',this.calendarNamesAry)
@@ -271,13 +271,21 @@ export class EventsService {
console.log('NORMAL ROLE',this.calendarNamesAry)
} */
//this.calendarRole.push(e.Role)
+ let objectShared = {
+ "Fullname": e.FullName,
+ "Role": e.Role
+ }
+ this.calendarNamesAry.push(objectShared)
+
+
+ console.log('objectShared',this.calendarNamesAry)
this.calendarNamesType[e.FullName] = {}
}
this.calendarNamesType[e.FullName][sharedCalendar.CalendarName] = true
this.calendarNamesType[e.FullName][sharedCalendar.CalendarName+'Id'] = sharedCalendar.CalendarId
-
+ this.calendarNamesType[e.FullName]['RoleId'] = sharedCalendar.CalendarRoleId
})
}
@@ -290,11 +298,13 @@ export class EventsService {
if(!this.calendarNamesAry.includes('Meu calendario')) {
this.calendarNamesAry.push('Meu calendario')
+ console.log(this.calendarNamesAry)
this.calendarNamesType['Meu calendario'] = {}
}
this.calendarNamesType['Meu calendario'][sharedCalendar.CalendarName] = true
this.calendarNamesType['Meu calendario'][sharedCalendar.CalendarName+'Id'] = sharedCalendar.CalendarId
+ this.calendarNamesType['Meu calendario']['RoleId'] = sharedCalendar.CalendarRoleId
}
diff --git a/src/app/services/processes.service.ts b/src/app/services/processes.service.ts
index 8f1604a2d..d952907d7 100644
--- a/src/app/services/processes.service.ts
+++ b/src/app/services/processes.service.ts
@@ -87,7 +87,7 @@ export class ProcessesService {
return this.http.get
(`${geturl}`, options);
}
- GetTask(serialnumber:string): Observable{
+ GetTask(serialnumber:string): Observable {
const geturl = environment.apiURL + 'Tasks/FindTask';
let params = new HttpParams();
diff --git a/src/app/shared/agenda/event-list/event-list.page.html b/src/app/shared/agenda/event-list/event-list.page.html
index 9b9e0ed27..69004c032 100644
--- a/src/app/shared/agenda/event-list/event-list.page.html
+++ b/src/app/shared/agenda/event-list/event-list.page.html
@@ -11,10 +11,12 @@
- Meu Calendário
+ Minha agenda
-
- Calendário Partilhado
+
+ Agenda do PR
+ Agenda do MD
+ Agenda do {{calendars.FullName}}
diff --git a/src/app/shared/agenda/event-list/event-list.page.ts b/src/app/shared/agenda/event-list/event-list.page.ts
index 1463ebabe..c47bb9815 100644
--- a/src/app/shared/agenda/event-list/event-list.page.ts
+++ b/src/app/shared/agenda/event-list/event-list.page.ts
@@ -6,6 +6,7 @@ import { NavigationEnd, Router } from '@angular/router';
import { LoginUserRespose } from 'src/app/models/user.model';
import { SortService } from 'src/app/services/functions/sort.service';
import { SessionStore } from 'src/app/store/session.service';
+import { EventsService } from 'src/app/services/events.service';
@Component({
selector: 'app-event-list',
@@ -36,6 +37,7 @@ export class EventListPage implements OnInit {
private processes:ProcessesService,
private router: Router,
private sortService: SortService,
+ public eventService: EventsService,
) {
this.loggeduser = SessionStore.user;
}
diff --git a/src/app/shared/agenda/new-event/new-event.page.html b/src/app/shared/agenda/new-event/new-event.page.html
index a0fe8d331..5fc142ee0 100644
--- a/src/app/shared/agenda/new-event/new-event.page.html
+++ b/src/app/shared/agenda/new-event/new-event.page.html
@@ -40,11 +40,17 @@
-
- Agenda do PR
- Agenda do MD
- Agenda do {{calendars}}
- Minha agenda
+
+
+ Agenda do PR
+ Agenda do MD
+ Agenda do {{calendars.FullName}}
+ Minha agenda
diff --git a/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.html b/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.html
index 6a9dd1fd2..5cfbdaa15 100644
--- a/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.html
+++ b/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.html
@@ -2,11 +2,11 @@
Diplomas para assinar
-
+