This commit is contained in:
Park Byung Eun 2022-08-31 05:59:25 +00:00
parent 8d0e844c0b
commit 4813572232
7 changed files with 238 additions and 156 deletions

View File

@ -6,7 +6,10 @@ import {
RouterStateSnapshot, RouterStateSnapshot,
} from '@angular/router'; } from '@angular/router';
import { MemberBankWithdrawService } from 'app/modules/polyglot/member_bank_withdraw/services/member_bank_withdraw.service'; import { MemberBankWithdrawService } from 'app/modules/polyglot/member_bank_withdraw/services/member_bank_withdraw.service';
import { ListMemberBankWithdrawsResponse } from 'app/modules/proto/c2se/member_bank_withdraw_pb'; import {
ListMemberBankWithdrawsRequest,
ListMemberBankWithdrawsResponse,
} from 'app/modules/proto/c2se/member_bank_withdraw_pb';
import { catchError, Observable, throwError } from 'rxjs'; import { catchError, Observable, throwError } from 'rxjs';
import { Withdraw } from '../models/withdraw'; import { Withdraw } from '../models/withdraw';
@ -114,6 +117,7 @@ export class BankWithdrawResolver implements Resolve<any> {
| Observable<ListMemberBankWithdrawsResponse.Result> | Observable<ListMemberBankWithdrawsResponse.Result>
| Promise<ListMemberBankWithdrawsResponse.Result> | Promise<ListMemberBankWithdrawsResponse.Result>
| ListMemberBankWithdrawsResponse.Result { | ListMemberBankWithdrawsResponse.Result {
return this._bankWithdrawService.listMemberBankWithdraws(); const req = new ListMemberBankWithdrawsRequest();
return this._bankWithdrawService.listMemberBankWithdraws(req);
} }
} }

View File

