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 de42052..3dd0443 100644 --- a/src/app/modules/admin/member/user/components/view.component.html +++ b/src/app/modules/admin/member/user/components/view.component.html @@ -51,7 +51,9 @@
가입일자 - {{ selectedUser?.registrationDate }} + {{ + selectedUser?.getCreatedAt() | date: "yyyy/MM/dd HH:mm" + }}
하부회원수 @@ -61,17 +63,17 @@
총입금 - {{ selectedUser?.totalDeposit }} + 2,000
총출금 - {{ selectedUser?.totalWithdraw }} + 2,000
총입금-총출금 - {{ selectedUser?.balance }} + 2,000
최근30일 배팅금액 @@ -97,10 +99,7 @@
-
+
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 d144df3..812d458 100644 --- a/src/app/modules/admin/member/user/components/view.component.ts +++ b/src/app/modules/admin/member/user/components/view.component.ts @@ -31,6 +31,9 @@ import { FuseConfirmationService } from '@fuse/services/confirmation'; import { User } from '../models/user'; import { UserService } from '../services/user.service'; +import { ActivatedRoute } from '@angular/router'; +import { GetMemberResponse } from 'app/modules/protobuf/c2se/backend/member_pb'; +import { MemberModel } from 'app/modules/protobuf/models/member/member_pb'; @Component({ selector: 'user-view', @@ -65,8 +68,9 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { isLoading = false; searchInputControl = new FormControl(); - selectedProductForm!: FormGroup; - selectedUser?: User; + memberViewForm!: FormGroup; + /* selectedUser?: User; */ + selectedUser?: MemberModel; private _unsubscribeAll: Subject = new Subject(); @@ -74,6 +78,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { * Constructor */ constructor( + private _activatedRoute: ActivatedRoute, private _changeDetectorRef: ChangeDetectorRef, private _fuseConfirmationService: FuseConfirmationService, private _formBuilder: FormBuilder, @@ -88,7 +93,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { * On init */ ngOnInit(): void { - this.selectedProductForm = this._formBuilder.group({ + this.memberViewForm = this._formBuilder.group({ id: [''], signinId: [{ value: '', disabled: true }], signinPw: [{ value: '' }], @@ -121,7 +126,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { }); // Get the User - this._userService.user$ + /* this._userService.user$ .pipe(takeUntil(this._unsubscribeAll)) .subscribe((user: User | undefined) => { if (!user) { @@ -129,12 +134,31 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { } this.selectedUser = user; - this.selectedProductForm.patchValue(user); + this.memberViewForm.patchValue(user); // Mark for check this._changeDetectorRef.markForCheck(); - }); + }); */ /* this.user$ = this._userService.user$; */ + + this._activatedRoute.data.subscribe((data) => { + let member: GetMemberResponse.Result = data['member']; + + this.selectedUser = member.getMember(); + + /* console.log('dddd', listMemberResult.getMembersList()); */ + this.memberViewForm.patchValue({ + signinId: this.selectedUser?.getUsername(), + signinPw: '1234', + exchangePw: '1234', + phoneNumber: this.selectedUser?.getMobilePhoneNumber(), + level: this.selectedUser?.getMemberLevel()?.getName(), + status: this.selectedUser?.getState(), + nickname: this.selectedUser?.getNickname(), + }); + // Mark for check + this._changeDetectorRef.markForCheck(); + }); } /** diff --git a/src/app/modules/admin/member/user/resolvers/user.resolver.ts b/src/app/modules/admin/member/user/resolvers/user.resolver.ts index 24d00f4..578c6b8 100644 --- a/src/app/modules/admin/member/user/resolvers/user.resolver.ts +++ b/src/app/modules/admin/member/user/resolvers/user.resolver.ts @@ -5,6 +5,8 @@ import { Router, RouterStateSnapshot, } from '@angular/router'; +import { MemberService } from 'app/modules/polyglot/member/services/member.service'; +import { GetMemberResponse } from 'app/modules/protobuf/c2se/backend/member_pb'; import { catchError, Observable, throwError } from 'rxjs'; import { User } from '../models/user'; @@ -82,3 +84,38 @@ export class UsersResolver implements Resolve { return this._userService.getUsers(); } } + +@Injectable({ + providedIn: 'root', +}) +export class MemberResolver implements Resolve { + /** + * Constructor + */ + constructor(private _router: Router, private _memberService: MemberService) {} + + // ----------------------------------------------------------------------------------------------------- + // @ Public methods + // ----------------------------------------------------------------------------------------------------- + + /** + * Resolver + * + * @param route + * @param state + */ + + resolve( + route: ActivatedRouteSnapshot, + state: RouterStateSnapshot + ): + | Observable + | Promise + | GetMemberResponse.Result { + let memberId = route.paramMap.get('id'); + if (!memberId) { + console.error('user.resolver memberId is null'); + } + return this._memberService.getMember(memberId!); + } +} diff --git a/src/app/modules/admin/member/user/user.routing.ts b/src/app/modules/admin/member/user/user.routing.ts index d7a2dc1..7069bdf 100644 --- a/src/app/modules/admin/member/user/user.routing.ts +++ b/src/app/modules/admin/member/user/user.routing.ts @@ -3,7 +3,11 @@ import { Route } from '@angular/router'; import { ListComponent } from 'app/modules/admin/member/user/components/list.component'; import { ViewComponent } from 'app/modules/admin/member/user/components/view.component'; -import { UsersResolver, UserResolver } from './resolvers/user.resolver'; +import { + UsersResolver, + UserResolver, + MemberResolver, +} from './resolvers/user.resolver'; export const userRoutes: Route[] = [ { @@ -17,7 +21,7 @@ export const userRoutes: Route[] = [ path: ':id', component: ViewComponent, resolve: { - user: UserResolver, + member: MemberResolver, }, }, ];