diff --git a/Mohem/src/app/app-routing.module.ts b/Mohem/src/app/app-routing.module.ts index a1fab539..5895ed8b 100644 --- a/Mohem/src/app/app-routing.module.ts +++ b/Mohem/src/app/app-routing.module.ts @@ -1,21 +1,22 @@ -import { NgModule } from '@angular/core'; -import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; +import { NgModule } from '@angular/core'; +import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; + +const routes: Routes = [ + { path: '', redirectTo: 'authentication/login', pathMatch: 'full' }, + { + path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule', + data: { preload: true, delay: 1000 } + }, + { path: 'home', loadChildren: './home/home.module#HomePageModule' }, + { path: 'sms-page', loadChildren: './authentication/sms-page/sms-page.module#SmsPagePageModule' }, { path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' } -const routes: Routes = [ - { path: '', redirectTo: 'authentication/login', pathMatch: 'full' }, - { - path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule', - data: { preload: true, delay: 1000 } - }, - { path: 'home', loadChildren: './home/home.module#HomePageModule' }, - { path: 'sms-page', loadChildren: './authentication/sms-page/sms-page.module#SmsPagePageModule' } - -]; - -@NgModule({ - imports: [ - RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) - ], - exports: [RouterModule] -}) -export class AppRoutingModule { } + +]; + +@NgModule({ + imports: [ + RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) + ], + exports: [RouterModule] +}) +export class AppRoutingModule { } diff --git a/Mohem/src/app/app.component.html b/Mohem/src/app/app.component.html index 6c1e3f07..8dd02575 100644 --- a/Mohem/src/app/app.component.html +++ b/Mohem/src/app/app.component.html @@ -28,7 +28,7 @@ --> - + diff --git a/Mohem/src/app/app.component.ts b/Mohem/src/app/app.component.ts index f46c777f..e38bb54c 100644 --- a/Mohem/src/app/app.component.ts +++ b/Mohem/src/app/app.component.ts @@ -102,12 +102,13 @@ export class AppComponent implements OnInit, AfterViewInit { }); } logout() { - // let req:any={}; - // this.menuService.disableSession(req).subscribe((result: any) => { - // }); this.cs.sharedService.clearAll(); this.menu.toggle(); this.cs.openLogin(); } + profile() { + this.cs.openProfile(); + this.menu.toggle(); + } } diff --git a/Mohem/src/app/authentication/forgot/forgot.component.scss b/Mohem/src/app/authentication/forgot/forgot.component.scss index e8ab06f1..139597f9 100644 --- a/Mohem/src/app/authentication/forgot/forgot.component.scss +++ b/Mohem/src/app/authentication/forgot/forgot.component.scss @@ -1,7 +1,2 @@ - .header-toolbar{ - --background: linear-gradient(45deg, #3ac1f1 0%, #19a163 36%, #19a163 59%, #1a586d 100%); -} -.btnBack{ - background: transparent; -} \ 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 bcf530ef..aab50a10 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -248,7 +248,7 @@ export class CommonService { public userNeedToReLogin() { this.presentConfirmDialog(this.ts.trPK("general", "relogin"), () => { - //this.openUserLogin(); + this.openLogin(); }); } @@ -892,6 +892,9 @@ export class CommonService { public openForgotPassword() { this.nav.navigateForward(["/authentication/forgot"]); } + public openProfile() { + this.nav.navigateForward(["/profile/home"]); + } public reload(url: string, from: string) { console.log("force reload called from:" + from); diff --git a/Mohem/src/app/hmg-common/services/connector/connector.service.ts b/Mohem/src/app/hmg-common/services/connector/connector.service.ts index 2cb40649..c6613abd 100644 --- a/Mohem/src/app/hmg-common/services/connector/connector.service.ts +++ b/Mohem/src/app/hmg-common/services/connector/connector.service.ts @@ -121,7 +121,7 @@ export class ConnectorService { if (!this.cs.validResponse(result)) { // not authorized if (result.ErrorType === 2) { - // this.cs.userNeedToReLogin(); + this.cs.userNeedToReLogin(); } else { this.cs.showErrorMessageDialog(onError, errorLabel, result.ErrorEndUserMessage); } diff --git a/Mohem/src/app/home/home.page.html b/Mohem/src/app/home/home.page.html index e870a242..7d7b7745 100644 --- a/Mohem/src/app/home/home.page.html +++ b/Mohem/src/app/home/home.page.html @@ -19,7 +19,7 @@
-

{{ts.trPK('home','dashboard')}}, {{userData.EMPLOYEE_DISPLAY_NAME}}

+

{{ts.trPK('home','dashboard')}}

diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index 602ac627..7573236e 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -34,7 +34,7 @@ export class HomePage implements OnInit { this.menu.toggle(); } private getUserDetails() { - const user = this.authService + this.authService .loadAuthenticatedUser() .subscribe((user: AuthenticatedUser) => { if (user) { diff --git a/Mohem/src/app/profile/home/home.component.html b/Mohem/src/app/profile/home/home.component.html new file mode 100644 index 00000000..d88cac28 --- /dev/null +++ b/Mohem/src/app/profile/home/home.component.html @@ -0,0 +1,111 @@ + + + + + + {{ts.trPK('userProfile','title')}} + + + + + + + + +
{{personalInfo.EMPLOYEE_NAME}}
+
+ +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
\ No newline at end of file diff --git a/Mohem/src/app/profile/home/home.component.scss b/Mohem/src/app/profile/home/home.component.scss new file mode 100644 index 00000000..60b11dbc --- /dev/null +++ b/Mohem/src/app/profile/home/home.component.scss @@ -0,0 +1,3 @@ +ion-col.colBold, ion-col.colBold > label{ + font-weight:bold; +} \ No newline at end of file diff --git a/Mohem/src/app/profile/home/home.component.spec.ts b/Mohem/src/app/profile/home/home.component.spec.ts new file mode 100644 index 00000000..5ec1377b --- /dev/null +++ b/Mohem/src/app/profile/home/home.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomeComponent } from './home.component'; + +describe('HomeComponent', () => { + let component: HomeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HomeComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/profile/home/home.component.ts b/Mohem/src/app/profile/home/home.component.ts new file mode 100644 index 00000000..f5e10adf --- /dev/null +++ b/Mohem/src/app/profile/home/home.component.ts @@ -0,0 +1,38 @@ +import { Component, OnInit } from "@angular/core"; +import { CommonService } from "src/app/hmg-common/services/common/common.service"; +import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service"; +import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service"; +import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/models/authenticated-user"; +@Component({ + selector: "app-home", + templateUrl: "./home.component.html", + styleUrls: ["./home.component.scss"] +}) +export class HomeComponent implements OnInit { + personalInfo: any; + imageSrc: string = "../assets/imgs/profile.png"; + constructor( + public ts: TranslatorService, + public cs: CommonService, + public authService: AuthenticationService + ) {} + + ngOnInit() { + this.getProfile(); + } + getProfile() { + this.authService + .loadAuthenticatedUser() + .subscribe((user: AuthenticatedUser) => { + if (user) { + this.personalInfo = user; + this.imageSrc = user.EMPLOYEE_IMAGE + ? "data:image/png;base64," + user.EMPLOYEE_IMAGE + : this.imageSrc; + console.log(user); + } else { + console.log(user); + } + }); + } +} diff --git a/Mohem/src/app/profile/profile.module.ts b/Mohem/src/app/profile/profile.module.ts new file mode 100644 index 00000000..6688ce80 --- /dev/null +++ b/Mohem/src/app/profile/profile.module.ts @@ -0,0 +1,32 @@ +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 { ProfilePage } from './profile.page'; +import { HomeComponent } from './home/home.component'; +const routes: Routes = [ + { + path: '', + component: ProfilePage, + children: [ + { + path: 'home', + component: HomeComponent + } + ], + } +]; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + RouterModule.forChild(routes) + ], + declarations: [ProfilePage , HomeComponent] +}) +export class ProfilePageModule {} diff --git a/Mohem/src/app/profile/profile.page.html b/Mohem/src/app/profile/profile.page.html new file mode 100644 index 00000000..e020ca2c --- /dev/null +++ b/Mohem/src/app/profile/profile.page.html @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Mohem/src/app/profile/profile.page.scss b/Mohem/src/app/profile/profile.page.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/profile/profile.page.spec.ts b/Mohem/src/app/profile/profile.page.spec.ts new file mode 100644 index 00000000..6f05c1ab --- /dev/null +++ b/Mohem/src/app/profile/profile.page.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ProfilePage } from './profile.page'; + +describe('ProfilePage', () => { + let component: ProfilePage; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ProfilePage ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ProfilePage); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/profile/profile.page.ts b/Mohem/src/app/profile/profile.page.ts new file mode 100644 index 00000000..e24f8f60 --- /dev/null +++ b/Mohem/src/app/profile/profile.page.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-profile', + templateUrl: './profile.page.html', + styleUrls: ['./profile.page.scss'], +}) +export class ProfilePage implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index 5392d1e6..375d032a 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -766,31 +766,31 @@ }, "confirmPassword": { "en":"Confirm Password", - "ar":"" + "ar":"تأكيد كلمة المرور" }, "newPassword": { "en":"New Password", - "ar":"" + "ar":"كلمة المرور الجديدة" }, "changePassword": { "en":"Change Password", - "ar":"" + "ar":"تغيير كلمة المرور" }, "codeNumber": { "en":"verification code", - "ar":"" + "ar": "رقم الرمز" }, "emptyNewPassword": { "en":"Please fill New Password field", - "ar":"" + "ar":"الرجاء ملء حقل كلمة المرور الجديدة" }, "emptyOldPassword": { "en":"Please fill Old Password field", - "ar":"" + "ar":"الرجاء ملء حقل كلمة المرور الحالية" }, "emptyConfirmPassword": { "en":"Please fill Confirm Password field", - "ar":"" + "ar":"الرجاء ملء حقل تأكيد كلمة المرور" } }, "attendance": diff --git a/Mohem/src/theme/styles.scss b/Mohem/src/theme/styles.scss index 7b52e4e6..8d15a51e 100644 --- a/Mohem/src/theme/styles.scss +++ b/Mohem/src/theme/styles.scss @@ -57,24 +57,18 @@ ion-label{ } -.loaderGif{ +.loading-gif{ background: transparent !important; width:100px; height: 100px; } -.loading-md .loading-wrapper, -.loading-ios .loading-wrapper{ +#custom-progress-loader .container{ background: transparent !important; box-shadow: none; -webkit-box-shadow:none; -moz-box-shadow: none; width: 150px; } -.loading-md ,.loading-ios { - ion-backdrop{ - background-color: #8c8c8c !important; - } -} /***********change header color***************/ .headerBtn{ @@ -83,7 +77,12 @@ ion-label{ .headerImg{ width: 36px; } - +.header-toolbar{ + --background: linear-gradient(45deg, #3ac1f1 0%, #19a163 36%, #19a163 59%, #1a586d 100%); +} +.btnBack{ + background: transparent !important; +} /***************/ .attachImg{ max-width: 30px;