third part registration
#24
Merged
naeem.ullah
merged 2 commits from mazdak/UX-1814 into dev-pending-01-01-2026 4 weeks ago
@ -1,28 +1,70 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { Component, ViewChild } from '@angular/core';
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { NgSelectModule } from '@ng-select/ng-select';
|
import { NgSelectModule } from '@ng-select/ng-select';
|
||||||
|
|
||||||
import { PasswordHideShowComponent } from '../../shared/components/password-hide-show/password-hide-show.component';
|
import { PasswordHideShowComponent } from '../../shared/components/password-hide-show/password-hide-show.component';
|
||||||
import { pageSizeOptions } from '../../utils/app.constants';
|
import { pageSizeOptions } from '../../utils/app.constants';
|
||||||
|
import { URIKey } from '../../utils/uri-enums';
|
||||||
|
import { HttpURIService } from '../../app.http.uri.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-third-party-registration',
|
selector: 'app-third-party-registration',
|
||||||
imports: [TranslateModule, CommonModule, FormsModule, PasswordHideShowComponent, NgSelectModule ],
|
imports: [TranslateModule, CommonModule, FormsModule, ReactiveFormsModule, PasswordHideShowComponent, NgSelectModule ],
|
||||||
templateUrl: './third-party-registration.component.html',
|
templateUrl: './third-party-registration.component.html',
|
||||||
styleUrl: './third-party-registration.component.scss'
|
styleUrl: './third-party-registration.component.scss'
|
||||||
})
|
})
|
||||||
export class ThirdPartyRegistrationComponent {
|
export class ThirdPartyRegistrationComponent implements OnInit {
|
||||||
|
thirdPartyRegForm! : FormGroup;
|
||||||
searchText: string = '';
|
searchText: string = '';
|
||||||
passwordType: string = 'password';
|
passwordType: string = 'password';
|
||||||
renewalDataExpanded = true;
|
renewalDataExpanded = true;
|
||||||
pageSizeOptions = pageSizeOptions;
|
pageSizeOptions = pageSizeOptions;
|
||||||
itemsPerPage: number = 5;
|
itemsPerPage: number = 5;
|
||||||
|
constructor(private fb: FormBuilder, private httpURIService: HttpURIService){}
|
||||||
@ViewChild(PasswordHideShowComponent) passwordHideShow?: PasswordHideShowComponent;
|
@ViewChild(PasswordHideShowComponent) passwordHideShow?: PasswordHideShowComponent;
|
||||||
|
|
||||||
togglePasswordType() {
|
togglePasswordType() {
|
||||||
this.passwordType = this.passwordHideShow?.showPassword ? 'password' : 'text';
|
this.passwordType = this.passwordHideShow?.showPassword ? 'password' : 'text';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void{
|
||||||
|
this.thirdPartyRegForm = this.fb.group({
|
||||||
|
thirdPartyId: ['', [Validators.required]],
|
||||||
|
thirdPartyName: ['',[Validators.required]],
|
||||||
|
email: ['',[Validators.required, Validators.email]],
|
||||||
|
address: ['',[Validators.required]],
|
||||||
|
phoneNumber: ['',[Validators.required, Validators.pattern('^[0-9]{10}$') ], ],
|
||||||
|
newNumberOfAccounts: ['',[Validators.required]],
|
||||||
|
password: ['',[Validators.required, Validators.minLength(6)]],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get passwordError(){
|
||||||
|
const control = this.thirdPartyRegForm.get('password');
|
||||||
|
if (!control || !control.touched) return null;
|
||||||
|
|
||||||
|
if (control.hasError('minlength')) return 'passwordTooShort';
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmit(){
|
||||||
|
|
||||||
|
if(this.thirdPartyRegForm.invalid){return}
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
thirdPartyId: this.thirdPartyRegForm.value.thirdPartyId,
|
||||||
|
thirdPartyName: this.thirdPartyRegForm.value.thirdPartyName,
|
||||||
|
email: this.thirdPartyRegForm.value.email,
|
||||||
|
address: this.thirdPartyRegForm.value.address,
|
||||||
|
phoneNumber: this.thirdPartyRegForm.value.phoneNumber,
|
||||||
|
newNumberOfAccounts: this.thirdPartyRegForm.value.newNumberOfAccounts,
|
||||||
|
password: this.thirdPartyRegForm.value.password
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.httpURIService.requestPOST(URIKey.THIRD_PARTY_REGISTER_URI, payload)
|
||||||
|
.subscribe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue