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,
} from '@angular/router';
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 { Withdraw } from '../models/withdraw';
@ -114,6 +117,7 @@ export class BankWithdrawResolver implements Resolve<any> {
| Observable<ListMemberBankWithdrawsResponse.Result>
| Promise<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 {
const req = new ListMemberBankDepositsRequest();
req.setSearch();
const search = new ListMemberBankDepositsRequest.Search();
search.setMemberId(this.member!.getId());
req.setSearch(search);

View File

@ -54,6 +54,12 @@
</button>
</div>
</div>
<ng-container
*ngIf="
partnerSignInHistoryDataSource.data.length > 0;
else noPartnerHistory
"
>
<div class="flex flex-col flex-auto mt-2">
<table
class="overflow-y-visible"
@ -93,7 +99,10 @@
></tr>
<tr
mat-row
*matRowDef="let row; columns: partnerSignInHistoryTableColumns"
*matRowDef="
let row;
columns: partnerSignInHistoryTableColumns
"
></tr>
</table>
<mat-paginator
@ -101,6 +110,14 @@
aria-label="Select page of users"
></mat-paginator>
</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>

View File

@ -52,6 +52,12 @@
</button>
</div>
</div>
<ng-container
*ngIf="
webSignInHistoryDataSource.data.length > 0;
else noSigninHistory
"
>
<div class="flex flex-col flex-auto mt-2">
<table
class="overflow-y-visible"
@ -92,6 +98,14 @@
aria-label="Select page of users"
></mat-paginator>
</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>

View File

@ -50,6 +50,9 @@
</button>
</div>
</div>
<ng-container
*ngIf="withdrawHistoryDataSource.data.length > 0; else noWithdraw"
>
<div class="flex flex-col flex-auto mt-2">
<table
class="overflow-y-visible"
@ -67,18 +70,24 @@
<!-- Expenses amount -->
<ng-container matColumnDef="amount">
<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>
<!-- Expenses amount -->
<ng-container matColumnDef="createAt">
<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 matColumnDef="state">
<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>
<tr
@ -96,6 +105,14 @@
>
</mat-paginator>
</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>

View File

@ -7,10 +7,18 @@ import {
OnInit,
ViewChild,
ViewEncapsulation,
Input,
} from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
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';
@Component({
@ -43,21 +51,25 @@ import { Subject } from 'rxjs';
export class WithdrawHistoryComponent
implements OnInit, AfterViewInit, OnDestroy
{
@Input()
member!: MemberModel | undefined;
@ViewChild(MatPaginator) private _paginator!: MatPaginator;
private _unsubscribeAll: Subject<any> = new Subject<any>();
withdrawHistoryTableColumns: string[] = ['no', 'amount', 'createAt', 'state'];
withdrawHistoryDataSource: MatTableDataSource<TempWithdraw> =
withdrawHistoryDataSource: MatTableDataSource<MemberBankWithdrawModel> =
new MatTableDataSource();
/**
* Constructor
*/
constructor(private _changeDetectorRef: ChangeDetectorRef) {
this.withdrawHistoryDataSource.data = WITHDRAW_HISTORY_DATA;
}
constructor(
private _changeDetectorRef: ChangeDetectorRef,
private _memberBankWithdrawService: MemberBankWithdrawService
) {}
// -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks
@ -66,7 +78,20 @@ export class WithdrawHistoryComponent
/**
* 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
@ -111,20 +136,25 @@ export class WithdrawHistoryComponent
__trackByFn(index: number, item: any): any {
return item.id || index;
}
}
export interface TempWithdraw {
amount: string;
createAt: string;
state: string;
}
__getWithdrawState(withdraw: MemberBankWithdrawModel): string | undefined {
const state = withdraw.getState();
let result: 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: '완료' },
];
switch (state) {
case MemberBankWithdrawState.APPLICATION:
result = '신청';
break;
case MemberBankWithdrawState.PENDING:
result = '대기';
break;
case MemberBankWithdrawState.COMPLETE:
result = '완료';
break;
default:
break;
}
return result;
}
}

View File

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