From ff95ad7c36332ef9a3cbff140d44baced9d542bc Mon Sep 17 00:00:00 2001 From: umasoodch Date: Wed, 20 Oct 2021 17:34:19 +0300 Subject: [PATCH] fixed business card issue --- .../business-card/business-card.component.ts | 3 +- .../confirm-login/confirm-login.component.ts | 15 ++++++---- .../authentication/authentication.service.ts | 2 +- .../ui/welcome-login/welcome.component.html | 2 +- .../ui/welcome-login/welcome.component.ts | 30 +++++++------------ Mohem/src/app/home/home.page.ts | 16 +++++++++- 6 files changed, 40 insertions(+), 28 deletions(-) diff --git a/Mohem/src/app/authentication/business-card/business-card.component.ts b/Mohem/src/app/authentication/business-card/business-card.component.ts index 0462829a..28a3bde3 100644 --- a/Mohem/src/app/authentication/business-card/business-card.component.ts +++ b/Mohem/src/app/authentication/business-card/business-card.component.ts @@ -10,7 +10,7 @@ import { TranslatorService } from 'src/app/hmg-common/services/translator/transl }) export class BusinessCardComponent implements OnInit { - @Input() userInfo: any; + public userInfo: any; public userJobName: any; constructor( public modalCtrl: ModalController, @@ -19,6 +19,7 @@ export class BusinessCardComponent implements OnInit { ) { } ngOnInit() { + this.userInfo = JSON.parse(localStorage.getItem('bussiness-card-info')); console.log(this.userInfo); } diff --git a/Mohem/src/app/authentication/confirm-login/confirm-login.component.ts b/Mohem/src/app/authentication/confirm-login/confirm-login.component.ts index 9e719df8..2e345b5c 100644 --- a/Mohem/src/app/authentication/confirm-login/confirm-login.component.ts +++ b/Mohem/src/app/authentication/confirm-login/confirm-login.component.ts @@ -475,11 +475,12 @@ export class ConfirmLoginComponent implements OnInit { return await modal.present(); } - checkAccess(el: any, isDigitalID = false, buttonType?) { + checkAccess(el: any, isDigitalID = false, buttonType?, isBusinessID = false,) { const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); - if (isDigitalID) { + if (isDigitalID || isBusinessID) { + const sourceType = isDigitalID === true ? 'digitalID' : 'businessID'; this.button(); - this.checkButtonType(buttonType); + this.checkButtonType(buttonType, sourceType); } else { console.log(data); @@ -497,7 +498,7 @@ export class ConfirmLoginComponent implements OnInit { } } - checkButtonType(typeNumber) { + checkButtonType(typeNumber, sourceType) { let buttonSelected; this.buttons.forEach(element => { element.forEach(elementValue => { @@ -508,7 +509,11 @@ export class ConfirmLoginComponent implements OnInit { } }); }); - this.sharedData.setSharedData(true, "loginWithDigitalIDButton"); + if (sourceType === 'digitalID') { + this.sharedData.setSharedData(true, "loginWithDigitalIDButton"); + } else { + this.sharedData.setSharedData(true, "loginWithBusinessIDButton"); + } this.loginType = buttonSelected; this.checkAppUpdated(); } diff --git a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts index 518f698b..fe589875 100644 --- a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts +++ b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts @@ -142,7 +142,7 @@ export class AuthenticationService { } else { mobileType = 'android'; } - request.VersionID = 3.1; + request.VersionID = 3.2; request.Channel = 31; request.LanguageID = TranslatorService.getCurrentLanguageCode(); request.MobileType = mobileType; diff --git a/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.html b/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.html index c0e012d1..32e5c5ff 100644 --- a/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.html +++ b/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.html @@ -59,7 +59,7 @@ - +

{{ts.trPK('general','business-card')}}

