File

app/dxa/dxa-entity/views/my-profile-views/my-profile-register/my-profile-register.component.ts

Implements

OnInit

Metadata

selector [my-profile-register]
styleUrls ./my-profile-register.component.scss
templateUrl ./my-profile-register.component.html

Index

Properties
Methods
Inputs
HostBindings

Constructor

constructor(formBuilder: FormBuilder, userService: MyProfileService, labelService: LabelService, publicationService: PublicationService, util: UtilService, dataService: DataResolverService, countryTaxonomyService: CountryTaxonomyService, taxonomyService: TaxonomyService, viewportScroller: ViewportScroller)
Parameters :
Name Type Optional
formBuilder FormBuilder No
userService MyProfileService No
labelService LabelService No
publicationService PublicationService No
util UtilService No
dataService DataResolverService No
countryTaxonomyService CountryTaxonomyService No
taxonomyService TaxonomyService No
viewportScroller ViewportScroller No

Inputs

entity

HostBindings

class

Methods

checkForErrors
checkForErrors(formControl: string, error: string)
Parameters :
Name Type Optional
formControl string No
error string No
Returns : boolean
checkIfTouched
checkIfTouched(formControl: string)
Parameters :
Name Type Optional
formControl string No
Returns : boolean
checkInvalid
checkInvalid(formControl: string)
Parameters :
Name Type Optional
formControl string No
Returns : boolean
checkPassword
checkPassword()
Returns : boolean
checkPhoneNumber
checkPhoneNumber()
Returns : boolean
createTermsLabel
createTermsLabel()
Returns : any
Public isEmpty
isEmpty(arr: any)
Parameters :
Name Type Optional
arr any No
Returns : boolean
ngOnInit
ngOnInit()
Returns : void
onChanges
onChanges()
Returns : void
onSubmit
onSubmit()
Returns : void
selectDeselectAll
selectDeselectAll(element)
Parameters :
Name Optional
element No
Returns : void
Private sortedList
sortedList(theList: any)
Parameters :
Name Type Optional
theList any No
Returns : any

Properties

countryList
Type : Countries
Public countryTaxonomyService
Type : CountryTaxonomyService
emailAddressConfirmLabel
Type : string
emailAddressIncorrectLabel
Type : string
emailAlreadyRegisteredLabel
Type : string
errorMessageLabel
Type : string
industries
Type : TaxonomySchema
interestedAboutLabel
Type : string
isLoading
Type : boolean
isRegistrationComplete
Default value : false
isRegistrationUnderProcess
Type : boolean
isSubmitted
Default value : false
languages
Type : TaxonomySchema
mandatoryLabel
Type : string
optionList
Type : []
Default value : []
passwordNoMatchLabel
Type : string
passwordStrongLabel
Type : string
phoneNumberLabel
Type : string
regionList
Type : Regions
registerForm
Type : FormGroup
registerLabel
Type : string
stateList
Type : States
Public taxonomyService
Type : TaxonomyService
termsarray
typeOfUsers
Type : TaxonomySchema
unexpectedErrorLabel
Type : string
user
Type : User
Public viewportScroller
Type : ViewportScroller
import { Component, OnInit, Input, HostBinding } from '@angular/core';
import { User } from '../my-profile.model';
import { MyProfileService } from '../my-profile.service';
import { FormBuilder, FormGroup, Validators, FormArray, FormControl, ValidationErrors } from '@angular/forms';
import { LabelService } from 'src/app/core/services/label-service/label-service.service';
import { PublicationService } from 'src/app/core/services/publication-service/publication.service';
import { matchOtherValidator, conditionalValidator } from 'src/app/shared/validator/validator';
import { UtilService } from 'src/app/core/services/util-service/util.service';
import { DataResolverService } from 'src/app/core/services/data-resolver/data-resolver.service';
import { Countries, States, Regions, CountryTaxonomyService } from 'src/app/core/services/taxonomy-services/country-taxonomy.service';
import { TaxonomyService, TaxonomySchema } from 'src/app/core/services/taxonomy-services/taxonomy.service';
import { AppConfig } from 'src/app/app.config';
import { ViewportScroller } from '@angular/common';

