diff --git a/.gitignore b/.gitignore index 2884ea598..5996509b7 100644 --- a/.gitignore +++ b/.gitignore @@ -76,4 +76,5 @@ _android/ _www/ www2020 android copy/ -report.* \ No newline at end of file +report.* +src/plugin/src/ \ No newline at end of file diff --git a/src/app/modals/view-document/view-document.page.ts b/src/app/modals/view-document/view-document.page.ts index dd3968b89..1e9910e26 100644 --- a/src/app/modals/view-document/view-document.page.ts +++ b/src/app/modals/view-document/view-document.page.ts @@ -1,13 +1,13 @@ import { Component, OnInit } from '@angular/core'; import { DomSanitizer } from '@angular/platform-browser'; -import { ModalController, NavParams } from '@ionic/angular'; +import { NavParams } from '@ionic/angular'; import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage'; import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page'; import { ProcessesService } from 'src/app/services/processes.service'; import { EventDetailsDocumentsOptionsPage } from 'src/app/shared/popover/event-details-documents-options/event-details-documents-options.page'; import { DocumentSetUpMeetingPage } from '../document-set-up-meeting/document-set-up-meeting.page'; - - +import { AlertService } from 'src/app/services/alert.service'; +import { AlertController, ModalController } from '@ionic/angular'; @Component({ selector: 'app-view-document', templateUrl: './view-document.page.html', @@ -27,6 +27,7 @@ export class ViewDocumentPage implements OnInit { private navParams: NavParams, private sanitazer: DomSanitizer, private processes: ProcessesService, + private alertController: AlertController, ) { this.file = this.navParams.get('file'); this.applicationId = this.navParams.get('applicationId'); @@ -44,10 +45,27 @@ export class ViewDocumentPage implements OnInit { ngOnInit() { - this.processes.GetViewer(this.docId, this.applicationId).subscribe(res=> { - console.log(res) + this.processes.GetViewer(this.docId, this.applicationId).subscribe(async(res)=> { + const link: string = res.replace('//pdfjs/web/', '/pdfjs/web/') this.trustedUrl = this.sanitazer.bypassSecurityTrustResourceUrl(link); + + if(res == "") { + const alert = await this.alertController.create({ + cssClass: 'my-custom-class', + //header: 'Apagar evento!', + message: 'Sem imagem', + buttons: [ + { + text: 'Sim', + handler: () => { + this.close(); + } + } + ] + }); + } + }, ()=>{ this.close(); }); diff --git a/src/app/modals/view-event/view-event.page.ts b/src/app/modals/view-event/view-event.page.ts index f37748364..aa0103420 100644 --- a/src/app/modals/view-event/view-event.page.ts +++ b/src/app/modals/view-event/view-event.page.ts @@ -153,8 +153,8 @@ export class ViewEventPage implements OnInit { }); } else { - if(this.CalendarId) { + console.log('calendar id') this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => { this.loadedEvent = res; this.addEventToDb(res); @@ -172,6 +172,8 @@ export class ViewEventPage implements OnInit { } loader.remove() }); + } else { + console.log('no calendar id') } } diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index 8d758e4dc..6aa418cf1 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -115,7 +115,6 @@ export class ChatPage implements OnInit { public ChatSystemService: ChatSystemService, ) { - this.loggedUserChat = SessionStore.user.ChatData?.data; this.headers = new HttpHeaders(); window.onresize = (event) => { if (window.innerWidth > 701) { @@ -591,11 +590,8 @@ export class ChatPage implements OnInit { return dateB - dateA; }); // - }) - } - } @@ -617,7 +613,6 @@ export class ChatPage implements OnInit { _updatedAt: element._updatedAt } - groupsArray.push(roomList) }); @@ -636,7 +631,6 @@ export class ChatPage implements OnInit { updatedat: element._updatedAt } - this.sqlservice.addChatListRoom(roomList); }); } diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index fb0689084..e00f64a40 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -331,6 +331,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { async goToEvent(event: any) { + // console.log(event) + let classs; if (window.innerWidth < 701) { classs = 'modal modal-desktop' diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.html b/src/app/pages/gabinete-digital/gabinete-digital.page.html index 7f728eb71..6c6e6ea80 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.html +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.html @@ -261,7 +261,7 @@ -
+
@@ -374,7 +374,6 @@
-
diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts index 1a9cd14d9..abb3cb545 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts @@ -106,6 +106,8 @@ export class GabineteDigitalPage implements OnInit { AllProcess = [] + workerList : Worker + @ViewChild(ExpedientsPage) expedientesPage: ExpedientsPage; @ViewChild(PendentesPage) pendentesListPage: PendentesPage; @ViewChild(EventsToApprovePage) eventsToApprove: EventsToApprovePage; @@ -126,6 +128,12 @@ export class GabineteDigitalPage implements OnInit { public NotificationsService: NotificationsService ) { + this.workerList = new Worker(new URL('./list.worker.js', import.meta.url)); + + this.workerList.onmessage = (oEvent) => { + this.AllProcess = oEvent.data + } + window.onresize = (event) => { // if not mobile remove all component if (window.innerWidth < 701) { @@ -571,6 +579,20 @@ export class GabineteDigitalPage implements OnInit { this.AllProcess = this.expedientegbstore.list.concat(this.pedidosstore.listparecer).concat(this.pedidosstore.listdeferimento) .concat(this.despachoprstore.list).concat(this.eventoaprovacaostore.listmd).concat(this.eventoaprovacaostore.listpr).concat(this.despachoStore.list) .concat(this.deplomasStore.diplomasParaAssinarList).concat(this.deplomasStore.diplomasAssinadoList).concat(this.deplomasStore.DiplomaGerarList) + + // try{ + // this.workerList.postMessage([ + // this.expedientegbstore.list,this.pedidosstore.listparecer,this.pedidosstore.listdeferimento, + // this.despachoprstore.list, this.eventoaprovacaostore.listmd, this.eventoaprovacaostore.listpr, this.despachoStore.list, + // this.deplomasStore.diplomasParaAssinarList, this.deplomasStore.diplomasAssinadoList, this.deplomasStore.DiplomaGerarList + // ]) + // } catch (e) { + // this.AllProcess = this.expedientegbstore.list.concat(this.pedidosstore.listparecer).concat(this.pedidosstore.listdeferimento) + // .concat(this.despachoprstore.list).concat(this.eventoaprovacaostore.listmd).concat(this.eventoaprovacaostore.listpr).concat(this.despachoStore.list) + // .concat(this.deplomasStore.diplomasParaAssinarList).concat(this.deplomasStore.diplomasAssinadoList).concat(this.deplomasStore.DiplomaGerarList) + // } + + } get getAllProcessCount() { diff --git a/src/app/pages/gabinete-digital/list.worker.js b/src/app/pages/gabinete-digital/list.worker.js new file mode 100644 index 000000000..adcecfb94 --- /dev/null +++ b/src/app/pages/gabinete-digital/list.worker.js @@ -0,0 +1,10 @@ +onmessage = function(oEvent) { + + + const list = Event.data + var a = [] + postMessage( + a.concat.apply([], [list]) + ); + +}; \ No newline at end of file diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 246760293..fa40f36f4 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -123,6 +123,7 @@ export class LoginPage implements OnInit { if (attempt.UserId == SessionStore.user.UserId) { await this.authService.SetSession(attempt, this.userattempt); + this.changeProfileService.run(); if(attempt.ChatData) { diff --git a/src/app/services/attachments.service.ts b/src/app/services/attachments.service.ts index fd67ce1ee..a0671c00d 100644 --- a/src/app/services/attachments.service.ts +++ b/src/app/services/attachments.service.ts @@ -24,22 +24,16 @@ export class AttachmentsService { private changeProfileService: ChangeProfileService) { this.changeProfileService.registerCallback(() => { - this.loggeduser = SessionStore.user - this.headers = new HttpHeaders(); - - this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey); - }) - this.changeProfileService.registerLoginCallback(() => { - this.loggeduser = SessionStore.user - this.headers = new HttpHeaders(); - - this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey); - }) + this.setHeader() + }); + this.setHeader() + } + + setHeader() { this.loggeduser = SessionStore.user this.headers = new HttpHeaders(); this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey); - } uploadFile(formData:any) { diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index 8238ca1b8..311c3a700 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -25,7 +25,7 @@ import { ChatSystemService } from 'src/app/services/chat/chat-system.service'; export class AuthService { userData$ = new BehaviorSubject(''); userId$ = new BehaviorSubject(''); - headers: HttpHeaders; + headers: HttpHeaders = new HttpHeaders(); public wsValidatedUserChat:any; public isWsAuthenticated: boolean = false; opts:any; @@ -43,9 +43,7 @@ export class AuthService { private storage: Storage, private initialsService: InitialsService, public p: PermissionService, - public ChatSystemService: ChatSystemService, ) { - - this.headers = new HttpHeaders(); + public ChatSystemService: ChatSystemService) { if (SessionStore.exist) { if(this.p.userPermission(this.p.permissionList.Chat.access) == true ) { diff --git a/src/app/services/chat/chat-methods.service.ts b/src/app/services/chat/chat-methods.service.ts index 379d048b5..abb25e3a4 100644 --- a/src/app/services/chat/chat-methods.service.ts +++ b/src/app/services/chat/chat-methods.service.ts @@ -25,6 +25,7 @@ export class ChatMethodsService { "end_date": data.end, "venue": data.venue, "id": data.id, + "calendarId": data.calendarId } } } diff --git a/src/app/services/chat/chat-system.service.ts b/src/app/services/chat/chat-system.service.ts index 1769d7893..5fdb97dc1 100644 --- a/src/app/services/chat/chat-system.service.ts +++ b/src/app/services/chat/chat-system.service.ts @@ -317,8 +317,12 @@ export class ChatSystemService { } this.RochetChatConnectorService.streamNotifyLogged().then((subscription=>{ - + console.log(subscription) })) + + // this.RochetChatConnectorService.subStreamNotifyUser().then((subscription=>{ + // console.log(subscription) + // })) } /** @@ -406,7 +410,7 @@ export class ChatSystemService { let roomId = this.getRoomId(roomData); - if (setData.name != 'Rocket Cat') { + if (setData.name != 'Rocket Cat' && setData.name != 'general' ) { // create room if(!this.roomExist(roomId)) { let room:RoomService = new RoomService(this.RochetChatConnectorService, new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this, this.ViewedMessageService) diff --git a/src/app/services/chat/message.service.ts b/src/app/services/chat/message.service.ts index 83255aa43..6e8231bce 100644 --- a/src/app/services/chat/message.service.ts +++ b/src/app/services/chat/message.service.ts @@ -446,9 +446,11 @@ export class MessageService { async delateDB() { - const message = await MessageModel.get({id: this.id}) - await message.delete() + if(!this.rowInstance) { + this.rowInstance = await this.getRowInstance() + } + await this.rowInstance.delete() } diff --git a/src/app/services/chat/rochet-chat-connector.service.ts b/src/app/services/chat/rochet-chat-connector.service.ts index 449c65b97..19bb9ae42 100644 --- a/src/app/services/chat/rochet-chat-connector.service.ts +++ b/src/app/services/chat/rochet-chat-connector.service.ts @@ -437,6 +437,35 @@ export class RochetChatConnectorService { } + + subStreamNotifyUser(param?: any) { + + const requestId = uuidv4() + + let message = { + msg: "sub", + id: requestId, + name: "stream-notify-user", + params:[ + `${SessionStore.user.ChatData.data.userId}/notification`, + param + ] + } + + + this.ws.send({message, requestId}) + + return new Promise((resolve, reject) => { + this.ws.registerCallback({type:'Onmessage', funx:(message)=>{ + if(message.id == requestId ) { // same request send + resolve(message) + return true + } + }}) + }); + + } + receiveStreamNotifyRoom(funx: Function) { this.ws.registerCallback({ diff --git a/src/app/services/chat/room.service.ts b/src/app/services/chat/room.service.ts index b67bfc32e..982ee860d 100644 --- a/src/app/services/chat/room.service.ts +++ b/src/app/services/chat/room.service.ts @@ -452,7 +452,13 @@ export class RoomService { "stream-notify-room", async (ChatMessage) => { const DeletedMessageId = ChatMessage.fields.args[0]._id; - this.deleteMessage(DeletedMessageId) + + const message = this.messages.find((e) => e._id == DeletedMessageId) + + if(message.delate == false) { + this.deleteMessage(DeletedMessageId) + } + } ) } diff --git a/src/app/services/contacts.service.ts b/src/app/services/contacts.service.ts index 55ce44b25..f555d9605 100644 --- a/src/app/services/contacts.service.ts +++ b/src/app/services/contacts.service.ts @@ -6,6 +6,7 @@ import { environment } from 'src/environments/environment'; import { AuthService } from '../services/auth.service'; import { LoginUserRespose } from '../models/user.model'; import { SessionStore } from '../store/session.service'; +import { ChangeProfileService } from './change-profile.service'; @Injectable({ providedIn: 'root' @@ -16,7 +17,18 @@ export class ContactsService { loggeduser: LoginUserRespose; headers: HttpHeaders; - constructor(private http: HttpClient, user: AuthService) { + constructor( + private http: HttpClient, + user: AuthService, + private changeProfileService: ChangeProfileService) { + + this.setHeader() + this.changeProfileService.registerCallback(() => { + this.setHeader() + }) + } + + setHeader() { this.loggeduser = SessionStore.user; this.headers = new HttpHeaders(); this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); diff --git a/src/app/services/events.service.ts b/src/app/services/events.service.ts index 7f6b01435..4681e0123 100644 --- a/src/app/services/events.service.ts +++ b/src/app/services/events.service.ts @@ -4,7 +4,6 @@ import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { Observable, from } from 'rxjs'; import { environment } from 'src/environments/environment'; import { AuthService } from '../services/auth.service'; -import { UserSession } from '../models/user.model'; import { EventList } from '../models/agenda/AgendaEventList'; import { ChangeProfileService } from './change-profile.service'; import { OfflineManagerService } from 'src/app/services/offline-manager.service'; @@ -20,7 +19,6 @@ import { SessionStore } from '../store/session.service'; export class EventsService { authheader = {}; - loggeduser: UserSession; headers: HttpHeaders; headersPrOficial: HttpHeaders; @@ -37,25 +35,17 @@ export class EventsService { headersSharedOficial: HttpHeaders; headersSharedPessoal: HttpHeaders; - - hasSharedCalendar = false - hasOwnCalendar = false - - + calendarIds = [] usersCalendarIds = [] + hasSharedCalendar = false; hasSharedOficial: boolean = false; hasSharedPessoal: boolean = false; + hasOwnOficial: boolean = false; hasOwnPessoal: boolean = false; - - - - userCalendarNameSharedOficial = ''; - userCalendarNameSharedPessoal = ''; - userCalendarNameOwnOficial = ''; - userCalendarNameOwnPessoal = ''; + hasOwnCalendar = false calendarNames = {} @@ -73,7 +63,14 @@ export class EventsService { private storage: Storage, private backgroundservice: BackgroundService) { - this.loggeduser = SessionStore.user; + this.setHeader() + this.changeProfileService.registerCallback(() => { + this.setHeader() + }) + + } + + async setHeader () { this.headers = new HttpHeaders(); this.headersMdOficial = new HttpHeaders(); @@ -92,16 +89,14 @@ export class EventsService { this.headerSharedOficial= new HttpHeaders(); this.headerSharedPessoal= new HttpHeaders(); + this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey); - this.setHeader() - this.changeProfileService.registerCallback(() => { - this.loggeduser = SessionStore.user; - this.setHeader() - }) - - } - - async setHeader () { + this.usersCalendarIds = []; + this.calendarNames = {} + this.calendarIds = [] + + this.calendarNamesAry = [] + this.calendarNamesType = {} this.hasSharedCalendar = false this.hasSharedOficial = false @@ -110,32 +105,11 @@ export class EventsService { this.hasOwnCalendar = false this.hasOwnOficial = false this.hasOwnPessoal = false - - this.headers = new HttpHeaders(); - this.headerOwnOficial= new HttpHeaders(); - this.headerOwnPessoal= new HttpHeaders(); - - this.headerSharedOficial= new HttpHeaders(); - this.headerSharedPessoal= new HttpHeaders(); + if (SessionStore.user) { + if (SessionStore.user.Profile == 'MDGPR') { - this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); - - this.userCalendarNameSharedOficial = ''; - this.userCalendarNameSharedPessoal = ''; - this.userCalendarNameOwnOficial = ''; - this.userCalendarNameOwnPessoal = ''; - - this.usersCalendarIds = []; - this.calendarNames = {} - - this.calendarNamesAry = [] - this.calendarNamesType = {} - - if (this.loggeduser) { - if (this.loggeduser.Profile == 'MDGPR') { - - for (let calendar of this.loggeduser.OwnerCalendars) { + for (let calendar of SessionStore.user.OwnerCalendars) { this.hasAnyCalendar = false if (calendar.CalendarName == 'Oficial') { @@ -143,7 +117,7 @@ export class EventsService { this.hasOwnOficial = true - this.headersMdOficial = this.headersMdOficial.set('Authorization', this.loggeduser.BasicAuthKey); + this.headersMdOficial = this.headersMdOficial.set('Authorization', SessionStore.user.BasicAuthKey); this.headersMdOficial = this.headersMdOficial.set('CalendarId', calendar.CalendarId); this.headersMdOficial = this.headersMdOficial.set('CalendarRoleId', calendar.CalendarRoleId); } @@ -151,21 +125,21 @@ export class EventsService { this.hasOwnPessoal = true - this.headersMdPessoal = this.headersMdPessoal.set('Authorization', this.loggeduser.BasicAuthKey); + this.headersMdPessoal = this.headersMdPessoal.set('Authorization', SessionStore.user.BasicAuthKey); this.headersMdPessoal = this.headersMdPessoal.set('CalendarId', calendar.CalendarId); this.headersMdPessoal = this.headersMdPessoal.set('CalendarRoleId', calendar.CalendarRoleId); } } - for (let sharedCalendar of this.loggeduser.SharedCalendars) { + for (let sharedCalendar of SessionStore.user.SharedCalendars) { this.hasAnyCalendar = false if (sharedCalendar.CalendarName == 'Oficial') { this.hasSharedOficial = true - this.headersSharedOficial = this.headersSharedOficial.set('Authorization', this.loggeduser.BasicAuthKey); + this.headersSharedOficial = this.headersSharedOficial.set('Authorization', SessionStore.user.BasicAuthKey); this.headersSharedOficial = this.headersSharedOficial.set('CalendarId', sharedCalendar.CalendarId); this.headersSharedOficial = this.headersSharedOficial.set('CalendarRoleId', sharedCalendar.CalendarRoleId); } @@ -173,7 +147,7 @@ export class EventsService { this.hasSharedPessoal = true - this.headersSharedPessoal = this.headersSharedPessoal.set('Authorization', this.loggeduser.BasicAuthKey); + this.headersSharedPessoal = this.headersSharedPessoal.set('Authorization', SessionStore.user.BasicAuthKey); this.headersSharedPessoal = this.headersSharedPessoal.set('CalendarId', sharedCalendar.CalendarId); this.headersSharedPessoal = this.headersSharedPessoal.set('CalendarRoleId', sharedCalendar.CalendarRoleId); } @@ -181,15 +155,15 @@ export class EventsService { } - else if (this.loggeduser.Profile == 'PR') { + else if (SessionStore.user.Profile == 'PR') { - for (let calendar of this.loggeduser.OwnerCalendars) { + for (let calendar of SessionStore.user.OwnerCalendars) { this.hasAnyCalendar = false if (calendar.CalendarName == 'Oficial') { this.hasOwnOficial = true - this.headersPrOficial = this.headersPrOficial.set('Authorization', this.loggeduser.BasicAuthKey); + this.headersPrOficial = this.headersPrOficial.set('Authorization', SessionStore.user.BasicAuthKey); this.headersPrOficial = this.headersPrOficial.set('CalendarId', calendar.CalendarId); this.headersPrOficial = this.headersPrOficial.set('CalendarRoleId', calendar.CalendarRoleId); } @@ -197,7 +171,7 @@ export class EventsService { this.hasOwnPessoal = true - this.headersPrPessoal = this.headersPrPessoal.set('Authorization', this.loggeduser.BasicAuthKey); + this.headersPrPessoal = this.headersPrPessoal.set('Authorization', SessionStore.user.BasicAuthKey); this.headersPrPessoal = this.headersPrPessoal.set('CalendarId', calendar.CalendarId); this.headersPrPessoal = this.headersPrPessoal.set('CalendarRoleId', calendar.CalendarRoleId); @@ -206,7 +180,7 @@ export class EventsService { } - for (let calendar of this.loggeduser.OwnerCalendars) { + for (let calendar of SessionStore.user.OwnerCalendars) { this.hasAnyCalendar = false if(!this.usersCalendarIds.includes(calendar.OwnerUserId)) { this.usersCalendarIds.push(calendar.OwnerUserId) @@ -222,7 +196,7 @@ export class EventsService { this.hasOwnOficial = true - this.headerOwnOficial = this.headerOwnOficial.set('Authorization', this.loggeduser.BasicAuthKey); + this.headerOwnOficial = this.headerOwnOficial.set('Authorization', SessionStore.user.BasicAuthKey); this.headerOwnOficial = this.headerOwnOficial.set('CalendarId', calendar.CalendarId); this.headerOwnOficial = this.headerOwnOficial.set('CalendarRoleId', calendar.CalendarRoleId); this.headerOwnOficial = this.headerOwnOficial.set('CalendarName', calendar.CalendarName); @@ -231,14 +205,14 @@ export class EventsService { this.hasOwnPessoal = true - this.headerOwnPessoal = this.headerOwnPessoal.set('Authorization', this.loggeduser.BasicAuthKey); + this.headerOwnPessoal = this.headerOwnPessoal.set('Authorization', SessionStore.user.BasicAuthKey); this.headerOwnPessoal =this.headerOwnPessoal.set('CalendarId', calendar.CalendarId); this.headerOwnPessoal =this.headerOwnPessoal.set('CalendarRoleId', calendar.CalendarRoleId); this.headerOwnPessoal = this.headerOwnPessoal.set('CalendarName', calendar.CalendarName); } } - for (let sharedCalendar of this.loggeduser.SharedCalendars) { + for (let sharedCalendar of SessionStore.user.SharedCalendars) { this.hasAnyCalendar = false if(!this.usersCalendarIds.includes(sharedCalendar.OwnerUserId)) { @@ -254,7 +228,7 @@ export class EventsService { if (sharedCalendar.CalendarName == 'Oficial') { this.hasSharedOficial = true - this.headerSharedOficial = this.headerSharedOficial.set('Authorization',this.loggeduser.BasicAuthKey); + this.headerSharedOficial = this.headerSharedOficial.set('Authorization',SessionStore.user.BasicAuthKey); this.headerSharedOficial = this.headerSharedOficial.set('CalendarId', sharedCalendar.CalendarId); this.headerSharedOficial = this.headerSharedOficial.set('CalendarRoleId', sharedCalendar.CalendarRoleId); this.headerSharedOficial = this.headerSharedOficial.set('CalendarName', sharedCalendar.CalendarName); @@ -263,7 +237,7 @@ export class EventsService { this.hasSharedPessoal = true - this.headerSharedPessoal = this.headerSharedPessoal.set('Authorization',this.loggeduser.BasicAuthKey); + this.headerSharedPessoal = this.headerSharedPessoal.set('Authorization',SessionStore.user.BasicAuthKey); this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarId', sharedCalendar.CalendarId); this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarRoleId', sharedCalendar.CalendarRoleId); this.headerSharedPessoal = this.headerSharedPessoal.set('CalendarName', sharedCalendar.CalendarName); @@ -271,7 +245,7 @@ export class EventsService { } - for (let sharedCalendar of this.loggeduser.SharedCalendars) { + for (let sharedCalendar of SessionStore.user.SharedCalendars) { this.hasAnyCalendar = false if(sharedCalendar?.OwnerUserId) { this.GetCalendarName(sharedCalendar.OwnerUserId).subscribe((e)=> { @@ -291,7 +265,7 @@ export class EventsService { } - for (let sharedCalendar of this.loggeduser.OwnerCalendars) { + for (let sharedCalendar of SessionStore.user.OwnerCalendars) { this.hasAnyCalendar = false this.calendarNames[sharedCalendar.CalendarId] = 'Meu calendario' @@ -326,13 +300,13 @@ export class EventsService { isMyEvent(event: any) { - for (let calendar of this.loggeduser.OwnerCalendars) { + for (let calendar of SessionStore.user.OwnerCalendars) { if(event.CalendarId == calendar.CalendarId) { return true } } - for (let sharedCalendar of this.loggeduser.SharedCalendars) { + for (let sharedCalendar of SessionStore.user.SharedCalendars) { if(event.CalendarId == sharedCalendar.CalendarId) { return false } @@ -438,7 +412,7 @@ export class EventsService { let prO = [], prP = []; - for (let calendar of this.loggeduser.OwnerCalendars) { + for (let calendar of SessionStore.user.OwnerCalendars) { if (calendar.CalendarName == 'Oficial') { prO = await this.getAllMdOficialEvents(startdate, enddate).toPromise(); if(!Array.isArray(prO)) { @@ -521,10 +495,10 @@ export class EventsService { let result = [] - for (let sharedCalendar of this.loggeduser.SharedCalendars) { + for (let sharedCalendar of SessionStore.user.SharedCalendars) { var header = new HttpHeaders(); - header = header.set('Authorization', this.loggeduser.BasicAuthKey); + header = header.set('Authorization', SessionStore.user.BasicAuthKey); header = header.set('CalendarId', sharedCalendar.CalendarId); header = header.set('CalendarRoleId', sharedCalendar.CalendarRoleId); header = header.set('CalendarName', sharedCalendar.CalendarName); @@ -591,7 +565,7 @@ export class EventsService { let prO = [], prP = []; - for(let calendar of this.loggeduser.SharedCalendars) { + for(let calendar of SessionStore.user.SharedCalendars) { if (calendar.CalendarName == 'Oficial') { prO = await this.getAllSharedOficialEvents(startdate, enddate).toPromise(); } @@ -608,8 +582,6 @@ export class EventsService { }); } - - getAllSharedOficialEvents(startdate: string, enddate: string): Observable { let geturl = environment.apiURL + 'calendar/pr'; geturl = geturl.replace('/V4/', '/V5/') @@ -745,10 +717,10 @@ export class EventsService { this.headers['CalendarName'] = event.CalendarName if (event.CalendarName == 'Oficial') { - if (this.loggeduser.Profile == 'MDGPR') { + if (SessionStore.user.Profile == 'MDGPR') { this.headers = this.headersMdOficial; } - else if (this.loggeduser.Profile == 'PR') { + else if (SessionStore.user.Profile == 'PR') { this.headers = this.headersPrOficial; } else { @@ -767,10 +739,10 @@ export class EventsService { } } else { - if (this.loggeduser.Profile == 'MDGPR') { + if (SessionStore.user.Profile == 'MDGPR') { this.headers = this.headersMdPessoal; } - else if (this.loggeduser.Profile == 'PR') { + else if (SessionStore.user.Profile == 'PR') { this.headers = this.headersPrPessoal; } else { @@ -916,7 +888,7 @@ export class EventsService { let options; - switch (this.loggeduser.Profile) { + switch (SessionStore.user.Profile) { case 'MDGPR': if (calendarName == 'Pessoal') { options = { @@ -974,7 +946,7 @@ export class EventsService { let options; - if(this.loggeduser.Profile == 'MDGPR') { + if(SessionStore.user.Profile == 'MDGPR') { if (calendarName == 'Pessoal') { options = { headers: this.headersMdPessoal, @@ -988,7 +960,7 @@ export class EventsService { }; } } - else if (this.loggeduser.Profile == 'PR') { + else if (SessionStore.user.Profile == 'PR') { if (calendarName == 'Pessoal') { options = { headers: this.headersPrPessoal, @@ -1050,7 +1022,7 @@ export class EventsService { params = params.set("SerialNumber", serialNumber); params = params.set("applicationID", applicationID); - switch (this.loggeduser.Profile) { + switch (SessionStore.user.Profile) { case 'MDGPR': if (body.CalendarName == 'Pessoal') { options = { @@ -1121,7 +1093,7 @@ export class EventsService { params = params.set("SerialNumber", serialNumber); params = params.set("applicationID", applicationID); - switch (this.loggeduser.Profile) { + switch (SessionStore.user.Profile) { case 'MDGPR': if (body.CalendarName == 'Pessoal') { options = { diff --git a/src/app/services/organic-entity.service.ts b/src/app/services/organic-entity.service.ts index 30fc583f5..2a5e6c512 100644 --- a/src/app/services/organic-entity.service.ts +++ b/src/app/services/organic-entity.service.ts @@ -7,6 +7,7 @@ import { AuthService } from '../services/auth.service'; import { LoginUserRespose } from '../models/user.model'; import { OrganicEntity } from 'src/app/models/organic-entity.model'; import { SessionStore } from '../store/session.service'; +import { ChangeProfileService } from './change-profile.service'; @Injectable({ providedIn: 'root' @@ -17,7 +18,18 @@ export class OrganicEntityService { loggeduser: LoginUserRespose; headers: HttpHeaders; - constructor(private http: HttpClient, user: AuthService) { + constructor( + private http: HttpClient, + user: AuthService, + private changeProfileService: ChangeProfileService) { + + this.setHeader() + this.changeProfileService.registerCallback(() => { + this.setHeader() + }) + } + + setHeader() { this.loggeduser = SessionStore.user; this.headers = new HttpHeaders(); this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); diff --git a/src/app/services/publications.service.ts b/src/app/services/publications.service.ts index c429d3482..55e813247 100644 --- a/src/app/services/publications.service.ts +++ b/src/app/services/publications.service.ts @@ -9,6 +9,7 @@ import { Publication } from '../models/publication'; import { getUrl } from 'ionicons/dist/types/components/icon/utils'; import { ActivatedRoute, Router } from '@angular/router'; import { SessionStore } from '../store/session.service'; +import { ChangeProfileService } from './change-profile.service'; @Injectable({ providedIn: 'root' @@ -23,11 +24,20 @@ export class PublicationsService { constructor(private http: HttpClient, user: AuthService, private activatedRoute: ActivatedRoute, - private router: Router) { + private router: Router, + private changeProfileService: ChangeProfileService,) { + + this.setHeader() + this.changeProfileService.registerCallback(() => { + this.setHeader() + }) + + } + + setHeader () { this.loggeduser = SessionStore.user; this.headers = new HttpHeaders(); this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); - } GetPublicationFolderList(){ diff --git a/src/app/services/search.service.ts b/src/app/services/search.service.ts index 31d198c87..8b6075663 100644 --- a/src/app/services/search.service.ts +++ b/src/app/services/search.service.ts @@ -8,6 +8,7 @@ import { LoginUserRespose } from '../models/user.model'; import { EventSearch } from "src/app/models/event-search"; import { TopSearch } from 'src/app/models/top-search'; import { SessionStore } from '../store/session.service'; +import { ChangeProfileService } from './change-profile.service'; @Injectable({ providedIn: 'root' @@ -21,7 +22,20 @@ export class SearchService { categories= Array; // setup - constructor(private http: HttpClient, user: AuthService) { + constructor( + private http: HttpClient, + user: AuthService, + private changeProfileService: ChangeProfileService) { + + this.setHeader(); + + this.changeProfileService.registerCallback(() => { + this.setHeader() + }) + } + + + setHeader() { this.loggeduser = SessionStore.user; this.headers = new HttpHeaders(); this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); diff --git a/src/app/shared/agenda/new-event/new-event.page.ts b/src/app/shared/agenda/new-event/new-event.page.ts index fbc5844a7..706229c88 100644 --- a/src/app/shared/agenda/new-event/new-event.page.ts +++ b/src/app/shared/agenda/new-event/new-event.page.ts @@ -585,7 +585,6 @@ export class NewEventPage implements OnInit { this.postEvent.CalendarName - const CalendarId = this.selectedCalendarId() let loader = this.toastService.loading(); @@ -643,15 +642,18 @@ export class NewEventPage implements OnInit { } selectedCalendarId () { + console.log('1:1',this.eventService.calendarNamesType,'2', this.CalendarName) if (this.eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.postEvent.CalendarName == 'Oficial') { + console.log('1') return this.eventService.calendarNamesType[this.CalendarName]['OficialId'] } else if (this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal'] && this.postEvent.CalendarName == 'Pessoal') { - + console.log('2') return this.eventService.calendarNamesType[this.CalendarName]['PessoalId'] } else { + console.log('1:1',this.eventService.calendarNamesType,'2', this.CalendarName) return '11:11' } } diff --git a/src/app/shared/gabinete-digital/all-processes/all-processes.page.html b/src/app/shared/gabinete-digital/all-processes/all-processes.page.html index a11a5d2e0..9d63acd23 100644 --- a/src/app/shared/gabinete-digital/all-processes/all-processes.page.html +++ b/src/app/shared/gabinete-digital/all-processes/all-processes.page.html @@ -1,5 +1,5 @@ - +
Todas as tarefas
@@ -120,6 +120,4 @@
- - - + \ No newline at end of file diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 8970b0d17..1420e1e74 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,4 +1,5 @@ import { versionData } from '../../version/git-version' + export const environment = { // apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/', apiURL: 'https://API.DONEIT.CO.AO/api/', diff --git a/version/git-static-version.ts b/version/git-static-version.ts new file mode 100644 index 000000000..e69de29bb diff --git a/version/git-version.ts b/version/git-version.ts index 71a13a235..9c78769c9 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,12 +1,12 @@ export let versionData = { - "shortSHA": "d8b443add", - "SHA": "d8b443add6a64568c3078b6b7d90a0732e85de92", + "shortSHA": "0144b306a", + "SHA": "0144b306a87b09f30811af394d85fd2c3942e894", "branch": "no_bug_movemente", "lastCommitAuthor": "'Eudes InĂ¡cio'", - "lastCommitTime": "'Wed Jan 18 14:20:23 2023 +0100'", - "lastCommitMessage": "Intervinientes bug solved", - "lastCommitNumber": "4651", + "lastCommitTime": "'Wed Jan 18 17:07:25 2023 +0100'", + "lastCommitMessage": "Text change to doneIT", + "lastCommitNumber": "4652", "change": "", - "changeStatus": "On branch no_bug_movemente\nYour branch is ahead of 'origin/no_bug_movemente' by 1 commit.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/modals/profile/profile.page.html\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.html\n\tmodified: src/app/shared/chat/messages/messages.page.ts\n\tmodified: src/app/shared/gabinete-digital/all-processes/all-processes.page.html\n\tmodified: src/app/shared/header/header.page.html", + "changeStatus": "On branch no_bug_movemente\nYour branch and 'origin/no_bug_movemente' have diverged,\nand have 2 and 4 different commits each, respectively.\n (use \"git pull\" to merge the remote branch into yours)\n\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: .gitignore\n\tmodified: src/app/modals/view-document/view-document.page.ts\n\tmodified: src/app/modals/view-event/view-event.page.ts\n\tmodified: src/app/pages/chat/chat.page.ts\n\tmodified: src/app/pages/chat/messages/messages.page.ts\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.html\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.ts\n\tnew file: src/app/pages/gabinete-digital/list.worker.js\n\tmodified: src/app/pages/login/login.page.ts\n\tmodified: src/app/services/attachments.service.ts\n\tmodified: src/app/services/auth.service.ts\n\tmodified: src/app/services/chat/chat-methods.service.ts\n\tmodified: src/app/services/chat/chat-system.service.ts\n\tmodified: src/app/services/chat/message.service.ts\n\tmodified: src/app/services/chat/rochet-chat-connector.service.ts\n\tmodified: src/app/services/chat/room.service.ts\n\tmodified: src/app/services/contacts.service.ts\n\tmodified: src/app/services/events.service.ts\n\tmodified: src/app/services/organic-entity.service.ts\n\tmodified: src/app/services/publications.service.ts\n\tmodified: src/app/services/search.service.ts\n\tmodified: src/app/shared/agenda/new-event/new-event.page.ts\n\tmodified: src/app/shared/gabinete-digital/all-processes/all-processes.page.html\n\tmodified: src/environments/environment.prod.ts\n\tnew file: version/git-static-version.ts", "changeAuthor": "eudes.inacio" } \ No newline at end of file