File
Index
Properties
|
|
Methods
|
|
Inputs
|
|
Methods
changeEvent
|
changeEvent(event)
|
|
|
closePopover
|
closePopover(data)
|
|
|
converDataSrcToObject
|
converDataSrcToObject(ele)
|
|
|
Async
ionViewWillEnter
|
ionViewWillEnter()
|
|
|
Async
openTermsOfUse
|
openTermsOfUse()
|
|
|
consentForm
|
Type : []
|
Default value : []
|
|
isAgreed
|
Default value : false
|
|
isSSOUser
|
Default value : false
|
|
import {Component, Input} from '@angular/core';
import { NavParams, PopoverController } from '@ionic/angular';
import { CommonUtilService, AppGlobalService, UtilityService } from '@app/services';
import {FormAndFrameworkUtilService} from '../../../../services/formandframeworkutil.service';
import { RouterLinks } from '@app/app/app.constant';
@Component({
selector: 'app-consent-pii-popup',
templateUrl: './consent-pii-popup.component.html',
styleUrls: ['./consent-pii-popup.component.scss'],
})
export class ConsentPiiPopupComponent {
@Input() course;
profile: any;
consentForm = [];
isAgreed = false;
appName: string;
isSSOUser = false;
constructor(
private popOverCtrl: PopoverController,
private commonUtilService: CommonUtilService,
private formAndFrameworkUtilService: FormAndFrameworkUtilService,
private appGlobalService: AppGlobalService,
private utilityService: UtilityService,
private navParams: NavParams,
) {
this.isSSOUser = this.navParams.get('isSSOUser');
}
async ionViewWillEnter() {
this.profile = this.appGlobalService.getCurrentUser();
const profileKeys = await this.formAndFrameworkUtilService.getConsentFormConfig();
profileKeys.forEach(element => {
this.consentForm.push({
key: this.commonUtilService.getTranslatedValue(element.templateOptions.placeHolder,
JSON.parse(element.templateOptions.placeHolder)['en']),
value: this.converDataSrcToObject(element)
});
});
this.commonUtilService.getAppName().then((res) => { this.appName = res; });
}
closePopover(data) {
const request = {
data,
userId: this.profile.uid
};
this.popOverCtrl.dismiss(request);
}
dontShare() {
this.closePopover(false);
}
share() {
this.closePopover(true);
}
converDataSrcToObject(ele) {
const dataSrc = ele.templateOptions.dataSrc;
switch (dataSrc.marker) {
case 'SERVER_PROFILE':
if (ele.code === 'emailId' || ele.code === 'phoneNumber') {
if (ele.code === 'emailId') {
return this.profile.serverProfile['email'] ? this.profile.serverProfile['email'] :
(this.profile.serverProfile['maskedEmail'] ? this.profile.serverProfile['maskedEmail'] : '-');
} else {
return this.profile.serverProfile['phone'] ? this.profile.serverProfile['phone'] :
(this.profile.serverProfile['maskedPhone'] ? this.profile.serverProfile['maskedPhone'] : '-');
}
} else {
if (ele.code === 'externalIds') {
let externalId = '-';
if (this.profile.serverProfile[dataSrc.params.categoryCode] ) {
this.profile.serverProfile[dataSrc.params.categoryCode].forEach((externaleId) => {
if (externaleId.provider === this.profile.serverProfile.channel) {
externalId = externaleId.id;
}
});
}
return externalId;
} else {
return this.profile.serverProfile[dataSrc.params.categoryCode] ?
this.profile.serverProfile[dataSrc.params.categoryCode] : '-';
}
}
case 'SERVER_PROFILE_LOCATIONS':
let location = '-';
if (this.profile.serverProfile.userLocations && this.profile.serverProfile.userLocations.length) {
this.profile.serverProfile.userLocations.forEach(element => {
if (element.type === ele.code) {
location = element.name;
} else if (ele.code === 'schoolId' && element.type === 'school' ) {
location = element.code;
}
});
}
return location;
case 'SERVER_PROFILE_DECLARED':
if (this.profile.serverProfile.declarations.length && this.profile.serverProfile.declarations[0].info) {
return this.profile.serverProfile.declarations[0].info[dataSrc.params.categoryCode] ?
this.profile.serverProfile.declarations[0].info[dataSrc.params.categoryCode] : '-';
} else if (ele.code === 'emailId' || ele.code === 'phoneNumber') {
if (ele.code === 'emailId') {
return this.profile.serverProfile['maskedEmail'] ? this.profile.serverProfile['maskedEmail'] : '-';
} else {
return this.profile.serverProfile['maskedPhone'] ? this.profile.serverProfile['maskedPhone'] : '-';
}
}
return '-';
default:
return '-';
}
}
async openTermsOfUse() {
const baseUrl = await this.utilityService.getBuildConfigValue('TOU_BASE_URL');
const url = baseUrl + RouterLinks.TERM_OF_USE;
const options
= 'hardwareback=yes,clearcache=no,zoom=no,toolbar=yes,disallowoverscroll=yes';
(window as any).cordova.InAppBrowser.open(url, '_blank', options);
}
changeEvent(event) {
if (event.detail.checked) {
this.isAgreed = true;
} else {
this.isAgreed = false;
}
}
}
<ion-header class="sb-popover-header">
<ion-toolbar class="sb-popover-toolbar">
<ion-title class="sb-popover-title" role="heading" aria-level="2">{{'PROFILE_DETAILS_TITLE' | translate}}
</ion-title>
</ion-toolbar>
</ion-header>
<div id="main-content">
<div class="consent-popover-info">
<div class="flex-container">
<div class="body" *ngIf="consentForm.length">
<div *ngFor="let element of consentForm">
<p class="profile-info-section"><span>{{element.key}}</span><span
class="profile-info">{{element.value}}</span></p>
</div>
</div>
<div class="footer">
<div>
<p>
<span>
<ion-icon name="information-circle" aria-hidden="true" color="#333333">
</ion-icon>
</span>
<span attr.aria-label="{{'FRMELEMNTS_LBL_CONSENT_POPUP_INFO' | translate}}" style="margin-left: 5px;">{{'FRMELEMNTS_LBL_CONSENT_POPUP_INFO' | translate}}</span>
</p>
</div>
<div class="cr-input-primary" lines="none">
<span *ngIf="!isSSOUser">
<ion-checkbox class="cr-terms-checkbox" attr.aria-label="{{'AGREE_TO_SHARE_PROFILE_DETAILS' | categoryKeyTranslate: course}}" (ionChange)="changeEvent($event)"></ion-checkbox>
</span>
<span *ngIf="isSSOUser">
<ion-checkbox class="cr-terms-checkbox" attr.aria-label="{{'SELF_DECLARE_TEACHER_TNC' | translate: {'%appName': appName} }}" (ionChange)="changeEvent($event)"></ion-checkbox>
</span>
<span>
<p class="cr-terms-checkbox-label" *ngIf="!isSSOUser">
<span>{{'AGREE_TO_SHARE_PROFILE_DETAILS' | categoryKeyTranslate: course}}</span>
<span (click)="openTermsOfUse()" class="terms-info">{{'CONSENT_TERMS_OF_USE' | translate }}</span>
<span >{{'CONSENT_TERMS_OF_USE_REMAINING' | translate }}</span>
</p>
<p class="cr-terms-checkbox-label" *ngIf="isSSOUser">
<span>{{'SELF_DECLARE_TEACHER_TNC' | translate: {'%appName': appName} }}</span>
<span (click)="openTermsOfUse()" class="terms-info">{{'PRIVACY_POLICY' | translate }}</span>
</p>
</span>
</div>
<div class="btn-info" *ngIf="!isSSOUser">
<button class="save-changes-not-agree" (click)="dontShare()">{{'FRMELEMNTS_BTN_DONOT_SHARE' | translate}}</button>
<button class="save-changes" (click)="share()" [disabled]="!isAgreed" [ngClass]="!isAgreed ? 'share-disabled' : null">{{'SHARE' | translate}}</button>
</div>
<div class="btn-info" *ngIf="isSSOUser">
<button class="save-changes" (click)="share()" [disabled]="!isAgreed" [ngClass]="!isAgreed ? 'share-disabled' : null">{{'CONTINUE' | translate}}</button>
</div>
</div>
</div>
</div>
</div>
@import "src/assets/styles/base/_variables.scss";
@import "src/assets/styles/_variables.scss";
@import "src/assets/styles/_custom-mixins.scss";
.cr-terms-checkbox-label{
padding-left: 5px;
}
.cr-terms-checkbox{
--background-checked: #{$blue};
--border-color: #{$blue};
--border-radius: 4px;
--border-width: 0.063rem;
--border-color-checked:#{$blue};
}
.cr-input-primary {
display: inline-flex;
}
.btn-label {
float: right;
display: inline-flex;
}
#main-content {
overflow-y: scroll;
background: map-get($colors, white);
}
.consent-popover-info {
overflow: hidden;
padding: 14px;
}
.flex-container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.header {
flex-grow: 0;
flex-shrink: 0;
color: #222222;
font-family: "Noto Sans", sans-serif;
font-size: 1.25rem;
letter-spacing: 0;
font-weight: bold;
margin-bottom: 16px;
@include ltr() {
text-align: right
}
@include rtl() {
text-align:left;
}
}
.body {
display: block;
flex-grow: 1;
flex-shrink: 1;
height: 38vh;
overflow-y: scroll;
}
.footer {
flex-grow: 0;
flex-shrink: 0;
}
.save-changes{
color: white;
background-color: $blue;
font-size: 1rem;
padding: 8px 0;
margin-left: 18px;
border: 2px solid $blue;
width: 45%;
}
.save-changes-not-agree{
color: $blue;
background-color: white;
font-size: 1rem;
padding: 8px 0;
border: 2px solid $blue;
width: 45%;
margin-left: 10px;
}
.btn-info{
padding: 12px;
text-align: center;
}
.profile-info{
color: map-get($colors, granite_gray);
font-family: "Noto Sans", sans-serif;
font-size: $font-size-base;
letter-spacing: 0;
}
.profile-info-section{
display: grid;
grid-template-columns: 100px 227px;
}
.share-disabled{
opacity: 0.5 !important;
cursor: default;
}
.terms-info{
color: $blue
}
ion-icon {
@include ltr {
float: right !important;
}
@include rtl {
float: left !important;
}
}
Legend
Html element with directive