diff --git a/src/app/modules/admin/member/user/components/view.component.html b/src/app/modules/admin/member/user/components/view.component.html index 0eb18a7..10e4efd 100644 --- a/src/app/modules/admin/member/user/components/view.component.html +++ b/src/app/modules/admin/member/user/components/view.component.html @@ -149,6 +149,16 @@ > {{ getPanelInfo(selectedPanel).title }} + + {{ alertConfig.message }} + @@ -169,16 +179,6 @@ [formControlName]="'username'" /> - - 비밀번호 - - - -
닉네임 - - 보유머니 - - 핸드폰
+
+ + 비밀번호 + + + + 비밀번호 확인 + + +
+ +
+
+
레벨 @@ -222,10 +242,16 @@ 상태 - - - brand option - + + + + {{ info.label }} + + @@ -239,6 +265,14 @@
+ + 보유머니 + + 콤프 +
+
추천인 -
-
- + + 사이트변경 - 카지노 베팅 + 첫충콤프 - 슬롯베팅 + 매충콤프
@@ -513,12 +548,12 @@ - 첫충콤프 + 카지노 베팅 - 매충콤프 + 슬롯베팅 diff --git a/src/app/modules/admin/member/user/components/view.component.ts b/src/app/modules/admin/member/user/components/view.component.ts index 946524e..0f056e2 100644 --- a/src/app/modules/admin/member/user/components/view.component.ts +++ b/src/app/modules/admin/member/user/components/view.component.ts @@ -9,9 +9,11 @@ import { ViewEncapsulation, } from '@angular/core'; import { + AbstractControl, FormBuilder, FormControl, FormGroup, + ValidatorFn, Validators, } from '@angular/forms'; import { MatCheckboxChange } from '@angular/material/checkbox'; @@ -34,9 +36,11 @@ import { UserService } from '../services/user.service'; import { ActivatedRoute } from '@angular/router'; import { GetMemberResponse, + UpdateMemberForPasswordRequest, + UpdateMemberForStateRequest, UpdateMemberRequest, } from 'app/modules/proto/c2se/member_pb'; -import { MemberModel } from 'app/modules/proto/models/member_pb'; +import { MemberModel, MemberState } from 'app/modules/proto/models/member_pb'; import { MemberService } from 'app/modules/polyglot/member/services/member.service'; import { MemberLevelService } from 'app/modules/polyglot/member_level/services/member_level.service'; import { BankService } from 'app/modules/polyglot/bank/services/bank.service'; @@ -47,7 +51,8 @@ import { Site } from 'app/modules/proto/models/site_pb'; import { MatDrawer } from '@angular/material/sidenav'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; -import { UpdateBankRequest } from 'app/modules/proto/c2se/bank_pb'; +import { FuseAlertType } from '@fuse/components/alert'; +import { MatSelectChange } from '@angular/material/select'; @Component({ selector: 'user-view', @@ -87,11 +92,47 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { isLoading = false; searchInputControl = new FormControl(); + /* NONE: 0; + NORMAL: 1; + PENDING: 2; + WITHDRAWAL: 3; + DORMANCY: 4; + BLACKLIST: 5; + SUSPENDED: 6; */ + memberStateOptions = [ + { + value: 1, + label: '정상', + }, + { + value: 2, + label: '대기', + }, + { + value: 3, + label: '탈퇴', + }, + { + value: 4, + label: '휴면', + }, + { + value: 5, + label: '블랙', + }, + { + value: 6, + label: '정지', + }, + ]; + memberDefaultForm!: FormGroup; memberBankForm!: FormGroup; memberSettleForm!: FormGroup; memberGameSettingForm!: FormGroup; + passwordConfirmConfigForm!: FormGroup; + /* currentMember?: User; */ currentMember?: MemberModel; @@ -102,6 +143,13 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { banks!: Bank[]; sites!: Site[]; + alertConfig: { type: FuseAlertType; message: string } = { + type: 'success', + message: '비밀번호가 수정 되었습니다.', + }; + + changePasswordResultShowAlert: boolean = false; + private _unsubscribeAll: Subject = new Subject(); /** @@ -131,8 +179,8 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { this.memberDefaultForm = this._formBuilder.group({ id: [''], username: [{ value: '', disabled: true }], - signinPw: [{ value: '' }], - + signinPw: [''], + signinPwConfirm: [''], nickname: [{ value: '', disabled: true }], ownCash: [''], mobilePhoneNumber: [''], @@ -167,6 +215,28 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { this.memberGameSettingForm = this._formBuilder.group({}); + this.passwordConfirmConfigForm = this._formBuilder.group({ + title: '알림', + message: '비밀번호를 변경 하시겠습니까?', + icon: this._formBuilder.group({ + show: true, + name: 'heroicons_outline:exclamation', + color: 'warn', + }), + actions: this._formBuilder.group({ + confirm: this._formBuilder.group({ + show: true, + label: '확인', + color: 'warn', + }), + cancel: this._formBuilder.group({ + show: true, + label: '취소', + }), + }), + dismissible: true, + }); + this.panels = [ { id: 'accountInfo', @@ -235,6 +305,8 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { this.currentMember = member.getMember(); + console.log(this.currentMember?.getState()); + /* console.log('dddd', listMemberResult.getMembersList()); */ this.memberDefaultForm.patchValue({ username: this.currentMember?.getUsername(), @@ -398,4 +470,109 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { trackByFn(index: number, item: any): any { return item.id || index; } + + __changePassword(): void { + const password = this.memberDefaultForm.get('signinPw')?.value as string; + const passwordConfirm = this.memberDefaultForm.get('signinPwConfirm') + ?.value as string; + + if (!password || !passwordConfirm) { + this.changePasswordResultShowAlert = true; + this.alertConfig = { + type: 'error', + message: '비밀번호를 입력하세요.', + }; + this.closeChangePasswordAlert(); + return; + } + + if (password !== passwordConfirm) { + this.changePasswordResultShowAlert = true; + this.alertConfig = { + type: 'error', + message: '비밀번호가 일치하지 않습니다.', + }; + this.closeChangePasswordAlert(); + return; + } + + const dialogRef = this._fuseConfirmationService.open( + this.passwordConfirmConfigForm.value + ); + + /* const dialogRef = this._matDialog.open(AddComposeComponent); */ + + dialogRef.afterClosed().subscribe((result) => { + if (result === 'confirmed') { + const req = new UpdateMemberForPasswordRequest(); + req.setPassword(password); + req.setId(this.currentMember!.getId()); + this._memberService + .updateMemberForPassword(req) + .then((result) => { + this.alertConfig = { + type: 'success', + message: '비밀번호가 수정 되었습니다.', + }; + this.changePasswordResultShowAlert = true; + }) + .catch((reson) => { + this.changePasswordResultShowAlert = true; + // Set the alert + this.alertConfig = { + type: 'error', + message: '패스워드 변경이 실패하였습니다.', + }; + }) + .finally(() => this.closeChangePasswordAlert()); + } + }); + } + + onSelectionChangeLanguage(event: MatSelectChange) { + const state = event.value; + + if (!state) { + this.alertConfig = { + type: 'error', + message: '상태값이 선택 되지 않았습니다.', + }; + this.closeChangePasswordAlert(); + return; + } + + const req = new UpdateMemberForStateRequest(); + req.setId(this.currentMember!.getId()); + req.setState(state); + + this._memberService + .updateMemberForState(req) + .then((result) => { + this.changePasswordResultShowAlert = true; + this.alertConfig = { + type: 'success', + message: '회원 상태가 수정 되었습니다.', + }; + }) + .catch((reson) => { + this.changePasswordResultShowAlert = true; + // Set the alert + this.alertConfig = { + type: 'error', + message: '회원 상태 변경이 실패하였습니다.', + }; + }) + .finally(() => this.closeChangePasswordAlert()); + } + + __changeMemberState(): void { + const state = this.memberDefaultForm.get('state')?.value; + } + + private closeChangePasswordAlert(): void { + setTimeout(() => { + this.changePasswordResultShowAlert = false; + this._changeDetectorRef.markForCheck(); + }, 5000); + } } diff --git a/src/app/modules/admin/member/user/user.module.ts b/src/app/modules/admin/member/user/user.module.ts index 413deed..a456ecd 100644 --- a/src/app/modules/admin/member/user/user.module.ts +++ b/src/app/modules/admin/member/user/user.module.ts @@ -25,6 +25,7 @@ import { MatTabsModule } from '@angular/material/tabs'; import { MatSidenavModule } from '@angular/material/sidenav'; import { FuseCardModule } from '@fuse/components/card'; +import { FuseAlertModule } from '@fuse/components/alert'; import { TranslocoModule } from '@ngneat/transloco'; @@ -66,6 +67,7 @@ import { userRoutes } from 'app/modules/admin/member/user/user.routing'; MatSidenavModule, FuseCardModule, + FuseAlertModule, ], }) export class UserModule {}