@Component({
	selector: '[my-profile-register]',
	templateUrl: './my-profile-register.component.html',
	styleUrls: ['./my-profile-register.component.scss']
})
export class MyProfileRegisterComponent implements OnInit {

	@Input() entity;
	registerForm: FormGroup;
	user: User;
	isSubmitted = false;
	termsarray;

	// Keyword lists
	optionList = [];

	// Labels
	mandatoryLabel: string;
	emailAlreadyRegisteredLabel: string;
	emailAddressIncorrectLabel: string;
	emailAddressConfirmLabel: string;
	passwordStrongLabel: string;
	passwordNoMatchLabel: string;
	phoneNumberLabel: string;
	interestedAboutLabel: string;
	registerLabel: string;
	unexpectedErrorLabel: string;
	errorMessageLabel: string;

	typeOfUsers: TaxonomySchema;
	languages: TaxonomySchema;
	industries: TaxonomySchema;

	countryList: Countries;
	stateList: States;
	regionList: Regions;
	isLoading: boolean;
	isRegistrationComplete = false;
	isRegistrationUnderProcess: boolean;

	@HostBinding('class') get class() { return 'col-md-12 space-between'; }

	constructor(
		private formBuilder: FormBuilder,
		private userService: MyProfileService,
		private labelService: LabelService,
		private publicationService: PublicationService,
		private util: UtilService,
		private dataService: DataResolverService,
		public countryTaxonomyService: CountryTaxonomyService,
		public taxonomyService: TaxonomyService,
		public viewportScroller: ViewportScroller
	) { }

	ngOnInit() {
		this.labelService.getLabel('mandatory').then(label => this.mandatoryLabel = label);
		this.labelService.getLabel('emailAlreadyRegistered').then(label => this.emailAlreadyRegisteredLabel = label);
		this.labelService.getLabel('emailAddressIncorrect').then(label => this.emailAddressIncorrectLabel = label);
		this.labelService.getLabel('emailAddressConfirm').then(label => this.emailAddressConfirmLabel = label);
		this.labelService.getLabel('passwordStrong').then(label => this.passwordStrongLabel = label);
		this.labelService.getLabel('passwordNoMatch').then(label => this.passwordNoMatchLabel = label);
		this.labelService.getLabel('phoneNumberIncorrect').then(label => this.phoneNumberLabel = label);
		this.labelService.getLabel('interestedAbout').then(label => this.interestedAboutLabel = label);
		this.labelService.getLabel('registerUser').then(label => this.registerLabel = label);
		this.labelService.getLabel('unexpectedError').then(label => this.unexpectedErrorLabel = label);
		this.createTermsLabel();

		this.registerForm = this.formBuilder.group({
			firstName: new FormControl('', Validators.required),
			lastName: new FormControl('', Validators.required),
			email: new FormControl('', [Validators.required, Validators.email]),
			confirmEmail: new FormControl('', [Validators.required, Validators.email, matchOtherValidator('email')]),
			password: new FormControl('', [Validators.required, Validators.minLength(8), Validators.pattern('(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[A-Za-z\d$@$!%*?&].{7,}')]),
			confirmPassword: new FormControl('', [
				Validators.required, matchOtherValidator('password')
			]),
			phoneNumber: new FormControl('', [Validators.required, Validators.minLength(7), Validators.maxLength(15), Validators.pattern('^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$')]),
			companyName: new FormControl('', Validators.required),
			address: new FormControl('', Validators.required),
			zipCode: new FormControl('', Validators.required),
			userType: new FormControl('', Validators.required),
			industry: new FormControl('', Validators.required),
			preferedLanguage: new FormControl('', Validators.required),
			location: new FormControl('', Validators.required),
			region: new FormControl('', [conditionalValidator(
				(() => (this.regionList && this.regionList.length > 0)),
				Validators.required)
			]),
			state: new FormControl('', [conditionalValidator(
				(() => (this.stateList && this.stateList.length > 0)),
				Validators.required)
			]),
			city: new FormControl('', Validators.required),
			optInOptions: new FormArray([]),
			termsAndCondition: new FormControl('', Validators.requiredTrue)
		});

		this.taxonomyService.getTaxonomyData(AppConfig.settings.taxonomyService.searcher.TypeOfUser)
			.subscribe((userType) => {
				this.typeOfUsers = userType;
			});
		this.taxonomyService.getTaxonomyData(AppConfig.settings.taxonomyService.searcher.Language)
			.subscribe((language) => {
				this.languages = language;
			});
		this.taxonomyService.getTaxonomyData(AppConfig.settings.taxonomyService.searcher.Industries)
			.subscribe((indistries) => {
				this.industries = indistries;
			});

		this.dataService.getKeywords('Registration Opt-in Options').then(optionList => {
            this.optionList = optionList;
            const defaustOptionList =  this.util.extract(this.entity, 'DefaultRegisterOptInOptions') || [];
			const optionForm = <FormArray>this.registerForm.get('optInOptions');
			optionList.forEach(option => {
				optionForm.push(new FormControl(defaustOptionList.includes(option.Key)));
			});
		});
		
		this.countryTaxonomyService.getBehaviorCountries().subscribe(countries => {
			this.countryList = this.sortedList(countries);
		}, (err) => { console.log(err); });
		this.countryTaxonomyService.getLoader().subscribe((val) => {
			this.isLoading = val;
		});
		// This will continous monitor any value change in Registration From field
		this.onChanges();
	}

