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 8b04adc..7c975ca 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 @@ -52,7 +52,7 @@ 상위 - {{ __getRefererMember(info) }} + {{ __getParentUserName("") }} @@ -209,7 +209,7 @@ 상위 - {{ __getRefererMember(info) }} + {{ __getParentUserName("") }} @@ -219,14 +219,14 @@ 등급 - {{ info.getMemberClass()?.getName() }} + {{ __getMemberClassName(info) }} 아이디 - {{ info.getUsername() }} + {{ info.getMember()?.getUsername() }} @@ -234,14 +234,16 @@ 닉네임 - {{ info.getNickname() }} + {{ info.getMember()?.getNickname() }} 사용여부 - Y + + {{ info.getCanUse() ? "Y" : "N" }} + 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 e52ca9e..64632da 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 @@ -8,46 +8,23 @@ import { ViewChild, ViewEncapsulation, } from '@angular/core'; -import { - FormBuilder, - FormControl, - FormGroup, - Validators, -} from '@angular/forms'; -import { MatCheckboxChange } from '@angular/material/checkbox'; +import { FormBuilder, FormControl, FormGroup } from '@angular/forms'; + import { MatPaginator } from '@angular/material/paginator'; import { MatSort } from '@angular/material/sort'; -import { - debounceTime, - map, - merge, - Observable, - Subject, - switchMap, - takeUntil, -} from 'rxjs'; +import { Subject } from 'rxjs'; import { fuseAnimations } from '@fuse/animations'; import { FuseConfirmationService } from '@fuse/services/confirmation'; -import { PartnerRecommendation as PartnerRecommendation } from '../models/partner-recommendation'; -import { PartnerRecommendationPagination as PartnerRecommendationPagination } from '../models/partner-recommendation-pagination'; -import { PartnerRecommendationService as PartnerRecommendationService } from '../services/partner-recommendation.service'; - 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'; -import { - AddComposeComponent, - AddComposeResult, -} from '../compose/add-compose.component'; -import { DeleteComposeComponent } from '../compose/delete-compose.component'; -import { MemberService } from 'app/modules/polyglot/member/services/member.service'; + import { MemberReferrerService } from 'app/modules/polyglot/member_referrer/services/member_referrer.service'; +import { MemberReferrerModel } from 'app/modules/proto/models/member_referrer_pb'; @Component({ selector: 'partner-recommendation-list', templateUrl: './list.component.html', @@ -85,7 +62,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { registPartnerStoreDataSource: MatTableDataSource = new MatTableDataSource(); - removePartnerStoreDataSource: MatTableDataSource = + removePartnerStoreDataSource: MatTableDataSource = new MatTableDataSource(); registPartnerStoreTableColumns: string[] = [ @@ -117,14 +94,12 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { isLoading = false; searchInputControl = new FormControl(); - selectedPartnerRecommendation?: PartnerRecommendation; - pagination?: PartnerRecommendationPagination; registSelection = new SelectionModel(true, []); - removeSelection = new SelectionModel(true, []); + removeSelection = new SelectionModel(true, []); - addBtnConfigForm!: FormGroup; - removeBtnConfigForm!: FormGroup; + registConfigForm!: FormGroup; + removeConfigForm!: FormGroup; private _unsubscribeAll: Subject = new Subject(); @@ -136,10 +111,6 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { private _activatedRoute: ActivatedRoute, private _fuseConfirmationService: FuseConfirmationService, private _formBuilder: FormBuilder, - private _partnerRecommendationService: PartnerRecommendationService, - private router: Router, - private _matDialog: MatDialog, - private _memberService: MemberService, private _memberReffererService: MemberReferrerService ) {} @@ -151,6 +122,24 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { * On init */ ngOnInit(): void { + this.__addBtnConfirmConfig(); + this.__removeBtnConfirmConfig(); + + this._memberReffererService.listMemberReferrers().then((result) => { + const list = result.getMemberReferrersList(); + + this.removePartnerStoreDataSource.data = result.getMemberReferrersList(); + /* this.registPartnerStoreDataSource.data */ + const partnerStores = this.listMembers.filter( + (m) => + m.getMemberClass()?.getId() === 'e11cac11-3825-4f4e-9cd5-39367f23f973' + ); + + this.registPartnerStoreDataSource.data = partnerStores; + + // Mark for check + this._changeDetectorRef.markForCheck(); + }); // Get the products this._activatedRoute.data.subscribe((data) => { let listMemberResult: ListMembersResponse.Result = @@ -158,12 +147,12 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { this.listMembers = listMemberResult.getMembersList(); - this.registPartnerStoreDataSource.data = listMemberResult + /* this.registPartnerStoreDataSource.data = listMemberResult .getMembersList() .filter( (v: MemberModel) => v.getMemberClass()?.getId() === - 'e11cac11-3825-4f4e-9cd5-39367f23f973' + 'e11cac11-3825-4f4e-9cd5-39367f23f973' && ); this.removePartnerStoreDataSource.data = listMemberResult .getMembersList() @@ -171,7 +160,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { (v: MemberModel) => v.getMemberClass()?.getId() === 'e11cac11-3825-4f4e-9cd5-39367f23f973' - ); + ); */ /* console.log('dddd', listMemberResult.getMembersList()); */ @@ -267,7 +256,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { } return `${ this.registSelection.isSelected(row) ? 'deselect' : 'select' - } row ${row.getUsername()}`; + } row ${row.getId()}`; } __removeToggleAllRows() { @@ -286,13 +275,13 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { } /** The label for the checkbox on the passed row */ - __removeCheckboxLabel(row?: MemberModel): string { + __removeCheckboxLabel(row?: MemberReferrerModel): string { if (!row) { return `${this.__removeIsAllSelected() ? 'deselect' : 'select'} all`; } return `${ this.removeSelection.isSelected(row) ? 'deselect' : 'select' - } row ${row.getUsername()}`; + } row ${row.getId()}`; } /** @@ -328,16 +317,8 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { return item.id || index; } - __onClickRegist(event: MouseEvent): void { - const dialogRef = this._matDialog.open(RegistComposeComponent); - - dialogRef.afterClosed().subscribe((result) => { - console.log('Compose dialog was closed!'); - }); - } - __addBtnConfirmConfig(): void { - this.addBtnConfigForm = this._formBuilder.group({ + this.registConfigForm = this._formBuilder.group({ title: '알림', message: '정말 추천인으로 추가하시겠습니까?', icon: this._formBuilder.group({ @@ -360,7 +341,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { }); } __removeBtnConfirmConfig(): void { - this.removeBtnConfigForm = this._formBuilder.group({ + this.removeConfigForm = this._formBuilder.group({ title: '알림', message: '정말 삭제하시겠습니까?', icon: this._formBuilder.group({ @@ -384,11 +365,14 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { } __onClickAddBtn(event: MouseEvent): void { // Open the dialog and save the reference of it - const dialogRef = this._fuseConfirmationService.open(); + const dialogRef = this._fuseConfirmationService.open( + this.registConfigForm.value + ); - dialogRef.afterClosed().subscribe((result: AddComposeResult) => { - console.log('Compose dialog was closed!'); - if (!!result.choice) { + /* const dialogRef = this._matDialog.open(AddComposeComponent); */ + + dialogRef.afterClosed().subscribe((result) => { + if (result === 'confirmed') { if (!!this.registSelection.hasValue()) { this.registSelection.selected.forEach((m: MemberModel) => { this._memberReffererService.createMemberReferrer(m.getId()); @@ -399,18 +383,27 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { } __onClickRemoveBtn(event: MouseEvent): void { // Open the dialog and save the reference of it - const dialogRef = this._fuseConfirmationService.open(); + const dialogRef = this._fuseConfirmationService.open( + this.removeConfigForm.value + ); // Subscribe to afterClosed from the dialog reference dialogRef.afterClosed().subscribe((result) => { - console.log(result); + if (result === 'confirmed') { + } }); } - __getRefererMember(member: MemberModel): string { + __getParentUserName(parentId: string): string { /* console.log(member.getReferrerMember()?.getUsername()); const name = member.getReferrerMember()?.getUsername(); */ - return '없음'; + const find = this.listMembers.find((m) => m.getId() === parentId); + return !!find ? find.getUsername() : '없음'; + } + + __getMemberClassName(info: MemberReferrerModel): string { + console.log(info.getMember()?.getUsername()); + return '매장'; } } diff --git a/src/app/modules/admin/member/partner-recommendation/compose/add-compose.component.html b/src/app/modules/admin/member/partner-recommendation/compose/add-compose.component.html deleted file mode 100644 index 8b596bd..0000000 --- a/src/app/modules/admin/member/partner-recommendation/compose/add-compose.component.html +++ /dev/null @@ -1,46 +0,0 @@ -
- -
-
알림
- -
- - -
-
- 추천인으로 추가하시겠습니까? -
-
-
- - - - -
-
-
-
diff --git a/src/app/modules/admin/member/partner-recommendation/compose/add-compose.component.ts b/src/app/modules/admin/member/partner-recommendation/compose/add-compose.component.ts deleted file mode 100644 index 11361d8..0000000 --- a/src/app/modules/admin/member/partner-recommendation/compose/add-compose.component.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { - ChangeDetectorRef, - Component, - Inject, - OnInit, - ViewEncapsulation, -} from '@angular/core'; -import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; -import { SiteService } from 'app/modules/polyglot/site/services/site.service'; -import { IdentityService } from 'app/modules/polyglot/identity/services/identity.service'; -import { Site } from 'app/modules/proto/models/site_pb'; - -export interface AddComposeData { - price: string; - memo: string; -} -export interface AddComposeResult { - choice: boolean; -} - -@Component({ - selector: 'app-add-compose', - templateUrl: './add-compose.component.html', - encapsulation: ViewEncapsulation.None, -}) -export class AddComposeComponent implements OnInit { - composeForm!: FormGroup; - sites: any[] = []; - // quillModules: any = { - // toolbar: [ - // ['bold', 'italic', 'underline'], - // [{ align: [] }, { list: 'ordered' }, { list: 'bullet' }], - // ['clean'], - // ], - // }; - - /** - * Constructor - */ - constructor( - public matDialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data: AddComposeData, - private _formBuilder: FormBuilder, - private _identityService: IdentityService, - private _changeDetectorRef: ChangeDetectorRef - ) {} - - // ----------------------------------------------------------------------------------------------------- - // @ Lifecycle hooks - // ----------------------------------------------------------------------------------------------------- - - /** - * On init - */ - ngOnInit(): void { - // Create the form - this.composeForm = this._formBuilder.group({ - price: ['', [Validators.required]], - memo: ['', [Validators.required]], - }); - } - - // ----------------------------------------------------------------------------------------------------- - // @ Public methods - // ----------------------------------------------------------------------------------------------------- - - selectAndClose(choice: boolean): void { - this.matDialogRef.close({ - choice, - }); - } -} diff --git a/src/app/modules/admin/member/partner-recommendation/compose/delete-compose.component.html b/src/app/modules/admin/member/partner-recommendation/compose/delete-compose.component.html deleted file mode 100644 index da265cc..0000000 --- a/src/app/modules/admin/member/partner-recommendation/compose/delete-compose.component.html +++ /dev/null @@ -1,38 +0,0 @@ -
- -
-
알림
- -
- - -
-
- 삭제하시겠습니까? -
-
-
- - - - -
-
-
-
diff --git a/src/app/modules/admin/member/partner-recommendation/compose/delete-compose.component.ts b/src/app/modules/admin/member/partner-recommendation/compose/delete-compose.component.ts deleted file mode 100644 index 549f127..0000000 --- a/src/app/modules/admin/member/partner-recommendation/compose/delete-compose.component.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { - ChangeDetectorRef, - Component, - Inject, - OnInit, - ViewEncapsulation, -} from '@angular/core'; -import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; -import { SiteService } from 'app/modules/polyglot/site/services/site.service'; -import { IdentityService } from 'app/modules/polyglot/identity/services/identity.service'; -import { Site } from 'app/modules/proto/models/site_pb'; - -export interface DeleteComposeData { - price: string; - memo: string; -} -export interface DeleteComposeResult { - price: string; - memo: string; -} - -@Component({ - selector: 'app-delete-compose', - templateUrl: './delete-compose.component.html', - encapsulation: ViewEncapsulation.None, -}) -export class DeleteComposeComponent implements OnInit { - composeForm!: FormGroup; - sites: any[] = []; - // quillModules: any = { - // toolbar: [ - // ['bold', 'italic', 'underline'], - // [{ align: [] }, { list: 'ordered' }, { list: 'bullet' }], - // ['clean'], - // ], - // }; - - /** - * Constructor - */ - constructor( - public matDialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data: DeleteComposeData, - private _formBuilder: FormBuilder, - private _identityService: IdentityService, - private _changeDetectorRef: ChangeDetectorRef - ) {} - - // ----------------------------------------------------------------------------------------------------- - // @ Lifecycle hooks - // ----------------------------------------------------------------------------------------------------- - - /** - * On init - */ - ngOnInit(): void { - // Create the form - this.composeForm = this._formBuilder.group({ - price: ['', [Validators.required]], - memo: ['', [Validators.required]], - }); - } - - // ----------------------------------------------------------------------------------------------------- - // @ Public methods - // ----------------------------------------------------------------------------------------------------- - - /** - * Save and close - */ - saveAndClose(): void { - // Save the message as a draft - this.saveAsDraft(); - - // Close the dialog - this.matDialogRef.close(); - } - - /** - * Discard the message - */ - discard(): void {} - - /** - * Save the message as a draft - */ - saveAsDraft(): void {} - - /** - * Send the message - */ - send(): void {} -} diff --git a/src/app/modules/admin/member/partner-recommendation/compose/index.ts b/src/app/modules/admin/member/partner-recommendation/compose/index.ts deleted file mode 100644 index 2198b77..0000000 --- a/src/app/modules/admin/member/partner-recommendation/compose/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { RegistComposeComponent } from './regist-compose.component'; -import { AddComposeComponent } from './add-compose.component'; -import { DeleteComposeComponent } from './delete-compose.component'; - -export const COMPOSE = [ - RegistComposeComponent, - AddComposeComponent, - DeleteComposeComponent, -]; diff --git a/src/app/modules/admin/member/partner-recommendation/compose/regist-compose.component.html b/src/app/modules/admin/member/partner-recommendation/compose/regist-compose.component.html deleted file mode 100644 index 109a5cd..0000000 --- a/src/app/modules/admin/member/partner-recommendation/compose/regist-compose.component.html +++ /dev/null @@ -1,111 +0,0 @@ -
- -
-
대본사 생성
- -
- - -
- - - 파트너아이디 - - - - - - 사이트명 - - - - - - 회원 아이디 - - - - - - 비밀번호 - - - - - 환전 비밀번호 - - - - - 닉네임 - - - - - 정산종류 - - - - - 휴대폰번호 - - - - - 은행명 - - - - - 계좌번호 - - - - - 예금주 - - - - - - - -
-
- - - - - - -
-
-
-
diff --git a/src/app/modules/admin/member/partner-recommendation/compose/regist-compose.component.ts b/src/app/modules/admin/member/partner-recommendation/compose/regist-compose.component.ts deleted file mode 100644 index 3f0319b..0000000 --- a/src/app/modules/admin/member/partner-recommendation/compose/regist-compose.component.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { Component, OnInit, ViewEncapsulation } from '@angular/core'; -import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { MatDialogRef } from '@angular/material/dialog'; - -@Component({ - selector: 'app-regist-compose', - templateUrl: './regist-compose.component.html', - encapsulation: ViewEncapsulation.None, -}) -export class RegistComposeComponent implements OnInit { - composeForm!: FormGroup; - copyFields: { cc: boolean; bcc: boolean } = { - cc: false, - bcc: false, - }; - // quillModules: any = { - // toolbar: [ - // ['bold', 'italic', 'underline'], - // [{ align: [] }, { list: 'ordered' }, { list: 'bullet' }], - // ['clean'], - // ], - // }; - - /** - * Constructor - */ - constructor( - public matDialogRef: MatDialogRef, - private _formBuilder: FormBuilder - ) {} - - // ----------------------------------------------------------------------------------------------------- - // @ Lifecycle hooks - // ----------------------------------------------------------------------------------------------------- - - /** - * On init - */ - ngOnInit(): void { - // Create the form - this.composeForm = this._formBuilder.group({ - partnerId: [{ value: 'kgon4', disabled: true }], - siteName: [''], - signinId: [''], - password: [''], - exchangePw: [''], - nickname: [''], - calculateType: [''], - phoneNumber: [''], - bankName: [''], - accountNumber: [''], - accountHolder: [''], - }); - } - - // ----------------------------------------------------------------------------------------------------- - // @ Public methods - // ----------------------------------------------------------------------------------------------------- - - /** - * Show the copy field with the given field name - * - * @param name - */ - showCopyField(name: string): void { - // Return if the name is not one of the available names - if (name !== 'cc' && name !== 'bcc') { - return; - } - - // Show the field - this.copyFields[name] = true; - } - - /** - * Save and close - */ - saveAndClose(): void { - // Save the message as a draft - this.saveAsDraft(); - - // Close the dialog - this.matDialogRef.close(); - } - - /** - * Discard the message - */ - discard(): void {} - - /** - * Save the message as a draft - */ - saveAsDraft(): void {} - - /** - * Send the message - */ - send(): void {} -} 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 3bc163d..6f76593 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 @@ -21,12 +21,11 @@ import { TranslocoModule } from '@ngneat/transloco'; import { SharedModule } from 'app/shared/shared.module'; import { COMPONENTS } from './components'; -import { COMPOSE } from './compose'; import { partnerRecommendationRoutes } from './partner-recommendation.routing'; @NgModule({ - declarations: [COMPONENTS, COMPOSE], + declarations: [COMPONENTS], imports: [ TranslocoModule, SharedModule,