diff --git a/src/app/modules/beteran/component/home.component.html b/src/app/modules/beteran/component/home.component.html index 9953282..6471c90 100644 --- a/src/app/modules/beteran/component/home.component.html +++ b/src/app/modules/beteran/component/home.component.html @@ -77,6 +77,34 @@
+
+
+
+ 회원아이디 +
+
test님
+
+ 보유금액 +
+
74,100원
+
+ 콤프 +
+
3,100P
+
+ 쪽지 +
+
(0)
+
+
diff --git a/src/app/modules/beteran/component/home.component.ts b/src/app/modules/beteran/component/home.component.ts index 0e5c191..afed1e6 100644 --- a/src/app/modules/beteran/component/home.component.ts +++ b/src/app/modules/beteran/component/home.component.ts @@ -25,12 +25,14 @@ import { VendorService } from 'app/modules/polyglot/api/services/vendor.service' import { ListGamesResponse } from 'app/modules/proto/c2se/api/game_pb'; import { Game } from 'app/modules/proto/models/api/game_pb'; import { Vendor } from 'app/modules/proto/models/api/vendor_pb'; +import { ModifyMemberComposeComponent } from '../compose/compose/modify-member-compose.component'; import { SlotGameComposeComponent } from '../compose/compose/slot-game-compose.component'; export enum ComposeMenuType { - signIn = 'signIn', - signup = 'signup', - signOut = 'signOut', + signIn = 'SignIn', + signup = 'Signup', + signOut = 'SignOut', + modifyMember = 'ModifyMember', deposit = 'Deposit', withdraw = 'Withdraw', notice = 'Notice', @@ -98,6 +100,8 @@ export class HomeComponent implements OnInit { ) {} ngOnInit(): void { + if (!!this.loggedIn) { + } this._vendorService.listVendors().then((result) => { this.liveCasinos = result .getVendorsList() @@ -172,6 +176,9 @@ export class HomeComponent implements OnInit { case ComposeMenuType.signup: selectType = SignUpComposeComponent; break; + case ComposeMenuType.modifyMember: + selectType = ModifyMemberComposeComponent; + break; case ComposeMenuType.deposit: selectType = DepositComposeComponent; break; diff --git a/src/app/modules/beteran/compose/compose/index.ts b/src/app/modules/beteran/compose/compose/index.ts index 3523f2b..a571ff2 100644 --- a/src/app/modules/beteran/compose/compose/index.ts +++ b/src/app/modules/beteran/compose/compose/index.ts @@ -8,6 +8,7 @@ import { WithdrawHistoryComposeComponent } from './withdraw-history-compose.comp import { SignUpComposeComponent } from './sign-up-compose.component'; import { SignInComposeComponent } from './sign-in-compose.component'; import { SlotGameComposeComponent } from './slot-game-compose.component'; +import { ModifyMemberComposeComponent } from './modify-member-compose.component'; export const COMPOSE = [ DepositComposeComponent, @@ -20,4 +21,5 @@ export const COMPOSE = [ SignUpComposeComponent, SignInComposeComponent, SlotGameComposeComponent, + ModifyMemberComposeComponent, ]; diff --git a/src/app/modules/beteran/compose/compose/modify-member-compose.component.html b/src/app/modules/beteran/compose/compose/modify-member-compose.component.html new file mode 100644 index 0000000..7e2f984 --- /dev/null +++ b/src/app/modules/beteran/compose/compose/modify-member-compose.component.html @@ -0,0 +1,131 @@ +
+ +
+
회원가입
+ +
+ + + {{ alert.message }} + + +
+
+
+ +
+ + +
+
+ + + 아이디 + + + + + + + 닉네임 + + + + 현재 비밀번호 + + +
+
+ +
+
+ + + 비밀번호 + + + 비밀번호는 필수 입력입니다. + + + + + + 비밀번호 확인 + + + 비밀번호 확인은 필수 입력입니다. + + + 비밀번호가 동일하지 않습니다. + + +
+
+ + +
+
+ + + + + +
+
+
+
+
+
+
diff --git a/src/app/modules/beteran/compose/compose/modify-member-compose.component.ts b/src/app/modules/beteran/compose/compose/modify-member-compose.component.ts new file mode 100644 index 0000000..8f8c533 --- /dev/null +++ b/src/app/modules/beteran/compose/compose/modify-member-compose.component.ts @@ -0,0 +1,156 @@ +import { Component, OnInit, ViewEncapsulation } from '@angular/core'; +import { + AbstractControl, + FormBuilder, + FormGroup, + ValidatorFn, + Validators, +} from '@angular/forms'; +import { MatDialogRef } from '@angular/material/dialog'; +import { fuseAnimations } from '@fuse/animations'; +import { FuseAlertType } from '@fuse/components/alert'; +import { BankService } from 'app/modules/polyglot/bank/services/bank.service'; +import { IdentityService } from 'app/modules/polyglot/identity/services/identity.service'; +import { MemberService } from 'app/modules/polyglot/member/services/member.service'; +import { MemberReferrerService } from 'app/modules/polyglot/member_referrer/services/member_referrer.service'; +import { + CreateMemberRequest, + CreateMemberResponse, + UpdateMemberForPasswordRequest, + UpdateMemberForPasswordResponse, +} from 'app/modules/proto/c2se/member_pb'; + +@Component({ + selector: 'modify-member-compose', + templateUrl: './modify-member-compose.component.html', + encapsulation: ViewEncapsulation.None, + animations: fuseAnimations, +}) +export class ModifyMemberComposeComponent implements OnInit { + modifyMemberComposeForm!: FormGroup; + + isSendDisable = false; + + alert: { type: FuseAlertType; message: string } = { + type: 'success', + message: '수정이 성공하였습니다.', + }; + + showAlert: boolean = false; + + /** + * Constructor + */ + constructor( + public matDialogRef: MatDialogRef, + private _formBuilder: FormBuilder, + private _identityService: IdentityService, + private _memberService: MemberService, + private _memberReferrerService: MemberReferrerService + ) {} + + // ----------------------------------------------------------------------------------------------------- + // @ Lifecycle hooks + // ----------------------------------------------------------------------------------------------------- + + /** + * On init + */ + ngOnInit(): void { + // Create the form + this.modifyMemberComposeForm = this._formBuilder.group({ + username: [{ value: '', disabled: true }], + nickname: [{ value: '', disabled: true }], + currentPassword: ['1234', [Validators.required]], + password: ['1234', [Validators.required]], + passwordConfirm: [ + '1234', + [Validators.required, this.checkSameForPassword()], + ], + }); + } + + // ----------------------------------------------------------------------------------------------------- + // @ Public methods + // ----------------------------------------------------------------------------------------------------- + + /** + * Save and close + */ + saveAndClose(): void { + // Save the message as a draft + this.saveAsDraft(); + + // Close the dialog + this.matDialogRef.close(); + } + + /** + * Discard the message + */ + discard(): void {} + + /** + * Save the message as a draft + */ + saveAsDraft(): void {} + + /** + * Send the message + */ + send(): void { + if (!this.modifyMemberComposeForm?.valid) { + return; + } + + this.isSendDisable = true; + + const { username, nickname, currentPassword, password, passwordConfirm } = + this.modifyMemberComposeForm?.value; + + this._memberService + .updateMemberForPassword('', password) + .then((res: UpdateMemberForPasswordResponse.Result) => { + this.showAlert = true; + }) + .catch((e) => { + this.showAlert = true; + this.alert = { type: 'error', message: '수정에 실패하였습니다.' }; + }) + .finally(() => setTimeout(() => this.close(), 5000)); + } + + __checkCurrentPassword(event: FocusEvent): void { + const code = this.modifyMemberComposeForm.get('currentPassword')?.value; + + // this._memberReferrerService.getMemberReferrerByCode(code).then((result) => { + // if (!result.getMemberReferrer()) { + // this.modifyMemberComposeForm + // ?.get('referalCode') + // ?.setErrors({ notExistReferalCode: true }); + // } + // }); + } + + close(): void { + this.matDialogRef.close({ + choice: true, + }); + } + + private checkSameForPassword(): ValidatorFn { + return (control: AbstractControl): { [key: string]: any } | null => { + if (!control || !control.value || control.value === '') { + return null; + } + const password = this.modifyMemberComposeForm?.get('password') + ?.value as string; + const passwordConfirm = control.value as string; + + if (password !== passwordConfirm) { + return { passwordNotMatch: true }; + } + return null; + }; + } +}