diff --git a/nice.html b/nice.html index dbf55e663..1768917f4 100644 --- a/nice.html +++ b/nice.html @@ -15,12 +15,11 @@ console.log(res) - var data= [ - { a:{aa:10}, b:{bb:2} }, - { a:{aa:10}, b:{bb:2} }, - { a:{aa:2} , b:{bb:2} }, - { a:{aa:3} , b:{bb:3} } + { a:{aa:10}, b:2 }, + { a:{aa:10}, b:2 }, + { a:{aa:2} , b:2 }, + { a:{aa:3} , b:3} ] @@ -30,20 +29,14 @@ } - var res = alasql('SELECT a, b FROM ? WHERE b->bb = 2',[ data ]); + var res = alasql('SELECT a, b FROM ? WHERE b = 2',[ data ]); console.log(res) - alasql(`CREATE TABLE Persons ( - ID int NOT NULL PRIMARY KEY, - LastName varchar(255) NOT NULL, - FirstName varchar(255), - Age int, - jsn1 JSON(64000) CHARACTER SET LATIN - );`); - + + alasql("INSERT INTO Persons VALUES (100, 'maquiran', 'peter', 18)"); console.log(alasql("SELECT * FROM Persons ")) diff --git a/package.json b/package.json index 9ea74a7ec..73300595b 100644 --- a/package.json +++ b/package.json @@ -197,7 +197,7 @@ "protractor": "~7.0.0", "ts-jest-puppeteer": "0.0.5", "ts-node": "~8.3.0", - "tslint": "~6.1.0", + "tslint": "^6.1.3", "typescript": "^4.3.5", "uk.co.workingedge.cordova.plugin.sqliteporter": "^1.1.1" }, diff --git a/src/app/guards/auth.guard.ts b/src/app/guards/auth.guard.ts index 10a5ff3e3..d147768af 100644 --- a/src/app/guards/auth.guard.ts +++ b/src/app/guards/auth.guard.ts @@ -18,7 +18,7 @@ export class AuthGuard implements CanActivate { canActivate( route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { - + // if user not active if(!SessionStore.user.Inactivity) { this.router.navigate(['/']); @@ -29,7 +29,7 @@ export class AuthGuard implements CanActivate { this.router.navigate(['/']); return false } else { - this.authService.loginChat(); + //this.authService.loginChat(); return true; } } diff --git a/src/app/home/home.page.html b/src/app/home/home.page.html index ce6843661..20503ed16 100644 --- a/src/app/home/home.page.html +++ b/src/app/home/home.page.html @@ -1,3 +1,4 @@ + diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 81f69a237..a55b4459b 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -100,9 +100,9 @@ export class HomePage implements OnInit { private processservice: ProcessesService, private screenOrientation: ScreenOrientation, private sqliteservice: SqliteService, - private RouteService: RouteService, + public RouteService: RouteService, private WsChatService: WsChatService, - private NativeNotificationService: NativeNotificationService) { + private NativeNotificationService: NativeNotificationService,) { /* this.webNotificationPopupService.askNotificationPermission() */ diff --git a/src/app/modals/delegar/delegar.page.ts b/src/app/modals/delegar/delegar.page.ts index b72e269e1..a6e6391ff 100644 --- a/src/app/modals/delegar/delegar.page.ts +++ b/src/app/modals/delegar/delegar.page.ts @@ -8,7 +8,6 @@ import { EventPerson } from 'src/app/models/eventperson.model'; import { EventsService } from 'src/app/services/events.service'; import { AttachmentsService } from 'src/app/services/attachments.service'; import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page'; -import { AlertService } from 'src/app/services/alert.service'; import { ToastService } from 'src/app/services/toast.service'; import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.page'; import { SearchList } from 'src/app/models/search-document'; @@ -24,10 +23,10 @@ import { ThemeService } from 'src/app/services/theme.service' export class DelegarPage implements OnInit { task: any; note:string; - + taskParticipants: EventPerson[] = []; taskParticipantsCc: EventPerson[] = []; - + taskDocId:string; loadedAttachments:any; @@ -51,7 +50,6 @@ export class DelegarPage implements OnInit { private attachmentsService: AttachmentsService, private calendarService: EventsService, public alertController: AlertController, - private alertService: AlertService, private animationController: AnimationController, private toastService: ToastService, public ThemeService: ThemeService @@ -75,7 +73,7 @@ export class DelegarPage implements OnInit { ngOnInit() { this.adding = "intervenient"; console.log(this.task); - + } close() { @@ -107,8 +105,8 @@ export class DelegarPage implements OnInit { const loader = this.toastService.loading() this.processes.DelegateTask(body).subscribe(res=>{ - - console.log(res); + + console.log(res); this.toastService._successMessage('Processo delegado') this.close(); }, @@ -157,16 +155,16 @@ export class DelegarPage implements OnInit { if(this.adding == "intervenient"){ this.taskParticipants = data; } else if (this.adding == "CC") { - + this.taskParticipantsCc = data; } - + } async setIntervenient(data) { this.taskParticipants = data; } - + async setIntervenientCC(data) { this.taskParticipantsCc = data; } @@ -189,7 +187,7 @@ export class DelegarPage implements OnInit { modal.onDidDismiss(); } - + validateFormInputs(){ let formLocation = this.postData.Location.trim(); if(!this.postData.Location && formLocation.length <= 0){ @@ -229,4 +227,4 @@ export class DelegarPage implements OnInit { } -} \ No newline at end of file +} diff --git a/src/app/models/user.model.ts b/src/app/models/user.model.ts index 89ea55fe4..172044e38 100644 --- a/src/app/models/user.model.ts +++ b/src/app/models/user.model.ts @@ -58,6 +58,7 @@ export class UserSession { UserName: string Password: string RochetChatUser: string + RochetChatUserId: string Profile: any; LoginPreference: 'None' | 'Password' | 'Pin' | null; PIN: string diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index a851161b5..3e9ad13a3 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -4,7 +4,6 @@ import { AlertController, ModalController, Platform } from '@ionic/angular'; import { EventsService } from 'src/app/services/events.service'; import { Event } from '../../models/event.model'; import { Router, NavigationEnd } from '@angular/router'; -import { AlertService } from 'src/app/services/alert.service'; import { momentG } from 'src/plugin/momentG'; import { DomSanitizer } from "@angular/platform-browser"; import { EventPerson } from 'src/app/models/eventperson.model'; @@ -170,7 +169,6 @@ export class AgendaPage implements OnInit { private modalCtrl: ModalController, private eventService: EventsService, private router: Router, - private alertController: AlertService, private sanitizer: DomSanitizer, authService: AuthService, private dateAdapter: DateAdapter, @@ -823,10 +821,10 @@ export class AgendaPage implements OnInit { this.storage.get('agendaResponse').then((events) => { this.trasnformDataDB(events) this.updateEventListBox() - + this.myCal.update(); this.myCal.loadEvents(); - + this.showLoader = false; this.showTimeline = true; }) @@ -834,20 +832,20 @@ export class AgendaPage implements OnInit { this.sqliteservice.getAllEvents().then((events: any[]) => { console.log('ALL EVENTS FROM DB', events) let eventArray = []; - + this.trasnformDataDB(events) this.updateEventListBox() - + this.myCal.update(); this.myCal.loadEvents(); - + this.showLoader = false; this.showTimeline = true; - - + + }) } - + } updateEventListBox() { @@ -974,10 +972,6 @@ export class AgendaPage implements OnInit { }, 250) } - showAlert() { - this.alertController.presentAlert("Funcionalidade em desenvolvimento."); - } - changeProfile() { if (this.profile == "mdgpr") { diff --git a/src/app/pages/chat/messages/messages.page.html b/src/app/pages/chat/messages/messages.page.html index ae936265a..ccb179623 100644 --- a/src/app/pages/chat/messages/messages.page.html +++ b/src/app/pages/chat/messages/messages.page.html @@ -52,7 +52,7 @@
- {{msg.u.name}} + {{msg.u.name}} {{msg.duration}}
diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index 9da3b7ed6..5f84d826b 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -856,6 +856,12 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { // dialogTitle: 'Share with buddies', // }); // } + + + hkellor() { + // alert('cool!') + } + } diff --git a/src/app/pages/gabinete-digital/event-list/event-list.page.ts b/src/app/pages/gabinete-digital/event-list/event-list.page.ts index 52ffc12d5..ba560742e 100644 --- a/src/app/pages/gabinete-digital/event-list/event-list.page.ts +++ b/src/app/pages/gabinete-digital/event-list/event-list.page.ts @@ -27,8 +27,8 @@ export class EventListPage implements OnInit { profile: string; segment: string; showLoader: boolean; - eventsPRList: any = [] - eventsMDGPRList: any = [] + eventsPRList: any = []; + eventsMDGPRList: any = []; eventPerson: EventPerson; eventBody: EventBody; categories: string[]; @@ -76,7 +76,7 @@ export class EventListPage implements OnInit { window.onresize = (event) => { // if not mobile remove all component - if (window.innerWidth <= 800) { + if (window.innerWidth < 701) { this.modalController.dismiss(); } }; @@ -85,13 +85,13 @@ export class EventListPage implements OnInit { getEventToAproveFromDB() { - + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { this.storage.get('event-to-aproveMD').then((events) => { this.eventsMDGPRList = events }) - + this.storage.get('event-to-aprovePR').then((events) => { this.eventsPRList = events }) @@ -99,17 +99,17 @@ export class EventListPage implements OnInit { this.platform.ready().then(() => { this.sqliteservice.getListOfEventAprove('Agenda Oficial MDGPR', 'Agenda Pessoal MDGPR').then((event: any[]) => { - + this.eventsMDGPRList = this.sortService.sortDate(this.transformaDataDB(event), 'taskStartDate') //this.eventsMDGPRList = this.eventsMDGPRList.filter(element => element.interveners != null) console.log('MD event to aprove', this.eventsMDGPRList) - + }) - + this.sqliteservice.getListOfEventAprove('Agenda Oficial PR', 'Agenda Pessoal PR').then((event: any[]) => { this.eventsPRList = this.sortService.sortDate(this.transformaDataDB(event), 'taskStartDate') console.log('PR event to aprove', this.eventsPRList) - + }) }) diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 5ff574166..c96c68dd3 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -102,8 +102,8 @@ export class LoginPage implements OnInit { if (attempt) { if (attempt.UserId == SessionStore.user.UserId) { await this.authService.SetSession(attempt, this.userattempt); - //await this.authService.loginChat(); - //await this.authService.loginToChatWs() + // await this.authService.loginChat(); + // await this.authService.loginToChatWs() this.getToken(); SessionStore.setInativity(true); @@ -117,12 +117,14 @@ export class LoginPage implements OnInit { await this.authService.SetSession(attempt, this.userattempt); this.changeProfileService.run() - /* await this.authService.loginChat(); - await this.authService.loginToChatWs() */ + // await this.authService.loginChat(); + // await this.authService.loginToChatWs() this.getToken(); this.router.navigateByUrl('/pin', { replaceUrl: true }); } - + } + else{ + this.toastService._badRequest('Ocorreu um problema por favor valide o username e password'); } } else { diff --git a/src/app/pages/publications/publications.page.ts b/src/app/pages/publications/publications.page.ts index 1cc20f8e8..77f1df29a 100644 --- a/src/app/pages/publications/publications.page.ts +++ b/src/app/pages/publications/publications.page.ts @@ -11,8 +11,6 @@ import { Publication } from 'src/app/models/publication'; import { ActionsOptionsPage } from 'src/app/shared/popover/actions-options/actions-options.page'; import { EditActionPage } from './edit-action/edit-action.page'; import { ToastService } from 'src/app/services/toast.service'; -import { PublicationEventFolderStorage } from 'src/app/store/publication-event-folder.service'; -import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service'; import { SqliteService } from 'src/app/services/sqlite.service'; import { BackgroundService } from 'src/app/services/background.service'; import { ThemeService } from 'src/app/services/theme.service' @@ -39,8 +37,6 @@ export class PublicationsPage implements OnInit { months: string[]; days: string[]; - publicationEventFolderStorage = PublicationEventFolderStorage - publicationTravelFolderService = PublicationTravelFolderStore desktopComponent: any = { showViewPublication: false, diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts index 1b2827755..b8c63dfb3 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -5,9 +5,6 @@ import { Publication } from 'src/app/models/publication'; import { PublicationFolder } from 'src/app/models/publicationfolder'; import { PublicationPipe } from 'src/app/pipes/publication.pipe'; import { PublicationsService } from 'src/app/services/publications.service'; -import { PublicationEventFolderStorage } from 'src/app/store/publication-event-folder.service'; -import { PublicationListStorage } from 'src/app/store/publication-list.service'; -import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service'; import { NewPublicationPage } from '../new-publication/new-publication.page'; import { PublicationDetailPage } from './publication-detail/publication-detail.page'; import { SqliteService } from 'src/app/services/sqlite.service'; @@ -32,11 +29,6 @@ export class ViewPublicationsPage implements OnInit { id: string; error: any; - publicationListStorage = PublicationListStorage - // - publicationEventFolderStorage = PublicationEventFolderStorage - publicationTravelFolderService = PublicationTravelFolderStore - publicationPipe = new PublicationPipe() publicationDitails: any; getpublication = []; @@ -170,7 +162,6 @@ export class ViewPublicationsPage implements OnInit { this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList)); console.log('PUBLICATIONS IMAGEs',this.publicationList) - this.publicationListStorage.add(folderId, this.publicationList) this.getpublication = this.publicationList; this.showLoader = false; @@ -210,7 +201,6 @@ export class ViewPublicationsPage implements OnInit { }); this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList)); - this.publicationListStorage.add(folderId, this.publicationList) this.getpublication = this.publicationList; this.showLoader = false; @@ -222,7 +212,6 @@ export class ViewPublicationsPage implements OnInit { if (error.status == '404') { this.error = 'Sem publicações disponíveis!'; this.publicationList = []; - this.publicationListStorage.add(folderId, this.publicationList) } this.showLoader = false; }); diff --git a/src/app/services/alert.service.ts b/src/app/services/alert.service.ts index 4c58508a2..48fe9d8ff 100644 --- a/src/app/services/alert.service.ts +++ b/src/app/services/alert.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@angular/core'; import { AlertController, AnimationController } from '@ionic/angular'; -import { ChatService } from './chat.service'; import { WsChatMethodsService } from './chat/ws-chat-methods.service'; import { ToastService } from './toast.service'; @@ -12,7 +11,6 @@ export class AlertService { constructor( public alertController: AlertController, private animationController: AnimationController, - private chatService: ChatService, private toastService: ToastService, public wsChatMethodsService: WsChatMethodsService, ) { } @@ -59,7 +57,7 @@ export class AlertService { text: 'Apagar', handler: () => { //const loader = this.toastService.loading(); - + this.wsChatMethodsService.deleteMessage(msgId).then(()=>{ room.deleteMessage(msgId) }) diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index aee17f236..b41ccd40c 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -56,9 +56,9 @@ export class AuthService { } - if (localStorage.getItem("userChat") != null) { + /* if (localStorage.getItem("userChat") != null) { this.ValidatedUserChat = JSON.parse(localStorage.getItem('userChat')); - } + } */ } @@ -112,7 +112,7 @@ export class AuthService { //user: UserForm async loginChat() { - const expirationMinutes = 30; + /* const expirationMinutes = 30; let date = new Date().getTime(); let expirationDate = new Date(new Date().getTime() + expirationMinutes*60*1000); @@ -135,7 +135,7 @@ export class AuthService { this.presentAlert('Network error'); } - this.autoLoginChat(expirationDate.getTime() - date); + this.autoLoginChat(expirationDate.getTime() - date); */ } async autoLoginChat(expirationDate:number){ @@ -145,7 +145,7 @@ export class AuthService { } loginToChatWs() { - setTimeout(()=>{ + /* setTimeout(()=>{ this.WsChatService.connect(); this.WsChatService.login().then((message) => { @@ -189,14 +189,12 @@ export class AuthService { console.log(e) return false } - } } return false } - this.NfService.downloadFileMsg = async (message: MessageService, room?: RoomService) => { console.log('FILE TYPE', message.file.type) @@ -224,18 +222,13 @@ export class AuthService { }); return true } - return false - } }; - - - - }, 1) + }, 1) */ } - autologout(expirationDate:number){ + autologout(expirationDate:number) { setTimeout(()=>{ this.logout(); }, expirationDate) @@ -255,13 +248,13 @@ export class AuthService { } //Get user data from RocketChat | global object - getUserData(){ + getUserData() { this.storageService.get(AuthConnstants.AUTH).then(res=>{ this.userData$.next(res); }); } - logoutChat(){ + logoutChat() { //this.storageService.clear(); /* this.storageService.removeStorageItem(AuthConnstants.AUTH).then(res =>{ this.userData$.next(''); diff --git a/src/app/services/chat/message.service.ts b/src/app/services/chat/message.service.ts index 74e52a2e8..f181a90a7 100644 --- a/src/app/services/chat/message.service.ts +++ b/src/app/services/chat/message.service.ts @@ -18,7 +18,13 @@ export class MessageService { msg = '' rid = '' ts = {} - u = {} + + u = { + name: '', + username: '', + _id: "" + } + t = '' _id ='' _updatedAt @@ -35,6 +41,8 @@ export class MessageService { loadHistory = false duration = '' localReference = null + viewed = [] + received = [] constructor(private storage: Storage, private NfService: NfService, @@ -78,6 +86,7 @@ export class MessageService { } } + this.calDateDuration() } @@ -140,9 +149,9 @@ export class MessageService { console.log('message', message) let ChatMessage = message.result - + if (environment.chatOffline) { - // this.redefinedMessage(ChatMessage) + this.redefinedMessage(ChatMessage) this.offline = false } @@ -189,5 +198,47 @@ export class MessageService { this.duration = showDateDuration(date || this._updatedAt); } + private messageReceptor() { + return this.u.username != SessionStore.user.RochetChatUser + } + + receptorReceive() { + + if(this.messageReceptor()) { + let newMessage = { + rid: this._id, + msg: this.msg, + attachments: this.attachments, + file: this.file, + localReference: this.localReference, + viewed: this.viewed.push('123'), + received: this.viewed.push('123'), + } + + this.WsChatService.updateMessage(newMessage).then(()=>{ + console.log('newMessage', newMessage) + }) + } + + } + + receptorView() { + if(this.messageReceptor()) { + let newMessage = { + rid: this._id, + msg: this.msg, + attachments: this.attachments, + file: this.file, + localReference: this.localReference, + viewed: this.viewed.push('123'), + received: this.viewed.push('123'), + } + + this.WsChatService.updateMessage(newMessage).then(()=>{ + console.log('newMessage', newMessage) + }) + } + + } } diff --git a/src/app/services/chat/room.service.ts b/src/app/services/chat/room.service.ts index 925b26eea..d6a3aba39 100644 --- a/src/app/services/chat/room.service.ts +++ b/src/app/services/chat/room.service.ts @@ -201,6 +201,40 @@ export class RoomService { }) } + } + + async updateViewedMessage(id, userId) { + if (environment.chatOffline) { + this.storage.get('chatmsg' + this.id).then((messages: any = []) => { + if(!Array.isArray(messages)) { + messages = [] + } + + let index; + const find = messages.find((message, _index)=> { + + if(message._id == id) { + index = _index + return true + } + + return false + }) + + if(find) { + + if(!messages[index].hasOwnProperty('viewed') || !Array.isArray(messages[index].viewed)) { + messages.viewed = [] + } + + messages.viewed.push(userId) + this.storage.set('chatmsg' + this.id, messages) + + } + + }) + } + } /** @@ -279,11 +313,16 @@ export class RoomService { attachments, file, temporaryData, - localReference + localReference, + viewed: [], + received: [] } const message: MessageService = this.prepareMessage(offlineChatMessage, environment.chatOffline) + /** + * @description redefine message offline data "offlineChatMessage" with live ChatMessage + */ message.send().then((ChatMessage) => { this.updateMessageDB(ChatMessage, localReference) }) @@ -305,6 +344,13 @@ export class RoomService { this.message= '' } + + /** + * + * @param message + * @param ChatMessage + * @description when creating message we use offline data, then we need redefined with live data + */ redefinedMessage (message: MessageService, ChatMessage) { ChatMessage = this.fix_updatedAt(ChatMessage) @@ -448,7 +494,12 @@ export class RoomService { } - + /** + * @description find or create message + * @param message + * @param save + * @returns + */ prepareMessage(message, save = true): MessageService { message = this.fix_updatedAt(message) const wewMessage = new MessageService(this.storage, this.NfService, this.WsChatService) diff --git a/src/app/services/chat/ws-chat-methods.service.ts b/src/app/services/chat/ws-chat-methods.service.ts index 8dda00329..d72196724 100644 --- a/src/app/services/chat/ws-chat-methods.service.ts +++ b/src/app/services/chat/ws-chat-methods.service.ts @@ -22,8 +22,8 @@ export class WsChatMethodsService { dm: {[key: string]: RoomService} = {} group: {[key: string]: RoomService} = {} - _dm = [] - _group = [] + _dm: RoomService[] = [] + _group: RoomService[] = [] loadingWholeList = false @@ -71,7 +71,9 @@ export class WsChatMethodsService { } }) - this.changeProfileService.registerCallback(()=>{ + + // on change profile remove a rooms + this.changeProfileService.registerCallback(() => { this.clearChat() this.ReLoadChat() this.storage.remove('Rooms'); @@ -142,13 +144,6 @@ export class WsChatMethodsService { this.users = [] } - getRoomFromDb() { - this.storage.get('Rooms').then((rooms) => { - rooms.result.update.forEach((roomData: room) => { - this.prepareRoom(roomData); - }); - }) - } openRoom(roomId) { @@ -186,7 +181,6 @@ export class WsChatMethodsService { async getAllRooms () { this.loadingWholeList = true - //this.getRoomFromDb(); const rooms = await this.WsChatService.getRooms(); await this.storage.remove('Rooms'); await this.storage.set('Rooms', rooms); @@ -266,6 +260,9 @@ export class WsChatMethodsService { prepareRoom(roomData) { + /** + * @description data used to define or create room + */ const setData = { customFields: roomData.customFields, id: this.getRoomId(roomData), @@ -277,13 +274,16 @@ export class WsChatMethodsService { let roomId = this.getRoomId(roomData) - if(!this.dm[roomId] && !this.group[roomId]) { + // create room + if(!this.roomExist(roomId)) { let room:RoomService = new RoomService(this.WsChatService, new MessageService(this.storage, this.NfService, this.WsChatService), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService) room.setData(setData) room.receiveMessage() room.getAllUsers = this.getUsers room.receiveMessageDelete(); room.sortRoomList = this.sortRoomList + + // create individual room if(this.isIndividual(roomData)) { @@ -292,12 +292,16 @@ export class WsChatMethodsService { this.dmCount++ } else { + // create group room + this.group[roomId] = room this._group.push(room) this.groupCount++ } } else { + // in this case room is already present, therefor it will only be necessary, + // to redefine if(this.dm[roomId]) { this.dm[roomId].setData(setData) @@ -306,11 +310,11 @@ export class WsChatMethodsService { } } - - } - + roomExist(roomId) { + return this.dm[roomId] && this.group[roomId] + } getReceptorName(roomData) { try { @@ -326,20 +330,20 @@ export class WsChatMethodsService { */ private getUserStatus(id?:string) { - // this.WsChatService.getUserStatus((d) => { + this.WsChatService.getUserStatus((d) => { - // const username = d.fields.args[0][1] - // const statusNum = d.fields.args[0][2] + const username = d.fields.args[0][1] + const statusNum = d.fields.args[0][2] - // const statusText = this.statusNumberToText(statusNum) + const statusText = this.statusNumberToText(statusNum) - // const user = this.getUserByName(username) + const user = this.getUserByName(username) - // if(user) { - // user.status = statusText - // } + if(user) { + user.status = statusText + } - // }) + }) } @@ -393,8 +397,11 @@ export class WsChatMethodsService { } hidingRoom(id?) { - //this.hideRoom(id); - return this.WsChatService.hidingRoom(id); + + return this.WsChatService.hidingRoom(id).then(()=>{ + // this.hideRoom(id) + }) + } addRoomOwner(roomid, userId){ @@ -420,7 +427,7 @@ export class WsChatMethodsService { getRoomName(roomData: room) { if(this.isIndividual(roomData)) { const names: String[] = roomData.usernames - const roomName = names.filter((name)=>{ + const roomName = names.filter((name, index)=>{ return name != SessionStore.user.RochetChatUser })[0] diff --git a/src/app/services/chat/ws-chat.service.ts b/src/app/services/chat/ws-chat.service.ts index e22c81891..f0f1911bc 100644 --- a/src/app/services/chat/ws-chat.service.ts +++ b/src/app/services/chat/ws-chat.service.ts @@ -186,6 +186,29 @@ export class WsChatService { }); } + updateMessage(messageObject) { + + const requestId = uuidv4() + var message = { + msg: "method", + method: "updateMessage", + id: requestId, + params: [messageObject] + } + + 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, requestId}) + return true + } + }}) + }) + + } + leaveRoom(roomId) { const requestId = uuidv4() diff --git a/src/app/services/events/edit-event/edit-event.page.ts b/src/app/services/events/edit-event/edit-event.page.ts index 3a987dea9..df6574c35 100644 --- a/src/app/services/events/edit-event/edit-event.page.ts +++ b/src/app/services/events/edit-event/edit-event.page.ts @@ -7,7 +7,6 @@ import { EventBody } from 'src/app/models/eventbody.model'; import { AlertController, ModalController } from '@ionic/angular'; import { EventPerson } from 'src/app/models/eventperson.model'; import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.page'; -import { AlertService } from 'src/app/services/alert.service'; import { Attachment } from 'src/app/models/attachment.model'; import { AttachmentsService } from 'src/app/services/attachments.service'; import { FormGroup, FormBuilder, Validators } from "@angular/forms"; @@ -35,19 +34,18 @@ export class EditEventPage implements OnInit { profile:string; constructor( - public formBuilder: FormBuilder, - public alertController: AlertController, - private router: Router, - private activatedRoute: ActivatedRoute, - private eventsService: EventsService, + public formBuilder: FormBuilder, + public alertController: AlertController, + private router: Router, + private activatedRoute: ActivatedRoute, + private eventsService: EventsService, private modalCtrl: ModalController, - private alertService: AlertService, private attachamentsService: AttachmentsService, private route: Router, - private iab: InAppBrowser) { + private iab: InAppBrowser) { this.loadedEvent = new Event(); this.loadedEvent.Body = new EventBody(); - + } ngOnInit() { @@ -73,7 +71,7 @@ export class EditEventPage implements OnInit { this.pageId = paramMap.get('eventId'); eventid = paramMap.get('eventId'); console.log(eventid); - + } if (paramMap.has("caller")){ this.backURL = "/home/" + paramMap.get('caller'); @@ -99,7 +97,7 @@ export class EditEventPage implements OnInit { modal.onDidDismiss().then((data) => { if (data['data'] != null) - { + { let newattendees: EventPerson[] = data['data']; this.loadedEvent.Attendees = newattendees; } @@ -142,20 +140,20 @@ export class EditEventPage implements OnInit { Delete() { - this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => + this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => { const alert = await this.alertController.create({ cssClass: 'my-custom-class', header: 'Evento removido', buttons: ['OK'] }); - + setTimeout(()=>{ alert.dismiss(); }, 1500); this.router.navigate(['/home/events']); - }); + }); } Save() @@ -165,18 +163,18 @@ export class EditEventPage implements OnInit { this.activatedRoute.paramMap.subscribe(paramMap =>{ if (paramMap.has("profile")){ console.log(paramMap.get('profile')); - + } }); - this.eventsService.editEvent(this.loadedEvent, 2, 3).subscribe(async () => + this.eventsService.editEvent(this.loadedEvent, 2, 3).subscribe(async () => { const alert = await this.alertController.create({ cssClass: 'my-custom-class', header: 'Evento actualizado', buttons: ['OK'] }); - + setTimeout(()=>{ alert.dismiss(); }, 1500); @@ -184,18 +182,14 @@ export class EditEventPage implements OnInit { } } - showAlert(){ - this.alertService.presentAlert("Funcionalidade em desenvolvimento"); - } - loadAttachments() - { + { /* console.log(this.pageId); */ - + this.attachamentsService.getAttachmentsById(this.pageId).subscribe(res => { this.loadedEventAttachments = res; console.log(res); - + }); } async viewDocument(documenturl:string) @@ -230,12 +224,12 @@ export class EditEventPage implements OnInit { cssClass: 'attachments', backdropDismiss: false }); - + await modal.present(); - + modal.onDidDismiss().then((data) => { if (data['data'] != null) - { + { let newattendees: EventPerson[] = data['data']; this.loadedEvent.Attendees = newattendees; } diff --git a/src/app/services/events/event-detail-modal/event-detail-modal.page.ts b/src/app/services/events/event-detail-modal/event-detail-modal.page.ts index efbed2dee..a813d050a 100644 --- a/src/app/services/events/event-detail-modal/event-detail-modal.page.ts +++ b/src/app/services/events/event-detail-modal/event-detail-modal.page.ts @@ -6,7 +6,6 @@ import { Attachment } from 'src/app/models/attachment.model'; import { Event } from 'src/app/models/event.model'; import { EventBody } from 'src/app/models/eventbody.model'; import { EventPerson } from 'src/app/models/eventperson.model'; -import { AlertService } from 'src/app/services/alert.service'; import { AttachmentsService } from 'src/app/services/attachments.service'; import { EventsService } from 'src/app/services/events.service'; import { AttachmentsPage } from '../attachments/attachments.page'; @@ -32,15 +31,14 @@ export class EventDetailModalPage implements OnInit { profile:string; constructor( - public formBuilder: FormBuilder, - public alertController: AlertController, - private router: Router, - private activatedRoute: ActivatedRoute, - private eventsService: EventsService, + public formBuilder: FormBuilder, + public alertController: AlertController, + private router: Router, + private activatedRoute: ActivatedRoute, + private eventsService: EventsService, private modalCtrl: ModalController, - private alertService: AlertService, private attachamentsService: AttachmentsService, - private route: Router,) { + private route: Router,) { this.loadedEvent = new Event(); this.loadedEvent.Body = new EventBody(); } @@ -75,7 +73,7 @@ export class EventDetailModalPage implements OnInit { this.pageId = paramMap.get('eventId'); eventid = paramMap.get('eventId'); console.log(eventid); - + } if (paramMap.has("caller")){ this.backURL = "/home/" + paramMap.get('caller'); @@ -101,7 +99,7 @@ export class EventDetailModalPage implements OnInit { modal.onDidDismiss().then((data) => { if (data['data'] != null) - { + { let newattendees: EventPerson[] = data['data']; this.loadedEvent.Attendees = newattendees; } @@ -144,35 +142,35 @@ export class EventDetailModalPage implements OnInit { Delete() { - this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => + this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => { const alert = await this.alertController.create({ cssClass: 'my-custom-class', header: 'Evento removido', buttons: ['OK'] }); - + setTimeout(()=>{ alert.dismiss(); }, 1500); this.router.navigate(['/home/events']); - }); + }); } Save() { - if (this.ionicForm.valid) + if (this.ionicForm.valid) { - this.eventsService.putEvent(this.loadedEvent, 2, 3, "md").subscribe(async () => + this.eventsService.putEvent(this.loadedEvent, 2, 3, "md").subscribe(async () => { const alert = await this.alertController.create({ cssClass: 'my-custom-class', header: 'Evento actualizado', buttons: ['OK'] }); - + setTimeout(()=>{ alert.dismiss(); }, 1500); @@ -180,21 +178,17 @@ export class EventDetailModalPage implements OnInit { } } - showAlert(){ - this.alertService.presentAlert("Funcionalidade em desenvolvimento"); - } - loadAttachments() - { + { /* this.attachamentsService.getEventAttachments(this.pageId).subscribe(attachments => { this.loadedEventAttachments = attachments; }); */ this.attachamentsService.getAttachmentsById(this.pageId).subscribe(res => { console.log(res); - + },(error) => { console.log(error); - + }); } async viewDocument(documenturl:string) @@ -234,7 +228,7 @@ export class EventDetailModalPage implements OnInit { modal.onDidDismiss().then((data) => { if (data['data'] != null) - { + { let newattendees: EventPerson[] = data['data']; this.loadedEvent.Attendees = newattendees; } diff --git a/src/app/services/events/event-detail/event-detail.page.ts b/src/app/services/events/event-detail/event-detail.page.ts index 9429e9222..67858c507 100644 --- a/src/app/services/events/event-detail/event-detail.page.ts +++ b/src/app/services/events/event-detail/event-detail.page.ts @@ -7,7 +7,6 @@ import { EventBody } from 'src/app/models/eventbody.model'; import { AlertController, ModalController } from '@ionic/angular'; import { EventPerson } from 'src/app/models/eventperson.model'; import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.page'; -import { AlertService } from 'src/app/services/alert.service'; import { Attachment } from 'src/app/models/attachment.model'; import { AttachmentsService } from 'src/app/services/attachments.service'; import { FormGroup, FormBuilder, Validators } from "@angular/forms"; @@ -36,16 +35,15 @@ export class EventDetailPage implements OnInit { constructor( - public formBuilder: FormBuilder, - public alertController: AlertController, - private router: Router, - private activatedRoute: ActivatedRoute, - private eventsService: EventsService, + public formBuilder: FormBuilder, + public alertController: AlertController, + private router: Router, + private activatedRoute: ActivatedRoute, + private eventsService: EventsService, private modalCtrl: ModalController, - private alertService: AlertService, private attachamentsService: AttachmentsService, private route: Router, - private iab: InAppBrowser) { + private iab: InAppBrowser) { this.loadedEvent = new Event(); this.loadedEvent.Body = new EventBody(); } @@ -73,7 +71,7 @@ export class EventDetailPage implements OnInit { this.pageId = paramMap.get('eventId'); eventid = paramMap.get('eventId'); console.log(eventid); - + } if (paramMap.has("caller")){ this.backURL = "/home/" + paramMap.get('caller'); @@ -99,7 +97,7 @@ export class EventDetailPage implements OnInit { modal.onDidDismiss().then((data) => { if (data['data'] != null) - { + { let newattendees: EventPerson[] = data['data']; this.loadedEvent.Attendees = newattendees; } @@ -142,18 +140,18 @@ export class EventDetailPage implements OnInit { Delete() { - this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => + this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => { /* const alert = await this.alertController.create({ cssClass: 'my-custom-class', header: 'Evento removido', buttons: ['OK'] }); - + await alert.present(); */ this.router.navigate(['/home/events']); - }); + }); } Save() @@ -163,18 +161,18 @@ export class EventDetailPage implements OnInit { this.activatedRoute.paramMap.subscribe(paramMap =>{ if (paramMap.has("profile")){ console.log(paramMap.get('profile')); - + } }); - this.eventsService.editEvent(this.loadedEvent, 2, 3).subscribe(async () => + this.eventsService.editEvent(this.loadedEvent, 2, 3).subscribe(async () => { const alert = await this.alertController.create({ cssClass: 'my-custom-class', header: 'Evento actualizado', buttons: ['OK'] }); - + setTimeout(()=>{ alert.dismiss(); }, 1500); @@ -182,18 +180,14 @@ export class EventDetailPage implements OnInit { } } - showAlert(){ - this.alertService.presentAlert("Funcionalidade em desenvolvimento"); - } - loadAttachments() - { + { /* console.log(this.pageId); */ - + this.attachamentsService.getAttachmentsById(this.pageId).subscribe(res => { this.loadedEventAttachments = res; console.log(res); - + }); } async viewDocument(documenturl:string) @@ -228,17 +222,17 @@ export class EventDetailPage implements OnInit { cssClass: 'attachments', backdropDismiss: false }); - + await modal.present(); - + modal.onDidDismiss().then((data) => { if (data['data'] != null) - { + { let newattendees: EventPerson[] = data['data']; this.loadedEvent.Attendees = newattendees; } }); } - + } diff --git a/src/app/services/events/events.page.ts b/src/app/services/events/events.page.ts index 079667c84..0bf1ea61c 100644 --- a/src/app/services/events/events.page.ts +++ b/src/app/services/events/events.page.ts @@ -4,7 +4,6 @@ import { Event } from '../../models/event.model'; import { EventsService } from 'src/app/services/events.service'; import { NavigationExtras, Router } from '@angular/router'; import { ActivatedRoute, NavigationEnd } from '@angular/router'; -import { AlertService } from 'src/app/services/alert.service'; import { AuthService } from 'src/app/services/auth.service'; import { StorageService } from 'src/app/services/storage.service'; import { ModalController, Platform } from '@ionic/angular'; @@ -78,7 +77,6 @@ export class EventsPage implements OnInit { private router: Router, private storageService:StorageService, public activatedRoute: ActivatedRoute, - private alertController: AlertService, private authService: AuthService, private processes:ProcessesService, /* private gabineteService: GabineteDigitalPage, */ diff --git a/src/app/services/route.service.ts b/src/app/services/route.service.ts index d1531e0e6..2f0c59440 100644 --- a/src/app/services/route.service.ts +++ b/src/app/services/route.service.ts @@ -1,6 +1,7 @@ import { Injectable } from '@angular/core'; -import { NavigationEnd, Router, NavigationStart } from '@angular/router'; - +import { NavigationEnd, Router, NavigationStart, NavigationExtras } from '@angular/router'; +import { LocalstoreService } from '../store/localstore.service'; +import { Location } from '@angular/common' @Injectable({ providedIn: 'root' @@ -8,11 +9,15 @@ import { NavigationEnd, Router, NavigationStart } from '@angular/router'; export class RouteService { history: any = []; - isGoBack = false; constructor( private router: Router, + private LocalstoreService: LocalstoreService, + private Location: Location ) { + + this.history = this.LocalstoreService.get('history', []) + this.router.events.forEach((event) => { if (event instanceof NavigationEnd) { @@ -20,6 +25,7 @@ export class RouteService { if(event.url != lastRoute) { this.history.push(event.url) + this.reduceHistory() } } @@ -30,23 +36,56 @@ export class RouteService { } /** - * @param url [string] incase no history to go back - * @param option [Object] some options to the url - */ - goBack(url = null, option: object = {}) { + * @param url [string] incase no history to go back */ + goBack(url = null) { if(this.history.length >= 2) { + console.log(this.history); + this.history.pop(); - const goTo = this.history.pop(); - this.isGoBack = true; - this.router.navigate([goTo]); + const url = this.history.pop(); + + this.goTo(url) + } else if(url) { - this.goTo({url}) + this.goTo(url) } + this.reduceHistory() } - goTo({url}) { - this.router.navigate([url]); + goTo(url) { + let navigationExtras: NavigationExtras = { + queryParams: this.queryParams(url) + } + + const urlObject = new URL('http://localhost:8100'+url); + this.router.navigate([urlObject.pathname], navigationExtras); + } + + + reduceHistory() { + if(this.history.length >= 15) { + this.history = this.history.slice(5, this.history.length) + } + this.LocalstoreService.set('history', this.history) + } + + + queryParams(url) { + + const urlObject = new URL('http://localhost:8100'+url); + + const paramsString = urlObject.search; + let searchParams: any = new URLSearchParams(paramsString); + let params = {} + + for (let [key, value] of searchParams) { + params[key] = value + } + + console.log('params', params) + return params + } } diff --git a/src/app/shared/agenda/approve-event/approve-event.page.ts b/src/app/shared/agenda/approve-event/approve-event.page.ts index c94d7daef..2e8985617 100644 --- a/src/app/shared/agenda/approve-event/approve-event.page.ts +++ b/src/app/shared/agenda/approve-event/approve-event.page.ts @@ -2,7 +2,6 @@ import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core'; import { NavigationExtras, Router } from '@angular/router'; import { ModalController, PopoverController } from '@ionic/angular'; import { Event } from 'src/app/models/event.model'; -import { AlertService } from 'src/app/services/alert.service'; import { AttachmentsService } from 'src/app/services/attachments.service'; import { ProcessesService } from 'src/app/services/processes.service'; import { EmendMessageModalPage } from 'src/app/pages/agenda/emend-message-modal/emend-message-modal.page'; @@ -47,7 +46,6 @@ export class ApproveEventPage implements OnInit { private processes:ProcessesService, private attachmentsService: AttachmentsService, private popoverController: PopoverController, - private alertService: AlertService, private iab: InAppBrowser, private toastService: ToastService, public ThemeService: ThemeService @@ -81,10 +79,6 @@ export class ApproveEventPage implements OnInit { } */ - notImplemented() { - this.alertService.presentAlert('Funcionalidade em desenvolvimento'); - } - close() { /* this.router.navigate(['/home/gabinete-digital/event-list']); */ this.closeEventToApprove.emit(); diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html index 65c1e02fb..b23e15fd4 100644 --- a/src/app/shared/chat/messages/messages.page.html +++ b/src/app/shared/chat/messages/messages.page.html @@ -48,11 +48,16 @@
- {{msg.u.name}} + {{msg.u.name}} {{msg.duration}}
-
- {{msg.msg}} +
+ {{msg.msg}} + + + + + {{last ? scrollToBottom() : ''}}
@@ -75,6 +80,11 @@
image + + + + +
@@ -99,6 +109,11 @@ {{msg.displayType}} + + + + +
diff --git a/src/app/shared/chat/messages/messages.page.scss b/src/app/shared/chat/messages/messages.page.scss index 5dc3040c6..6dd7ecd97 100644 --- a/src/app/shared/chat/messages/messages.page.scss +++ b/src/app/shared/chat/messages/messages.page.scss @@ -287,3 +287,29 @@ display: block; padding-left: 10px; } +.float-status{ + position: relative !important; + float: right; + display: flex; + align-items: self-end; +} + +.float-status-image{ + position: relative !important; + float: right; + display: flex; + align-items: self-end; + top: -15px; +} + +.float-status-webtrix { + position: relative !important; + top: 0px !important; + float: right; + display: flex; + align-items: self-end; +} + +.float-status-all { + font-size: 10pt !important; +} \ No newline at end of file diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 2b0328b67..7f43bdcbf 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -150,11 +150,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy }); } - - notImplemented() { - this.alertService.presentAlert('Funcionalidade em desenvolvimento'); - } - load = () => { this.checktimeOut = true; this.getChatMembers(); @@ -774,6 +769,12 @@ console.log(msg); } } + + + testEditMessage(msg:MessageService) { + msg.receptorReceive() + // alert('cool!') + } } diff --git a/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts b/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts index 047ba3e66..7c5f017f8 100644 --- a/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts +++ b/src/app/shared/gabinete-digital/diplomas-assinar/diplomas-assinar.page.ts @@ -3,7 +3,6 @@ import { NavigationStart, Router } from '@angular/router'; import { customTask, DailyWorkTask } from '../../../models/dailyworktask.model'; import { ProcessesService } from 'src/app/services/processes.service'; import { ModalController } from '@ionic/angular'; -import { AlertService } from 'src/app/services/alert.service'; import { DeplomasStore } from 'src/app/store/deplomas.service'; import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe'; import { SortService } from 'src/app/services/functions/sort.service'; @@ -27,7 +26,6 @@ export class DiplomasAssinarPage implements OnInit { constructor( private processes:ProcessesService, private modalController: ModalController, - private alertService: AlertService, private router: Router, private sortService: SortService, public ThemeService: ThemeService diff --git a/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts b/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts index b46dc541c..5e2264b06 100644 --- a/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts +++ b/src/app/shared/gabinete-digital/diplomas/diplomas.page.ts @@ -3,7 +3,6 @@ import { ActivatedRoute, NavigationEnd, NavigationExtras, NavigationStart, Route import { DailyWorkTask } from '../../../models/dailyworktask.model'; import { ProcessesService } from 'src/app/services/processes.service'; import { ModalController, NavParams } from '@ionic/angular'; -import { AlertService } from 'src/app/services/alert.service'; import { removeDuplicate } from 'src/plugin/removeDuplicate.js' import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe'; import { DeplomasStore } from 'src/app/store/deplomas.service'; @@ -32,7 +31,6 @@ customTaskPipe = new CustomTaskPipe() constructor( private processes:ProcessesService, private modalController: ModalController, - private alertService: AlertService, private router: Router, private activatedRoute: ActivatedRoute, public ThemeService: ThemeService, @@ -64,10 +62,6 @@ constructor( this.router.navigate(['/home/gabinete-digital/diplomas', serialNumber, 'gabinete-digital']); } - notImplemented(){ - this.alertService.presentAlert('Funcionalidade em desenvolvimento'); - } - async LoadList() { this.skeletonLoader = true; diff --git a/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts b/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts index 34a6c3042..363139958 100644 --- a/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts +++ b/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts @@ -18,8 +18,8 @@ import { Storage } from '@ionic/storage'; export class EventsToApprovePage implements OnInit { showLoader: boolean; - eventsPRList: any; - eventsMDGPRList: any; + eventsPRList: any = [] + eventsMDGPRList: any = [] eventPerson: EventPerson; eventBody: EventBody; categories: string[]; @@ -84,7 +84,7 @@ export class EventsToApprovePage implements OnInit { let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise(); this.eventsPRList = prEventsOficial.concat(prEventsPessoal); this.eventsPRList = this.sortService.sortArrayByDate(this.eventsPRList) - + this.storage.set('event-to-aprovePR',this.eventsPRList).then(() => { console.log(' EVENTPR TO APROVE SAVED') }) @@ -155,6 +155,10 @@ export class EventsToApprovePage implements OnInit { } close(){ this.modalController.dismiss(null); + + + + // this.RouteService.goBack('/home/gabinetedigital') } diff --git a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts index fc6b10e54..843db5601 100644 --- a/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts +++ b/src/app/shared/gabinete-digital/expedientes-pr/expedientes-pr.page.ts @@ -3,7 +3,6 @@ import { NavigationStart, Router } from '@angular/router'; import { customTask, DailyWorkTask } from '../../../models/dailyworktask.model'; import { ProcessesService } from 'src/app/services/processes.service'; import { ModalController } from '@ionic/angular'; -import { AlertService } from 'src/app/services/alert.service'; import { LoginUserRespose } from 'src/app/models/user.model'; import { AuthService } from 'src/app/services/auth.service'; import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe'; @@ -33,7 +32,6 @@ export class ExpedientesPrPage implements OnInit { constructor( private processes:ProcessesService, private modalController: ModalController, - private alertService: AlertService, private authService: AuthService, private router: Router, public ThemeService: ThemeService, @@ -77,7 +75,7 @@ export class ExpedientesPrPage implements OnInit { let task = this.expedienteTaskPipe.transform(element); this.taskslist.push(task); }); - + this.taskslist = this.sortService.sortDate(this.taskslist, 'CreateDate') this.expedienteGdStore.reset(this.taskslist); diff --git a/src/app/shared/gabinete-digital/expedients/expedients.page.ts b/src/app/shared/gabinete-digital/expedients/expedients.page.ts index 8c5696320..3f9eb25a7 100644 --- a/src/app/shared/gabinete-digital/expedients/expedients.page.ts +++ b/src/app/shared/gabinete-digital/expedients/expedients.page.ts @@ -1,7 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { NavigationStart, Router } from '@angular/router'; import { ProcessesService } from 'src/app/services/processes.service'; -import { AlertService } from 'src/app/services/alert.service'; import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service'; import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe'; import { ThemeService } from 'src/app/services/theme.service' @@ -27,7 +26,6 @@ export class ExpedientsPage implements OnInit { constructor( private processes: ProcessesService, - private alertService: AlertService, private router: Router, public ThemeService: ThemeService, private sortService: SortService, @@ -59,10 +57,6 @@ export class ExpedientsPage implements OnInit { this.LoadList(); } - notImplemented() { - this.alertService.presentAlert('Funcionalidade em desenvolvimento'); - } - LoadList() { this.skeletonLoader = true diff --git a/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts b/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts index a09f07014..cfd9fc9d1 100644 --- a/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts +++ b/src/app/shared/gabinete-digital/pedidos/pedidos.page.ts @@ -4,7 +4,6 @@ import { CalendarComponent } from 'ionic2-calendar'; import { customTask, DailyWorkTask } from '../../../models/dailyworktask.model'; import { ProcessesService } from 'src/app/services/processes.service'; import { ModalController } from '@ionic/angular'; -import { AlertService } from 'src/app/services/alert.service'; import { PedidoPage } from 'src/app/pages/gabinete-digital/pedidos/pedido/pedido.page'; import { PedidosStore } from 'src/app/store/pedidos-store.service'; import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe'; @@ -45,7 +44,6 @@ export class PedidosPage implements OnInit { private router: Router, private processes:ProcessesService, private modalController: ModalController, - private alertService: AlertService, private sortService: SortService, public ThemeService: ThemeService ) { diff --git a/src/app/shared/header/header.page.html b/src/app/shared/header/header.page.html index 34d0f448b..fb691770c 100644 --- a/src/app/shared/header/header.page.html +++ b/src/app/shared/header/header.page.html @@ -133,4 +133,5 @@
+ diff --git a/src/app/shared/header/header.page.ts b/src/app/shared/header/header.page.ts index b8d9446ec..d71c5512f 100644 --- a/src/app/shared/header/header.page.ts +++ b/src/app/shared/header/header.page.ts @@ -11,6 +11,7 @@ import { environment } from 'src/environments/environment'; import { EventTrigger } from '../../services/eventTrigger.service'; import { ThemeService } from '../../services/theme.service'; import { interval } from 'rxjs'; +import { RouteService } from 'src/app/services/route.service'; @Component({ selector: 'app-header', @@ -39,7 +40,8 @@ export class HeaderPage implements OnInit { private platform: Platform, //private notificationsService: NotificationsService, private eventrigger: EventTrigger, - public ThemeService: ThemeService + public ThemeService: ThemeService, + public RouteService: RouteService ) { this.loggeduser = SessionStore.user; router.events.subscribe((val) => { diff --git a/src/app/shared/popover/chat-options-popover/chat-options-popover.page.ts b/src/app/shared/popover/chat-options-popover/chat-options-popover.page.ts index c0d566d76..db75f4b19 100644 --- a/src/app/shared/popover/chat-options-popover/chat-options-popover.page.ts +++ b/src/app/shared/popover/chat-options-popover/chat-options-popover.page.ts @@ -4,7 +4,6 @@ import { EventPerson } from 'src/app/models/eventperson.model'; import { SearchList } from 'src/app/models/search-document'; import { NewEventPage } from 'src/app/pages/agenda/new-event/new-event.page'; import { SearchPage } from 'src/app/pages/search/search.page'; -import { AlertService } from 'src/app/services/alert.service'; import { environment } from 'src/environments/environment'; import { ThemeService } from 'src/app/services/theme.service' @@ -22,7 +21,6 @@ export class ChatOptionsPopoverPage implements OnInit { constructor( private popoverController: PopoverController, private modalController: ModalController, - private alertService: AlertService, private navParams: NavParams, public ThemeService: ThemeService ) { @@ -43,10 +41,6 @@ export class ChatOptionsPopoverPage implements OnInit { } - notImplemented(){ - this.alertService.presentAlert('Funcionalidade em desenvolvimento'); - } - takePicture(){ if( window.innerWidth < 701){ this.popoverController.dismiss('take-picture'); @@ -97,26 +91,6 @@ export class ChatOptionsPopoverPage implements OnInit { } - /* getGroupContacts(room:any){ - this.showLoader = true; - //If group is private call getGroupMembers - if(this.room.t === 'p'){ - this.chatService.getGroupMembers(this.roomId).subscribe(res=>{ - console.log(res); - this.members = res['members']; - this.showLoader = false; - }); - } - //Otherwise call getChannelMembers for públic groups - else{ - this.chatService.getChannelMembers(this.roomId).subscribe(res=>{ - console.log(res); - this.members = res['members']; - this.showLoader = false; - }); - } - } */ - async getDoc(){ const modal = await this.modalController.create({ diff --git a/src/app/shared/publication/view-publications/view-publications.page.ts b/src/app/shared/publication/view-publications/view-publications.page.ts index 6ebf25996..8fa8d4e7c 100644 --- a/src/app/shared/publication/view-publications/view-publications.page.ts +++ b/src/app/shared/publication/view-publications/view-publications.page.ts @@ -6,9 +6,6 @@ import { LoadingService } from 'src/app/services/loading.service'; import { PublicationsService } from 'src/app/services/publications.service'; import { NewPublicationPage } from 'src/app/pages/publications/new-publication/new-publication.page'; -import { PublicationListStorage } from 'src/app/store/publication-list.service' -import { PublicationEventFolderStorage } from 'src/app/store/publication-event-folder.service'; -import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service'; import { PublicationPipe } from 'src/app/pipes/publication.pipe'; import { ThemeService } from 'src/app/services/theme.service' import { ToastService } from 'src/app/services/toast.service'; @@ -38,11 +35,6 @@ export class ViewPublicationsPage implements OnInit { @Output() goBacktoPublicationDetails = new EventEmitter(); - publicationListStorage = PublicationListStorage - // - publicationEventFolderStorage = PublicationEventFolderStorage - publicationTravelFolderService = PublicationTravelFolderStore - publicationPipe = new PublicationPipe() constructor( @@ -136,7 +128,6 @@ export class ViewPublicationsPage implements OnInit { this.storage.set('view_publications', this.publicationList); console.log('PUBLICATIONS IMAGEs',this.publicationList) - this.publicationListStorage.add(folderId, this.publicationList) this.getpublication = this.publicationList; this.showLoader = false; },() => { @@ -162,7 +153,6 @@ export class ViewPublicationsPage implements OnInit { this.publicationList.push(item); }); - this.publicationListStorage.add(folderId, this.publicationList) await this.storage.remove('view_publications'); await this.storage.set('view_publications', this.publicationList); //this.getFromDB(); @@ -172,7 +162,6 @@ export class ViewPublicationsPage implements OnInit { if(error.status == '404') { this.error = 'Sem publicações disponíveis!'; this.publicationList= []; - this.publicationListStorage.add(folderId, this.publicationList) } this.showLoader = false; diff --git a/src/app/store/publication-event-folder.service.ts b/src/app/store/publication-event-folder.service.ts deleted file mode 100644 index edd57c397..000000000 --- a/src/app/store/publication-event-folder.service.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Injectable } from '@angular/core'; -import { localstoreService } from './localstore.service' -import { SHA1 } from 'crypto-js' -import { PublicationFolder } from '../models/publicationfolder'; - -@Injectable({ - providedIn: 'root' -}) -export class PublicationEventFolderService { - // main data - private _list: PublicationFolder[] = [] - // local storage keyName - private keyName: string; - - constructor() { - - this.keyName = (SHA1(this.constructor.name+ 'PublicationEventFolder/local')).toString() - - setTimeout(()=>{ - let restore = localstoreService.get(this.keyName, []) - this._list = restore.list || [] - }, 10) - - } - - get list() { - return this._list || [] - } - - reset(list: PublicationFolder[]) { - this._list = list || [] - - this.save() - } - - private save() { - setTimeout(()=> { - localstoreService.set(this.keyName, { - list: this._list || [] - }) - }, 10) - } -} - -export const PublicationEventFolderStorage = new PublicationEventFolderService() diff --git a/src/app/store/publication-list.service.spec.ts b/src/app/store/publication-list.service.spec.ts deleted file mode 100644 index c87726648..000000000 --- a/src/app/store/publication-list.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { PublicationListService } from './publication-list.service'; - -describe('PublicationListService', () => { - let service: PublicationListService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(PublicationListService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/src/app/store/publication-list.service.ts b/src/app/store/publication-list.service.ts deleted file mode 100644 index 093f4f763..000000000 --- a/src/app/store/publication-list.service.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { Injectable } from '@angular/core' -import { localstoreService } from './localstore.service' -import { SHA1 } from 'crypto-js' - -@Injectable({ - providedIn: 'root' -}) -export class PublicationListService { - - // main data - private _document = {} - // local storage keyName - private keyName: string; - - constructor() { - - this.keyName = (SHA1(this.constructor.name+ 'view-publication-list/local')).toString() - - setTimeout(()=>{ - let restore = localstoreService.get(this.keyName, {}) - this._document = restore.document || {} - }, 10) - - } - - get documents() { - return this._document - } - - getDocument(folderId) { - return this._document[folderId] - } - - - add(folderId, document = []) { - this._document[folderId] = document - - - - setTimeout(()=> { - localstoreService.set(this.keyName, { - document: this._document - }) - }, 100) - } - -} - - -export const PublicationListStorage = new PublicationListService() diff --git a/src/app/store/publication-travel-folder.service.spec.ts b/src/app/store/publication-travel-folder.service.spec.ts deleted file mode 100644 index 19bfb9971..000000000 --- a/src/app/store/publication-travel-folder.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { PublicationTravelFolderService } from './publication-travel-folder.service'; - -describe('PublicationTravelFolderService', () => { - let service: PublicationTravelFolderService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(PublicationTravelFolderService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/src/app/store/publication-travel-folder.service.ts b/src/app/store/publication-travel-folder.service.ts deleted file mode 100644 index 6497f0c93..000000000 --- a/src/app/store/publication-travel-folder.service.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Injectable } from '@angular/core'; -import { localstoreService } from './localstore.service' -import { SHA1 } from 'crypto-js' -import { Publication } from 'src/app/models/publication'; -import { PublicationFolder } from '../models/publicationfolder'; - -@Injectable({ - providedIn: 'root' -}) -export class PublicationTravelFolderService { - - // main data - private _list: PublicationFolder[] = [] - // local storage keyName - private keyName: string; - - constructor() { - - this.keyName = (SHA1(this.constructor.name+ ' PublicationTravelFolder/local')).toString() - - setTimeout(()=>{ - let restore = localstoreService.get(this.keyName, []) - this._list = restore.list - }, 10) - - } - - get list() { - return this._list - } - - reset(list: PublicationFolder[]) { - this._list = list - - this.save(this._list) - } - - private save(list: PublicationFolder[]) { - setTimeout(()=> { - localstoreService.set(this.keyName, { - list: this._list - }) - }, 10) - } -} - - -export const PublicationTravelFolderStore = new PublicationTravelFolderService() \ No newline at end of file diff --git a/src/assets/images/check-double-solid -viewed.svg b/src/assets/images/check-double-solid -viewed.svg new file mode 100644 index 000000000..b193997b3 --- /dev/null +++ b/src/assets/images/check-double-solid -viewed.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/assets/images/check-double-solid.svg b/src/assets/images/check-double-solid.svg new file mode 100644 index 000000000..6fc3d2b54 --- /dev/null +++ b/src/assets/images/check-double-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/images/check-solid.svg b/src/assets/images/check-solid.svg new file mode 100644 index 000000000..181ee76f9 --- /dev/null +++ b/src/assets/images/check-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 6bf93dabc..6ed05505b 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -5,15 +5,15 @@ export const environment = { production: false, apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/', - //apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/', - apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/', - apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', + // apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/', + apiChatUrl: 'https://gpr-dev-01.gabinetedigital.local/api/v1/', + apiWsChatUrl: 'ws://gpr-dev-01.gabinetedigital.local/websocket', //apiChatUrl: 'https://www.tabularium.pt/api/v1/', /* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */ domain: 'gabinetedigital.local', //gabinetedigital.local defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local defaultuserpwd: 'tabteste@006', //tabteste@006, - chatOffline: false + chatOffline: true }; /* diff --git a/test/login.spec.ts b/test/login.spec.ts index 941388008..dc9b6ced5 100644 --- a/test/login.spec.ts +++ b/test/login.spec.ts @@ -87,8 +87,8 @@ describe('Puppeteer tests', () => { await page.type('input[type="password"]', environment.defaultuserpwd); // click and wait for navigation await Promise.all([ - page.click('.btn-ok'), - // page.waitForNavigation({ waitUntil: 'networkidle0' }), + page.click('.btn-ok'), + // page.waitForNavigation({ waitUntil: 'networkidle0' }), ]); await page.waitForSelector('.circle') diff --git a/workspace.code-workspace b/workspace.code-workspace new file mode 100644 index 000000000..e238bd67d --- /dev/null +++ b/workspace.code-workspace @@ -0,0 +1,15 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "..\\powercon" + } + ], + "settings": { + "cSpell.words": [ + "Chatmessage" + ] + } +} \ No newline at end of file