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,53 +54,70 @@
</button>
</div>
</div>
<div class="flex flex-col flex-auto mt-2">
<table
class="overflow-y-visible"
mat-table
[dataSource]="partnerSignInHistoryDataSource"
<ng-container
*ngIf="
partnerSignInHistoryDataSource.data.length > 0;
else noPartnerHistory
"
>
<div class="flex flex-col flex-auto mt-2">
<table
class="overflow-y-visible"
mat-table
[dataSource]="partnerSignInHistoryDataSource"
>
<!-- Total -->
<ng-container matColumnDef="no">
<th mat-header-cell *matHeaderCellDef>번호</th>
<td mat-cell *matCellDef="let info; let idx = index">
<span class="font-medium text-rignt">
{{ idx + 1 }}
</span>
</td>
</ng-container>
<ng-container matColumnDef="signInIp">
<th mat-header-cell *matHeaderCellDef>접속아이피</th>
<td mat-cell *matCellDef="let info">
{{ info.signInIp }}
</td>
</ng-container>
<ng-container matColumnDef="signInAt">
<th mat-header-cell *matHeaderCellDef>접속일자</th>
<td mat-cell *matCellDef="let info">{{ info.signInAt }}</td>
</ng-container>
<ng-container matColumnDef="note">
<th mat-header-cell *matHeaderCellDef>비고</th>
<td mat-cell *matCellDef="let info">{{ info.note }}</td>
</ng-container>
<tr
mat-header-row
*matHeaderRowDef="partnerSignInHistoryTableColumns"
></tr>
<tr
mat-row
*matRowDef="
let row;
columns: partnerSignInHistoryTableColumns
"
></tr>
</table>
<mat-paginator
[pageSizeOptions]="[5, 10, 25, 100]"
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"
>
<!-- Total -->
<ng-container matColumnDef="no">
<th mat-header-cell *matHeaderCellDef>번호</th>
<td mat-cell *matCellDef="let info; let idx = index">
<span class="font-medium text-rignt">
{{ idx + 1 }}
</span>
</td>
</ng-container>
<ng-container matColumnDef="signInIp">
<th mat-header-cell *matHeaderCellDef>접속아이피</th>
<td mat-cell *matCellDef="let info">
{{ info.signInIp }}
</td>
</ng-container>
<ng-container matColumnDef="signInAt">
<th mat-header-cell *matHeaderCellDef>접속일자</th>
<td mat-cell *matCellDef="let info">{{ info.signInAt }}</td>
</ng-container>
<ng-container matColumnDef="note">
<th mat-header-cell *matHeaderCellDef>비고</th>
<td mat-cell *matCellDef="let info">{{ info.note }}</td>
</ng-container>
<tr
mat-header-row
*matHeaderRowDef="partnerSignInHistoryTableColumns"
></tr>
<tr
mat-row
*matRowDef="let row; columns: partnerSignInHistoryTableColumns"
></tr>
</table>
<mat-paginator
[pageSizeOptions]="[5, 10, 25, 100]"
aria-label="Select page of users"
></mat-paginator>
</div>
There are no data!
</div>
</ng-template>
</div>
</div>
</div>

View File

