From 560184405577fffb7701c5a35ce5db26cd404a67 Mon Sep 17 00:00:00 2001 From: Park Byung Eun Date: Tue, 30 Aug 2022 09:29:56 +0000 Subject: [PATCH] bug fix --- .../user/components/view.component.html | 13 +++--- .../member/user/components/view.component.ts | 40 ++++++++++++++++++- .../modules/admin/member/user/user.routing.ts | 1 + 3 files changed, 47 insertions(+), 7 deletions(-) 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 b1209d4..ef299a2 100644 --- a/src/app/modules/admin/member/user/components/view.component.html +++ b/src/app/modules/admin/member/user/components/view.component.html @@ -25,16 +25,17 @@ >on00, on01, on02 --> - on00 - on01 - on02 - on03 + {{ parent.getUsername() }}
사이트명 - test.com + {{ currentMember?.getSite()?.getUrl() }}
가입일자 @@ -46,7 +47,7 @@
하부회원수 - 0명 + {{ currentMember?.getChildMemberCount() }}명
총입금 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 36ed5e6..f45c37c 100644 --- a/src/app/modules/admin/member/user/components/view.component.ts +++ b/src/app/modules/admin/member/user/components/view.component.ts @@ -26,6 +26,7 @@ import { FuseConfirmationService } from '@fuse/services/confirmation'; import { ActivatedRoute } from '@angular/router'; import { GetMemberResponse, + ListMembersResponse, UpdateMemberForPasswordRequest, UpdateMemberForStateRequest, UpdateMemberRequest, @@ -132,7 +133,9 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { fuseAlertConfirmConfigForm!: FormGroup; /* currentMember?: User; */ + listMembers?: MemberModel[]; currentMember?: MemberModel; + parentMembers?: MemberModel[] = []; panels: any[] = []; selectedPanel: string = 'accountInfo'; @@ -300,8 +303,10 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { }); this._activatedRoute.data.subscribe((data) => { - let member: GetMemberResponse.Result = data['member']; + let listMembers: ListMembersResponse.Result = data['listmembers']; + this.listMembers = listMembers.getMembersList(); + let member: GetMemberResponse.Result = data['member']; this.currentMember = member.getMember(); let listMemberLevelsResult: ListMemberLevelsResponse.Result = @@ -356,6 +361,27 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { canBetSlot: memberGameSetting?.getCanBetSlot(), }); + const firstParent = this.currentMember?.getParentMember(); + if (!!firstParent) { + const secondParent = this.listMembers.find( + (v) => v.getId() === firstParent?.getParentMemberId() + ); + if (!!secondParent) { + const thirdParent = this.listMembers.find( + (v) => v.getId() === secondParent?.getParentMember()?.getId() + ); + + if (!!thirdParent) { + const fourParent = this.listMembers.find( + (v) => v.getId() === thirdParent?.getParentMember()?.getId() + ); + } + } + } + + this.getParentMembers(this.currentMember); + console.log(this.parentMembers); + // Mark for check this._changeDetectorRef.markForCheck(); }); @@ -803,4 +829,16 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { }); }); } + + private getParentMembers(member: MemberModel | undefined): void { + const findMember = this.listMembers?.find( + (v) => v.getId() === member?.getParentMember()?.getId() + ); + if (!!findMember) { + this.parentMembers?.push(findMember); + this.getParentMembers(findMember); + } else { + return; + } + } } diff --git a/src/app/modules/admin/member/user/user.routing.ts b/src/app/modules/admin/member/user/user.routing.ts index 34e9874..c986218 100644 --- a/src/app/modules/admin/member/user/user.routing.ts +++ b/src/app/modules/admin/member/user/user.routing.ts @@ -28,6 +28,7 @@ export const userRoutes: Route[] = [ component: ViewComponent, resolve: { member: MemberResolver, + listmembers: ListMemberResolver, listMemberLevels: ListMemberLevelsResolver, listMemberBanks: ListMemberBanksResolver, listSites: SiteResolver,