	onChanges(): void {
		this.registerForm.get('location').valueChanges.subscribe(countryName => {
			this.countryTaxonomyService.getRegionStates(countryName);
			this.countryTaxonomyService.getBehaviorRegions().subscribe(regions => {
				this.regionList = this.sortedList(regions);
				this.checkInvalid('region');
			});
			this.countryTaxonomyService.getBehaviorStates().subscribe(states => {
				this.stateList = this.sortedList(states);
				this.checkInvalid('state');
			});
			this.countryTaxonomyService.getLoader().subscribe((val) => {
				this.isLoading = val;
			});
		});
		this.registerForm.get('region').valueChanges.subscribe(regionName => {
			const selectedRegionObj = this.regionList.filter(function (reg) {
				return reg['Title'] === regionName;
			});
			if (selectedRegionObj[0] !== undefined) {
				this.stateList = selectedRegionObj[0]['Children'];
				this.countryTaxonomyService.setBehaviorStates(this.stateList);
			} else {
				this.countryTaxonomyService.setBehaviorStates(null);
			}

			this.countryTaxonomyService.getBehaviorStates().subscribe(states => {
				this.stateList = this.sortedList(states);
			});
		});
	}

	private sortedList(theList: any): any {
		if (!this.isEmpty(theList)) {
			theList = theList.sort(this.countryTaxonomyService.compare);
		}
		return theList;
	}

	public isEmpty(arr: any) {
		return (arr === undefined || arr === null || arr.length === 0) ? true : false;
	}

	checkInvalid(formControl: string): boolean {
		if (this.registerForm.controls[formControl] && this.registerForm.controls[formControl].errors) {
			return (this.registerForm.controls[formControl].errors.required);
		}
	}

	checkIfTouched(formControl: string): boolean {
		return (this.registerForm.controls[formControl].touched);
	}

	checkForErrors(formControl: string, error: string): boolean {
		return (this.registerForm.controls[formControl].errors && this.registerForm.controls[formControl].errors[error]);
	}

	checkPhoneNumber(): boolean {
		return (this.registerForm.controls.phoneNumber.errors && (this.registerForm.controls.phoneNumber.errors.minlength || this.registerForm.controls.phoneNumber.errors.maxlength || this.registerForm.controls.phoneNumber.errors.pattern));
	}
	checkPassword(): boolean {
		return (this.registerForm.controls.password.errors && (this.registerForm.controls.password.errors.minlength || this.registerForm.controls.password.errors.pattern));
	}

