diff --git a/Mohem/src/app/app-routing.module.ts b/Mohem/src/app/app-routing.module.ts index c6a651c9..94bc059c 100644 --- a/Mohem/src/app/app-routing.module.ts +++ b/Mohem/src/app/app-routing.module.ts @@ -8,6 +8,7 @@ const routes: Routes = [ path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule' }, { path: 'home', loadChildren: './home/home.module#HomePageModule' }, + { path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' }, { path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' }, { path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' }, @@ -29,7 +30,9 @@ const routes: Routes = [ { path: 'reports', loadChildren: './reports/reports.module#ReportsPageModule' }, { path: 'termination', loadChildren: './termination/termination.module#TerminationPageModule' }, - { path: 'pending-transaction', loadChildren: './pending-transaction/pending-transaction.module#PendingTransactionPageModule' } + { path: 'pending-transaction', loadChildren: './pending-transaction/pending-transaction.module#PendingTransactionPageModule' }, + { path: 'notification-center', loadChildren: './notification-center/notification-center.module#NotificationCenterPageModule' } + diff --git a/Mohem/src/app/authentication/sms-page/sms-page.page.scss b/Mohem/src/app/authentication/sms-page/sms-page.page.scss index 986beeb9..3aec3b30 100644 --- a/Mohem/src/app/authentication/sms-page/sms-page.page.scss +++ b/Mohem/src/app/authentication/sms-page/sms-page.page.scss @@ -1,25 +1,26 @@ -.header-toolbar{ +.header-toolbar { --background: linear-gradient(45deg, #3ac1f1 0%, #19a163 36%, #19a163 59%, #1a586d 100%); } -.btnBack{ +.btnBack { background: transparent; } -ion-img{ +ion-img { width: 180px; height: 180px; - background:transparent; + background: transparent; } -h1{ +h1 { font-size: 28px !important; } -span{ +span { font-weight: bold; } -.button-login{ + +.button-login { --background: var(--newgreen) !important; background: var(--newgreen) !important; @@ -39,7 +40,7 @@ span{ display: block; } -.sms_code{ +.sms_code { margin: 0px; text-align: center; } @@ -57,12 +58,13 @@ ion-input { transition: all .2s ease-in-out; border-radius: 3px; display: inline-block; + &:focus { - border-color:var(--ion-color-secondary) !important; - box-shadow: 0 0 5px var(--ion-color-secondary) !important inset; + border-color: var(--ion-color-secondary) !important; + box-shadow: 0 0 5px var(--ion-color-secondary) !important; } - + &::selection { - background: transparent; + background: transparent; } - } \ No newline at end of file +} \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts index b4fd54bf..337a83f6 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -1430,7 +1430,9 @@ export class CommonService { public openLogin() { this.nav.navigateRoot(['/authentication/login']); } - + public openNotificationCenter() { + this.nav.navigateRoot(['/notification-center']); + } public openUserForgot() { this.nav.navigateForward(['/authentication/checkuser']); } diff --git a/Mohem/src/app/hmg-common/services/push/push.service.ts b/Mohem/src/app/hmg-common/services/push/push.service.ts index 4ed1f3ae..92682892 100644 --- a/Mohem/src/app/hmg-common/services/push/push.service.ts +++ b/Mohem/src/app/hmg-common/services/push/push.service.ts @@ -40,13 +40,13 @@ export class PushService { this.firebasex.grantPermission().then(hasPermission => { console.log("Permission was " + (hasPermission ? "granted" : "denied")); this.processStartReceivingWithFirebase(); - }); + }); } else { this.processStartReceivingWithFirebase(); } - }); - }​​ - + }); + } + private processNotification(data: any) { const notification = new NotificationModel(); @@ -67,7 +67,7 @@ export class PushService { this.sharedService.setSharedData(notification, NotificationModel.SHARED_DATA); } else if (type === NotificationModel.TYPE_CONFERENCE) { const session = data.additionalData.sessionId; - this.sharedService.setSharedData( new SessionModel(session) , SessionModel.SHARED_DATA); + this.sharedService.setSharedData(new SessionModel(session), SessionModel.SHARED_DATA); } else { if (type === NotificationModel.TYPE_VIDEO) { notification.MessageType = 'video'; @@ -87,7 +87,7 @@ export class PushService { } private registerInBackend(data: any) { - console.log('firebasex Token ID: ' + data); + console.log('firebasex Token ID: ' + data); if (data) { this.cs.sharedService.setSharedData(data, AuthenticationService.DEVICE_TOKEN); localStorage.setItem('deviceToken', data); @@ -101,11 +101,11 @@ export class PushService { request.DeviceToken = deviceToken; request.DeviceType = this.getDeviceType(); const user = this.authService.getAuthenticatedUser(); - // request.PatientMobileNumber = user.MobileNo; + // request.PatientMobileNumber = user.MobileNo; // request.NationalID = user.IdentificationNo; request.Gender = user.Gender; request.PatientID = user.PatientID; - // request.PatientOutSA = user.PatientOutSA ? 1 : 0; + // request.PatientOutSA = user.PatientOutSA ? 1 : 0; // request.LoginType = user.biometricEnabled ? 2 : 1; // 1 sms , 2 touch id request.MACAddress = '00:00:00:00:00:00'; return this.con.postNoLoad(PushService.loggedInUserURL, request @@ -138,12 +138,24 @@ export class PushService { private processStartReceivingWithFirebase() { console.log("processStartReceivingWithFirebase"); this.firebasex.getToken().then(token => { - // alert("token: "+ token); + // alert("token: "+ token); this.cs.sharedService.setSharedData(token, "new-device-token"); localStorage.setItem('deviceToken', token); this.cs.setDeviceToken(token); //last way to set the device Token to get it through getDeviceToken this.registerInBackend(token); }).catch(error => console.error('Error getting token', error)); + + this.firebasex.onMessageReceived().subscribe(data => { + console.log("onMessageReceived"); + console.log(data); + this.firebasex.clearAllNotifications(); + if (data.notification_type == 3) { + this.cs.sharedService.setSharedData(data, NotificationModel.SHARED_DATA); + this.cs.openNotificationCenter(); + } + + }); + } public onPushReceived(payload: any) { diff --git a/Mohem/src/app/notification-center/notification-center.module.ts b/Mohem/src/app/notification-center/notification-center.module.ts new file mode 100644 index 00000000..cadf43b2 --- /dev/null +++ b/Mohem/src/app/notification-center/notification-center.module.ts @@ -0,0 +1,29 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { Routes, RouterModule } from '@angular/router'; + +import { IonicModule } from '@ionic/angular'; + +import { NotificationCenterPage } from './notification-center.page'; +import { DetailComponent } from './notification-detail/detail.component'; +import { HmgCommonModule } from '../hmg-common/hmg-common.module'; + +const routes: Routes = [ + { + path: '', + component: DetailComponent + } +]; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + HmgCommonModule, + RouterModule.forChild(routes) + ], + declarations: [NotificationCenterPage, DetailComponent] +}) +export class NotificationCenterPageModule { } diff --git a/Mohem/src/app/notification-center/notification-center.page.html b/Mohem/src/app/notification-center/notification-center.page.html new file mode 100644 index 00000000..7da442b0 --- /dev/null +++ b/Mohem/src/app/notification-center/notification-center.page.html @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Mohem/src/app/notification-center/notification-center.page.scss b/Mohem/src/app/notification-center/notification-center.page.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/notification-center/notification-center.page.spec.ts b/Mohem/src/app/notification-center/notification-center.page.spec.ts new file mode 100644 index 00000000..f21e182e --- /dev/null +++ b/Mohem/src/app/notification-center/notification-center.page.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NotificationCenterPage } from './notification-center.page'; + +describe('NotificationCenterPage', () => { + let component: NotificationCenterPage; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ NotificationCenterPage ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NotificationCenterPage); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/notification-center/notification-center.page.ts b/Mohem/src/app/notification-center/notification-center.page.ts new file mode 100644 index 00000000..9fb934cd --- /dev/null +++ b/Mohem/src/app/notification-center/notification-center.page.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-notification-center', + templateUrl: './notification-center.page.html', + styleUrls: ['./notification-center.page.scss'], +}) +export class NotificationCenterPage implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/Mohem/src/app/notification-center/notification-detail/detail.component.html b/Mohem/src/app/notification-center/notification-detail/detail.component.html new file mode 100644 index 00000000..4df46e65 --- /dev/null +++ b/Mohem/src/app/notification-center/notification-detail/detail.component.html @@ -0,0 +1,30 @@ + + + + {{ 'worklistMain,notfDetails' | translate }} + + + + + + + + + + + +

{{data.image_Text}}

+
+
+ + + + + +
+ + +
\ No newline at end of file diff --git a/Mohem/src/app/notification-center/notification-detail/detail.component.scss b/Mohem/src/app/notification-center/notification-detail/detail.component.scss new file mode 100644 index 00000000..63143424 --- /dev/null +++ b/Mohem/src/app/notification-center/notification-detail/detail.component.scss @@ -0,0 +1,61 @@ +.vertical_space { + height: 0.5cm; + width: 100%; +} + +.title { + font-size: 0.38cm; + font-weight: bold; +} + +.info-icon ion-icon { + font-size: 90px; + margin: 10px auto; + display: block; + margin-bottom: 0; + color: var(--ion-color-danger); +} +.info-icon h1 { + margin: auto; + font-size: 22px; + text-align: center; + margin-top: 10%; +} +.info-icon { + padding: 20px; + background: #fff; + margin: 20px; + margin-top: 15%; + border-radius: 15px; +} +.info-icon .line { + width: 100%; + height: 1px; + background: #ccddcc; + margin: 15px auto; +} +.info-icon .instruction p { + display: block; + margin: 0px; + margin-top: 7%; + color: #000; + text-align: center; +} +.info-icon b { + bottom: 11px; + margin: 18px; + color: var(--ion-color-danger); +} +.instruction b { + color: var(--ion-color-danger); + font-weight: bolder; +} +.stop-icon { + display: flex; + margin: 10px auto; + width: 45%; + margin-top: 40px; +} +p.otherwise { + font-size: 20px !important; +} diff --git a/Mohem/src/app/notification-center/notification-detail/detail.component.spec.ts b/Mohem/src/app/notification-center/notification-detail/detail.component.spec.ts new file mode 100644 index 00000000..149b9be7 --- /dev/null +++ b/Mohem/src/app/notification-center/notification-detail/detail.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DetailComponent } from './detail.component'; + +describe('DetailComponent', () => { + let component: DetailComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DetailComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DetailComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/notification-center/notification-detail/detail.component.ts b/Mohem/src/app/notification-center/notification-detail/detail.component.ts new file mode 100644 index 00000000..d5cc4123 --- /dev/null +++ b/Mohem/src/app/notification-center/notification-detail/detail.component.ts @@ -0,0 +1,78 @@ +import { Component, OnInit } from '@angular/core'; +import { NotificationModel } from 'src/app/hmg-common/services/push/models/notification.model'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +// import { NotificationsCenterService } from '../service/notifications-center.service'; +import { Route, Router, ActivatedRoute, ActivationEnd } from '@angular/router'; +import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser'; + +@Component({ + selector: 'app-detail', + templateUrl: './detail.component.html', + styleUrls: ['./detail.component.scss'] +}) +export class DetailComponent implements OnInit { + + public notification: NotificationModel; + public video_link: string; + public trustedVideoUrl: SafeResourceUrl; + public direction: any; + public data: any; + constructor( + public cs: CommonService, + public ts: TranslatorService, + public sharedData: SharedDataService, + // public notifyService: NotificationsCenterService, + public router: Router, + private domSanitizer: DomSanitizer, + public route: ActivatedRoute + ) { + + } + + ngOnInit() { + this.direction = TranslatorService.getCurrentDirection(); + + this.data = this.sharedData.getSharedData(NotificationModel.SHARED_DATA, true); + } + // this.initialize(); + // if (this.notification.MessageType == "image") { + + // } + // if (this.notification.MessageType == "video") { + // var url = this.notification.MessageTypeData; + // var v_id = url.substr(url.lastIndexOf("?v=") + 3, url.length); + // this.trustedVideoUrl = this.domSanitizer.bypassSecurityTrustResourceUrl("https://www.youtube.com/embed/" + v_id); + // } + // else { + + // } + + // } + + // private initialize() { + // // this.notifyService.decreaseBadgeCount(); + // this.notification = this.sharedData.getSharedData(NotificationModel.SHARED_DATA, true); + // if (!this.notification) { + // this.cs.back(); + // } + // if (this.notification.MessageType == "image") { + // } + // if (this.notification.MessageType == "video") { + // var url = this.notification.MessageTypeData; + // var v_id = url.substr(url.lastIndexOf("?v=") + 3, url.length); + // this.trustedVideoUrl = this.domSanitizer.bypassSecurityTrustResourceUrl("https://www.youtube.com/embed/" + v_id); + // } else { + // } + // } + + // public isHtml5VideoSupported(): boolean { + // return this.cs.isHtml5VideoSupported(); + // } + + // public playNativeVideo() { + // this.cs.openBrowser(this.notification.MessageTypeData); + // } + +} diff --git a/Mohem/src/app/notification/worklist-main/worklist-main.component.ts b/Mohem/src/app/notification/worklist-main/worklist-main.component.ts index 4b9560b3..337d2307 100644 --- a/Mohem/src/app/notification/worklist-main/worklist-main.component.ts +++ b/Mohem/src/app/notification/worklist-main/worklist-main.component.ts @@ -1290,7 +1290,7 @@ export class WorklistMainComponent implements OnInit { showLoading(notificationList) { if (notificationList.length < 0) { return true; - } else if (notificationList === []) { + } else if (notificationList.length == 0) { return false; } else { return true; } }