diff --git a/src/app/modules/admin/member/user/components/list.component.html b/src/app/modules/admin/member/user/components/list.component.html index 87d31ec..e332118 100644 --- a/src/app/modules/admin/member/user/components/list.component.html +++ b/src/app/modules/admin/member/user/components/list.component.html @@ -57,20 +57,24 @@
- + - + + - + - - - 40 - 60 - 80 - 100 - - - LV.1 - LV.2 - LV.3 - LV.4 + + None + + {{ ml.getName() }} + + - 정상 - 대기 - 탈퇴 - 휴면 - 블랙 - 정지 + None + 정상 + 대기 + 탈퇴 + 휴면 + 블랙 + 정지 @@ -205,8 +204,6 @@
@@ -218,38 +215,39 @@
요율
상부
-
아이디
- + 아이디
- 닉네임 + 닉네임
- 연락처 + 연락처
- 등급 + 등급
- 레벨 + 레벨
- 상태 + 상태
+ -
diff --git a/src/app/modules/admin/member/user/components/list.component.ts b/src/app/modules/admin/member/user/components/list.component.ts index 6764676..e445088 100644 --- a/src/app/modules/admin/member/user/components/list.component.ts +++ b/src/app/modules/admin/member/user/components/list.component.ts @@ -12,7 +12,7 @@ import { } from '@angular/core'; import { FormBuilder, FormControl, FormGroup } from '@angular/forms'; import { MatPaginator } from '@angular/material/paginator'; -import { MatSort } from '@angular/material/sort'; +import { MatSort, Sort } from '@angular/material/sort'; import { map, merge, @@ -42,6 +42,9 @@ import { MemberClass } from 'app/modules/proto/models/member_class_pb'; import { MemberClassService } from 'app/modules/polyglot/member_class/services/member_class.service'; import { result } from 'lodash'; import { MatCheckbox, MatCheckboxChange } from '@angular/material/checkbox'; +import { ListMemberLevelsResponse } from 'app/modules/proto/c2se/member_level_pb'; +import { MemberLevel } from 'app/modules/proto/models/member_level_pb'; +import { ListMemberClassesResponse } from 'app/modules/proto/c2se/member_class_pb'; @Component({ selector: 'user-list', @@ -85,6 +88,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { @ViewChildren('chkUsers') chkUsers!: QueryList; listMembers$!: Observable; + listMemberLevels$!: Observable; __isSearchOpened = false; isLoading = false; @@ -133,17 +137,19 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { this._changeDetectorRef.markForCheck(); }); - // Get the products - this._memberClassService - .listMemberClasss() - .then((result) => (this.memberClasses = result.getMemberClassesList())); - // Get the products this._activatedRoute.data.subscribe((data) => { let listMemberResult: ListMembersResponse.Result = data['listmembers']; - this.listMembers$ = of(listMemberResult.getMembersList()); + let listMemberLevelsResult: ListMemberLevelsResponse.Result = + data['listMemberLevels']; + this.listMemberLevels$ = of(listMemberLevelsResult.getMemberLevelsList()); + + let listMemberClassesResult: ListMemberClassesResponse.Result = + data['listMemberClasses']; + this.memberClasses = listMemberClassesResult.getMemberClassesList(); + // Mark for check this._changeDetectorRef.markForCheck(); }); @@ -355,7 +361,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { } __getParentUsername(member: MemberModel): string { - if (!member.getParentMember()) { + if (!member || !member.getParentMember()) { return ''; } @@ -371,6 +377,8 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { return `[${findClass.getName()}]${parentUsername}`; } + __onMatSortChangeUsers(sort: Sort): void {} + __getMemberState(member: MemberModel): string { const state = member.getState(); let resultStr = ''; 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 1e143bc..a9a7c01 100644 --- a/src/app/modules/admin/member/user/components/view.component.ts +++ b/src/app/modules/admin/member/user/components/view.component.ts @@ -53,6 +53,7 @@ import { MatDrawer } from '@angular/material/sidenav'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; import { FuseAlertType } from '@fuse/components/alert'; import { MatSelectChange } from '@angular/material/select'; +import { ListMemberLevelsResponse } from 'app/modules/proto/c2se/member_level_pb'; @Component({ selector: 'user-view', @@ -291,11 +292,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { this._siteService .listSites() .then((result) => (this.sites = result.getSitesList())); - this._memberLevelService.listMemberLevels().then((result) => { - this.memberLevels = result - .getMemberLevelsList() - .filter((v) => !!v.getShow()); - }); + this._bankService .listBanks() .then((result) => (this.banks = result.getBanksList())); @@ -318,6 +315,11 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { nickname: this.currentMember?.getNickname(), bankId: this.currentMember?.getBankAccount()?.getId(), }); + + let listMemberLevelsResult: ListMemberLevelsResponse.Result = + data['listMemberLevels']; + this.memberLevels = listMemberLevelsResult.getMemberLevelsList(); + // Mark for check this._changeDetectorRef.markForCheck(); }); diff --git a/src/app/modules/admin/member/user/resolvers/member-class.resolver.ts b/src/app/modules/admin/member/user/resolvers/member-class.resolver.ts new file mode 100644 index 0000000..dbac3d3 --- /dev/null +++ b/src/app/modules/admin/member/user/resolvers/member-class.resolver.ts @@ -0,0 +1,53 @@ +import { Injectable } from '@angular/core'; +import { + ActivatedRouteSnapshot, + Resolve, + Router, + RouterStateSnapshot, +} from '@angular/router'; +import { MemberClassService } from 'app/modules/polyglot/member_class/services/member_class.service'; +import { + ListMemberClassesRequest, + ListMemberClassesResponse, +} from 'app/modules/proto/c2se/member_class_pb'; + +import { Observable } from 'rxjs'; + +@Injectable({ + providedIn: 'root', +}) +export class ListMemberClassesResolver implements Resolve { + /** + * Constructor + */ + constructor( + private _router: Router, + private __memberClassService: MemberClassService + ) {} + + // ----------------------------------------------------------------------------------------------------- + // @ Public methods + // ----------------------------------------------------------------------------------------------------- + + /** + * Resolver + * + * @param route + * @param state + */ + + resolve( + route: ActivatedRouteSnapshot, + state: RouterStateSnapshot + ): + | Observable + | Promise + | ListMemberClassesResponse.Result { + let search = new ListMemberClassesRequest.Search(); + search.setShow(true); + let req = new ListMemberClassesRequest(); + req.setSearch(search); + + return this.__memberClassService.listMemberClasss(req); + } +} diff --git a/src/app/modules/admin/member/user/resolvers/member-level.resolver.ts b/src/app/modules/admin/member/user/resolvers/member-level.resolver.ts new file mode 100644 index 0000000..3f4a90f --- /dev/null +++ b/src/app/modules/admin/member/user/resolvers/member-level.resolver.ts @@ -0,0 +1,54 @@ +import { Injectable } from '@angular/core'; +import { + ActivatedRouteSnapshot, + Resolve, + Router, + RouterStateSnapshot, +} from '@angular/router'; + +import { MemberLevelService } from 'app/modules/polyglot/member_level/services/member_level.service'; +import { + ListMemberLevelsRequest, + ListMemberLevelsResponse, +} from 'app/modules/proto/c2se/member_level_pb'; + +import { Observable } from 'rxjs'; + +@Injectable({ + providedIn: 'root', +}) +export class ListMemberLevelsResolver implements Resolve { + /** + * Constructor + */ + constructor( + private _router: Router, + private __memberLevelService: MemberLevelService + ) {} + + // ----------------------------------------------------------------------------------------------------- + // @ Public methods + // ----------------------------------------------------------------------------------------------------- + + /** + * Resolver + * + * @param route + * @param state + */ + + resolve( + route: ActivatedRouteSnapshot, + state: RouterStateSnapshot + ): + | Observable + | Promise + | ListMemberLevelsResponse.Result { + let search = new ListMemberLevelsRequest.Search(); + search.setShow(true); + let req = new ListMemberLevelsRequest(); + req.setSearch(search); + + return this.__memberLevelService.listMemberLevels(req); + } +} diff --git a/src/app/modules/admin/member/user/user.routing.ts b/src/app/modules/admin/member/user/user.routing.ts index e5c731e..ee7454c 100644 --- a/src/app/modules/admin/member/user/user.routing.ts +++ b/src/app/modules/admin/member/user/user.routing.ts @@ -2,13 +2,10 @@ 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 { ListMemberClassesResolver } from './resolvers/member-class.resolver'; +import { ListMemberLevelsResolver } from './resolvers/member-level.resolver'; -import { - UsersResolver, - UserResolver, - MemberResolver, - ListMemberResolver, -} from './resolvers/user.resolver'; +import { MemberResolver, ListMemberResolver } from './resolvers/user.resolver'; export const userRoutes: Route[] = [ { @@ -16,6 +13,8 @@ export const userRoutes: Route[] = [ component: ListComponent, resolve: { listmembers: ListMemberResolver, + listMemberClasses: ListMemberClassesResolver, + listMemberLevels: ListMemberLevelsResolver, }, }, { @@ -23,6 +22,7 @@ export const userRoutes: Route[] = [ component: ViewComponent, resolve: { member: MemberResolver, + listMemberLevels: ListMemberLevelsResolver, }, }, ]; diff --git a/src/app/modules/polyglot/member_class/services/member_class.service.ts b/src/app/modules/polyglot/member_class/services/member_class.service.ts index 0b63681..d001845 100644 --- a/src/app/modules/polyglot/member_class/services/member_class.service.ts +++ b/src/app/modules/polyglot/member_class/services/member_class.service.ts @@ -62,10 +62,10 @@ export class MemberClassService { }); } - listMemberClasss(): Promise { + listMemberClasss( + req: ListMemberClassesRequest + ): Promise { return new Promise((resolve, reject) => { - let req = new ListMemberClassesRequest(); - this.__natsService .request( SUBJECT_LIST_MEMBER_CLASSES, diff --git a/src/app/modules/polyglot/member_level/services/member_level.service.ts b/src/app/modules/polyglot/member_level/services/member_level.service.ts index 7b6ce8d..04c69e4 100644 --- a/src/app/modules/polyglot/member_level/services/member_level.service.ts +++ b/src/app/modules/polyglot/member_level/services/member_level.service.ts @@ -62,10 +62,10 @@ export class MemberLevelService { }); } - listMemberLevels(): Promise { + listMemberLevels( + req: ListMemberLevelsRequest + ): Promise { return new Promise((resolve, reject) => { - let req = new ListMemberLevelsRequest(); - this.__natsService .request( SUBJECT_LIST_MEMBER_LEVELS,