추천인 등록 요청

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 { MemberModel } from 'app/modules/proto/models/member_pb';
import { ListMembersResponse } from 'app/modules/proto/c2se/member_pb'; import { ListMembersResponse } from 'app/modules/proto/c2se/member_pb';
import { SelectionModel } from '@angular/cdk/collections'; 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 { 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({ @Component({
selector: 'partner-recommendation-list', selector: 'partner-recommendation-list',
templateUrl: './list.component.html', templateUrl: './list.component.html',
@ -130,7 +135,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
private _formBuilder: FormBuilder, private _formBuilder: FormBuilder,
private _partnerRecommendationService: PartnerRecommendationService, private _partnerRecommendationService: PartnerRecommendationService,
private router: Router, 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 { __onClickAdd(event: MouseEvent): void {
const dialogRef = this._matDialog.open(AddComposeComponent); const dialogRef = this._matDialog.open(AddComposeComponent);
dialogRef.afterClosed().subscribe((result) => { dialogRef.afterClosed().subscribe((result: AddComposeResult) => {
console.log('Compose dialog was closed!'); 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 { __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" 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> <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 <mat-icon
class="text-current" class="text-current"
[svgIcon]="'heroicons_outline:x'" [svgIcon]="'heroicons_outline:x'"
@ -25,12 +25,20 @@
> >
<div class="flex items-center mt-4 sm:mt-0"> <div class="flex items-center mt-4 sm:mt-0">
<!-- Save as draft --> <!-- Save as draft -->
<button class="sm:mx-3" mat-stroked-button (click)="saveAsDraft()"> <button
<span>OK</span> class="sm:mx-3"
mat-stroked-button
(click)="selectAndClose(true)"
>
<span>등록</span>
</button> </button>
<!-- Save as draft --> <!-- Save as draft -->
<button class="sm:mx-3" mat-stroked-button (click)="saveAsDraft()"> <button
<span>CANCEL</span> class="sm:mx-3"
mat-stroked-button
(click)="selectAndClose(false)"
>
<span>취소</span>
</button> </button>
</div> </div>
</div> </div>

View File

@ -16,8 +16,7 @@ export interface AddComposeData {
memo: string; memo: string;
} }
export interface AddComposeResult { export interface AddComposeResult {
price: string; choice: boolean;
memo: string;
} }
@Component({ @Component({
@ -66,29 +65,9 @@ export class AddComposeComponent implements OnInit {
// @ Public methods // @ Public methods
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
/** selectAndClose(choice: boolean): void {
* Save and close this.matDialogRef.close({
*/ choice,
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 {}
} }

View File

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