입금 관리 화면 수정
This commit is contained in:
parent
b63dd4f5be
commit
dd4a871a4c
|
@ -131,7 +131,7 @@
|
||||||
<div class="flex flex-auto overflow-hidden">
|
<div class="flex flex-auto overflow-hidden">
|
||||||
<!-- Products list -->
|
<!-- Products list -->
|
||||||
<div
|
<div
|
||||||
class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto"
|
class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto overflow-x-auto"
|
||||||
>
|
>
|
||||||
<ng-container *ngIf="bankDeposit$ | async as bankDeposit">
|
<ng-container *ngIf="bankDeposit$ | async as bankDeposit">
|
||||||
<ng-container *ngIf="bankDeposit.length > 0; else noDeposit">
|
<ng-container *ngIf="bankDeposit.length > 0; else noDeposit">
|
||||||
|
@ -143,32 +143,45 @@
|
||||||
<div>
|
<div>
|
||||||
<mat-checkbox></mat-checkbox>
|
<mat-checkbox></mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
<div>상부</div>
|
<div>구분</div>
|
||||||
<div>
|
<div>
|
||||||
|
등급
|
||||||
|
<hr style="margin: 7px 0px" />
|
||||||
아이디
|
아이디
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
닉네임
|
닉네임
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
등급
|
입금예정금액
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
레벨
|
은행
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
상태
|
예금주
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden sm:block">예금주</div>
|
<div>
|
||||||
<div>정산종류</div>
|
정산종류
|
||||||
<div>비고</div>
|
<hr style="margin: 7px 0px" />
|
||||||
<div>입금예정금액</div>
|
비고
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="hidden md:block">
|
<div class="hidden md:block">
|
||||||
등록날짜
|
등록날짜
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
처리날짜
|
처리날짜
|
||||||
|
<hr style="margin: 7px 0px" />
|
||||||
|
상태
|
||||||
|
</div>
|
||||||
|
<div class="hidden md:block">
|
||||||
|
입금
|
||||||
|
<hr style="margin: 7px 0px" />
|
||||||
|
출금
|
||||||
|
<hr style="margin: 7px 0px" />
|
||||||
|
보유금
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden md:block">입금출금</div>
|
|
||||||
<div class="hidden md:block">게임중머니</div>
|
<div class="hidden md:block">게임중머니</div>
|
||||||
<div class="hidden lg:block">카지노->캐쉬</div>
|
<div class="hidden lg:block">카지노->캐쉬</div>
|
||||||
<div class="hidden lg:block">회원정보</div>
|
<div class="hidden lg:block">상위</div>
|
||||||
<div class="hidden lg:block">배팅정보</div>
|
<div class="hidden lg:block">배팅정보</div>
|
||||||
<div class="hidden lg:block">삭제</div>
|
<div class="hidden lg:block">삭제</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -187,44 +200,50 @@
|
||||||
<div>
|
<div>
|
||||||
<mat-checkbox></mat-checkbox>
|
<mat-checkbox></mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
<!-- 상부 -->
|
<!-- 구분 -->
|
||||||
<div>test {{ idx }}</div>
|
|
||||||
<!-- 아이디, 닉네임 -->
|
|
||||||
<div>
|
<div>
|
||||||
|
{{ __getMemberClassesByMemberId(deposit.getMemberId()) }}
|
||||||
|
</div>
|
||||||
|
<!-- 등급, 아이디, 닉네임 -->
|
||||||
<div
|
<div
|
||||||
(click)="viewUserDetail(deposit.getMemberId())"
|
(click)="viewUserDetail(deposit.getMemberId())"
|
||||||
style="cursor: pointer"
|
style="cursor: pointer"
|
||||||
>
|
>
|
||||||
test {{ idx }}
|
{{ __getMemberLevelByMemberId(deposit.getMemberId()) }}
|
||||||
</div>
|
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
test {{ idx }}
|
|
||||||
</div>
|
|
||||||
<!-- 등급, 레벨, 상태 -->
|
|
||||||
<div>
|
<div>
|
||||||
test {{ idx }}
|
{{
|
||||||
<hr style="margin: 7px 0px" />
|
__getMemberById(deposit.getMemberId())?.getUsername()
|
||||||
test {{ idx }}
|
}}
|
||||||
<hr style="margin: 7px 0px" />
|
|
||||||
test {{ idx }}
|
|
||||||
</div>
|
</div>
|
||||||
<!-- 예금주 -->
|
<hr style="margin: 7px 0px" />
|
||||||
<div class="hidden sm:block">
|
{{ __getMemberById(deposit.getMemberId())?.getNickname() }}
|
||||||
|
</div>
|
||||||
|
<!-- 입금예정금액, 은행, 예금주 -->
|
||||||
|
<div>
|
||||||
|
{{ deposit.getAmount() }}
|
||||||
|
<hr style="margin: 7px 0px" />
|
||||||
|
{{ __getMemberBankByMemberId(deposit.getMemberId()) }}
|
||||||
|
<hr style="margin: 7px 0px" />
|
||||||
{{ deposit.getName() }}
|
{{ deposit.getName() }}
|
||||||
</div>
|
</div>
|
||||||
<!-- 정산종류 -->
|
|
||||||
<div>{{ idx % 2 === 0 ? "롤링" : "콤프" }}</div>
|
<!-- 정산종류, 비고 -->
|
||||||
<!-- 비고 -->
|
<div>
|
||||||
<div>test {{ idx }}</div>
|
{{ __getMemberSettlementByMemberId(deposit.getMemberId()) }}
|
||||||
<!-- 입금예정금액 -->
|
<hr style="margin: 7px 0px" />
|
||||||
<div>test {{ idx }}</div>
|
{{ deposit.getMemo() }}
|
||||||
<!-- 등록날짜, 처리날짜 -->
|
</div>
|
||||||
|
|
||||||
|
<!-- 등록날짜, 처리날짜, 상태 -->
|
||||||
<div class="hidden md:block">
|
<div class="hidden md:block">
|
||||||
{{ deposit.getCreatedAt() | date: "yyyy-MM-dd HH:mm" }}
|
{{ deposit.getCreatedAt() | date: "yyyy-MM-dd HH:mm" }}
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
{{ deposit.getStateChangedAt() | date: "yyyy-MM-dd HH:mm" }}
|
{{ deposit.getStateChangedAt() | date: "yyyy-MM-dd HH:mm" }}
|
||||||
|
<hr style="margin: 7px 0px" />
|
||||||
|
{{ __getDepositState(deposit) }}
|
||||||
</div>
|
</div>
|
||||||
<!-- 입금, 출금 -->
|
<!-- 입금, 출금, 보유금 -->
|
||||||
<div class="hidden md:block">
|
<div class="hidden md:block">
|
||||||
<span>41,200,000원</span>
|
<span>41,200,000원</span>
|
||||||
|
|
||||||
|
@ -235,7 +254,7 @@
|
||||||
<span>22,200,000원</span>
|
<span>22,200,000원</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- 게임중머니 -->
|
<!-- 게임중머니 -->
|
||||||
<div class="hidden md:block">test {{ idx }}</div>
|
<div class="hidden md:block">22,200,000원</div>
|
||||||
<div class="hidden lg:block">
|
<div class="hidden lg:block">
|
||||||
<button
|
<button
|
||||||
mat-flat-button
|
mat-flat-button
|
||||||
|
@ -253,13 +272,14 @@
|
||||||
게임머니회수
|
게임머니회수
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 상위 -->
|
||||||
<div class="hidden lg:block">
|
<div class="hidden lg:block">
|
||||||
<button
|
<button
|
||||||
mat-flat-button
|
mat-flat-button
|
||||||
class="bet-mat-small-8"
|
class="bet-mat-small-8"
|
||||||
[color]="'primary'"
|
[color]="'primary'"
|
||||||
>
|
>
|
||||||
회원정보
|
{{ __getMemberRefferByMemberId(deposit.getMemberId()) }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden lg:block">
|
<div class="hidden lg:block">
|
||||||
|
|
|
@ -35,7 +35,14 @@ import { DepositPagination } from '../models/deposit-pagination';
|
||||||
import { DepositService } from '../services/deposit.service';
|
import { DepositService } from '../services/deposit.service';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { ListMemberBankDepositsResponse } from 'app/modules/proto/c2se/member_bank_deposit_pb';
|
import { ListMemberBankDepositsResponse } from 'app/modules/proto/c2se/member_bank_deposit_pb';
|
||||||
import { MemberBankDeposit } from 'app/modules/proto/models/member_bank_deposit_pb';
|
import {
|
||||||
|
MemberBankDeposit,
|
||||||
|
MemberBankDepositState,
|
||||||
|
} from 'app/modules/proto/models/member_bank_deposit_pb';
|
||||||
|
import { MemberModel } from 'app/modules/proto/models/member_pb';
|
||||||
|
import { ListMembersResponse } from 'app/modules/proto/c2se/member_pb';
|
||||||
|
import { ListMemberClassesResponse } from 'app/modules/proto/c2se/member_class_pb';
|
||||||
|
import { MemberClass } from 'app/modules/proto/models/member_class_pb';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'deposit-list',
|
selector: 'deposit-list',
|
||||||
|
@ -45,21 +52,21 @@ import { MemberBankDeposit } from 'app/modules/proto/models/member_bank_deposit_
|
||||||
`
|
`
|
||||||
.deposit-grid {
|
.deposit-grid {
|
||||||
/* CB 상부 아이디 등급 예금주 정산종류 */
|
/* CB 상부 아이디 등급 예금주 정산종류 */
|
||||||
grid-template-columns: 20px 100px 100px 80px auto 40px;
|
grid-template-columns: 20px 80px 100px auto 60px 140px;
|
||||||
|
|
||||||
@screen sm {
|
@screen sm {
|
||||||
/* CB 상부 아이디 등급 예금주 정산종류 비고 예정 등록*/
|
/* CB 상부 아이디 등급 예금주 정산종류 비고 예정 등록*/
|
||||||
grid-template-columns: 20px 100px 100px 80px auto 40px 20px 140px 140px;
|
grid-template-columns: 20px 80px 100px auto 60px 140px 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@screen md {
|
@screen md {
|
||||||
/* CB 상부 아이디 등급 예금주 정산종류 비고 예정 등록 입금출금 */
|
/* CB 상부 아이디 등급 예금주 정산종류 비고 예정 등록 입금출금 */
|
||||||
grid-template-columns: 20px 100px 100px 80px auto 40px 20px 100px 100px 100px;
|
grid-template-columns: 20px 80px 100px auto 60px 140px 120px 140px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@screen lg {
|
@screen lg {
|
||||||
/* CB 상부 아이디 등급 예금주 정산종류 비고 예정 등록 입금출금 게임중 카지노 회원 배팅 삭제*/
|
/* CB 구분 아이디 입금정보 정산종류 등록날짜 입금출금 게임중머니 카지노 상위 배팅 삭제*/
|
||||||
grid-template-columns: 20px 100px 100px 80px auto 40px 20px 140px 140px 140px 100px 100px 100px 100px 100px;
|
grid-template-columns: 20px 80px 100px auto 60px 140px 120px 140px 80px 120px 80px 60px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
|
@ -72,6 +79,8 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
@ViewChild(MatPaginator) private _paginator!: MatPaginator;
|
@ViewChild(MatPaginator) private _paginator!: MatPaginator;
|
||||||
@ViewChild(MatSort) private _sort!: MatSort;
|
@ViewChild(MatSort) private _sort!: MatSort;
|
||||||
|
|
||||||
|
listMember!: MemberModel[];
|
||||||
|
memberClasses!: MemberClass[];
|
||||||
bankDeposit$!: Observable<MemberBankDeposit[] | undefined>;
|
bankDeposit$!: Observable<MemberBankDeposit[] | undefined>;
|
||||||
|
|
||||||
__isSearchOpened = false;
|
__isSearchOpened = false;
|
||||||
|
@ -116,9 +125,15 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
// Get the products
|
// Get the products
|
||||||
|
|
||||||
this._activatedRoute.data.subscribe((data) => {
|
this._activatedRoute.data.subscribe((data) => {
|
||||||
|
let listMemberResult: ListMembersResponse.Result = data['listMember'];
|
||||||
let listBankDepositResult: ListMemberBankDepositsResponse.Result =
|
let listBankDepositResult: ListMemberBankDepositsResponse.Result =
|
||||||
data['bankDeposit'];
|
data['bankDeposit'];
|
||||||
|
let listMemberClasses: ListMemberClassesResponse.Result =
|
||||||
|
data['listMemberClasses'];
|
||||||
|
|
||||||
|
this.listMember = listMemberResult.getMembersList();
|
||||||
this.bankDeposit$ = of(listBankDepositResult.getMemberBankDepositsList());
|
this.bankDeposit$ = of(listBankDepositResult.getMemberBankDepositsList());
|
||||||
|
this.memberClasses = listMemberClasses.getMemberClassesList();
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
'bankDeposit: ',
|
'bankDeposit: ',
|
||||||
|
@ -223,4 +238,82 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
__trackByFn(index: number, item: any): any {
|
__trackByFn(index: number, item: any): any {
|
||||||
return item.id || index;
|
return item.id || index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__getMemberRefferByMemberId(memberId: string): string | undefined {
|
||||||
|
const member = this.__getMemberById(memberId);
|
||||||
|
|
||||||
|
if (!!member) {
|
||||||
|
const parentUserName = member.getParentMember()?.getUsername();
|
||||||
|
const parentClassesId = member.getParentMember()?.getMemberClassId();
|
||||||
|
const parentClass = this.memberClasses.find(
|
||||||
|
(v) => v.getId() === parentClassesId
|
||||||
|
);
|
||||||
|
|
||||||
|
const parentClassName = parentClass?.getName();
|
||||||
|
|
||||||
|
return `[${parentClassName}]${parentUserName}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
__getDepositState(deposit: MemberBankDeposit): string | undefined {
|
||||||
|
const state = deposit.getState();
|
||||||
|
let result: string = '';
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
case MemberBankDepositState.APPLICATION:
|
||||||
|
result = '신청';
|
||||||
|
break;
|
||||||
|
case MemberBankDepositState.COMPLETE:
|
||||||
|
result = '완료';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
__getMemberSettlementByMemberId(memberId: string): string | undefined {
|
||||||
|
const member = this.__getMemberById(memberId);
|
||||||
|
|
||||||
|
if (!!member) {
|
||||||
|
const type = member.getMemberSettlementSetting()?.getSettlementType();
|
||||||
|
return type === 1 ? '롤링' : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
__getMemberLevelByMemberId(memberId: string): string | undefined {
|
||||||
|
const member = this.__getMemberById(memberId);
|
||||||
|
|
||||||
|
if (!!member) {
|
||||||
|
return member.getMemberLevel()?.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
__getMemberBankByMemberId(memberId: string): string | undefined {
|
||||||
|
const member = this.__getMemberById(memberId);
|
||||||
|
|
||||||
|
if (!!member) {
|
||||||
|
return member.getBankAccount()?.getBank()?.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
__getMemberClassesByMemberId(memberId: string): string | undefined {
|
||||||
|
const member = this.__getMemberById(memberId);
|
||||||
|
|
||||||
|
if (!!member) {
|
||||||
|
return member.getMemberClass()?.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
__getMemberById(memberId: string): MemberModel | undefined {
|
||||||
|
return this.listMember.find((v) => v.getId() === memberId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,17 @@ import {
|
||||||
DepositsResolver,
|
DepositsResolver,
|
||||||
} from './resolvers/deposit.resolver';
|
} from './resolvers/deposit.resolver';
|
||||||
import { UserResolver } from '../../dashboards/user/user.resolvers';
|
import { UserResolver } from '../../dashboards/user/user.resolvers';
|
||||||
|
import { ListMemberResolver } from 'app/shared/resolvers/member.resolver';
|
||||||
|
import { ListMemberClassesResolver } from 'app/shared/resolvers/member-class.resolver';
|
||||||
|
|
||||||
export const depositRoutes: Route[] = [
|
export const depositRoutes: Route[] = [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: ListComponent,
|
component: ListComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
|
listMember: ListMemberResolver,
|
||||||
bankDeposit: BankDepositResolver,
|
bankDeposit: BankDepositResolver,
|
||||||
|
listMemberClasses: ListMemberClassesResolver,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,69 +95,3 @@ export class UsersResolver implements Resolve<any> {
|
||||||
return this._userService.getUsers();
|
return this._userService.getUsers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root',
|
|
||||||
})
|
|
||||||
export class ListMemberResolver implements Resolve<any> {
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
constructor(private _router: Router, private _memberService: MemberService) {}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
|
||||||
// @ Public methods
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resolver
|
|
||||||
*
|
|
||||||
* @param route
|
|
||||||
* @param state
|
|
||||||
*/
|
|
||||||
|
|
||||||
resolve(
|
|
||||||
route: ActivatedRouteSnapshot,
|
|
||||||
state: RouterStateSnapshot
|
|
||||||
):
|
|
||||||
| Observable<ListMembersResponse.Result>
|
|
||||||
| Promise<ListMembersResponse.Result>
|
|
||||||
| ListMembersResponse.Result {
|
|
||||||
return this._memberService.listMembers();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root',
|
|
||||||
})
|
|
||||||
export class MemberResolver implements Resolve<any> {
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
constructor(private _router: Router, private _memberService: MemberService) {}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
|
||||||
// @ Public methods
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resolver
|
|
||||||
*
|
|
||||||
* @param route
|
|
||||||
* @param state
|
|
||||||
*/
|
|
||||||
|
|
||||||
resolve(
|
|
||||||
route: ActivatedRouteSnapshot,
|
|
||||||
state: RouterStateSnapshot
|
|
||||||
):
|
|
||||||
| Observable<GetMemberResponse.Result>
|
|
||||||
| Promise<GetMemberResponse.Result>
|
|
||||||
| GetMemberResponse.Result {
|
|
||||||
let memberId = route.paramMap.get('id');
|
|
||||||
if (!memberId) {
|
|
||||||
console.error('user.resolver memberId is null');
|
|
||||||
}
|
|
||||||
return this._memberService.getMember(memberId!);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,15 +2,17 @@ import { Route } from '@angular/router';
|
||||||
|
|
||||||
import { ListComponent } from 'app/modules/admin/member/user/components/list.component';
|
import { ListComponent } from 'app/modules/admin/member/user/components/list.component';
|
||||||
import { ViewComponent } from 'app/modules/admin/member/user/components/view.component';
|
import { ViewComponent } from 'app/modules/admin/member/user/components/view.component';
|
||||||
|
import {
|
||||||
|
ListMemberResolver,
|
||||||
|
MemberResolver,
|
||||||
|
} from 'app/shared/resolvers/member.resolver';
|
||||||
import { SiteResolver } from 'app/shared/resolvers/site.resolver';
|
import { SiteResolver } from 'app/shared/resolvers/site.resolver';
|
||||||
import { ListMemberBanksResolver } from './resolvers/member-bank.resolver';
|
import { ListMemberBanksResolver } from './resolvers/member-bank.resolver';
|
||||||
import { ListMemberClassesResolver } from './resolvers/member-class.resolver';
|
import { ListMemberClassesResolver } from 'app/shared/resolvers/member-class.resolver';
|
||||||
import { MemberGameSettingResolver } from './resolvers/member-game-setting.resolver';
|
import { MemberGameSettingResolver } from './resolvers/member-game-setting.resolver';
|
||||||
import { ListMemberLevelsResolver } from './resolvers/member-level.resolver';
|
import { ListMemberLevelsResolver } from './resolvers/member-level.resolver';
|
||||||
import { MemberSettlementResolver } from './resolvers/member-settlement-setting.resolver';
|
import { MemberSettlementResolver } from './resolvers/member-settlement-setting.resolver';
|
||||||
|
|
||||||
import { MemberResolver, ListMemberResolver } from './resolvers/user.resolver';
|
|
||||||
|
|
||||||
export const userRoutes: Route[] = [
|
export const userRoutes: Route[] = [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
|
|
78
src/app/shared/resolvers/member.resolver.ts
Normal file
78
src/app/shared/resolvers/member.resolver.ts
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import {
|
||||||
|
ActivatedRouteSnapshot,
|
||||||
|
Resolve,
|
||||||
|
Router,
|
||||||
|
RouterStateSnapshot,
|
||||||
|
} from '@angular/router';
|
||||||
|
import { MemberService } from 'app/modules/polyglot/member/services/member.service';
|
||||||
|
import { ListMembersResponse } from 'app/modules/proto/c2se/member_pb';
|
||||||
|
import { GetMemberResponse } from 'app/modules/proto/c2se/member_pb';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class ListMemberResolver implements Resolve<any> {
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor(private _router: Router, private _memberService: MemberService) {}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolver
|
||||||
|
*
|
||||||
|
* @param route
|
||||||
|
* @param state
|
||||||
|
*/
|
||||||
|
|
||||||
|
resolve(
|
||||||
|
route: ActivatedRouteSnapshot,
|
||||||
|
state: RouterStateSnapshot
|
||||||
|
):
|
||||||
|
| Observable<ListMembersResponse.Result>
|
||||||
|
| Promise<ListMembersResponse.Result>
|
||||||
|
| ListMembersResponse.Result {
|
||||||
|
return this._memberService.listMembers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class MemberResolver implements Resolve<any> {
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor(private _router: Router, private _memberService: MemberService) {}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolver
|
||||||
|
*
|
||||||
|
* @param route
|
||||||
|
* @param state
|
||||||
|
*/
|
||||||
|
|
||||||
|
resolve(
|
||||||
|
route: ActivatedRouteSnapshot,
|
||||||
|
state: RouterStateSnapshot
|
||||||
|
):
|
||||||
|
| Observable<GetMemberResponse.Result>
|
||||||
|
| Promise<GetMemberResponse.Result>
|
||||||
|
| GetMemberResponse.Result {
|
||||||
|
let memberId = route.paramMap.get('id');
|
||||||
|
if (!memberId) {
|
||||||
|
console.error('user.resolver memberId is null');
|
||||||
|
}
|
||||||
|
return this._memberService.getMember(memberId!);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user