@ -82,8 +82,8 @@ export class DepositHistoryComponent
*/ */
ngOnInit(): void { ngOnInit(): void {
const req = new ListMemberBankDepositsRequest(); const req = new ListMemberBankDepositsRequest();
req.setSearch();
const search = new ListMemberBankDepositsRequest.Search(); const search = new ListMemberBankDepositsRequest.Search();
search.setMemberId(this.member!.getId()); search.setMemberId(this.member!.getId());
req.setSearch(search); req.setSearch(search);

View File

@ -54,6 +54,12 @@
</button> </button>
</div> </div>
</div> </div>
<ng-container
*ngIf="
partnerSignInHistoryDataSource.data.length > 0;
else noPartnerHistory
"
>
<div class="flex flex-col flex-auto mt-2"> <div class="flex flex-col flex-auto mt-2">
<table <table
class="overflow-y-visible" class="overflow-y-visible"
@ -93,7 +99,10 @@
></tr> ></tr>
<tr <tr
mat-row mat-row
*matRowDef="let row; columns: partnerSignInHistoryTableColumns" *matRowDef="
let row;
columns: partnerSignInHistoryTableColumns
"
></tr> ></tr>
</table> </table>
<mat-paginator <mat-paginator
@ -101,6 +110,14 @@
aria-label="Select page of users" aria-label="Select page of users"
></mat-paginator> ></mat-paginator>
</div> </div>
</ng-container>
<ng-template #noPartnerHistory>
<div
class="p-8 sm:p-16 border-t text-4xl font-semibold tracking-tight text-center"
>
There are no data!
</div>
</ng-template>
</div> </div>
</div> </div>
</div> </div>

View File

@ -52,6 +52,12 @@
</button> </button>
</div> </div>
</div> </div>
<ng-container
*ngIf="
webSignInHistoryDataSource.data.length > 0;
else noSigninHistory
"
>
<div class="flex flex-col flex-auto mt-2"> <div class="flex flex-col flex-auto mt-2">
<table <table
class="overflow-y-visible" class="overflow-y-visible"
@ -92,6 +98,14 @@
aria-label="Select page of users" aria-label="Select page of users"
></mat-paginator> ></mat-paginator>
</div> </div>
</ng-container>
<ng-template #noSigninHistory>
<div
class="p-8 sm:p-16 border-t text-4xl font-semibold tracking-tight text-center"
>
There are no data!
</div>
</ng-template>
</div> </div>
</div> </div>
</div> </div>

View File

@ -50,6 +50,9 @@
</button> </button>
</div> </div>
</div> </div>
<ng-container
*ngIf="withdrawHistoryDataSource.data.length > 0; else noWithdraw"
>
<div class="flex flex-col flex-auto mt-2"> <div class="flex flex-col flex-auto mt-2">
<table <table
class="overflow-y-visible" class="overflow-y-visible"
@ -67,18 +70,24 @@
<!-- Expenses amount --> <!-- Expenses amount -->
<ng-container matColumnDef="amount"> <ng-container matColumnDef="amount">
<th mat-header-cell *matHeaderCellDef>충전금액</th> <th mat-header-cell *matHeaderCellDef>충전금액</th>
<td mat-cell *matCellDef="let info">{{ info.amount }}</td> <td mat-cell *matCellDef="let info">
{{ info.getAmount() }}
</td>
</ng-container> </ng-container>
<!-- Expenses amount --> <!-- Expenses amount -->
<ng-container matColumnDef="createAt"> <ng-container matColumnDef="createAt">
<th mat-header-cell *matHeaderCellDef>신청일자</th> <th mat-header-cell *matHeaderCellDef>신청일자</th>
<td mat-cell *matCellDef="let info">{{ info.createAt }}</td> <td mat-cell *matCellDef="let info">
{{ info.getCreatedAt() | date: "yyyy/MM/dd HH:mm" }}
</td>
</ng-container> </ng-container>
<ng-container matColumnDef="state"> <ng-container matColumnDef="state">
<th mat-header-cell *matHeaderCellDef>결과</th> <th mat-header-cell *matHeaderCellDef>결과</th>
<td mat-cell *matCellDef="let info">{{ info.state }}</td> <td mat-cell *matCellDef="let info">
{{ __getWithdrawState(info) }}
</td>
</ng-container> </ng-container>
<tr <tr
@ -96,6 +105,14 @@
> >
</mat-paginator> </mat-paginator>
</div> </div>
</ng-container>
<ng-template #noWithdraw>
<div
class="p-8 sm:p-16 border-t text-4xl font-semibold tracking-tight text-center"
>
There are no data!
</div>
</ng-template>
</div> </div>
</div> </div>
</div> </div>

View File

@ -7,10 +7,18 @@ import {
OnInit, OnInit,
ViewChild, ViewChild,
ViewEncapsulation, ViewEncapsulation,
Input,
} from '@angular/core'; } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator'; import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table'; import { MatTableDataSource } from '@angular/material/table';
import { fuseAnimations } from '@fuse/animations'; import { fuseAnimations } from '@fuse/animations';
import { MemberBankWithdrawService } from 'app/modules/polyglot/member_bank_withdraw/services/member_bank_withdraw.service';
import { ListMemberBankWithdrawsRequest } from 'app/modules/proto/c2se/member_bank_withdraw_pb';
import {
MemberBankWithdrawModel,
MemberBankWithdrawState,
} from 'app/modules/proto/models/member_bank_withdraw_pb';
import { MemberModel } from 'app/modules/proto/models/member_pb';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
@Component({ @Component({
@ -43,21 +51,25 @@ import { Subject } from 'rxjs';
export class WithdrawHistoryComponent export class WithdrawHistoryComponent
implements OnInit, AfterViewInit, OnDestroy implements OnInit, AfterViewInit, OnDestroy
{ {
@Input()
member!: MemberModel | undefined;
@ViewChild(MatPaginator) private _paginator!: MatPaginator; @ViewChild(MatPaginator) private _paginator!: MatPaginator;
private _unsubscribeAll: Subject<any> = new Subject<any>(); private _unsubscribeAll: Subject<any> = new Subject<any>();
withdrawHistoryTableColumns: string[] = ['no', 'amount', 'createAt', 'state']; withdrawHistoryTableColumns: string[] = ['no', 'amount', 'createAt', 'state'];
withdrawHistoryDataSource: MatTableDataSource<TempWithdraw> = withdrawHistoryDataSource: MatTableDataSource<MemberBankWithdrawModel> =
new MatTableDataSource(); new MatTableDataSource();
/** /**
* Constructor * Constructor
*/ */
constructor(private _changeDetectorRef: ChangeDetectorRef) { constructor(
this.withdrawHistoryDataSource.data = WITHDRAW_HISTORY_DATA; private _changeDetectorRef: ChangeDetectorRef,
} private _memberBankWithdrawService: MemberBankWithdrawService
) {}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks // @ Lifecycle hooks
@ -66,7 +78,20 @@ export class WithdrawHistoryComponent
/** /**
* On init * On init
*/ */
ngOnInit(): void {} ngOnInit(): void {
const req = new ListMemberBankWithdrawsRequest();
const search = new ListMemberBankWithdrawsRequest.Search();
search.setMemberId(this.member!.getId());
req.setSearch(search);
this._memberBankWithdrawService
.listMemberBankWithdraws(req)
.then((result) => {
const mbwdl = result.getMemberBankWithdrawsList();
this.withdrawHistoryDataSource.data = mbwdl;
this._changeDetectorRef.markForCheck();
});
}
/** /**
* After view init * After view init
@ -111,20 +136,25 @@ export class WithdrawHistoryComponent
__trackByFn(index: number, item: any): any { __trackByFn(index: number, item: any): any {
return item.id || index; return item.id || index;
} }
__getWithdrawState(withdraw: MemberBankWithdrawModel): string | undefined {
const state = withdraw.getState();
let result: string = '';
switch (state) {
case MemberBankWithdrawState.APPLICATION:
result = '신청';
break;
case MemberBankWithdrawState.PENDING:
result = '대기';
break;
case MemberBankWithdrawState.COMPLETE:
result = '완료';
break;
default:
break;
} }
export interface TempWithdraw { return result;
amount: string; }
createAt: string;
state: string;
} }
const WITHDRAW_HISTORY_DATA: TempWithdraw[] = [
{ amount: '100,000', createAt: '2022-08-20 13:13', state: '완료' },
{ amount: '100,000', createAt: '2022-08-20 13:13', state: '완료' },
{ amount: '100,000', createAt: '2022-08-20 13:13', state: '완료' },
{ amount: '100,000', createAt: '2022-08-20 13:13', state: '완료' },
{ amount: '100,000', createAt: '2022-08-20 13:13', state: '완료' },
{ amount: '100,000', createAt: '2022-08-20 13:13', state: '완료' },
{ amount: '100,000', createAt: '2022-08-20 13:13', state: '완료' },
];

View File

@ -67,11 +67,11 @@ export class MemberBankWithdrawService {
); );
} }
listMemberBankWithdraws(): Promise<ListMemberBankWithdrawsResponse.Result> { listMemberBankWithdraws(
req: ListMemberBankWithdrawsRequest
): Promise<ListMemberBankWithdrawsResponse.Result> {
return new Promise<ListMemberBankWithdrawsResponse.Result>( return new Promise<ListMemberBankWithdrawsResponse.Result>(
(resolve, reject) => { (resolve, reject) => {
let req = new ListMemberBankWithdrawsRequest();
this.__natsService this.__natsService
.request<ListMemberBankWithdrawsResponse.Result>( .request<ListMemberBankWithdrawsResponse.Result>(
SUBJECT_LIST_MEMBER_BANK_WITHDRAWS, SUBJECT_LIST_MEMBER_BANK_WITHDRAWS,