	createTermsLabel(): any {
		let terms = this.util.extract(this.entity, 'Terms') || '';
		terms = terms.replace('{terms and condition}', ',');
		terms = terms.replace('{privacy policy}', ',');
		this.termsarray = terms.split(',');
	}

	selectDeselectAll(element){
		const optionForm = <FormArray>this.registerForm.get('optInOptions');
		element.checked = !element.checked;		
		document.querySelectorAll('input[name="interest"]').forEach((el, index) =>{
			el['checked'] = element.checked;
			optionForm.at(index).setValue(element.checked);
		});
	}

	onSubmit(): void {
		this.isSubmitted = true;

		if (this.registerForm.invalid) {
			return;
		}

		this.isRegistrationUnderProcess = true;
		this.user = new User(
			this.registerForm.controls.location.value,
			this.registerForm.controls.email.value,
			this.registerForm.controls.password.value,
			this.registerForm.controls.email.value
		);

		this.user.city = this.registerForm.controls.city.value;
		this.user.companyName = this.registerForm.controls.companyName.value;
		this.user.email_verified = !this.checkInvalid('confirmEmail');
		this.user.family_name = this.registerForm.controls.lastName.value;
		this.user.given_name = this.registerForm.controls.firstName.value;
		this.user.phoneNumber = this.registerForm.controls.phoneNumber.value;
		this.user.postal_code = this.registerForm.controls.zipCode.value;
		this.user.preferred_language = this.registerForm.controls.preferedLanguage.value;
		this.user.industry = this.registerForm.controls.industry.value;
		this.user.user_type = this.registerForm.controls.userType.value;
		this.user.pub_id = this.publicationService.getPublicationId();
		this.user.region = this.registerForm.controls.region.value;
		this.user.state = this.registerForm.controls.state.value;
		this.user.street = this.registerForm.controls.address.value;
		this.registerForm.controls.optInOptions.value.forEach((selected, index) => {
			const option = this.optionList[index];
			this.user[option.Value] = selected;
		});

		this.userService.postUser(this.user).toPromise().then(res => {
			if (res.status === 208) {
				this.errorMessageLabel = this.emailAlreadyRegisteredLabel;
			} else if (res.status === 202) {
				this.isRegistrationUnderProcess = false; 
				this.isRegistrationComplete = true;
				this.viewportScroller.scrollToPosition([0, 0]);
			}
		}).catch((error) => {
			if (error === 409) {
				this.errorMessageLabel = this.emailAlreadyRegisteredLabel;
			}
			else {
				this.errorMessageLabel = this.unexpectedErrorLabel;
			}
		});
	}

}
<form *ngIf="!isRegistrationComplete; else registrationComplete" [formGroup]="registerForm" (ngSubmit)="onSubmit()" novalidate >
  <div class="form-group">
    <label for="firstName">{{entity.FirstName}} <span class="error-message">*</span></label>
    <input type="text" class="form-control" formControlName="firstName"
      [ngClass]="{'is-invalid': checkInvalid('firstName') && isSubmitted}" required>
    <small class="form-text error-message" *ngIf="checkInvalid('firstName') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div class="form-group">
    <label for="lastName">{{entity.LastName}} <span class="error-message">*</span></label>
    <input type="text" class="form-control" formControlName="lastName"
      [ngClass]="{'is-invalid': checkInvalid('lastName') && isSubmitted}" required>
    <small class="form-text error-message" *ngIf="checkInvalid('lastName') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div class="form-group">
    <label for="email">{{entity.EmailAddress}} <span class="error-message">*</span></label>
    <input type="email" class="form-control" formControlName="email"
      [ngClass]="{'is-invalid': checkInvalid('email') && isSubmitted}" required>
    <small class="form-text error-message"
      *ngIf="checkIfTouched('email') && checkForErrors('email', 'email')">{{emailAddressIncorrectLabel}}</small>
    <small class="form-text error-message" *ngIf="checkInvalid('email') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div class="form-group">
    <label for="confirmEmail">{{entity.EmailAddressConfirm}} <span class="error-message">*</span></label>
    <input type="email" class="form-control" formControlName="confirmEmail"
      [ngClass]="{'is-invalid': checkInvalid('confirmEmail') && isSubmitted}" required>
    <small class="form-text error-message"
      *ngIf="checkIfTouched('confirmEmail') && checkForErrors('confirmEmail', 'match')">{{emailAddressConfirmLabel}}</small>
    <small class="form-text error-message"
      *ngIf="checkInvalid('confirmEmail') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div class="form-group">
    <label for="password">{{entity.ChoosePassword}} <span class="error-message">*</span></label>
    <input type="password" class="form-control" formControlName="password"
      [ngClass]="{'is-invalid': checkInvalid('password') && isSubmitted}" required>
    <small class="form-text error-message"
      *ngIf="checkIfTouched('password') && checkPassword()">{{passwordStrongLabel}}</small>
    <small class="form-text error-message" *ngIf="checkInvalid('password') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div class="form-group">
    <label for="confirmPassword">{{entity.ConfirmPassword}}<span class="error-message">*</span></label>
    <input type="password" class="form-control" formControlName="confirmPassword"
      [ngClass]="{'is-invalid': checkInvalid('confirmPassword') && isSubmitted}" required>
    <small class="form-text error-message"
      *ngIf="checkIfTouched('confirmPassword') && checkForErrors('confirmPassword', 'match')">{{passwordNoMatchLabel}}</small>
    <small class="form-text error-message"
      *ngIf="checkInvalid('confirmPassword') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div class="form-group">
    <label for="phoneNumber">{{entity.PhoneNumber}} <span class="error-message">*</span></label>
    <input type="text" class="form-control" formControlName="phoneNumber"
      [ngClass]="{'is-invalid': checkInvalid('phoneNumber') && isSubmitted}" required>
    <small class="form-text error-message"
      *ngIf="checkIfTouched('phoneNumber') && checkPhoneNumber()">{{phoneNumberLabel}}</small>
    <small class="form-text error-message" *ngIf="checkInvalid('phoneNumber') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div class="form-group">
    <label for="companyName">{{entity.CompanyName}} <span class="error-message">*</span></label>
    <input type="text" class="form-control" formControlName="companyName"
      [ngClass]="{'is-invalid': checkInvalid('companyName') && isSubmitted}" required>
    <small class="form-text error-message" *ngIf="checkInvalid('companyName') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div class="form-group">
    <label for="address">{{entity.Address}} <span class="error-message">*</span></label>
    <input type="textarea" class="form-control" formControlName="address"
      [ngClass]="{'is-invalid': checkInvalid('address') && isSubmitted}" required>
    <small class="form-text error-message" *ngIf="checkInvalid('address') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div class="form-group">
    <label for="zipCode">{{entity.ZipCode}} <span class="error-message">*</span></label>
    <input type="text" class="form-control" formControlName="zipCode"
      [ngClass]="{'is-invalid': checkInvalid('zipCode') && isSubmitted}" required>
    <small class="form-text error-message" *ngIf="checkInvalid('zipCode') && isSubmitted">{{mandatoryLabel}}</small>
  </div>

  <div class="form-group">
    <label for="userType">{{entity.Role}} <span class="error-message">*</span></label>
    <select class="form-control" formControlName="userType"
      [ngClass]="{'is-invalid': checkInvalid('userType') && isSubmitted}" required>
      <option value="">Select User Type</option>
      <option *ngFor="let userType of typeOfUsers" [ngValue]="userType.Key">{{userType.Key}}</option>
    </select>
    <small class="form-text error-message" *ngIf="checkInvalid('userType') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div class="form-group">
    <label for="industry">{{entity.Industry}}<span class="error-message">*</span></label>
    <select class="form-control" formControlName="industry"
      [ngClass]="{'is-invalid': checkInvalid('industry') && isSubmitted}" required>
      <option value="">Select Industry</option>
      <option *ngFor="let industry of industries" [ngValue]="industry.Key">{{industry.Key}}</option>
    </select>
    <small class="form-text error-message" *ngIf="checkInvalid('industry') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div class="form-group">
    <label for="preferedLanguage">{{entity.PreferredLanguage}}<span class="error-message">*</span></label>
    <select class="form-control" formControlName="preferedLanguage"
      [ngClass]="{'is-invalid': checkInvalid('preferedLanguage') && isSubmitted}" required>
      <option value="">Select Prefered Language</option>
      <ng-container *ngFor="let language of languages">
        <option *ngIf="language.Value" [ngValue]="language.Key">{{language.Key}}</option>
      </ng-container>
    </select>
    <small class="form-text error-message"
      *ngIf="checkInvalid('preferedLanguage') && isSubmitted">{{mandatoryLabel}}</small>
  </div>

  <div class="form-group" *ngIf="!isEmpty(countryList)">
    <label for="location">{{entity.Location}} <span class="error-message">*</span></label>
    <select class="form-control" formControlName="location"
      [ngClass]="{'is-invalid': checkInvalid('location') && isSubmitted}" required>
      <option value="">Select Country</option>
      <option *ngFor="let country of countryList" [ngValue]="country.Title">{{country.Title}}</option>
    </select>
    <small class="form-text error-message" *ngIf="checkInvalid('location') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div class="form-group" *ngIf="!isEmpty(regionList)">
    <label for="region">{{entity.Region}} <span class="error-message">*</span></label>
    <select class="form-control" formControlName="region"
      [ngClass]="{'is-invalid': checkInvalid('region') && isSubmitted }" required>
      <option value="">Select Region</option>
      <option *ngFor="let region of regionList" [ngValue]="region.Title">{{region.Title}}</option>
    </select>
    <small class="form-text error-message" *ngIf="checkInvalid('region') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div class="form-group" *ngIf="!isEmpty(stateList)">
    <label for="state">{{entity.State}} <span class="error-message">*</span></label>
    <select class="form-control" formControlName="state"
      [ngClass]="{'is-invalid': checkInvalid('state') && isSubmitted}" required>
      <option value="">Select State</option>
      <option *ngFor="let state of stateList" [ngValue]="state.Title">{{state.Title}}</option>
    </select>
    <small class="form-text error-message" *ngIf="checkInvalid('state') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div *ngIf="isLoading">
    <img src="./v2/assets/img/loader.gif" />
  </div>


  <div class="form-group">
    <label for="city">{{entity.City}} <span class="error-message">*</span></label>
    <input type="text" class="form-control" formControlName="city"
      [ngClass]="{'is-invalid': checkInvalid('city') && isSubmitted}" required>
    <small class="form-text error-message" *ngIf="checkInvalid('city') && isSubmitted">{{mandatoryLabel}}</small>
  </div>
  <div class="form-group">
    <div class="card">
      <div class="card-body">
        <h5 class="card-title">{{entity.Interested}}</h5>
        <div class="card-text">

          <div class="form-check container" (click)="selectDeselectAll(selectAll)">
            <input  type="checkbox" class="form-check-input" #selectAll>
            <label class="form-check-label" > All </label>
            <label class="checkmark" ></label>
          </div>
          
          <ng-container *ngIf="registerForm.controls.optInOptions.value.length > 0">
            <div class="form-check container"
              *ngFor="let opt of registerForm.controls.optInOptions.controls; let i=index">
              <input name="interest" [formControl]="opt" [value]="optionList[i].Value" type="checkbox"
                class="form-check-input" [id]="optionList[i].Value">
              <label class="form-check-label" [for]="optionList[i].Value">
                {{optionList[i].Key}}
              </label>
              <label class="checkmark" [for]="optionList[i].Value"></label>
            </div>
          </ng-container>
        </div>
      </div>
    </div>
  </div>
  <div class="form-check mb-3">
    <input type="checkbox" class="form-check-input" id="termsAndCondition" formControlName="termsAndCondition">
    <label class="form-check-label" for="termsAndCondition">{{termsarray[0]}}
      <a component-link [linkObject]="entity.TermsAndConditions" class="no-new-window-icon">{{entity.TermsAndConditions.LinkButtonTitleText}}</a>
      {{termsarray[1]}}
      <a component-link [linkObject]="entity.PrivacyPolicy" class="no-new-window-icon">{{entity.PrivacyPolicy.LinkButtonTitleText}}</a>
      {{termsarray[2]}} <span class="error-message">* </span> </label>
    <label class="checkmark" for="termsAndCondition"></label>
    <small class="form-text error-message" *ngIf="checkInvalid('termsAndCondition') && isSubmitted">
      {{mandatoryLabel}}
    </small>
  </div>
  <button type="submit" class="btn btn-green mr-1 mb-1" [disabled]="isSubmitted && registerForm.invalid" [ngClass]="{'loading': isRegistrationUnderProcess}"  >
		<span>{{registerLabel}}</span>
	</button>
  <span *ngIf="isRegistrationUnderProcess"> 
    <img src="./v2/assets/img/loader.gif" />
  </span>
  <small class="form-text error-message" *ngIf="isSubmitted && errorMessageLabel">
    {{errorMessageLabel}}
  </small>
