diff --git a/src/app/modules/admin/bank/deposit/resolvers/deposit.resolver.ts b/src/app/modules/admin/bank/deposit/resolvers/deposit.resolver.ts index a001ce1..ecee2cb 100644 --- a/src/app/modules/admin/bank/deposit/resolvers/deposit.resolver.ts +++ b/src/app/modules/admin/bank/deposit/resolvers/deposit.resolver.ts @@ -6,7 +6,7 @@ import { RouterStateSnapshot, } from '@angular/router'; import { MemberBankDepositService } from 'app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service'; -import { ListMemberBankDepositsResponse } from 'app/modules/proto/c2se/member_bank_deposit_pb'; +import { ListMemberBankDepositsRequest, ListMemberBankDepositsResponse } from 'app/modules/proto/c2se/member_bank_deposit_pb'; import { catchError, Observable, throwError } from 'rxjs'; import { Deposit } from '../models/deposit'; @@ -114,6 +114,7 @@ export class BankDepositResolver implements Resolve { | Observable | Promise | ListMemberBankDepositsResponse.Result { - return this._bankDepositService.listMemberBankDeposits(); + const req = new ListMemberBankDepositsRequest(); + return this._bankDepositService.listMemberBankDeposits(req); } } diff --git a/src/app/modules/admin/member/user/components/deposit-history.component.html b/src/app/modules/admin/member/user/components/deposit-history.component.html index 1eeb08d..9103476 100644 --- a/src/app/modules/admin/member/user/components/deposit-history.component.html +++ b/src/app/modules/admin/member/user/components/deposit-history.component.html @@ -52,57 +52,70 @@ -
- +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
번호 + + {{ idx + 1 }} + + 충전금액 + {{ info.getAmount() }} + 신청일자 + {{ info.getCreatedAt() | date: "MMM dd, h:mm a" }} + 결과 + {{ __getDepositState(info) }} +
+ +
+ + +
- - - 번호 - - - {{ idx + 1 }} - - - - - - - 충전금액 - {{ info.amount }} - - - - - 신청일자 - - {{ info.createAt }} - - - - - 결과 - - {{ info.state }} - - - - - - - -
+ There are no data! + +
diff --git a/src/app/modules/admin/member/user/components/deposit-history.component.ts b/src/app/modules/admin/member/user/components/deposit-history.component.ts index 585225b..8b26134 100644 --- a/src/app/modules/admin/member/user/components/deposit-history.component.ts +++ b/src/app/modules/admin/member/user/components/deposit-history.component.ts @@ -3,6 +3,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, + Input, OnDestroy, OnInit, ViewChild, @@ -11,6 +12,13 @@ import { import { MatPaginator } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { fuseAnimations } from '@fuse/animations'; +import { MemberBankDepositService } from 'app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service'; +import { ListMemberBankDepositsRequest } from 'app/modules/proto/c2se/member_bank_deposit_pb'; +import { + MemberBankDepositModel, + MemberBankDepositState, +} from 'app/modules/proto/models/member_bank_deposit_pb'; +import { MemberModel } from 'app/modules/proto/models/member_pb'; import { Subject } from 'rxjs'; @Component({ @@ -43,20 +51,26 @@ import { Subject } from 'rxjs'; export class DepositHistoryComponent implements OnInit, AfterViewInit, OnDestroy { + @Input() + member!: MemberModel | undefined; + @ViewChild(MatPaginator) private _paginator!: MatPaginator; private _unsubscribeAll: Subject = new Subject(); depositHistoryTableColumns: string[] = ['no', 'amount', 'createAt', 'state']; - depositHistoryDataSource: MatTableDataSource = + depositHistoryDataSource: MatTableDataSource = new MatTableDataSource(); /** * Constructor */ - constructor(private _changeDetectorRef: ChangeDetectorRef) { - this.depositHistoryDataSource.data = DEPOSIT_HISTORY_DATA; + constructor( + private _changeDetectorRef: ChangeDetectorRef, + private _memberBankDepositService: MemberBankDepositService + ) { + /* this.depositHistoryDataSource.data = DEPOSIT_HISTORY_DATA; */ } // ----------------------------------------------------------------------------------------------------- @@ -66,7 +80,22 @@ export class DepositHistoryComponent /** * On init */ - ngOnInit(): void {} + ngOnInit(): void { + const req = new ListMemberBankDepositsRequest(); + req.setSearch(); + const search = new ListMemberBankDepositsRequest.Search(); + search.setMemberId(this.member!.getId()); + req.setSearch(search); + + this._memberBankDepositService + .listMemberBankDeposits(req) + .then((result) => { + const memberBankDepositList = result.getMemberBankDepositsList(); + this.depositHistoryDataSource.data = memberBankDepositList; + + this._changeDetectorRef.markForCheck(); + }); + } /** * After view init @@ -111,21 +140,25 @@ export class DepositHistoryComponent __trackByFn(index: number, item: any): any { return item.id || index; } -} -export interface TempDeposit { - amount: string; - createAt: string; - state: string; -} + __getDepositState(deposit: MemberBankDepositModel): string | undefined { + const state = deposit.getState(); + let result: string = ''; -const DEPOSIT_HISTORY_DATA: TempDeposit[] = [ - { amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' }, - { amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' }, - { amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' }, - { amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' }, - { amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' }, - { amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' }, - { amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' }, - { amount: '100,000', createAt: '2022-08-20 12:40', state: '완료' }, -]; + switch (state) { + case MemberBankDepositState.APPLICATION: + result = '신청'; + break; + case MemberBankDepositState.PENDING: + result = '대기'; + break; + case MemberBankDepositState.COMPLETE: + result = '완료'; + break; + default: + break; + } + + return result; + } +} 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 ef299a2..a67df31 100644 --- a/src/app/modules/admin/member/user/components/view.component.html +++ b/src/app/modules/admin/member/user/components/view.component.html @@ -655,7 +655,9 @@ - + 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 fe9415d..35b9170 100644 --- a/src/app/modules/admin/member/user/components/view.component.ts +++ b/src/app/modules/admin/member/user/components/view.component.ts @@ -198,7 +198,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { coupon: [''], recommender: [{ value: '', disabled: true }], siteUrl: [''], - recommendCount: [''], + recommendCount: [{ value: 0, disabled: true }], hodingGameMoney: [{ value: '0', disabled: true }], }); @@ -333,6 +333,9 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { state: this.currentMember?.getState(), nickname: this.currentMember?.getNickname(), siteUrl: this.currentMember?.getSite()?.getUrl(), + recommender: this.currentMember?.getParentMember()?.getUsername(), + recommendCount: this.currentMember?.getChildMemberCount(), + ownCash: 0, }); this.memberBankForm.patchValue({ diff --git a/src/app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service.ts b/src/app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service.ts index 28249dc..c8f755a 100644 --- a/src/app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service.ts +++ b/src/app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service.ts @@ -67,11 +67,11 @@ export class MemberBankDepositService { ); } - listMemberBankDeposits(): Promise { + listMemberBankDeposits( + req: ListMemberBankDepositsRequest + ): Promise { return new Promise( (resolve, reject) => { - let req = new ListMemberBankDepositsRequest(); - this.__natsService .request( SUBJECT_LIST_MEMBER_BANK_DEPOSITS,