diff --git a/src/app/modules/beteran/component/home.component.ts b/src/app/modules/beteran/component/home.component.ts index 9f70e2d..0f3b887 100644 --- a/src/app/modules/beteran/component/home.component.ts +++ b/src/app/modules/beteran/component/home.component.ts @@ -164,7 +164,7 @@ export class HomeComponent implements OnInit { */ __onClickCompose(composeMenuType: ComposeMenuType): void { let selectType: any; - + let data = {}; if ( !this.loggedIn && composeMenuType !== ComposeMenuType.signIn && @@ -188,6 +188,7 @@ export class HomeComponent implements OnInit { break; case ComposeMenuType.modifyMember: selectType = ModifyMemberComposeComponent; + data = { member: this.member }; break; case ComposeMenuType.deposit: selectType = DepositComposeComponent; @@ -212,7 +213,7 @@ export class HomeComponent implements OnInit { break; } - const dialogRef = this._matDialog.open(selectType); + const dialogRef = this._matDialog.open(selectType, { data }); dialogRef.afterClosed().subscribe((result) => { if (ComposeMenuType.signIn === composeMenuType && !!result.choice) { diff --git a/src/app/modules/beteran/compose/compose/modify-member-compose.component.ts b/src/app/modules/beteran/compose/compose/modify-member-compose.component.ts index 77a7237..5575a37 100644 --- a/src/app/modules/beteran/compose/compose/modify-member-compose.component.ts +++ b/src/app/modules/beteran/compose/compose/modify-member-compose.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewEncapsulation } from '@angular/core'; +import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core'; import { AbstractControl, FormBuilder, @@ -6,7 +6,7 @@ import { ValidatorFn, Validators, } from '@angular/forms'; -import { MatDialogRef } from '@angular/material/dialog'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { fuseAnimations } from '@fuse/animations'; import { FuseAlertType } from '@fuse/components/alert'; import { BankService } from 'app/modules/polyglot/bank/services/bank.service'; @@ -19,7 +19,11 @@ import { UpdateMemberForPasswordRequest, UpdateMemberForPasswordResponse, } from 'app/modules/proto/c2se/member_pb'; - +import { MemberModel } from 'app/modules/proto/models/member_pb'; +export interface ModifyMemberComposeData { + member: MemberModel; +} +export interface ModifyMemberComposeResult {} @Component({ selector: 'modify-member-compose', templateUrl: './modify-member-compose.component.html', @@ -44,6 +48,7 @@ export class ModifyMemberComposeComponent implements OnInit { */ constructor( public matDialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: ModifyMemberComposeData, private _formBuilder: FormBuilder, private _identityService: IdentityService, private _memberService: MemberService, @@ -60,8 +65,8 @@ export class ModifyMemberComposeComponent implements OnInit { ngOnInit(): void { // Create the form this.modifyMemberComposeForm = this._formBuilder.group({ - username: [{ value: '', disabled: true }], - nickname: [{ value: '', disabled: true }], + username: [{ value: this.data.member.getUsername(), disabled: true }], + nickname: [{ value: this.data.member.getNickname(), disabled: true }], currentPassword: ['1234', [Validators.required]], password: [ '1234',