diff --git a/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.ts b/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.ts index 2cb0ea3a..e0e74379 100644 --- a/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.ts +++ b/Mohem/src/app/hmg-common/ui/welcome-login/welcome.component.ts @@ -17,7 +17,6 @@ import { ButtonSettings } from '../button/models/button-settingsl'; import { Events, ModalController } from '@ionic/angular'; import { SharedDataService } from '../../services/shared-data-service/shared-data.service'; import { DigitalIdComponent } from "src/app/authentication/digital-id/digital-id.component"; -import { BusinessCardComponent } from "src/app/authentication/business-card/business-card.component"; @Component({ selector: "welcome-login", @@ -97,11 +96,11 @@ export class WelcomeComponent implements OnInit, AfterViewInit, OnDestroy { console.log( "this.user in welcome login"+ JSON.stringify(this.user)); - // if (this.user && this.user.BusinessCardPrivilege) { - // this.showBusinessCard = true - // } else { - // this.showBusinessCard = false; - // } + if (this.user && this.user.BusinessCardPrivilege) { + this.showBusinessCard = true + } else { + this.showBusinessCard = false; + } this.userName = localStorage.getItem("user"); this.password = localStorage.getItem("password"); @@ -111,6 +110,7 @@ export class WelcomeComponent implements OnInit, AfterViewInit, OnDestroy { this.lastLoginDate= localStorage.getItem("login-at"); this.userInfo = JSON.parse(localStorage.getItem('digitalIDUser')); this.userBusiness = JSON.parse(localStorage.getItem('bussiness-card-info')); + console.log('userBusiness' + this.userBusiness); // this.userBusiness = this.cs.sharedService.getSharedData('bussiness-card-info', false); @@ -236,7 +236,11 @@ export class WelcomeComponent implements OnInit, AfterViewInit, OnDestroy { } loginWithDigitalID(){ - this.confimLogin.checkAccess(this.logintype, true, this.logintype); + this.confimLogin.checkAccess(this.logintype, true, this.logintype, false); + } + + loginWithBusinessCard() { + this.confimLogin.checkAccess(this.logintype, false, this.logintype, true); } @@ -261,16 +265,4 @@ export class WelcomeComponent implements OnInit, AfterViewInit, OnDestroy { return await modal.present(); } - async openBusinessCard() { - const modal = await this.modalController.create({ - component: BusinessCardComponent, - cssClass: 'digital-id-modal-css', - componentProps: { - 'userInfo': this.userBusiness - } - }); - return await modal.present(); - } - - } diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index 2e63be2b..0a882f0f 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -40,6 +40,7 @@ import { BackgroundGeolocation } from '@ionic-native/background-geolocation/ngx' import { NFC, Ndef } from "@ionic-native/nfc/ngx" import { DigitalIdComponent } from '../authentication/digital-id/digital-id.component'; import { FirebaseX } from '@ionic-native/firebase-x/ngx'; +import { BusinessCardComponent } from "src/app/authentication/business-card/business-card.component"; @Component({ selector: 'app-home', @@ -167,6 +168,7 @@ export class HomePage implements OnInit { ngOnInit() { let openDigitalIDCard = this.sharedData.getSharedData("loginWithDigitalIDButton", true); + let openBusinessCard = this.sharedData.getSharedData("loginWithBusinessIDButton", true); this.direction = TranslatorService.getCurrentLanguageName(); this.myTeamTitle = this.ts.trPK('myTeam', 'myTeam-header'); this.vacationRuleTitle = this.ts.trPK('vacation-rule', 'vacationRule'); @@ -175,9 +177,11 @@ export class HomePage implements OnInit { this.events.subscribe('getNotCount', badge => { this.notBadge = badge; }); - if (openDigitalIDCard === true) { + if (openDigitalIDCard) { console.log("DONE"); this.openDigitalId(); + } else if (openBusinessCard) { + this.openBusinessCard(); } } @@ -787,6 +791,16 @@ export class HomePage implements OnInit { }); return await modal.present(); } + + async openBusinessCard() { + const modal = await this.modalController.create({ + component: BusinessCardComponent, + cssClass: 'digital-id-modal-css' + }); + return await modal.present(); + } + + itemForSale() { this.common.navigateForward('/itemforsale/items'); }