파트너 리스트 연동

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

View File

@ -22,6 +22,7 @@ import {
map,
merge,
Observable,
of,
Subject,
switchMap,
takeUntil,
@ -32,17 +33,18 @@ import { FuseConfirmationService } from '@fuse/services/confirmation';
import { Partner } from '../models/partner';
import { PartnerPagination } from '../models/partner-pagination';
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 { MatDialog } from '@angular/material/dialog';
import { SiteService } from 'app/modules/polyglot/domain/services/site.service';
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 {
Member,
MemberModel,
} from 'app/modules/protobuf/models/member/member_pb';
import { ListMembersResponse } from 'app/modules/protobuf/c2se/backend/member_pb';
@Component({
selector: 'partner-list',
templateUrl: './list.component.html',
@ -81,7 +83,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild(MatPaginator) private _paginator!: MatPaginator;
@ViewChild(MatSort) private _sort!: MatSort;
partners$!: Observable<Partner[] | undefined>;
/* partners$!: Observable<Partner[] | undefined>; */
listPartner$!: Observable<MemberModel[] | undefined>;
isLoading = false;
searchInputControl = new FormControl();
@ -99,8 +103,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
private _changeDetectorRef: ChangeDetectorRef,
private _fuseConfirmationService: FuseConfirmationService,
private _formBuilder: FormBuilder,
private _activatedRoute: ActivatedRoute,
private _partnerService: PartnerService,
private __memberService: MembeerService,
private __memberService: MemberService,
private _siteService: SiteService,
private router: Router,
private _matDialog: MatDialog
@ -126,9 +131,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
});
// Get the products
this.partners$ = this._partnerService.partners$;
/* this.partners$ = this._partnerService.partners$; */
this._siteService
/* this._siteService
.listSites()
.then((result) => {
this.sites = result.getSitesList();
@ -141,7 +146,16 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
this.__members = result.getMembersList();
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 { PartnersResolver } from './resolvers/partner.resolver';
import {
PartnerListResolver,
PartnersResolver,
} from './resolvers/partner.resolver';
export const partnerRoutes: Route[] = [
// {
@ -14,7 +17,7 @@ export const partnerRoutes: Route[] = [
path: 'all',
component: ListComponent,
resolve: {
Partners: PartnersResolver,
listPartner: PartnerListResolver,
},
},
{

View File

@ -5,6 +5,8 @@ import {
Router,
RouterStateSnapshot,
} 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 { Partner } from '../models/partner';
@ -87,3 +89,33 @@ export class PartnersResolver implements Resolve<any> {
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 { 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({
providedIn: 'root',
})
export class MembeerService {
export class MemberService {
/**
* Constructor
*/