-
-
+
@@ -54,7 +53,7 @@
-
+
diff --git a/src/app/modals/delegar/delegar.page.ts b/src/app/modals/delegar/delegar.page.ts index 81e57b3ca..93304a383 100644 --- a/src/app/modals/delegar/delegar.page.ts +++ b/src/app/modals/delegar/delegar.page.ts @@ -97,7 +97,7 @@ export class DelegarPage implements OnInit { let body = { "SerialNumber": this.task.SerialNumber, "DispatchDocId": this.task.DocId, - "FolderID": this.task.FolderId, + "FolderID": this.task.FolderId || this.task.FolderID, "Subject": this.task.Folio, "Comment": this.note, "DelegatedUserEmail": this.taskParticipants[0].EmailAddress, diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts index 57f7bffcb..54e8f0905 100644 --- a/src/app/modals/profile/profile.page.ts +++ b/src/app/modals/profile/profile.page.ts @@ -1,5 +1,3 @@ -/// -/* /// */ import { Component, OnInit, NgZone } from '@angular/core'; import { Router, NavigationExtras } from '@angular/router'; import { AnimationController, ModalController,Platform } from '@ionic/angular'; @@ -132,7 +130,7 @@ export class ProfilePage implements OnInit { Status: element.Status } } - + this.DataArray.push(notificationObject) }); @@ -168,7 +166,7 @@ export class ProfilePage implements OnInit { else if (Service === "agenda" && Object === "event-list") { //this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'agenda'])); this.zone.run(() =>this.router.navigate(['/home/agenda/event-list/approve-event',IdObject, 'agenda'])); - + } else if (Service === "gabinete-digital" && Object === "despachos") { this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', IdObject, 'gabinete-digital'], { replaceUrl: true })); @@ -195,7 +193,7 @@ export class ProfilePage implements OnInit { this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', IdObject, 'gabinete-digital'])); } else if (Service === "gabinete-digital" && Object === "diplomas-assinar") { - + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar',IdObject,'gabinete-digital'])); } else if (Service === "gabinete-digital" && Object === "expedientes-pr") { @@ -215,7 +213,7 @@ export class ProfilePage implements OnInit { deleteNotification(index){ console.log("Delete notification first stata", this.notificationdata) this.notificationdata = this.notificationdata.filter(item=>item.index !=index ); - + this.storageservice.store("Notifications",JSON.stringify(this.notificationdata)).then(() =>{ this.storageservice.get("Notifications").then((value) =>{ console.log("notfication state", value, ) diff --git a/src/app/pages/agenda/agenda.page.html b/src/app/pages/agenda/agenda.page.html index 322aa5555..044c38f94 100644 --- a/src/app/pages/agenda/agenda.page.html +++ b/src/app/pages/agenda/agenda.page.html @@ -339,7 +339,7 @@
-
+
{{event.event.StartDate | date: 'HH:mm'}}
diff --git a/src/app/pages/chat/chat.page.scss b/src/app/pages/chat/chat.page.scss index 8fff9beeb..2fc786346 100644 --- a/src/app/pages/chat/chat.page.scss +++ b/src/app/pages/chat/chat.page.scss @@ -96,7 +96,7 @@ ion-content{ margin-top: 10px; } .item-title{ - width: calc(100% - 80px); + width: calc(100% - 90px); float: left; font-size: 15px; color: var(--title-text-color); @@ -105,7 +105,7 @@ ion-content{ color: #fff; } .item-date{ - width: 80px; + width: 90px; float: right; font-size: 13px; color: #797979; diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index 2a6c69e75..296cd4de2 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -29,6 +29,7 @@ import { environment } from 'src/environments/environment'; import { NotificationsService } from 'src/app/services/notifications.service'; import { TimeService } from 'src/app/services/functions/time.service'; import { ThemeService } from 'src/app/services/theme.service' +import { DataService } from 'src/app/services/data.service'; @Component({ @@ -115,7 +116,9 @@ export class ChatPage implements OnInit { private resolver: ComponentFactoryResolver, private route: Router, private timeService: TimeService, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private dataService:DataService, + private router: Router, ){ this.loggedUserChat = authService.ValidatedUserChat['data']; this.headers = new HttpHeaders(); @@ -150,6 +153,21 @@ export class ChatPage implements OnInit { console.log(t); this.setStatus('away'); + if(this.dataService.get("newGroup")){ + this.openNewGroupPage(); + } + + this.router.events.forEach((event) => { + if (event instanceof NavigationStart && event.url.startsWith('/home/chat')) { + if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/chat')) { + alert('OIII') + } else { + if(this.dataService.get("newGroup")){ + this.openNewGroupPage(); + } + } + } + }); } ngOnDestroy(){ @@ -397,7 +415,7 @@ hideRefreshButton(){ //console.log('TIMER'); //Check if modal is opened if(this.segment == "Contactos" && this.showMessages != true){ - await new Promise(resolve => setTimeout(resolve, 2000)); + await new Promise(resolve => setTimeout(resolve, 1000)); await this.getDirectMessages(); //console.log('Timer contactos list running') } @@ -453,7 +471,7 @@ hideRefreshButton(){ else { //Check if modal is opened if(this.segment == "Grupos" && this.showGroupMessages != true){ - await new Promise(resolve => setTimeout(resolve, 2000)); + await new Promise(resolve => setTimeout(resolve, 1000)); await this.getGroups(); //console.log('Timer groups list running') } diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts index 48d497e74..b89e7e8b1 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -126,6 +126,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { ngAfterViewInit() { this.scrollChangeCallback = () => this.onContentScrolled(event); window.addEventListener('scroll', this.scrollChangeCallback, true); + this.roomCountDownDate = this.timeService.countDownDate(this.room.customFields.countDownDate, this.room._id); } handlePress(id?:string){ @@ -184,7 +185,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { this.room = room['room']; this.roomName = this.room.name.split('-').join(' '); if(this.room.customFields.countDownDate){ - this.roomCountDownDate = this.timeService.countDownDate(this.room.customFields.countDownDate, this.room._id); + this.roomCountDownDate = this.timeService.countDownDateTimer(this.room.customFields.countDownDate, this.room._id); } this.getGroupContacts(this.room); this.loadGroupMessages(this.room); @@ -260,7 +261,8 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { return this.timeService.showDateDuration(start); } countDownDate(date:any, roomId:string){ - return this.timeService.countDownDate(date, roomId); + this.roomCountDownDate = this.timeService.countDownDate(date, roomId); + return this.timeService.countDownDateTimer(date, roomId); } addZero(i) { diff --git a/src/app/pages/chat/new-group/new-group.page.html b/src/app/pages/chat/new-group/new-group.page.html index f046ea010..b6b7a0690 100644 --- a/src/app/pages/chat/new-group/new-group.page.html +++ b/src/app/pages/chat/new-group/new-group.page.html @@ -32,7 +32,7 @@
-
+
diff --git a/src/app/pages/chat/new-group/new-group.page.scss b/src/app/pages/chat/new-group/new-group.page.scss index 46bb28495..3c0239197 100644 --- a/src/app/pages/chat/new-group/new-group.page.scss +++ b/src/app/pages/chat/new-group/new-group.page.scss @@ -61,7 +61,7 @@ ion-content{ .middle{ padding: 0!important; float: left; - width: 221px; + width:fit-content; margin: 2.5px 0 0 5px; } .btn-criar{ @@ -115,7 +115,6 @@ ion-content{ .item-container-no-border{ display: flex; - width: 360px; margin: 25px auto; border-radius: 5px; align-items: center; @@ -133,8 +132,8 @@ ion-content{ overflow: auto; .ion-item-class-2{ - width: 360px; margin: 0px auto; + overflow: auto; .ion-icon-class{ width: 45px; @@ -145,7 +144,7 @@ ion-content{ } } .ion-input-class{ - width: 315px; + width: calc(100% - 45px) !important; height: 45px; border: 1px solid #ebebeb; border-radius: 5px; diff --git a/src/app/pages/chat/new-group/new-group.page.ts b/src/app/pages/chat/new-group/new-group.page.ts index 7ef8adb6f..9b5d33136 100644 --- a/src/app/pages/chat/new-group/new-group.page.ts +++ b/src/app/pages/chat/new-group/new-group.page.ts @@ -52,6 +52,7 @@ export class NewGroupPage implements OnInit { createGroup(){ let name = this.groupName.split(' ').join('-'); + name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); let body = { "name":name, } this.chatService.addGroup(body).subscribe(res=>{ console.log('group created'); diff --git a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts index 15312a34a..92edda048 100644 --- a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts +++ b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts @@ -186,6 +186,7 @@ export class DespachoPage implements OnInit { this.sqliteservice.updateProcess(res); } } + updateProcessInterveners(users) { if (this.platform.is('desktop') || this.platform.is('mobileweb')) { } else { @@ -356,6 +357,32 @@ export class DespachoPage implements OnInit { } + async generateDiploma(note:string, documents:any) { + let body = { + "serialNumber": this.serialnumber, + "action": "Reencaminhar", + "ActionTypeId": 99999839, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } + + const loader = this.toastService.loading() + + try { + await this.processes.CompleteTask(body).toPromise() + this.toastService.successMessage() + this.close(); + } catch (error) { + this.toastService.badRequest() + } finally { + loader.remove() + } + + } + + toDateString(e) { return new Date(e).toDateString() } @@ -417,6 +444,9 @@ export class DespachoPage implements OnInit { else if (actionName == 'Reexecução') { await this.reexecute(res.data.note, docs); this.goBack(); + } else if(actionName == 'Gerar Diploma') { + await this.generateDiploma(res.data.note, docs); + this.goBack(); } } }); @@ -488,7 +518,13 @@ export class DespachoPage implements OnInit { }); await modal.present(); modal.onDidDismiss().then(res => { - this.goBack(); + if(res){ + const data = res.data; + if(data == 'close') { + this.goBack(); + } + } + }); } @@ -533,4 +569,5 @@ export class DespachoPage implements OnInit { return await popover.present(); } + } diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html index d827c28d3..a26270b9b 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html @@ -104,6 +104,7 @@ +
diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts index 7b16bf4b2..4adf39246 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts @@ -30,6 +30,8 @@ import { ThemeService } from 'src/app/services/theme.service' import { SqliteService } from 'src/app/services/sqlite.service'; import { Platform } from '@ionic/angular'; import { BackgroundService } from 'src/app/services/background.service'; +import { NewGroupPage } from 'src/app/pages/chat/new-group/new-group.page'; +import { DataService } from 'src/app/services/data.service'; @Component({ selector: 'app-expediente-detail', @@ -77,7 +79,8 @@ export class ExpedienteDetailPage implements OnInit { public platform: Platform, private sqliteservice: SqliteService, private backgroundservice: BackgroundService, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private dataService: DataService, ) { this.activatedRoute.paramMap.subscribe(params => { if (params["params"].SerialNumber) { @@ -612,4 +615,30 @@ export class ExpedienteDetailPage implements OnInit { return await popover.present(); } + openNewGroupPage(){ + this.router.navigate(['/home/chat']); + this.dataService.set("newGroup", true); + + if( window.innerWidth < 801){ + this.newGroup(); + } + else{ + this.dataService.set("newGroup", true); + /* this.closeAllDesktopComponents(); + this.showNewGroup=true; */ + } + } + + async newGroup(){ + const modal = await this.modalController.create({ + component: NewGroupPage, + cssClass: 'modal modal-desktop', + componentProps: { + name: this.task.Folio, + }, + }); + await modal.present(); + modal.onDidDismiss(); + } + } diff --git a/src/app/pipes/participants.pipe.ts b/src/app/pipes/participants.pipe.ts index 9856911c6..92019441b 100644 --- a/src/app/pipes/participants.pipe.ts +++ b/src/app/pipes/participants.pipe.ts @@ -6,7 +6,7 @@ import { EventPerson } from 'src/app/models/eventperson.model' }) export class ParticipantsPipe implements PipeTransform { - transform(EventPerson: EventPerson[]): any { + transform(EventPerson: EventPerson[] = []): any { let taskParticipants = []; let taskParticipantsCc = []; diff --git a/src/app/services/functions/time.service.ts b/src/app/services/functions/time.service.ts index 421c53981..8ed278bcb 100644 --- a/src/app/services/functions/time.service.ts +++ b/src/app/services/functions/time.service.ts @@ -49,7 +49,7 @@ export class TimeService { let c_minutes = Math.floor((difference % (1000*60*60)) / (1000*60)); let c_seconds = Math.floor((difference % (1000*60)) / 1000); - this.countDownTime = c_day + " : " + c_hours + " : " + c_minutes + " : " + c_seconds ; + this.countDownTime = this.addZero(c_day) + " : " + this.addZero(c_hours) + " : " + this.addZero(c_minutes) + " : " + this.addZero(c_seconds) ; if(difference < 0){ //clearInterval(timer); @@ -74,6 +74,39 @@ export class TimeService { return this.countDownTime; } + countDownDateTimer(date:any, roomId:string){ + let timer = setInterval(() =>{ + let difference = new Date(date).getTime() - new Date().getTime(); + let c_day = Math.floor(difference/(1000*60*60*24)); + let c_hours = Math.floor((difference % (1000*60*60*24)) / (1000*60*60)); + let c_minutes = Math.floor((difference % (1000*60*60)) / (1000*60)); + let c_seconds = Math.floor((difference % (1000*60)) / 1000); + + this.countDownTime = this.addZero(c_day) + " : " + this.addZero(c_hours) + " : " + this.addZero(c_minutes) + " : " + this.addZero(c_seconds) ; + + if(difference < 0){ + clearInterval(timer); + this.countDownTime = "Expired"; + let body = { "roomId":roomId, } + this.chatService.getRoomInfo(roomId).subscribe(room=>{ + this.room = room['room']; + + if(this.room.t === 'p'){ + this.chatService.deleteGroup(body).subscribe(res=>{ + console.log(res); + }); + } + else{ + this.chatService.deleteChannel(body).subscribe(res=>{ + console.log(res); + }); + } + }); + } + }) + return this.countDownTime; + } + addZero(i) { if (i < 10) { i = "0" + i; diff --git a/src/app/services/jsonStore.service.ts b/src/app/services/jsonStore.service.ts index a87920299..3dec50203 100644 --- a/src/app/services/jsonStore.service.ts +++ b/src/app/services/jsonStore.service.ts @@ -1,5 +1,3 @@ -/// -/* /// */ import { Injectable } from "@angular/core"; @Injectable({ @@ -8,7 +6,7 @@ import { Injectable } from "@angular/core"; export class JsonStore { -/* createCollection(name, data) { + /* createCollection(name, data) { var collectionName = name; var addOptions = { @@ -32,7 +30,7 @@ export class JsonStore { console.log(err) }); - } + } */ getCollection(collectionName) { @@ -50,11 +48,11 @@ export class JsonStore { JSONStoreCollections[collectionName] = {}; JSONStoreCollections[collectionName].searchFields = { UserId: 'integer' }; - WL.JSONStore.init(JSONStoreCollections) + /* WL.JSONStore.init(JSONStoreCollections) .then(function () { WL.Logger.debug('Find all colletion data'); console.log('Find all colletion data'); - + }).fail(function (err) { WL.Logger.error(err); @@ -66,8 +64,8 @@ export class JsonStore { return JSON.parse(value); }); - - return data + + return data */ //return notificationData } @@ -90,7 +88,7 @@ export class JsonStore { JSONStoreCollections[collectionName] = {}; JSONStoreCollections[collectionName].searchFields = { UserId: 'integer' }; - WL.JSONStore.init(JSONStoreCollections) + /* WL.JSONStore.init(JSONStoreCollections) .then(function () { WL.Logger.debug('Find colletion data by id'); console.log('Find colletion data by id'); @@ -101,30 +99,30 @@ export class JsonStore { }).fail(function (err) { WL.Logger.error(err); console.log(err) - }); + }); */ } replaceDocument(collectionName: string, document: any) { - /* var document = { Example of how identify the document to replace + /* var document = { Example of how identify the document to replace _id: 1, json: {name: 'chevy', age: 23} }; var options = {}; - WL.JSONStore.get(collectionName).replace(document, options).then(function (numberOfDocsReplaced) { + /* WL.JSONStore.get(collectionName).replace(document, options).then(function (numberOfDocsReplaced) { console.log("JsonStore replace document sucess: ", numberOfDocsReplaced) }).fail(function (error) { console.log("JsonStore replace document error: ", error) - }); + }); */ } removeDocument(collectionName: any,query: any,) { /* var query = { _id: 1 }; Exemple of query var options = { exact: true }; - WL.JSONStore.get(collectionName).remove(query, options).then(function (numberOfDocsRemoved) { + /* WL.JSONStore.get(collectionName).remove(query, options).then(function (numberOfDocsRemoved) { console.log("JsonStore remove document sucess: ", numberOfDocsRemoved) }).fail(function (error) { console.log("JsonStore remove document erro: ", error) - }); - } */ -} \ No newline at end of file + }); */ + } +} diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index b24689d0b..6e68db071 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -1,6 +1,5 @@ /* eslint-disable */ /* tslint:disable */ -/* /// */ import { Injectable, NgZone } from '@angular/core'; import { ActivatedRoute } from '@angular/router' import { HttpClient } from '@angular/common/http'; @@ -48,10 +47,11 @@ export class NotificationsService { private activeroute: ActivatedRoute, private jsonstore: JsonStore, private eventtrigger: EventTrigger, - private backgroundservice: BackgroundService, - private fcm: FCM) { + private backgroundservice: BackgroundService) { - this.storageService.get("Notifications").then((value) => { + this.storageService.get("Notifications").then((value) => { + + }).catch(()=>{ }).catch(() => { @@ -88,63 +88,6 @@ export class NotificationsService { return this.http.get(`${geturl}`); } - getAndpostToken(username) { - if (this.platform.is('desktop') || this.platform.is('mobileweb')) { - console.log('Notifications not supported') - } else { - - const geturl = environment.apiURL + 'notifications/token'; - - return this.fcm.getToken().then(token => { - console.log('token: ', token) - this.storageService.store(username, token); - this.storageService.get(username).then(value => { - console.log('STORAGE TOKEN', value) - this.storageService.get(AuthConnstants.USER).then(res => { - console.log('USERID', res); - const headers = { 'Authorization': SessionStore.user.BasicAuthKey }; - const body = { - UserId: res.UserId, - TokenId: token, - Status: 1, - Service: 1 - }; - - this.http.post(`${geturl}`, body, { headers }).subscribe(data => { - console.log('TOKEN USER MIDLE', data); - }) - }); - - }); - }); - } - - } - - async onReceviNotification() { - this.fcm.onNotification().subscribe(data => { - if (data.click_action) { - console.log("Received in background: ", data); - - this.notificatinsRoutes(data) - - } else { - console.log("Received in foreground: ", data); - - console.log(data.Service) - console.log(data.Object) - console.log(data.IdObject) - - /* this.DataArray.push(data) - console.log("On ReceiveNotification", this.DataArray) - this.storageService.store("Notifications", this.DataArray) */ - - - }; - }); - } - - ///////////////////////////////////////////////////// /* getTokenByUserIdAndId(user, userID) { @@ -226,7 +169,6 @@ export class NotificationsService { window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then( (token) => { console.log('Push Notification: Success ' + token); - window['MFPPush'].initialize( function (successResponse) { console.log("Push notification Successfully intialized: " + successResponse); @@ -236,30 +178,33 @@ export class NotificationsService { console.log("Push notification failure intialized: " + failureResponse); } ); - var notificationReceived = (message) => { - //this.jsonstore.createCollection('Notifications',message); - this.DataArray.push(message) - console.log("On ReceiveNotification", this.DataArray) - this.storageService.store("Notifications",this.DataArray) - - console.log(message); - this.eventtrigger.publishSomeData({ - notification: "recive" - }) - var data = JSON.parse(message.payload); - - //synchro.$send(data) - - console.log('data.Service', data.Service); // module - console.log('data.IdObject', data.IdObject); // Object id - console.log('data.Object', data.Object); // details - - if(message.actionName){ - this.notificatinsRoutes(data); - } else { - /* this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data); - //this.notificatinsRoutes(data); - console.log(data) + + window['MFPPush'].registerDevice(null, async (successResponse) => { + console.log("Successfully registered: " + JSON.stringify(successResponse)); + console.log('token: ', successResponse.deviceId) + await this.storageService.store(username, successResponse.deviceId).then((tokennoti) => { + console.log('token store',tokennoti) + }); + await this.storageService.get(username).then(value => { + console.log('STORAGE TOKEN', value) + this.storageService.get(AuthConnstants.USER).then(res => { + console.log('USERID', res); + const headers = { 'Authorization': SessionStore.user.BasicAuthKey }; + const body = { + UserId: res.UserId, + TokenId: successResponse.deviceId, + Status: 1, + Service: 1 + }; + this.http.post(`${geturl}`, body, { headers }).subscribe(data => { + console.log('TOKEN USER MIDLE', data); + }) + }); + + }); + }, + function (failureResponse) { + console.log("Successfully failue: " + JSON.stringify(failureResponse)); } this.callbacks.forEach( e=> { diff --git a/src/app/services/toast.service.ts b/src/app/services/toast.service.ts index 3d1b4fe24..db279af79 100644 --- a/src/app/services/toast.service.ts +++ b/src/app/services/toast.service.ts @@ -14,9 +14,7 @@ export class ToastService { private modalController: ModalController, ) { } - ngOnInit() { - - } + ngOnInit() {} async presentToast(infoMessage: string) { const toast = await this.toastController.create({ diff --git a/src/app/services/webnotifications.service.ts b/src/app/services/webnotifications.service.ts index f5d8321b8..96c30cd34 100644 --- a/src/app/services/webnotifications.service.ts +++ b/src/app/services/webnotifications.service.ts @@ -7,7 +7,6 @@ import { Token } from '../models/token.model'; import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular'; import { NavigationExtras, Router } from '@angular/router'; import { ToastService } from './toast.service'; -import MFPPush from 'ibm-mfp-web-push'; @Injectable({ providedIn: 'root' @@ -39,18 +38,12 @@ export class WebNotificationsService { } - MFPPush.initialize({ - appId: "com.gpr.gabinetedigital", - mfpContextRoot: "/mfp", - }); - - /* MFPPush.initialize({ appId: "com.gpr.gabinetedigital", mfpContextRoot: "/mfp", }); */ - + /* MFPPush.registerDevice() .then((res) => { console.log("WEB Successfully Registered Device..."); @@ -72,60 +65,6 @@ export class WebNotificationsService { }); */ } - register(){ - MFPPush.registerDevice() - .then((res) => { - console.log("WEB Successfully Registered Device...", res); - }) - .catch((err) => { - console.log("WEB Registration Failed" + err); - }); - } - - async onReceviNotificationWeb() { - - if (window['WLAuthorizationManager']) { - if (window['WLAuthorizationManager'].obtainAccessToken) { - window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then( - (token) => { - console.log('Push Notification: Success ' + token); - - MFPPush.initialize( - function (successResponse) { - console.log("Push notification Successfully intialized: " + successResponse); - MFPPush.registerNotificationsCallback(notificationReceived); - }, - function (failureResponse) { - console.log("Push notification failure intialized: " + failureResponse); - } - ); - var notificationReceived = (message) => { - console.log(message); - var data = JSON.parse(message.payload); - console.log(data.Service); - console.log(data.IdObject); - console.log(data.Object); - - if (message.actionName) { - //this.notificatinsRoutes(data); - console.log("Web notification") - } else { - console.log("Web notification") - //this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data); - } - - } - }, (error) => { - console.log('Push notification recived: failure ' + error.responseText); - console.log(JSON.stringify(error)); - } - ); - } - } - - - } - /* getTokenByUserIdAndId(user, userID) { const geturl = environment.apiURL + 'notifications/user/' + userID; @@ -138,11 +77,11 @@ export class WebNotificationsService { } else { const geturl = environment.apiURL + 'notifications/token'; */ - /* + /* window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then( (token) => { console.log('Push Notification: Success ' + token); - + MFPPush.initialize( function (successResponse) { console.log("Push notification Successfully Service intialized: " + successResponse); @@ -151,7 +90,7 @@ export class WebNotificationsService { console.log("Push notification failure Service intialized: " + failureResponse); } ); - + MFPPush.registerDevice(null, (successResponse) => { console.log("Successfully registered: " + JSON.stringify(successResponse)); console.log('token: ', successResponse.deviceId) @@ -171,7 +110,7 @@ export class WebNotificationsService { console.log('TOKEN USER MIDLE', data); }) }); - + }); }, function (failureResponse) { @@ -184,14 +123,14 @@ export class WebNotificationsService { } ); } - + } */ - /* + /* async onReceviNotification() { window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then( (token) => { console.log('Push Notification: Success ' + token); - + MFPPush.initialize( function (successResponse) { console.log("Push notification Successfully intialized: " + successResponse); @@ -207,13 +146,13 @@ export class WebNotificationsService { console.log(data.Service); console.log(data.IdObject); console.log(data.Object); - + if(message.actionName){ this.notificatinsRoutes(data); } else { this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data); } - + } }, (error) => { console.log('Push notification recived: failure ' + error.responseText); diff --git a/src/app/shared/agenda/approve-event/approve-event.page.html b/src/app/shared/agenda/approve-event/approve-event.page.html index 671c6c56f..35da291f1 100644 --- a/src/app/shared/agenda/approve-event/approve-event.page.html +++ b/src/app/shared/agenda/approve-event/approve-event.page.html @@ -22,7 +22,7 @@
- +
diff --git a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts index 5570ca88b..bf0cc6f6a 100644 --- a/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts +++ b/src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts @@ -88,7 +88,8 @@ export class EditEventToApprovePage implements OnInit { MDEmail: '', MDName: '', IsAllDayEvent: false, - Message: '' + Message: '', + Status: '' } } @@ -295,12 +296,12 @@ export class EditEventToApprovePage implements OnInit { MDName: this.eventProcess.workflowInstanceDataFields.MDName, MDEmail: this.eventProcess.workflowInstanceDataFields.MDEmail, IsAllDayEvent: this.eventProcess.workflowInstanceDataFields.IsAllDayEvent, - Status: null, + Status: this.eventProcess.workflowInstanceDataFields.Status, EventType: this.eventProcess.workflowInstanceDataFields.EventType, IsRecurring: this.eventProcess.workflowInstanceDataFields.IsRecurring, Message: this.eventProcess.workflowInstanceDataFields.Message, EventRecurrence: { - Type: this.eventProcess.workflowInstanceDataFields.OccurrenceType, + Type: this.eventProcess.workflowInstanceDataFields.OccurrenceType || '-1', LastOccurrence: this.eventProcess.workflowInstanceDataFields.LastOccurrence, }, ParticipantsList: this.eventProcess.workflowInstanceDataFields.ParticipantsList, diff --git a/src/app/shared/agenda/edit-event/edit-event.page.ts b/src/app/shared/agenda/edit-event/edit-event.page.ts index 494b832fa..4eef38a80 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.ts +++ b/src/app/shared/agenda/edit-event/edit-event.page.ts @@ -302,9 +302,8 @@ export class EditEventPage implements OnInit { SerialNumber: '', }; - this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{ - this.getAttachments(this.postEvent.EventId); - }); + await this.attachmentsService.setEventAttachmentById(DocumentToSave).toPromise(); + this.getAttachments(this.postEvent.EventId); } else if(remove) { this.attachmentsService.deleteEventAttachmentById(e.Id).subscribe( res=> {}) diff --git a/src/app/shared/agenda/event-list/event-list.page.ts b/src/app/shared/agenda/event-list/event-list.page.ts index f166dd248..924755b02 100644 --- a/src/app/shared/agenda/event-list/event-list.page.ts +++ b/src/app/shared/agenda/event-list/event-list.page.ts @@ -56,7 +56,7 @@ export class EventListPage implements OnInit { } ngOnChanges() { - //this.LoadToApproveEvents(); + this.LoadToApproveEvents(); } segmentChanged(ev: any) { diff --git a/src/app/shared/chat/group-messages/group-messages.page.html b/src/app/shared/chat/group-messages/group-messages.page.html index 428237204..e8ba47bdc 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.html +++ b/src/app/shared/chat/group-messages/group-messages.page.html @@ -23,9 +23,9 @@
-
+
- {{roomCountDownDate}} + {{countDownDate()}}
diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index 979c97bdf..9e57e30e8 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -56,7 +56,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe currentPosition: any; startPosition: number; scrollToBottomBtn = false; - roomCountDownDate:any; + roomCountDownDate:string; + roomCountDownTime:string; @Input() roomId:string; @Output() closeAllDesktopComponents:EventEmitter = new EventEmitter(); @@ -89,6 +90,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe ) { this.loggedUserChat = authService.ValidatedUserChat['data']; this.isGroupCreated = true; + this.roomCountDownDate = ""; + this.roomCountDownTime = ""; } ngOnChanges(changes: SimpleChanges): void { @@ -100,49 +103,18 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe this.loggedUser=this.loggedUserChat; this.getRoomInfo(); this.serverLongPull(); - console.log(this.roomId); this.setStatus('online'); this.getChatMembers(); - - /* pdfjs.Lib.getDocument('sample.pdf').promise.then((doc)=>{ - console.log(doc); - - }) */ - //this.loadPDF(); } - /* loadPDF() { - const loadingTask = pdfjsLib.getDocument( this.pdfurl ); - loadingTask.promise.then((pdf) => { - console.log( "pdf: ", pdf ); - console.log('PDF loaded'); + showDateDuration(start:any){ + return this.timeService.showDateDuration(start); + } - // Fetch the first page - var pageNumber = 1; - pdf.getPage(pageNumber).then(function(page) { - console.log('Page loaded'); - - var scale = 1.5; - var viewport = page.getViewport({scale: scale}); - - // Prepare canvas using PDF page dimensions - var canvas: any = document.getElementById('pdf_canvas'); - var context = canvas.getContext('2d'); - canvas.height = viewport.height; - canvas.width = viewport.width; - - // Render PDF page into canvas context - var renderContext = { - canvasContext: context, - viewport: viewport - }; - var renderTask = page.render(renderContext); - renderTask.promise.then(function () { - console.log('Page rendered'); - }); - }); - }); - } */ + countDownDate(){ + //this.roomCountDownTime = this.timeService.countDownDateTimer(this.roomCountDownDate, this.room._id); + return this.timeService.countDownDateTimer(this.roomCountDownDate, this.roomId); + } setStatus(status:string){ let body = { @@ -235,30 +207,19 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe console.log('here watching'); return this.roomId; } - showDateDuration(start:any){ - return this.timeService.showDateDuration(start); - } - countDownDate(date:any, roomId:string){ - return this.timeService.countDownDate(date, roomId); - } + async getRoomInfo(){ + let room = await this.chatService.getRoomInfo(this.roomId).toPromise(); + this.room=room['room']; + if(this.room.name){ + this.roomName = this.room.name.split('-').join(' '); + } - getRoomInfo(){ - this.showLoader = true; - this.chatService.getRoomInfo(this.roomId).subscribe(room=>{ - console.log(room); + if(this.room.customFields.countDownDate){ + this.roomCountDownDate = this.room.customFields.countDownDate; + } - this.room = room['room']; - if(this.room.name){ - this.roomName = this.room.name.split('-').join(' '); - } - if(this.room.customFields.countDownDate){ - this.roomCountDownDate = this.timeService.countDownDate(this.room.customFields.countDownDate, this.room._id); - } - this.getGroupContacts(this.room); - //this.loadGroupMessages(this.room); - this.showLoader = false; - }); + this.getGroupContacts(this.room); } getGroupContacts(room:any){ diff --git a/src/proxy.conf.json b/src/proxy.conf.json index 55df3c944..e69de29bb 100644 --- a/src/proxy.conf.json +++ b/src/proxy.conf.json @@ -1,14 +0,0 @@ -{ - "/mfp/api/imfpush/": { - "target": "http://gpr-dev-10.gabinetedigital.local:9080/mfp/api/imfpush/", - "changeOrigin": true, - "secure": false, - "pathRewrite": {"/mfp/api/imfpush/" : ""} - }, - "/mfp/api": { - "target": "http://gpr-dev-10.gabinetedigital.local:9080/mfp/api", - "changeOrigin": true, - "secure": false, - "pathRewrite": {"/mfp/api" : ""} - } -} \ No newline at end of file