mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
pull of Peter changes
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -261,7 +261,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div (click)="openDiplomasPage('assinados'); selectedElement='DiplomasAssinados'" [class.active]="selectedElement == 'DiplomasAssinados'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
<div *ngIf="deplomasStore.countDiplomasAssinadoListCount >= 1" (click)="openDiplomasPage('assinados'); selectedElement='DiplomasAssinados'" [class.active]="selectedElement == 'DiplomasAssinados'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-diplomas-assinados-presidente.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'DiplomasAssinados'" src="assets/images/theme/gov/icons-diplomas-assinados-presidente.svg"></ion-icon>
|
||||
@@ -374,7 +374,6 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
onmessage = function(oEvent) {
|
||||
|
||||
|
||||
const list = Event.data
|
||||
var a = []
|
||||
postMessage(
|
||||
a.concat.apply([], [list])
|
||||
);
|
||||
|
||||
};
|
||||
@@ -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) {
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -25,7 +25,7 @@ import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
export class AuthService {
|
||||
userData$ = new BehaviorSubject<any>('');
|
||||
userId$ = new BehaviorSubject<any>('');
|
||||
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 ) {
|
||||
|
||||
@@ -25,6 +25,7 @@ export class ChatMethodsService {
|
||||
"end_date": data.end,
|
||||
"venue": data.venue,
|
||||
"id": data.id,
|
||||
"calendarId": data.calendarId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<Event[]> {
|
||||
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 = {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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(){
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<ion-header class="ion-no-border">
|
||||
<ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar>
|
||||
<!-- <ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar> -->
|
||||
<div class="title">
|
||||
<div class="thetitle"><ion-label >Todas as tarefas</ion-label></div>
|
||||
<div class="theicon">
|
||||
@@ -120,6 +120,4 @@
|
||||
</div>
|
||||
|
||||
|
||||
</ion-content>
|
||||
|
||||
|
||||
</ion-content>
|
||||
Reference in New Issue
Block a user