From 6d7d23798b82431bb2b8615d83698da6be3bd5b4 Mon Sep 17 00:00:00 2001 From: Park Byung Eun Date: Fri, 19 Aug 2022 08:40:01 +0000 Subject: [PATCH] =?UTF-8?q?=EC=B6=94=EC=B2=9C=EC=9D=B8=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20=EC=9A=94=EC=B2=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/list.component.ts | 20 ++++++++++-- .../compose/add-compose.component.html | 18 ++++++++--- .../compose/add-compose.component.ts | 31 +++---------------- .../services/member_referrer.service.ts | 5 ++- 4 files changed, 39 insertions(+), 35 deletions(-) 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 6672632..45d99d9 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 @@ -41,8 +41,13 @@ 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 } from '../compose/add-compose.component'; +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'; @Component({ selector: 'partner-recommendation-list', templateUrl: './list.component.html', @@ -130,7 +135,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { private _formBuilder: FormBuilder, private _partnerRecommendationService: PartnerRecommendationService, private router: Router, - private _matDialog: MatDialog + private _matDialog: MatDialog, + private _memberService: MemberService, + private _memberReffererService: MemberReferrerService ) {} // ----------------------------------------------------------------------------------------------------- @@ -329,8 +336,15 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { __onClickAdd(event: MouseEvent): void { const dialogRef = this._matDialog.open(AddComposeComponent); - dialogRef.afterClosed().subscribe((result) => { + dialogRef.afterClosed().subscribe((result: AddComposeResult) => { console.log('Compose dialog was closed!'); + if (!!result.choice) { + if (!!this.registSelection.hasValue()) { + this.registSelection.selected.forEach((m: MemberModel) => { + this._memberReffererService.createMemberReferrer(m.getId()); + }); + } + } }); } __onClickDelete(event: MouseEvent): void { 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 index 8f0872a..8b596bd 100644 --- 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 @@ -4,7 +4,7 @@ class="flex flex-0 items-center justify-between h-16 pr-3 sm:pr-5 pl-6 sm:pl-8 bg-primary text-on-primary" >
알림
- - 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 index e10f63e..11361d8 100644 --- 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 @@ -16,8 +16,7 @@ export interface AddComposeData { memo: string; } export interface AddComposeResult { - price: string; - memo: string; + choice: boolean; } @Component({ @@ -66,29 +65,9 @@ export class AddComposeComponent implements OnInit { // @ Public methods // ----------------------------------------------------------------------------------------------------- - /** - * Save and close - */ - saveAndClose(): void { - // Save the message as a draft - this.saveAsDraft(); - - // Close the dialog - this.matDialogRef.close(); + selectAndClose(choice: boolean): void { + this.matDialogRef.close({ + choice, + }); } - - /** - * Discard the message - */ - discard(): void {} - - /** - * Save the message as a draft - */ - saveAsDraft(): void {} - - /** - * Send the message - */ - send(): void {} } diff --git a/src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts b/src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts index fa26a99..eb9dac8 100644 --- a/src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts +++ b/src/app/modules/polyglot/member_referrer/services/member_referrer.service.ts @@ -41,10 +41,13 @@ export class MemberReferrerService { // @ Public methods // ----------------------------------------------------------------------------------------------------- - createMemberReferrer(): Promise { + createMemberReferrer( + memberId: string + ): Promise { return new Promise( (resolve, reject) => { let req = new CreateMemberReferrerRequest(); + req.setMemberId(memberId); this.__natsService .request(