파트너 리스트 연동

This commit is contained in:
Park Byung Eun 2022-08-11 07:01:53 +00:00
parent 90277b9b08
commit 0e07f16204
6 changed files with 86 additions and 44 deletions

View File

@ -30,8 +30,8 @@
<div <div
class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto overflow-x-auto overflow-y-hidden" class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto overflow-x-auto overflow-y-hidden"
> >
<ng-container *ngIf="partners$ | async as partners"> <ng-container *ngIf="listPartner$ | async as listPartner">
<ng-container *ngIf="partners.length > 0; else noPartner"> <ng-container *ngIf="listPartner.length > 0; else noPartner">
<div class="grid"> <div class="grid">
<!-- Header --> <!-- Header -->
<div <div
@ -73,9 +73,9 @@
<div class="hidden lg:block">비고</div> <div class="hidden lg:block">비고</div>
</div> </div>
<!-- Rows --> <!-- Rows -->
<ng-container *ngIf="partners$ | async as partners"> <ng-container *ngIf="listPartner$ | async as listPartner">
<ng-container <ng-container
*ngFor="let partner of partners; trackBy: __trackByFn" *ngFor="let partner of listPartner; trackBy: __trackByFn"
> >
<div <div
class="partner-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b" class="partner-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b"
@ -102,71 +102,64 @@
<div [matTooltip]="__getRateTooltop()">요율</div> <div [matTooltip]="__getRateTooltop()">요율</div>
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
<div> <div>
<div> <div>2 3 2 1 5</div>
{{ partner.branchCount }}{{ partner.divisionCount }}
{{ partner.officeCount }}{{ partner.storeCount
}}{{ partner.memberCount }}
</div>
</div> </div>
</div> </div>
<!-- 아이디/닉네임/연락처 --> <!-- 아이디/닉네임/연락처 -->
<div <div
class="hidden lg:block" class="hidden lg:block"
(click)="viewUserDetail(partner.id)" (click)="viewUserDetail(partner.getId())"
style="cursor: pointer" style="cursor: pointer"
> >
{{ partner.signinId }} {{ partner.getUsername() }}
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
{{ partner.nickname }} {{ partner.getNickname() }}
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
{{ partner.phoneNumber }} {{ partner.getMobilePhoneNumber() }}
</div> </div>
<!-- 등급/레벨/상태 --> <!-- 등급/레벨/상태 -->
<div class="hidden lg:block"> <div class="hidden lg:block">
{{ partner.rank }} {{ partner.getMemberClass()?.getName() }}
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
LV{{ partner.level }} LV{{ partner.getMemberLevel()?.getName() }}
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
{{ partner.state }} {{ partner.getState() }}
</div> </div>
<!-- 예금주 --> <!-- 예금주 -->
<div class="hidden lg:block"> <div class="hidden lg:block">예금주</div>
{{ partner.accountHolder }}
</div>
<!-- 정산종류 --> <!-- 정산종류 -->
<div class="hidden lg:block"> <div class="hidden lg:block">정산종류</div>
{{ partner.calculateType }}
</div>
<!-- 보유금 --> <!-- 보유금 -->
<div class="hidden lg:block"> <div class="hidden lg:block">
캐쉬{{ partner.ownCash }} 캐쉬: 2,900
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
콤프{{ partner.ownComp }}P 콤프: 3,000P
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
쿠폰{{ partner.ownCoupon }} 쿠폰: 2,000
</div> </div>
<!-- 충전금 --> <!-- 충전금 -->
<div class="hidden lg:block"> <div class="hidden lg:block">
본인{{ partner.ownCharge }} 본인: 2,900
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
하부{{ partner.bottomCharge }} 하부 1,900
</div> </div>
<!-- 환전금 --> <!-- 환전금 -->
<div class="hidden lg:block"> <div class="hidden lg:block">
본인{{ partner.ownExchange }} 본인: 2,900
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
하부{{ partner.bottomExchange }} 하부: 2,800
</div> </div>
<!-- 수익금 --> <!-- 수익금 -->
<div class="hidden lg:block"> <div class="hidden lg:block">
본인{{ partner.ownRevenue }} 본인: 2,900
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
하부{{ partner.bottomRevenue }} 하부: 2,800
</div> </div>
<!-- 가입날짜 --> <!-- 가입날짜 -->
<div class="hidden lg:block"> <div class="hidden lg:block">
{{ partner.registrationDate }} <!-- {{ partner.getCreatedAt() }} -->
{{ partner.getCreatedAt() | date: "yyyy/MM/dd" }}
</div> </div>
<!-- 비고 --> <!-- 비고 -->
<div class="hidden lg:block"> <div class="hidden lg:block">

View File