@ -52,46 +52,60 @@
</button>
</div>
</div>
<div class="flex flex-col flex-auto mt-2">
<table
class="overflow-y-visible"
mat-table
[dataSource]="webSignInHistoryDataSource"
<ng-container
*ngIf="
webSignInHistoryDataSource.data.length > 0;
else noSigninHistory
"
>
<div class="flex flex-col flex-auto mt-2">
<table
class="overflow-y-visible"
mat-table
[dataSource]="webSignInHistoryDataSource"
>
<!-- Total -->
<ng-container matColumnDef="no">
<th mat-header-cell *matHeaderCellDef>번호</th>
<td mat-cell *matCellDef="let info; let idx = index">
<span class="font-medium text-right">
{{ idx + 1 }}
</span>
</td>
</ng-container>
<ng-container matColumnDef="signInIp">
<th mat-header-cell *matHeaderCellDef>접속아이피</th>
<td mat-cell *matCellDef="let info">{{ info.signInIp }}</td>
</ng-container>
<ng-container matColumnDef="signInAt">
<th mat-header-cell *matHeaderCellDef>접속일자</th>
<td mat-cell *matCellDef="let info">{{ info.signInAt }}</td>
</ng-container>
<tr
mat-header-row
*matHeaderRowDef="webSignInHistoryTableColumns"
></tr>
<tr
mat-row
*matRowDef="let row; columns: webSignInHistoryTableColumns"
></tr>
</table>
<mat-paginator
[pageSizeOptions]="[5, 10, 25, 100]"
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"
>
<!-- Total -->
<ng-container matColumnDef="no">
<th mat-header-cell *matHeaderCellDef>번호</th>
<td mat-cell *matCellDef="let info; let idx = index">
<span class="font-medium text-right">
{{ idx + 1 }}
</span>
</td>
</ng-container>
<ng-container matColumnDef="signInIp">
<th mat-header-cell *matHeaderCellDef>접속아이피</th>
<td mat-cell *matCellDef="let info">{{ info.signInIp }}</td>
</ng-container>
<ng-container matColumnDef="signInAt">
<th mat-header-cell *matHeaderCellDef>접속일자</th>
<td mat-cell *matCellDef="let info">{{ info.signInAt }}</td>
</ng-container>
<tr
mat-header-row
*matHeaderRowDef="webSignInHistoryTableColumns"
></tr>
<tr
mat-row
*matRowDef="let row; columns: webSignInHistoryTableColumns"
></tr>
</table>
<mat-paginator
[pageSizeOptions]="[5, 10, 25, 100]"
aria-label="Select page of users"
></mat-paginator>
</div>
There are no data!
</div>
</ng-template>
</div>
</div>
</div>

View File

@ -50,52 +50,69 @@
</button>
</div>
</div>
<div class="flex flex-col flex-auto mt-2">
<table
class="overflow-y-visible"
mat-table
[dataSource]="withdrawHistoryDataSource"
<ng-container
*ngIf="withdrawHistoryDataSource.data.length > 0; else noWithdraw"
>
<div class="flex flex-col flex-auto mt-2">
<table
class="overflow-y-visible"
mat-table
[dataSource]="withdrawHistoryDataSource"
>
<!-- Total -->
<ng-container matColumnDef="no">
<th mat-header-cell *matHeaderCellDef>번호</th>
<td mat-cell *matCellDef="let info; let idx = index">
<span class="font-medium text-right">{{ idx + 1 }}</span>
</td>
</ng-container>
<!-- Expenses amount -->
<ng-container matColumnDef="amount">
<th mat-header-cell *matHeaderCellDef>충전금액</th>
<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.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">
{{ __getWithdrawState(info) }}
</td>
</ng-container>
<tr
mat-header-row
*matHeaderRowDef="withdrawHistoryTableColumns"
></tr>
<tr
mat-row
*matRowDef="let row; columns: withdrawHistoryTableColumns"
></tr>
</table>
<mat-paginator
[pageSizeOptions]="[5, 10, 25, 100]"
aria-label="Select page of users"
>
</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"
>
<!-- Total -->
<ng-container matColumnDef="no">
<th mat-header-cell *matHeaderCellDef>번호</th>
<td mat-cell *matCellDef="let info; let idx = index">
<span class="font-medium text-right">{{ idx + 1 }}</span>
</td>
</ng-container>
<!-- Expenses amount -->
<ng-container matColumnDef="amount">
<th mat-header-cell *matHeaderCellDef>충전금액</th>
<td mat-cell *matCellDef="let info">{{ info.amount }}</td>
</ng-container>
<!-- Expenses amount -->
<ng-container matColumnDef="createAt">
<th mat-header-cell *matHeaderCellDef>신청일자</th>
<td mat-cell *matCellDef="let info">{{ info.createAt }}</td>
</ng-container>
<ng-container matColumnDef="state">
<th mat-header-cell *matHeaderCellDef>결과</th>
<td mat-cell *matCellDef="let info">{{ info.state }}</td>
</ng-container>
<tr
mat-header-row
*matHeaderRowDef="withdrawHistoryTableColumns"
></tr>
<tr
mat-row
*matRowDef="let row; columns: withdrawHistoryTableColumns"
></tr>
</table>
<mat-paginator
[pageSizeOptions]="[5, 10, 25, 100]"
aria-label="Select page of users"
>
</mat-paginator>
</div>
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,