출금신청 수정

This commit is contained in:
Park Byung Eun 2022-09-22 08:32:05 +00:00
parent d11fd57d4f
commit 78f5f37a3c
5 changed files with 184 additions and 65 deletions

View File

@ -5,8 +5,11 @@ import {
OnInit, OnInit,
ViewEncapsulation, ViewEncapsulation,
} from '@angular/core'; } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { Router } from '@angular/router'; 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 { CompComposeComponent } from 'app/modules/beteran/compose/compose/comp-compose.component';
import { CustomerComposeComponent } from 'app/modules/beteran/compose/compose/customer-compose.component'; import { CustomerComposeComponent } from 'app/modules/beteran/compose/compose/customer-compose.component';
@ -48,6 +51,8 @@ export class HomeComponent implements OnInit {
composeMenuType = ComposeMenuType; composeMenuType = ComposeMenuType;
configForm!: FormGroup;
liveCasinos!: Vendor[]; liveCasinos!: Vendor[];
hotelCasinos!: Vendor[]; hotelCasinos!: Vendor[];
slotGames!: Vendor[]; slotGames!: Vendor[];
@ -85,8 +90,11 @@ export class HomeComponent implements OnInit {
private _changeDetectorRef: ChangeDetectorRef, private _changeDetectorRef: ChangeDetectorRef,
private _router: Router, private _router: Router,
private _matDialog: MatDialog, private _matDialog: MatDialog,
private _formBuilder: FormBuilder,
private _fuseConfirmationService: FuseConfirmationService,
private _vendorService: VendorService, private _vendorService: VendorService,
private __gameService: GameService private __gameService: GameService,
private _authService: AuthService
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
@ -104,6 +112,28 @@ export class HomeComponent implements OnInit {
this._changeDetectorRef.markForCheck(); 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 * Track by function for ngFor loops
@ -132,6 +162,8 @@ export class HomeComponent implements OnInit {
switch (composeMenuType) { switch (composeMenuType) {
case ComposeMenuType.signOut: case ComposeMenuType.signOut:
// selectType = SignInComposeComponent; // selectType = SignInComposeComponent;
this.checkSignout();
return; return;
break; break;
case ComposeMenuType.signIn: case ComposeMenuType.signIn:
@ -172,6 +204,19 @@ export class HomeComponent implements OnInit {
console.log('Compose dialog was closed!'); 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( private async getGameByParentId(
parenId: number parenId: number
): Promise<ListGamesResponse.Result> { ): Promise<ListGamesResponse.Result> {

View File

@ -36,7 +36,15 @@
<!-- 비밀번호 --> <!-- 비밀번호 -->
<mat-form-field> <mat-form-field>
<mat-label>비밀번호</mat-label> <mat-label>비밀번호</mat-label>
<input matInput [formControlName]="'password'" /> <input
placeholder="Password"
[type]="hide ? 'password' : 'text'"
matInput
[formControlName]="'password'"
/>
<mat-icon matSuffix (click)="hide = !hide">{{
hide ? "visibility_off" : "visibility"
}}</mat-icon>
</mat-form-field> </mat-form-field>
<!-- Actions --> <!-- Actions -->

View File

@ -24,6 +24,7 @@ export class SignInComposeComponent implements OnInit {
message: '로그인이 성공하였습니다.', message: '로그인이 성공하였습니다.',
}; };
hide: boolean = true;
showAlert: boolean = false; showAlert: boolean = false;
/** /**

View File

@ -25,51 +25,81 @@
<!-- Compose form --> <!-- Compose form -->
<form <form
class="flex flex-col flex-auto p-6 sm:p-8 overflow-y-auto" class="flex flex-col flex-auto p-6 sm:p-8 overflow-y-auto"
[formGroup]="composeForm" [formGroup]="withdrawComposeForm"
> >
<!-- To --> <div class="flex flex-col w-full">
<mat-form-field> <div class="flex items-center w-full mt-6">
<mat-label>은행명</mat-label> <!-- 은행명 -->
<mat-select <mat-form-field class="w-full">
[formControlName]="'bankName'" <mat-label>은행명</mat-label>
placeholder="은행 선택" <mat-select [formControlName]="'bankId'" placeholder="은행 선택">
> <mat-option *ngFor="let bank of banks" [value]="bank.getId()">
<mat-option {{ bank.getName() }}
> </mat-option>
국민은행 <!-- <mat-option [value]="'0'"> 국민은행 </mat-option> -->
</mat-option> </mat-select>
</mat-select> <mat-error
</mat-form-field> *ngIf="withdrawComposeForm?.get('bankId')?.hasError('required')"
<mat-error *ngIf="composeForm.get('bankName')?.hasError('required')"> >
은행명은 필수 입력입니다. 은행명은 필수 입력입니다.
</mat-error> </mat-error>
<mat-form-field> </mat-form-field>
<mat-label>예금주</mat-label> </div>
<input matInput [formControlName]="'accountHolder'" /> </div>
</mat-form-field> <div class="flex flex-col w-full">
<mat-error *ngIf="composeForm.get('accountHolder')?.hasError('required')"> <div class="flex items-center w-full mt-6">
예금주는 필수 입력입니다. <!-- 계좌번호 -->
</mat-error> <mat-form-field class="w-1/2 pl-2">
<mat-form-field> <mat-label>계좌번호</mat-label>
<mat-label>계좌번호</mat-label> <input matInput [formControlName]="'accountNumber'" />
<input matInput [formControlName]="'account'" /> <mat-error
</mat-form-field> *ngIf="
<mat-error *ngIf="composeForm.get('account')?.hasError('required')"> withdrawComposeForm?.get('accountNumber')?.hasError('required')
계좌번호는 필수 입력입니다. "
</mat-error> >
<mat-form-field> 계좌번호는 필수 입력입니다.
<mat-label>보유금액</mat-label> </mat-error>
<input matInput [formControlName]="'holdingMoney'" /> </mat-form-field>
</mat-form-field> <!-- 예금주 -->
<mat-form-field class="w-1/2 pl-2">
<mat-label>예금주</mat-label>
<input matInput [formControlName]="'accountHolder'" />
<mat-error
*ngIf="
withdrawComposeForm?.get('accountHolder')?.hasError('required')
"
>
예금주는 필수 입력입니다.
</mat-error>
</mat-form-field>
</div>
</div>
<!-- Subject --> <div class="flex flex-col w-full">
<mat-form-field> <div class="flex items-center w-full mt-6">
<mat-label>출금금액</mat-label> <!-- 보유그앰 -->
<input #inputAmount matInput [formControlName]="'amount'" value="" placeholder="최소출금 50,000원 부터" />
<mat-error *ngIf="composeForm.get('amount')?.hasError('required')"> <mat-form-field class="w-1/2 pr-2">
출금금액은 필수 입력입니다. <mat-label>보유금액</mat-label>
</mat-error> <input matInput [formControlName]="'holdingMoney'" />
</mat-form-field> </mat-form-field>
<mat-form-field class="w-1/2 pr-2">
<mat-label>출금금액</mat-label>
<input
#inputAmount
matInput
[formControlName]="'amount'"
value=""
placeholder="최소출금 50,000원 부터"
/>
<mat-error
*ngIf="withdrawComposeForm.get('amount')?.hasError('required')"
>
출금금액은 필수 입력입니다.
</mat-error>
</mat-form-field>
</div>
</div>
<!-- Actions --> <!-- Actions -->
<div <div
@ -120,13 +150,31 @@
</div> </div>
</div> </div>
<mat-form-field> <div class="flex flex-col w-full">
<mat-label>출금비밀번호</mat-label> <div class="flex items-center w-full mt-6">
<input #inputAmount matInput /> <!-- 출금비밀번호 -->
<mat-error *ngIf="composeForm.get('amount')?.hasError('required')"> <!-- 비밀번호 -->
출금비밀번호는 필수 입력입니다. <mat-form-field class="w-60">
</mat-error> <mat-label>출금비밀번호</mat-label>
</mat-form-field> <input
placeholder="Password"
[type]="hide ? 'password' : 'text'"
matInput
[formControlName]="'exchangePassword'"
/>
<mat-icon matSuffix (click)="hide = !hide">{{
hide ? "visibility_off" : "visibility"
}}</mat-icon>
<mat-error
*ngIf="
withdrawComposeForm?.get('exchangePassword')?.hasError('required')
"
>
출금 비밀번호는 필수 입력입니다.
</mat-error>
</mat-form-field>
</div>
</div>
<div class="flex flex-col sm:flex-row sm:items-center mt-4 sm:mt-6"> <div class="flex flex-col sm:flex-row sm:items-center mt-4 sm:mt-6">
<div class="flex mt-4 sm:mt-0"> <div class="flex mt-4 sm:mt-0">
<!-- Save as draft --> <!-- Save as draft -->

View File

@ -2,8 +2,10 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef } from '@angular/material/dialog'; import { MatDialogRef } from '@angular/material/dialog';
import { FuseAlertType } from '@fuse/components/alert'; 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 { 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 { CreateMemberBankWithdrawRequest } from 'app/modules/proto/c2se/member_bank_withdraw_pb';
import { Bank } from 'app/modules/proto/models/bank_pb';
@Component({ @Component({
selector: 'withdraw-compose', selector: 'withdraw-compose',
@ -11,19 +13,22 @@ import { CreateMemberBankWithdrawRequest } from 'app/modules/proto/c2se/member_b
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
}) })
export class WithdrawComposeComponent implements OnInit { export class WithdrawComposeComponent implements OnInit {
composeForm!: FormGroup; withdrawComposeForm!: FormGroup;
alert: { type: FuseAlertType; message: string } = { alert: { type: FuseAlertType; message: string } = {
type: 'success', type: 'success',
message: '출금신청이 완료 되었습니다.', message: '출금신청이 완료 되었습니다.',
}; };
showAlert: boolean = false; showAlert: boolean = false;
banks!: Bank[];
hide: boolean = true;
/** /**
* Constructor * Constructor
*/ */
constructor( constructor(
public matDialogRef: MatDialogRef<WithdrawComposeComponent>, public matDialogRef: MatDialogRef<WithdrawComposeComponent>,
private _formBuilder: FormBuilder, private _formBuilder: FormBuilder,
private _memberBankWithdrawService: MemberBankWithdrawService private _memberBankWithdrawService: MemberBankWithdrawService,
private _bankService: BankService
) {} ) {}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -34,10 +39,21 @@ export class WithdrawComposeComponent implements OnInit {
* On init * On init
*/ */
ngOnInit(): void { ngOnInit(): void {
this._bankService
.listBanks()
.then((result) => {
this.banks = result.getBanksList();
})
.catch((reson) => console.log(reson));
// Create the form // Create the form
this.composeForm = this._formBuilder.group({ this.withdrawComposeForm = this._formBuilder.group({
accountHolder: ['', [Validators.required]], bankId: ['', [Validators.required]],
accountNumber: ['123123123', [Validators.required]],
accountHolder: ['', [Validators.required]],
exchangePassword: ['1234', [Validators.required]],
amount: ['', [Validators.required]], amount: ['', [Validators.required]],
holdingMoney: ['', [Validators.required]],
}); });
} }
@ -70,23 +86,24 @@ export class WithdrawComposeComponent implements OnInit {
* Send the message * Send the message
*/ */
send(): void { send(): void {
if (!this.composeForm.valid) { if (!this.withdrawComposeForm.valid) {
return; return;
} }
this.composeForm?.disable(); this.withdrawComposeForm?.disable();
const req = new CreateMemberBankWithdrawRequest(); const req = new CreateMemberBankWithdrawRequest();
const amount = this.composeForm.get('amount')?.value as number; const amount = this.withdrawComposeForm.get('amount')?.value as number;
const holder = this.composeForm.get('accountHolder')?.value as string; const holder = this.withdrawComposeForm.get('accountHolder')
?.value as string;
req.setAmount(amount); req.setAmount(amount);
req.setName(holder); req.setName(holder);
req.setMemo('test'); req.setMemo('test');
this._memberBankWithdrawService this._memberBankWithdrawService
.createMemberBankWithdraw( .createMemberBankWithdraw
// req - 에러나서 지워둠. 이담 // req - 에러나서 지워둠. 이담
) ()
.then(() => { .then(() => {
console.log(); console.log();
this.showAlert = true; this.showAlert = true;
@ -95,7 +112,7 @@ export class WithdrawComposeComponent implements OnInit {
this.showAlert = true; this.showAlert = true;
this.alert = { type: 'error', message: '출금신청이 실패 하였습니다.' }; this.alert = { type: 'error', message: '출금신청이 실패 하였습니다.' };
// Re-enable the form // Re-enable the form
this.composeForm?.enable(); this.withdrawComposeForm?.enable();
// Reset the form // Reset the form
}) })
@ -108,7 +125,7 @@ export class WithdrawComposeComponent implements OnInit {
} }
__changeAmount(amount: string): void { __changeAmount(amount: string): void {
const amountInput = this.composeForm.get('amount'); const amountInput = this.withdrawComposeForm.get('amount');
if (amount === '0') { if (amount === '0') {
amountInput?.setValue(''); amountInput?.setValue('');