@ -22,6 +22,7 @@ import {
map, map,
merge, merge,
Observable, Observable,
of,
Subject, Subject,
switchMap, switchMap,
takeUntil, takeUntil,
@ -32,17 +33,18 @@ import { FuseConfirmationService } from '@fuse/services/confirmation';
import { Partner } from '../models/partner'; import { Partner } from '../models/partner';
import { PartnerPagination } from '../models/partner-pagination'; import { PartnerPagination } from '../models/partner-pagination';
import { PartnerService } from '../services/partner.service'; import { PartnerService } from '../services/partner.service';
import { Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { RegistComposeComponent } from '../compose/regist-compose.component'; import { RegistComposeComponent } from '../compose/regist-compose.component';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { SiteService } from 'app/modules/polyglot/domain/services/site.service'; import { SiteService } from 'app/modules/polyglot/domain/services/site.service';
import { Site } from 'app/modules/protobuf/models/domain/site_pb'; import { Site } from 'app/modules/protobuf/models/domain/site_pb';
import { MembeerService } from 'app/modules/polyglot/member/services/member.service'; import { MemberService } from 'app/modules/polyglot/member/services/member.service';
import { import {
Member, Member,
MemberModel, MemberModel,
} from 'app/modules/protobuf/models/member/member_pb'; } from 'app/modules/protobuf/models/member/member_pb';
import { ListMembersResponse } from 'app/modules/protobuf/c2se/backend/member_pb';
@Component({ @Component({
selector: 'partner-list', selector: 'partner-list',
templateUrl: './list.component.html', templateUrl: './list.component.html',
@ -81,7 +83,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild(MatPaginator) private _paginator!: MatPaginator; @ViewChild(MatPaginator) private _paginator!: MatPaginator;
@ViewChild(MatSort) private _sort!: MatSort; @ViewChild(MatSort) private _sort!: MatSort;
partners$!: Observable<Partner[] | undefined>; /* partners$!: Observable<Partner[] | undefined>; */
listPartner$!: Observable<MemberModel[] | undefined>;
isLoading = false; isLoading = false;
searchInputControl = new FormControl(); searchInputControl = new FormControl();
@ -99,8 +103,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
private _changeDetectorRef: ChangeDetectorRef, private _changeDetectorRef: ChangeDetectorRef,
private _fuseConfirmationService: FuseConfirmationService, private _fuseConfirmationService: FuseConfirmationService,
private _formBuilder: FormBuilder, private _formBuilder: FormBuilder,
private _activatedRoute: ActivatedRoute,
private _partnerService: PartnerService, private _partnerService: PartnerService,
private __memberService: MembeerService, private __memberService: MemberService,
private _siteService: SiteService, private _siteService: SiteService,
private router: Router, private router: Router,
private _matDialog: MatDialog private _matDialog: MatDialog
@ -126,9 +131,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
}); });
// Get the products // Get the products
this.partners$ = this._partnerService.partners$; /* this.partners$ = this._partnerService.partners$; */
this._siteService /* this._siteService
.listSites() .listSites()
.then((result) => { .then((result) => {
this.sites = result.getSitesList(); this.sites = result.getSitesList();
@ -141,7 +146,16 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
this.__members = result.getMembersList(); this.__members = result.getMembersList();
console.log('member list', this.__members); console.log('member list', this.__members);
}) })
.catch((reson) => console.log(reson)); .catch((reson) => console.log(reson)); */
this._activatedRoute.data.subscribe((data) => {
let listMemberResult: ListMembersResponse.Result = data['listPartner'];
this.listPartner$ = of(listMemberResult.getMembersList());
/* console.log('dddd', listMemberResult.getMembersList()); */
// Mark for check
this._changeDetectorRef.markForCheck();
});
} }
/** /**

View File

@ -2,7 +2,10 @@ import { Route } from '@angular/router';
import { ListComponent } from './components/list.component'; import { ListComponent } from './components/list.component';
import { PartnersResolver } from './resolvers/partner.resolver'; import {
PartnerListResolver,
PartnersResolver,
} from './resolvers/partner.resolver';
export const partnerRoutes: Route[] = [ export const partnerRoutes: Route[] = [
// { // {
@ -14,7 +17,7 @@ export const partnerRoutes: Route[] = [
path: 'all', path: 'all',
component: ListComponent, component: ListComponent,
resolve: { resolve: {
Partners: PartnersResolver, listPartner: PartnerListResolver,
}, },
}, },
{ {

View File

@ -5,6 +5,8 @@ import {
Router, Router,
RouterStateSnapshot, RouterStateSnapshot,
} from '@angular/router'; } from '@angular/router';
import { MemberService } from 'app/modules/polyglot/member/services/member.service';
import { ListMembersResponse } from 'app/modules/protobuf/c2se/backend/member_pb';
import { catchError, Observable, throwError } from 'rxjs'; import { catchError, Observable, throwError } from 'rxjs';
import { Partner } from '../models/partner'; import { Partner } from '../models/partner';
@ -87,3 +89,33 @@ export class PartnersResolver implements Resolve<any> {
return this._partnerService.getPartners(); return this._partnerService.getPartners();
} }
} }
@Injectable({
providedIn: 'root',
})
export class PartnerListResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private __memberService: MemberService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
):
| Observable<ListMembersResponse.Result>
| Promise<ListMembersResponse.Result>
| ListMembersResponse.Result {
return this.__memberService.listMembers();
}
}

View File

@ -1,6 +1,6 @@
import { Type } from '@angular/core'; import { Type } from '@angular/core';
import { IdentityService } from './identity.service'; import { IdentityService } from './identity.service';
import { MembeerService } from './member.service'; import { MemberService } from './member.service';
export const SERVICES: Type<any>[] = [IdentityService, MembeerService]; export const SERVICES: Type<any>[] = [IdentityService, MemberService];

View File

@ -19,7 +19,7 @@ import {
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
}) })
export class MembeerService { export class MemberService {
/** /**
* Constructor * Constructor
*/ */