추천인 등록 요청

This commit is contained in:
Park Byung Eun 2022-08-19 08:40:01 +00:00
parent 4cc31a17ab
commit 6d7d23798b
4 changed files with 39 additions and 35 deletions

View File

@ -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 {

View File

@ -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"
>
<div class="text-lg font-medium">알림</div>
<button mat-icon-button (click)="saveAndClose()" [tabIndex]="-1">
<button mat-icon-button (click)="selectAndClose(false)" [tabIndex]="-1">
<mat-icon
class="text-current"
[svgIcon]="'heroicons_outline:x'"
@ -25,12 +25,20 @@
>
<div class="flex items-center mt-4 sm:mt-0">
<!-- Save as draft -->
<button class="sm:mx-3" mat-stroked-button (click)="saveAsDraft()">
<span>OK</span>
<button
class="sm:mx-3"
mat-stroked-button
(click)="selectAndClose(true)"
>
<span>등록</span>
</button>
<!-- Save as draft -->
<button class="sm:mx-3" mat-stroked-button (click)="saveAsDraft()">
<span>CANCEL</span>
<button
class="sm:mx-3"
mat-stroked-button
(click)="selectAndClose(false)"
>
<span>취소</span>
</button>
</div>
</div>

View File

@ -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 {}
}

View File

@ -41,10 +41,13 @@ export class MemberReferrerService {
// @ Public methods
// -----------------------------------------------------------------------------------------------------
createMemberReferrer(): Promise<CreateMemberReferrerResponse.Result> {
createMemberReferrer(
memberId: string
): Promise<CreateMemberReferrerResponse.Result> {
return new Promise<CreateMemberReferrerResponse.Result>(
(resolve, reject) => {
let req = new CreateMemberReferrerRequest();
req.setMemberId(memberId);
this.__natsService
.request<CreateMemberReferrerResponse.Result>(