회원 등록 연동
This commit is contained in:
parent
a6a54e68e6
commit
9bf22f83d3
|
@ -22,6 +22,7 @@ import {
|
|||
startWith,
|
||||
Subject,
|
||||
switchMap,
|
||||
take,
|
||||
takeUntil,
|
||||
timer,
|
||||
} from 'rxjs';
|
||||
|
@ -32,7 +33,10 @@ import { Partner } from '../models/partner';
|
|||
import { PartnerPagination } from '../models/partner-pagination';
|
||||
import { PartnerService } from '../services/partner.service';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { RegistComposeComponent } from '../compose/regist-compose.component';
|
||||
import {
|
||||
RegistComposeComponent,
|
||||
RegistComposeResult,
|
||||
} from '../compose/regist-compose.component';
|
||||
import { CashComposeComponent } from '../compose/cash-compose.component';
|
||||
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
@ -240,11 +244,14 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
|
||||
__onClickRegist(event: MouseEvent, partner: MemberModel): void {
|
||||
const dialogRef = this._matDialog.open(RegistComposeComponent, {
|
||||
data: { title: '대본 등록하기', parent: partner, sites: this.sites },
|
||||
data: { title: '대본 등록', parent: partner, sites: this.sites },
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((result) => {
|
||||
console.log('Compose dialog was closed!');
|
||||
dialogRef
|
||||
.afterClosed()
|
||||
.pipe(take(1))
|
||||
.subscribe((result: RegistComposeResult) => {
|
||||
console.log('Compose dialog was closed: ', result);
|
||||
});
|
||||
}
|
||||
__onClickCash(event: MouseEvent): void {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div
|
||||
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">{{ data.title }} 등록</div>
|
||||
<div class="text-lg font-medium">{{ data.title }}</div>
|
||||
<button mat-icon-button (click)="saveAndClose()" [tabIndex]="-1">
|
||||
<mat-icon
|
||||
class="text-current"
|
||||
|
@ -12,6 +12,17 @@
|
|||
</button>
|
||||
</div>
|
||||
|
||||
<fuse-alert
|
||||
class="mt-8 -mb-4"
|
||||
*ngIf="showAlert"
|
||||
[appearance]="'outline'"
|
||||
[showIcon]="false"
|
||||
[type]="alert.type"
|
||||
[@shake]="alert.type === 'error'"
|
||||
>
|
||||
{{ alert.message }}
|
||||
</fuse-alert>
|
||||
|
||||
<!-- Compose form -->
|
||||
<form
|
||||
class="flex flex-col flex-auto p-6 sm:p-8 overflow-y-auto"
|
||||
|
@ -132,6 +143,7 @@
|
|||
<mat-option *ngFor="let bank of data.banks" [value]="bank.getId()">
|
||||
{{ bank.getName() }}
|
||||
</mat-option>
|
||||
<mat-option [value]="'0'"> 국민은행 </mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="composeForm.get('bankName')?.hasError('required')">
|
||||
은행명은 필수 입력입니다.
|
||||
|
@ -184,6 +196,7 @@
|
|||
mat-flat-button
|
||||
[color]="'primary'"
|
||||
(click)="send()"
|
||||
[disabled]="isSendDisable"
|
||||
>
|
||||
등록
|
||||
</button>
|
||||
|
|
|
@ -7,11 +7,18 @@ import {
|
|||
} from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { FuseAlertType } from '@fuse/components/alert';
|
||||
import { SiteService } from 'app/modules/polyglot/domain/services/site.service';
|
||||
import { IdentityService } from 'app/modules/polyglot/member/services/identity.service';
|
||||
import { MemberService } from 'app/modules/polyglot/member/services/member.service';
|
||||
import {
|
||||
CreateMemberRequest,
|
||||
CreateMemberResponse,
|
||||
} from 'app/modules/protobuf/c2se/backend/member_pb';
|
||||
import { Bank } from 'app/modules/protobuf/models/account/bank_pb';
|
||||
import { Site } from 'app/modules/protobuf/models/domain/site_pb';
|
||||
import { MemberModel } from 'app/modules/protobuf/models/member/member_pb';
|
||||
import { fuseAnimations } from '@fuse/animations';
|
||||
|
||||
export interface RegistComposeData {
|
||||
title: string;
|
||||
|
@ -20,35 +27,25 @@ export interface RegistComposeData {
|
|||
banks: Bank[];
|
||||
}
|
||||
export interface RegistComposeResult {
|
||||
parentId: string;
|
||||
siteName: string;
|
||||
signinId: string;
|
||||
password: string;
|
||||
exchangePassword: string;
|
||||
nickname: string;
|
||||
calculateType: string;
|
||||
phoneNumber: string;
|
||||
bankName: string;
|
||||
accountNumber: string;
|
||||
accountHolder: string;
|
||||
choice: boolean;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-regist-compose',
|
||||
templateUrl: './regist-compose.component.html',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
animations: fuseAnimations,
|
||||
})
|
||||
export class RegistComposeComponent implements OnInit {
|
||||
composeForm!: FormGroup;
|
||||
sites: any[] = [];
|
||||
// quillModules: any = {
|
||||
// toolbar: [
|
||||
// ['bold', 'italic', 'underline'],
|
||||
// [{ align: [] }, { list: 'ordered' }, { list: 'bullet' }],
|
||||
// ['clean'],
|
||||
// ],
|
||||
// };
|
||||
|
||||
alert: { type: FuseAlertType; message: string } = {
|
||||
type: 'success',
|
||||
message: '등록이 성공하였습니다.',
|
||||
};
|
||||
|
||||
showAlert: boolean = false;
|
||||
isSendDisable = false;
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
@ -57,10 +54,9 @@ export class RegistComposeComponent implements OnInit {
|
|||
@Inject(MAT_DIALOG_DATA) public data: RegistComposeData,
|
||||
private _formBuilder: FormBuilder,
|
||||
private _identityService: IdentityService,
|
||||
private _memberService: MemberService,
|
||||
private _changeDetectorRef: ChangeDetectorRef
|
||||
) {
|
||||
this.data.sites.forEach((v) => console.log(v.getUrl()));
|
||||
}
|
||||
) {}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Lifecycle hooks
|
||||
|
@ -113,11 +109,61 @@ export class RegistComposeComponent implements OnInit {
|
|||
|
||||
/**
|
||||
* Send the message
|
||||
*
|
||||
}
|
||||
*/
|
||||
send(): void {
|
||||
console.log(this.composeForm.value);
|
||||
if (!this.composeForm.valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isSendDisable = true;
|
||||
|
||||
const {
|
||||
partnerId,
|
||||
siteName,
|
||||
signinId,
|
||||
password,
|
||||
exchangePassword,
|
||||
nickname,
|
||||
calculateType,
|
||||
phoneNumber,
|
||||
bankName,
|
||||
accountNumber,
|
||||
accountHolder,
|
||||
} = this.composeForm.value;
|
||||
|
||||
const member = new CreateMemberRequest();
|
||||
const site = new Site();
|
||||
site.setId(siteName);
|
||||
|
||||
member.setSiteId(siteName);
|
||||
member.setUsername(signinId);
|
||||
member.setPassword('beteran');
|
||||
member.setMemberClassId('ae9b874e-5d0e-4c4d-8432-f45f02691ceb');
|
||||
member.setMemberLevelId('c56231ac-2120-4a81-a30a-5d41fafb6c57');
|
||||
member.setReferrerMemberUsername(this.data.parent.getUsername());
|
||||
member.setNickname(nickname);
|
||||
member.setMobilePhoneNumber(phoneNumber);
|
||||
|
||||
this._memberService
|
||||
.createMember(member)
|
||||
.then((res: CreateMemberResponse.Result) => {
|
||||
console.log(res.getMember());
|
||||
this.showAlert = true;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.showAlert = true;
|
||||
this.alert = { type: 'error', message: '등록에 실패하였습니다.' };
|
||||
})
|
||||
.finally(() => (this.showAlert = false));
|
||||
}
|
||||
|
||||
private close(): void {
|
||||
this.matDialogRef.close({
|
||||
choice: true,
|
||||
});
|
||||
}
|
||||
__checkSigninId(event: FocusEvent): void {
|
||||
const signinId = this.composeForm.get('signinId')?.value;
|
||||
// console.log(event, '::', signinId);
|
||||
|
|
|
@ -26,6 +26,7 @@ import { COMPOSE } from './compose';
|
|||
|
||||
import { partnerRoutes } from './partner.routing';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { FuseAlertModule } from '@fuse/components/alert';
|
||||
|
||||
@NgModule({
|
||||
declarations: [COMPONENTS, COMPOSE],
|
||||
|
@ -51,6 +52,8 @@ import { MatDialogModule } from '@angular/material/dialog';
|
|||
MatGridListModule,
|
||||
MatMenuModule,
|
||||
MatRadioModule,
|
||||
|
||||
FuseAlertModule,
|
||||
],
|
||||
})
|
||||
export class PartnerModule {}
|
||||
|
|
|
@ -17,8 +17,12 @@ import {
|
|||
UpdateMemberRequest,
|
||||
UpdateMemberResponse,
|
||||
SUBJECT_UPDATE_MEMBER,
|
||||
CreateMemberResponse,
|
||||
CreateMemberRequest,
|
||||
SUBJECT_CREATE_MEMBER,
|
||||
} from 'app/modules/protobuf/c2se/backend/member_pb';
|
||||
import { Pagination } from 'app/modules/protobuf/protobuf/pagination/pagination_pb';
|
||||
import { MemberModel } from 'app/modules/protobuf/models/member/member_pb';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
|
@ -157,46 +161,22 @@ export class MemberService {
|
|||
// classId: 4b014ef5-3bab-4413-aaf9-b0040a70ec77
|
||||
// levelId: c56231ac-2120-4a81-a30a-5d41fafb6c57
|
||||
|
||||
// createMember(
|
||||
// siteId: string = '8429a7ab-b9de-400b-a209-28ff46e22bec',
|
||||
// memberLevelId: string = 'c56231ac-2120-4a81-a30a-5d41fafb6c57',
|
||||
// classId: string = '4b014ef5-3bab-4413-aaf9-b0040a70ec77',
|
||||
// signinId: string,
|
||||
// nickname: string,
|
||||
// password: string,
|
||||
// mobilePhoneNumber: string
|
||||
// ): Promise<MemberRequ.Result> {
|
||||
// return new Promise<UpdateMemberResponse.Result>((resolve, reject) => {
|
||||
// let req = new UpdateMemberRequest();
|
||||
// req.setId(id);
|
||||
|
||||
// if (!!siteId) {
|
||||
// req.setSiteId(siteId);
|
||||
// }
|
||||
// if (!!memberLevelId) {
|
||||
// req.setMemberLevelId(memberLevelId);
|
||||
// }
|
||||
// if (!!password) {
|
||||
// req.setPassword(password);
|
||||
// }
|
||||
// if (!!mobilePhoneNumber) {
|
||||
// req.setMobilePhoneNumber(mobilePhoneNumber);
|
||||
// }
|
||||
|
||||
// this.__natsService
|
||||
// .request<UpdateMemberResponse.Result>(
|
||||
// SUBJECT_UPDATE_MEMBER,
|
||||
// req.serializeBinary(),
|
||||
// UpdateMemberResponse.deserializeBinary
|
||||
// )
|
||||
// .then((result) => {
|
||||
// console.log('updateMember Result: ', result);
|
||||
// resolve(result);
|
||||
// })
|
||||
// .catch((e: Error) => {
|
||||
// console.log('failed', e);
|
||||
// reject(e);
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
createMember(req: CreateMemberRequest): Promise<CreateMemberResponse.Result> {
|
||||
return new Promise<CreateMemberResponse.Result>((resolve, reject) => {
|
||||
this.__natsService
|
||||
.request<CreateMemberResponse.Result>(
|
||||
SUBJECT_CREATE_MEMBER,
|
||||
req.serializeBinary(),
|
||||
CreateMemberResponse.deserializeBinary
|
||||
)
|
||||
.then((result) => {
|
||||
console.log('createMember Result: ', result);
|
||||
resolve(result);
|
||||
})
|
||||
.catch((e: Error) => {
|
||||
console.log('failed', e);
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user