diff --git a/src/app/modules/user/main/compose/sign-up-compose.component.html b/src/app/modules/user/main/compose/sign-up-compose.component.html index 0d1beac..5e0ec6d 100644 --- a/src/app/modules/user/main/compose/sign-up-compose.component.html +++ b/src/app/modules/user/main/compose/sign-up-compose.component.html @@ -16,15 +16,20 @@
-
+ - + 추천인 코드 - -
+ + + 추천인 코드는 필수 입력입니다. +
@@ -33,18 +38,56 @@
- + 아이디 - -
+ + + 아이디는 필수 입력입니다. + + + 아이디가 중복됩니다. +
- + 닉네임 - -
+ + + 닉네임은 필수 입력입니다. + + + 닉네임이 중복됩니다. +
@@ -52,58 +95,109 @@
- + 비밀번호 -
+ + 비밀번호는 필수 입력입니다. +
- + 비밀번호 확인 + + 비밀번호 확인은 필수 입력입니다. +
- + 출금비밀번호 -
+ + 출금 비밀번호는 필수 입력입니다. +
- + 전화번호 + + 전화번호는 필수 입력입니다. +
- + 은행명 -
+ + 은행명은 필수 입력입니다. +
- + 계좌번호 + + 계좌번호는 필수 입력입니다. +
- + 예금주 -
+ + 예금주는 필수 입력입니다. +
diff --git a/src/app/modules/user/main/compose/sign-up-compose.component.ts b/src/app/modules/user/main/compose/sign-up-compose.component.ts index 13dda37..c4f37b2 100644 --- a/src/app/modules/user/main/compose/sign-up-compose.component.ts +++ b/src/app/modules/user/main/compose/sign-up-compose.component.ts @@ -1,6 +1,8 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { MatDialogRef } from '@angular/material/dialog'; +import { IdentityService } from 'app/modules/polyglot/identity/services/identity.service'; +import { MemberService } from 'app/modules/polyglot/member/services/member.service'; @Component({ selector: 'sign-up-compose', @@ -8,7 +10,7 @@ import { MatDialogRef } from '@angular/material/dialog'; encapsulation: ViewEncapsulation.None, }) export class SignUpComposeComponent implements OnInit { - composeForm!: FormGroup; + signupComposeForm!: FormGroup; copyFields: { cc: boolean; bcc: boolean } = { cc: false, bcc: false, @@ -26,8 +28,14 @@ export class SignUpComposeComponent implements OnInit { */ constructor( public matDialogRef: MatDialogRef, - private _formBuilder: FormBuilder - ) {} + private _formBuilder: FormBuilder, + private _identityService: IdentityService, + private _memberService: MemberService + ) { + this._identityService + .checkUsernameForDuplication('administrator') + .then((v) => console.log('result: ', v)); + } // ----------------------------------------------------------------------------------------------------- // @ Lifecycle hooks @@ -38,11 +46,17 @@ export class SignUpComposeComponent implements OnInit { */ ngOnInit(): void { // Create the form - this.composeForm = this._formBuilder.group({ - signInId: ['', [Validators.required, Validators.email]], - password: ['', [Validators.email]], - passwordConfirm: ['', [Validators.email]], + this.signupComposeForm = this._formBuilder.group({ + referalCode: ['', [Validators.required]], + username: ['', [Validators.required]], nickname: ['', Validators.required], + password: ['', [Validators.required]], + passwordConfirm: ['', [Validators.required]], + exchangePassword: ['', [Validators.required]], + mobilePhoneNumber: ['', [Validators.required]], + bankName: ['', [Validators.required]], + accountNumber: ['', [Validators.required]], + accountHolder: ['', [Validators.required]], }); } @@ -90,4 +104,34 @@ export class SignUpComposeComponent implements OnInit { * Send the message */ send(): void {} + + __checkUsernameDuplicate(event: FocusEvent): void { + const username = this.signupComposeForm.get('username')?.value; + // console.log(event, '::', username); + this._identityService + .checkUsernameForDuplication(username) + .then((isUse: boolean) => { + if (!!isUse) { + this.signupComposeForm + .get('username') + ?.setErrors({ usernameDuplicate: true }); + } + // this._changeDetectorRef.markForCheck(); + }); + } + + __checkNickname(event: FocusEvent): void { + const nickname = this.signupComposeForm.get('nickname')?.value; + + this._identityService + .checkNicknameForDuplication(nickname) + .then((isUse: boolean) => { + if (!!isUse) { + this.signupComposeForm + .get('nickname') + ?.setErrors({ nicknameDuplicate: true }); + } + // this._changeDetectorRef.markForCheck(); + }); + } }