</form>
<ng-template #registrationComplete>
  <my-profile-confirmation [user]="user"></my-profile-confirmation>
</ng-template>

./my-profile-register.component.scss

@import "src/app/styles/helpers";
@import "~bootstrap/scss/spinners";

form {
  max-width: calc-rem(700);

  .error-message{
      color: $red;
  }
  
 
  .form-check {
      display: flex;
      position: relative;
      padding-left: calc-rem(35);
      padding-bottom: calc-rem(6);
      padding-top: calc-rem(6);
      font-size: inherit;
  
      /* Hide the browser's default checkbox */
      &-input {
        position: absolute;
        display: none;
        cursor: pointer;
        height: 0;
        width: 0;
  
        /* Show the checkmark when checked */
        &:checked~.checkmark:after {
          display: block;
        }
      }
  
      &-label{
        flex-grow: 1;
        cursor: pointer;
      }
  
      /* Create a custom checkbox */
      .checkmark {
        position: absolute;
        top: 6px;
        left: 5px;
        height: calc-rem(16);
        width: calc-rem(15);
        background-color: $white;
        border: 1px solid $slate;
        margin-top: calc-rem(7);
        cursor: pointer;
  
        /* Create the checkmark/indicator (hidden when not checked) */
        &:after {
          content: "";
          position: absolute;
          display: none;
          left: 4px !important;
          top: 2px !important;
          width: 5px !important;
          height: 10px !important;
          border: solid $blue !important;
          border-width: 0 3px 3px 0 !important;
          border-radius: 0px !important;
          background-color: transparent !important;
          transform: rotate(45deg);
        }
      }
    }
    
    .input-group-text {
      background-color: $off-white;  // Color of image background.
      padding: 0 calc-rem(8);
      border: 1px solid $light-slate;
  
      img {
          width: calc-rem(30);
          height: calc-rem(24);
      }
  }
  
  .search-box-query {
      height: calc-rem(41);
      padding: calc-rem(8);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      border: 1px solid $light-slate;
      border-left: none;
  
      &:focus {
          box-shadow: none;
      }
  }
  .no-new-window-icon {
    // Remove the automatically added new-window icon because it's an internal link
    &[target="_blank"]:after {
        content: none;
    }
  }
}

.btn {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	justify-content: center;
	align-items: center;
	display: inline;

	&:focus {
		outline: none !important;
		border: none !important;
		box-shadow: none;
	}

	&.loading {
		background-color:rgba(136, 192, 8, 0.3);// #green with 30% opacity
		border-color: rgba(136, 192, 8, 0.3);	// #green with 30% opacity
	}
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""