diff --git a/src/app/modules/admin/member/partner-recommendation/components/list.component.html b/src/app/modules/admin/member/partner-recommendation/components/list.component.html index 5c226da..bb43b7f 100644 --- a/src/app/modules/admin/member/partner-recommendation/components/list.component.html +++ b/src/app/modules/admin/member/partner-recommendation/components/list.component.html @@ -1,323 +1,290 @@ -
- -
- -
- -
- -
추천코드등록
- -
- -
-
- -
- -
- - - - 검색어 - 매장아이디 - 매장닉네임 - - - - - - - - - -
-
- - -
- -
- - -
- -
-
선택
-
상부
-
- 아이디 -
- 닉네임 -
- 상태 -
-
등급
- - - -
- - - -
-
- -
-
{{ partnerRecommendation.highRank }}
-
- {{ partnerRecommendation.signinId }} -
- {{ partnerRecommendation.nickname }} -
- {{ partnerRecommendation.state }} -
-
- {{ partnerRecommendation.rank }} -
-
- {{ partnerRecommendation.bankName }} -
- {{ partnerRecommendation.accountHolder }} -
- {{ partnerRecommendation.accountNumber }} -
- - -
-
-
-
-
- -
- - -
-
- - +
+
+
+
+
- There are no data! -
- -
- - -
- -
-
- -
- -
- - - - 매장아이디 - 매장닉네임 - - - - - - - - - -
-
- -
- - -
- -
-
선택
-
상부
-
- 아이디 -
- 닉네임 -
-
- 등급 -
- 상태 -
- - +
+ 추천코드등록
- - -
+ -
- -
-
{{ partnerRecommendation.highRank }}
-
- {{ partnerRecommendation.signinId }} -
- {{ partnerRecommendation.nickname }} -
-
- {{ partnerRecommendation.rank }} -
- {{ partnerRecommendation.state }} -
-
{{ partnerRecommendation.useOrNot }}
- - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + 상위 + + {{ __getRefererMember(info) }} + + 등급 + {{ info.getMemberClass()?.getName() }} + 아이디 + {{ info.getUsername() }} + 닉네임 + {{ info.getNickname() }} + 머니1000원콤프0P계좌정보 + {{ info.getBankAccount() }} + {{ info.getBankAccount() }} + {{ info.getBankAccount() }} + 상태정상사이트 + {{ info.getSite().getUrl() }} + +
+ +
+
+ + +
-
-
- -
- - - + +
+ There are no data! +
+
+
+ +
+
+ 추천코드삭제 +
+ +
+ + + + + + + + + + + - -
- There are no data! + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + 상위 + + {{ __getRefererMember(info) }} + + 등급 + {{ info.getMemberClass()?.getName() }} + 아이디 + {{ info.getUsername() }} + 닉네임 + {{ info.getNickname() }} + 사용여부Y회원수1 +
+ +
+
+ +
+
+ + +
+ There are no data! +
+
+
- +
diff --git a/src/app/modules/admin/member/partner-recommendation/components/list.component.ts b/src/app/modules/admin/member/partner-recommendation/components/list.component.ts index 51da2e6..f676686 100644 --- a/src/app/modules/admin/member/partner-recommendation/components/list.component.ts +++ b/src/app/modules/admin/member/partner-recommendation/components/list.component.ts @@ -33,10 +33,14 @@ import { PartnerRecommendation as PartnerRecommendation } from '../models/partne import { PartnerRecommendationPagination as PartnerRecommendationPagination } from '../models/partner-recommendation-pagination'; import { PartnerRecommendationService as PartnerRecommendationService } from '../services/partner-recommendation.service'; -import { Router } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { MatDialog } from '@angular/material/dialog'; import { RegistComposeComponent } from '../compose/regist-compose.component'; +import { MatTableDataSource } from '@angular/material/table'; +import { MemberModel } from 'app/modules/proto/models/member_pb'; +import { ListMembersResponse } from 'app/modules/proto/c2se/member_pb'; +import { SelectionModel } from '@angular/cdk/collections'; @Component({ selector: 'partner-recommendation-list', templateUrl: './list.component.html', @@ -72,15 +76,45 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { @ViewChild(MatPaginator) private _paginator!: MatPaginator; @ViewChild(MatSort) private _sort!: MatSort; - partnerRecommendations$!: Observable; + registPartnerStoreDataSource: MatTableDataSource = + new MatTableDataSource(); + removePartnerStoreDataSource: MatTableDataSource = + new MatTableDataSource(); + + registPartnerStoreTableColumns: string[] = [ + 'select', + 'referrerMember', + 'memberClass', + 'username', + 'nickname', + 'amountMoney', + 'comp', + 'bankInfo', + 'state', + 'site', + ]; + + removePartnerStoreTableColumns: string[] = [ + 'select', + 'referrerMember', + 'memberClass', + 'username', + 'nickname', + 'isUse', + 'memberCount', + ]; __isSearchOpened1 = false; __isSearchOpened2 = false; + listMembers!: MemberModel[]; + isLoading = false; searchInputControl = new FormControl(); selectedPartnerRecommendation?: PartnerRecommendation; pagination?: PartnerRecommendationPagination; + selection = new SelectionModel(true, []); + private _unsubscribeAll: Subject = new Subject(); /** @@ -88,6 +122,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { */ constructor( private _changeDetectorRef: ChangeDetectorRef, + private _activatedRoute: ActivatedRoute, private _fuseConfirmationService: FuseConfirmationService, private _formBuilder: FormBuilder, private _partnerRecommendationService: PartnerRecommendationService, @@ -103,27 +138,40 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { * On init */ ngOnInit(): void { - // Get the pagination - this._partnerRecommendationService.pagination$ - .pipe(takeUntil(this._unsubscribeAll)) - .subscribe((pagination: PartnerRecommendationPagination | undefined) => { - // Update the pagination - this.pagination = pagination; - - // Mark for check - this._changeDetectorRef.markForCheck(); - }); - // Get the products - this.partnerRecommendations$ = - this._partnerRecommendationService.partnerRecommendations$; + this._activatedRoute.data.subscribe((data) => { + let listMemberResult: ListMembersResponse.Result = + data['listPartnerStore']; + + this.listMembers = listMemberResult.getMembersList(); + + this.registPartnerStoreDataSource.data = listMemberResult + .getMembersList() + .filter( + (v: MemberModel) => + v.getMemberClass()?.getId() === + 'e11cac11-3825-4f4e-9cd5-39367f23f973' + ); + this.removePartnerStoreDataSource.data = listMemberResult + .getMembersList() + .filter( + (v: MemberModel) => + v.getMemberClass()?.getId() === + 'e11cac11-3825-4f4e-9cd5-39367f23f973' + ); + + /* console.log('dddd', listMemberResult.getMembersList()); */ + + // Mark for check + this._changeDetectorRef.markForCheck(); + }); } /** * After view init */ ngAfterViewInit(): void { - if (this._sort && this._paginator) { + /* if (this._sort && this._paginator) { // Set the initial sort this._sort.sort({ id: 'signinId', @@ -159,7 +207,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { }) ) .subscribe(); - } + } */ } /** @@ -183,6 +231,31 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { // @ Private methods // ----------------------------------------------------------------------------------------------------- + /** Selects all rows if they are not all selected; otherwise clear selection. */ + __toggleAllRows() { + if (this.__isAllSelected()) { + this.selection.clear(); + return; + } + + this.selection.select(...this.registPartnerStoreDataSource.data); + } + + __isAllSelected() { + const numSelected = this.selection.selected.length; + const numRows = this.registPartnerStoreDataSource.data.length; + return numSelected === numRows; + } + + /** The label for the checkbox on the passed row */ + __checkboxLabel(row?: MemberModel): string { + if (!row) { + return `${this.__isAllSelected() ? 'deselect' : 'select'} all`; + } + return `${ + this.selection.isSelected(row) ? 'deselect' : 'select' + } row ${row.getUsername()}`; + } /** * Create product */ @@ -223,4 +296,14 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { console.log('Compose dialog was closed!'); }); } + + __getRefererMember(member: MemberModel): string { + console.log(member.getReferrerMember()?.getUsername()); + + const name = member.getReferrerMember()?.getUsername(); + return name ? name : '없음'; + /* const findMember = this.listMembers.find((m) => m.getId() === id); */ + + /* return !!findMember ? findMember : undefined; */ + } } diff --git a/src/app/modules/admin/member/partner-recommendation/partner-recommendation.module.ts b/src/app/modules/admin/member/partner-recommendation/partner-recommendation.module.ts index 3729997..042db13 100644 --- a/src/app/modules/admin/member/partner-recommendation/partner-recommendation.module.ts +++ b/src/app/modules/admin/member/partner-recommendation/partner-recommendation.module.ts @@ -15,6 +15,7 @@ import { MatGridListModule } from '@angular/material/grid-list'; import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import { MatRadioModule } from '@angular/material/radio'; import { MatCheckboxModule } from '@angular/material/checkbox'; +import { MatTableModule } from '@angular/material/table'; import { TranslocoModule } from '@ngneat/transloco'; @@ -46,6 +47,7 @@ import { partnerRecommendationRoutes } from './partner-recommendation.routing'; MatSlideToggleModule, MatRadioModule, MatCheckboxModule, + MatTableModule, ], }) export class PartnerRecommendationModule {} diff --git a/src/app/modules/admin/member/partner-recommendation/partner-recommendation.routing.ts b/src/app/modules/admin/member/partner-recommendation/partner-recommendation.routing.ts index 09265b7..1855b7b 100644 --- a/src/app/modules/admin/member/partner-recommendation/partner-recommendation.routing.ts +++ b/src/app/modules/admin/member/partner-recommendation/partner-recommendation.routing.ts @@ -2,7 +2,10 @@ import { Route } from '@angular/router'; import { ListComponent } from './components/list.component'; -import { PartnerRecommendationsResolver } from './resolvers/partner-recommendation.resolver'; +import { + ListPartnerStoreResolver, + PartnerRecommendationsResolver, +} from './resolvers/partner-recommendation.resolver'; export const partnerRecommendationRoutes: Route[] = [ // { @@ -14,7 +17,7 @@ export const partnerRecommendationRoutes: Route[] = [ path: '', component: ListComponent, resolve: { - PartnerRecommendations: PartnerRecommendationsResolver, + listPartnerStore: ListPartnerStoreResolver, }, }, ]; diff --git a/src/app/modules/admin/member/partner-recommendation/resolvers/partner-recommendation.resolver.ts b/src/app/modules/admin/member/partner-recommendation/resolvers/partner-recommendation.resolver.ts index 7afce94..cdb770f 100644 --- a/src/app/modules/admin/member/partner-recommendation/resolvers/partner-recommendation.resolver.ts +++ b/src/app/modules/admin/member/partner-recommendation/resolvers/partner-recommendation.resolver.ts @@ -5,6 +5,11 @@ import { Router, RouterStateSnapshot, } from '@angular/router'; +import { MemberService } from 'app/modules/polyglot/member/services/member.service'; +import { + ListMembersRequest, + ListMembersResponse, +} from 'app/modules/proto/c2se/member_pb'; import { catchError, Observable, throwError } from 'rxjs'; import { PartnerRecommendation } from '../models/partner-recommendation'; @@ -89,3 +94,35 @@ export class PartnerRecommendationsResolver implements Resolve { return this._partnerRecommendationService.getPartnerRecommendations(); } } + +@Injectable({ + providedIn: 'root', +}) +export class ListPartnerStoreResolver implements Resolve { + /** + * Constructor + */ + constructor(private _memberService: MemberService) {} + + // ----------------------------------------------------------------------------------------------------- + // @ Public methods + // ----------------------------------------------------------------------------------------------------- + + /** + * Resolver + * + * @param route + * @param state + */ + resolve( + route: ActivatedRouteSnapshot, + state: RouterStateSnapshot + ): + | Observable + | Promise + | ListMembersResponse.Result { + let req = new ListMembersRequest(); + + return this._memberService.listMembers(req); + } +}