This commit is contained in:
Park Byung Eun 2022-08-25 06:30:48 +00:00
parent 60f7417cdf
commit 3b71dd1fe3
4 changed files with 69 additions and 67 deletions

View File

@ -59,6 +59,8 @@ import {
UpdateMemberBankAccountRequest,
} from 'app/modules/proto/c2se/member_bank_account_pb';
import { MemberBankAccountService } from 'app/modules/polyglot/member_bank_account/services/member_bank_account.service';
import { ListBanksResponse } from 'app/modules/proto/c2se/bank_pb';
import { ListMemberClassesResponse } from 'app/modules/proto/c2se/member_class_pb';
@Component({
selector: 'user-view',
@ -299,18 +301,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
this._changeDetectorRef.markForCheck();
});
/* this._memberLevelService.listMemberLevels().then((result) => {
this.memberLevels = result
.getMemberLevelsList()
.filter((v) => !!v.getShow());
this.memberDefaultForm
.get('levelName')
?.setValue(this.currentMember?.getMemberLevel()?.getName());
this._changeDetectorRef.markForCheck();
}); */
this._bankService.listBanks().then((result) => {
/* this._bankService.listBanks().then((result) => {
this.memberBankForm.get('bankName')?.value;
this.memberBankForm.patchValue({
@ -323,7 +314,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
this._changeDetectorRef.markForCheck();
this.banks = result.getBanksList();
});
}); */
this._activatedRoute.data.subscribe((data) => {
let member: GetMemberResponse.Result = data['member'];
@ -347,6 +338,19 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
data['listMemberLevels'];
this.memberLevels = listMemberLevelsResult.getMemberLevelsList();
let listMemberClassesResult: ListMemberClassesResponse.Result =
data['listMemberClasses'];
let listbanksResult: ListBanksResponse.Result = data['listMemberBanks'];
this.banks = listbanksResult.getBanksList();
this.memberBankForm.patchValue({
bankName: this.currentMember?.getBankAccount()?.getBank()?.getName(),
accountNumber: this.currentMember?.getBankAccount()?.getAccountNumber(),
accountHolder: this.currentMember?.getBankAccount()?.getName(),
description: this.currentMember?.getBankAccount()?.getMemo(),
});
// Mark for check
this._changeDetectorRef.markForCheck();
});

View File

@ -0,0 +1,50 @@
import { Injectable } from '@angular/core';
import {
ActivatedRouteSnapshot,
Resolve,
Router,
RouterStateSnapshot,
} from '@angular/router';
import { BankService } from 'app/modules/polyglot/bank/services/bank.service';
import { MemberClassService } from 'app/modules/polyglot/member_class/services/member_class.service';
import {
ListBanksRequest,
ListBanksResponse,
} from 'app/modules/proto/c2se/bank_pb';
import {
ListMemberClassesRequest,
ListMemberClassesResponse,
} from 'app/modules/proto/c2se/member_class_pb';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root',
})
export class ListMemberBanksResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private _router: Router, private __bankService: BankService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
):
| Observable<ListBanksResponse.Result>
| Promise<ListBanksResponse.Result>
| ListBanksResponse.Result {
return this.__bankService.listBanks();
}
}

View File

@ -161,57 +161,3 @@ export class MemberResolver implements Resolve<any> {
return this._memberService.getMember(memberId!);
}
}
export class SitesResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private __siteService: SiteService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
):
| Observable<ListSitesResponse.Result>
| Promise<ListSitesResponse.Result>
| ListSitesResponse.Result {
return this.__siteService.listSites();
}
}
export class BanksResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private _bankService: BankService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
):
| Observable<ListBanksResponse.Result>
| Promise<ListBanksResponse.Result>
| ListBanksResponse.Result {
return this._bankService.listBanks();
}
}

View File

@ -2,6 +2,7 @@ import { Route } from '@angular/router';
import { ListComponent } from 'app/modules/admin/member/user/components/list.component';
import { ViewComponent } from 'app/modules/admin/member/user/components/view.component';
import { ListMemberBanksResolver } from './resolvers/member-bank.resolver';
import { ListMemberClassesResolver } from './resolvers/member-class.resolver';
import { ListMemberLevelsResolver } from './resolvers/member-level.resolver';
@ -15,6 +16,7 @@ export const userRoutes: Route[] = [
listmembers: ListMemberResolver,
listMemberClasses: ListMemberClassesResolver,
listMemberLevels: ListMemberLevelsResolver,
listMemberBanks: ListMemberBanksResolver,
},
},
{