From 78f5f37a3cefb013d8b1887e790e31e35b923b96 Mon Sep 17 00:00:00 2001 From: Park Byung Eun Date: Thu, 22 Sep 2022 08:32:05 +0000 Subject: [PATCH] =?UTF-8?q?=EC=B6=9C=EA=B8=88=EC=8B=A0=EC=B2=AD=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beteran/component/home.component.ts | 47 +++++- .../compose/sign-in-compose.component.html | 10 +- .../compose/sign-in-compose.component.ts | 1 + .../compose/withdraw-compose.component.html | 148 ++++++++++++------ .../compose/withdraw-compose.component.ts | 43 +++-- 5 files changed, 184 insertions(+), 65 deletions(-) diff --git a/src/app/modules/beteran/component/home.component.ts b/src/app/modules/beteran/component/home.component.ts index 227a04b..0e5c191 100644 --- a/src/app/modules/beteran/component/home.component.ts +++ b/src/app/modules/beteran/component/home.component.ts @@ -5,8 +5,11 @@ import { OnInit, ViewEncapsulation, } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { Router } from '@angular/router'; +import { FuseConfirmationService } from '@fuse/services/confirmation'; +import { AuthService } from 'app/core/auth/auth.service'; import { CompComposeComponent } from 'app/modules/beteran/compose/compose/comp-compose.component'; import { CustomerComposeComponent } from 'app/modules/beteran/compose/compose/customer-compose.component'; @@ -48,6 +51,8 @@ export class HomeComponent implements OnInit { composeMenuType = ComposeMenuType; + configForm!: FormGroup; + liveCasinos!: Vendor[]; hotelCasinos!: Vendor[]; slotGames!: Vendor[]; @@ -85,8 +90,11 @@ export class HomeComponent implements OnInit { private _changeDetectorRef: ChangeDetectorRef, private _router: Router, private _matDialog: MatDialog, + private _formBuilder: FormBuilder, + private _fuseConfirmationService: FuseConfirmationService, private _vendorService: VendorService, - private __gameService: GameService + private __gameService: GameService, + private _authService: AuthService ) {} ngOnInit(): void { @@ -104,6 +112,28 @@ export class HomeComponent implements OnInit { this._changeDetectorRef.markForCheck(); }); + + this.configForm = this._formBuilder.group({ + title: '알림', + message: '로그아웃 하시겠습니까?', + icon: this._formBuilder.group({ + show: true, + name: 'heroicons_outline:exclamation', + color: 'warn', + }), + actions: this._formBuilder.group({ + confirm: this._formBuilder.group({ + show: true, + label: '확인', + color: 'warn', + }), + cancel: this._formBuilder.group({ + show: true, + label: '취소', + }), + }), + dismissible: true, + }); } /** * Track by function for ngFor loops @@ -132,6 +162,8 @@ export class HomeComponent implements OnInit { switch (composeMenuType) { case ComposeMenuType.signOut: // selectType = SignInComposeComponent; + this.checkSignout(); + return; break; case ComposeMenuType.signIn: @@ -172,6 +204,19 @@ export class HomeComponent implements OnInit { console.log('Compose dialog was closed!'); }); } + + private checkSignout(): void { + const dialogRef = this._fuseConfirmationService.open(this.configForm.value); + + // Subscribe to afterClosed from the dialog reference + dialogRef.afterClosed().subscribe((result) => { + if (result === 'confirmed') { + this._authService + .signOut() + .subscribe(() => this._router.navigate(['main'])); + } + }); + } private async getGameByParentId( parenId: number ): Promise { diff --git a/src/app/modules/beteran/compose/compose/sign-in-compose.component.html b/src/app/modules/beteran/compose/compose/sign-in-compose.component.html index fc7fedc..6f3e9b1 100644 --- a/src/app/modules/beteran/compose/compose/sign-in-compose.component.html +++ b/src/app/modules/beteran/compose/compose/sign-in-compose.component.html @@ -36,7 +36,15 @@ 비밀번호 - + + {{ + hide ? "visibility_off" : "visibility" + }} diff --git a/src/app/modules/beteran/compose/compose/sign-in-compose.component.ts b/src/app/modules/beteran/compose/compose/sign-in-compose.component.ts index e7cf560..a220e4f 100644 --- a/src/app/modules/beteran/compose/compose/sign-in-compose.component.ts +++ b/src/app/modules/beteran/compose/compose/sign-in-compose.component.ts @@ -24,6 +24,7 @@ export class SignInComposeComponent implements OnInit { message: '로그인이 성공하였습니다.', }; + hide: boolean = true; showAlert: boolean = false; /** diff --git a/src/app/modules/beteran/compose/compose/withdraw-compose.component.html b/src/app/modules/beteran/compose/compose/withdraw-compose.component.html index c105217..c585f5a 100644 --- a/src/app/modules/beteran/compose/compose/withdraw-compose.component.html +++ b/src/app/modules/beteran/compose/compose/withdraw-compose.component.html @@ -25,51 +25,81 @@
- - - 은행명 - - - 국민은행 - - - - - 은행명은 필수 입력입니다. - - - 예금주 - - - - 예금주는 필수 입력입니다. - - - 계좌번호 - - - - 계좌번호는 필수 입력입니다. - - - 보유금액 - - +
+
+ + + 은행명 + + + {{ bank.getName() }} + + + + + 은행명은 필수 입력입니다. + + +
+
+
+
+ + + 계좌번호 + + + 계좌번호는 필수 입력입니다. + + + + + 예금주 + + + 예금주는 필수 입력입니다. + + +
+
- - - 출금금액 - - - 출금금액은 필수 입력입니다. - - +
+
+ + + + 보유금액 + + + + 출금금액 + + + 출금금액은 필수 입력입니다. + + +
+
- - 출금비밀번호 - - - 출금비밀번호는 필수 입력입니다. - - +
+
+ + + + 출금비밀번호 + + {{ + hide ? "visibility_off" : "visibility" + }} + + 출금 비밀번호는 필수 입력입니다. + + +
+
diff --git a/src/app/modules/beteran/compose/compose/withdraw-compose.component.ts b/src/app/modules/beteran/compose/compose/withdraw-compose.component.ts index cf89a98..6578f76 100644 --- a/src/app/modules/beteran/compose/compose/withdraw-compose.component.ts +++ b/src/app/modules/beteran/compose/compose/withdraw-compose.component.ts @@ -2,8 +2,10 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { MatDialogRef } from '@angular/material/dialog'; import { FuseAlertType } from '@fuse/components/alert'; +import { BankService } from 'app/modules/polyglot/bank/services/bank.service'; import { MemberBankWithdrawService } from 'app/modules/polyglot/member_bank_withdraw/services/member_bank_withdraw.service'; import { CreateMemberBankWithdrawRequest } from 'app/modules/proto/c2se/member_bank_withdraw_pb'; +import { Bank } from 'app/modules/proto/models/bank_pb'; @Component({ selector: 'withdraw-compose', @@ -11,19 +13,22 @@ import { CreateMemberBankWithdrawRequest } from 'app/modules/proto/c2se/member_b encapsulation: ViewEncapsulation.None, }) export class WithdrawComposeComponent implements OnInit { - composeForm!: FormGroup; + withdrawComposeForm!: FormGroup; alert: { type: FuseAlertType; message: string } = { type: 'success', message: '출금신청이 완료 되었습니다.', }; showAlert: boolean = false; + banks!: Bank[]; + hide: boolean = true; /** * Constructor */ constructor( public matDialogRef: MatDialogRef, private _formBuilder: FormBuilder, - private _memberBankWithdrawService: MemberBankWithdrawService + private _memberBankWithdrawService: MemberBankWithdrawService, + private _bankService: BankService ) {} // ----------------------------------------------------------------------------------------------------- @@ -34,10 +39,21 @@ export class WithdrawComposeComponent implements OnInit { * On init */ ngOnInit(): void { + this._bankService + .listBanks() + .then((result) => { + this.banks = result.getBanksList(); + }) + .catch((reson) => console.log(reson)); + // Create the form - this.composeForm = this._formBuilder.group({ - accountHolder: ['', [Validators.required]], + this.withdrawComposeForm = this._formBuilder.group({ + bankId: ['', [Validators.required]], + accountNumber: ['123123123', [Validators.required]], + accountHolder: ['', [Validators.required]], + exchangePassword: ['1234', [Validators.required]], amount: ['', [Validators.required]], + holdingMoney: ['', [Validators.required]], }); } @@ -70,23 +86,24 @@ export class WithdrawComposeComponent implements OnInit { * Send the message */ send(): void { - if (!this.composeForm.valid) { + if (!this.withdrawComposeForm.valid) { return; } - this.composeForm?.disable(); + this.withdrawComposeForm?.disable(); const req = new CreateMemberBankWithdrawRequest(); - const amount = this.composeForm.get('amount')?.value as number; - const holder = this.composeForm.get('accountHolder')?.value as string; + const amount = this.withdrawComposeForm.get('amount')?.value as number; + const holder = this.withdrawComposeForm.get('accountHolder') + ?.value as string; req.setAmount(amount); req.setName(holder); req.setMemo('test'); this._memberBankWithdrawService - .createMemberBankWithdraw( - // req - 에러나서 지워둠. 이담 - ) + .createMemberBankWithdraw + // req - 에러나서 지워둠. 이담 + () .then(() => { console.log(); this.showAlert = true; @@ -95,7 +112,7 @@ export class WithdrawComposeComponent implements OnInit { this.showAlert = true; this.alert = { type: 'error', message: '출금신청이 실패 하였습니다.' }; // Re-enable the form - this.composeForm?.enable(); + this.withdrawComposeForm?.enable(); // Reset the form }) @@ -108,7 +125,7 @@ export class WithdrawComposeComponent implements OnInit { } __changeAmount(amount: string): void { - const amountInput = this.composeForm.get('amount'); + const amountInput = this.withdrawComposeForm.get('amount'); if (amount === '0') { amountInput?.setValue('');