File
Implements
Index
Properties
|
|
Methods
|
|
Inputs
|
|
Outputs
|
|
Outputs
triggerNext
|
Type : EventEmitter<boolean>
|
|
Methods
onRegisterSubmit
|
onRegisterSubmit(event)
|
|
|
onSbFormValueChange
|
onSbFormValueChange(event)
|
|
|
sbformDOMManipulation
|
sbformDOMManipulation()
|
|
|
updateUserDetails
|
updateUserDetails()
|
|
If user is not minor and login mode is gmail, then update basic info and redirect to resources page
|
Public
router
|
Type : Router
|
|
showEditUserDetailsPopup
|
Default value : false
|
|
showFullScreenLoader
|
Default value : false
|
|
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { ResourceService, ToasterService } from '@sunbird/shared';
import * as _ from 'lodash-es';
import { Router } from '@angular/router';
import { ProfileService } from '@sunbird/profile';
@Component({
selector: 'app-signup-onboarding-info',
templateUrl: './signup-onboarding-info.component.html',
styleUrls: ['./signup-onboarding-info.component.scss', '../signup/signup_form.component.scss']
})
export class SignupOnboardingInfoComponent implements OnInit {
@Input() startingForm: object;
@Output() subformInitialized: EventEmitter<{}> = new EventEmitter<{}>();
@Output() triggerNext: EventEmitter<boolean> = new EventEmitter<boolean>();
showEditUserDetailsPopup = false;
showFullScreenLoader = false;
constructor(public resourceService: ResourceService, public toasterService: ToasterService,
public router: Router, private profileService: ProfileService) { }
ngOnInit(): void {
setTimeout(() => {
this.sbformDOMManipulation();
}, 500);
}
sbformDOMManipulation() {
let formElement = document.getElementsByTagName('sb-form')[0];
if (formElement) {
let roleElement = formElement.getElementsByClassName('sb-input')[0];
if (roleElement) {
roleElement.classList.add('hide');
}
}
}
onRegisterSubmit(event) {
// If user is minor and login mode is gmail, then continue accepting email / phone for verification
if (_.get(this.startingForm, 'basicInfo.isMinor') && _.get(this.startingForm, 'routeParams.loginMode') === 'gmail') {
this.subformInitialized.emit(event);
this.triggerNext.emit();
} else if (!_.get(this.startingForm, 'basicInfo.isMinor') && _.get(this.startingForm, 'routeParams.loginMode') === 'gmail') {
// If user is not minor and login mode is gmail, then update basic info and redirect to resources page
this.updateUserDetails();
} else {
this.subformInitialized.emit(event);
this.triggerNext.emit();
}
}
/**
* @description This method is used to update user details and redirect user to resources page
* If user is not minor and login mode is gmail, then update basic info and redirect to resources page
* @since 4.10.1
*/
updateUserDetails() {
const req = {
'firstName': _.trim(_.get(this.startingForm, 'basicInfo.name')),
'dob': _.get(this.startingForm, 'basicInfo.yearOfBirth').toString(),
};
this.profileService.updateProfile(req).subscribe(res => {
if (_.get(res, 'result.response') === 'SUCCESS') {
this.toasterService.success(this.resourceService?.messages?.smsg?.m0046);
setTimeout(() => {
this.router.navigate(['/resources']).then(() => {
window.location.reload();
});
}, 1000);
} else {
this.toasterService.error(this.resourceService.messages.fmsg.m0085);
}
}, err => {
this.toasterService.error(this.resourceService.messages.fmsg.m0085);
});
}
onSbFormValueChange(event) {
this.sbformDOMManipulation();
}
}
<div class="signup-form-content">
<p class="fnormal font-weight-bold mb-16">To discover relevant content update the following details:</p>
<app-location-selection (onFormValueChange)="onSbFormValueChange($event)" (registerSubmit)="onRegisterSubmit($event)"
[showModal]="false">
<div slot="popup-sub-header">
<p class="subtitle">{{resourceService?.frmelmnts?.lbl?.editPersonalDetails}}‎</p>
</div>
</app-location-selection>
</div>
::ng-deep {
html[layout=joy] sb-form {
.multi-select-container .list-border {
border: 0.03125rem solid var(--gray-400) !important;
}
.multi-select-container {
margin-top: 0.5rem !important;
}
.multi-select-container {
margin-bottom: 1rem !important;
}
}
.sb-onboard__footer {
max-width: 100% !important;
margin-top: 1.5rem !important;
}
.w-10 {
width: 5% !important;
max-width: 5% !important;
}
}
@use "@project-sunbird/sb-styles/assets/mixins/mixins" as *;
.signup-form-content,.logo-content{
width: 100%;
max-width: calculateRem(360px);
margin: 0 auto;
padding:0 1rem
}
Legend
Html element with directive