출금신청 수정
This commit is contained in:
parent
d11fd57d4f
commit
78f5f37a3c
|
@ -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<ListGamesResponse.Result> {
|
||||
|
|
|
@ -36,7 +36,15 @@
|
|||
<!-- 비밀번호 -->
|
||||
<mat-form-field>
|
||||
<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>
|
||||
|
||||
<!-- Actions -->
|
||||
|
|
|
@ -24,6 +24,7 @@ export class SignInComposeComponent implements OnInit {
|
|||
message: '로그인이 성공하였습니다.',
|
||||
};
|
||||
|
||||
hide: boolean = true;
|
||||
showAlert: boolean = false;
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,51 +25,81 @@
|
|||
<!-- Compose form -->
|
||||
<form
|
||||
class="flex flex-col flex-auto p-6 sm:p-8 overflow-y-auto"
|
||||
[formGroup]="composeForm"
|
||||
[formGroup]="withdrawComposeForm"
|
||||
>
|
||||
<!-- To -->
|
||||
<mat-form-field>
|
||||
<mat-label>은행명</mat-label>
|
||||
<mat-select
|
||||
[formControlName]="'bankName'"
|
||||
placeholder="은행 선택"
|
||||
>
|
||||
<mat-option
|
||||
>
|
||||
국민은행
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-error *ngIf="composeForm.get('bankName')?.hasError('required')">
|
||||
은행명은 필수 입력입니다.
|
||||
</mat-error>
|
||||
<mat-form-field>
|
||||
<mat-label>예금주</mat-label>
|
||||
<input matInput [formControlName]="'accountHolder'" />
|
||||
</mat-form-field>
|
||||
<mat-error *ngIf="composeForm.get('accountHolder')?.hasError('required')">
|
||||
예금주는 필수 입력입니다.
|
||||
</mat-error>
|
||||
<mat-form-field>
|
||||
<mat-label>계좌번호</mat-label>
|
||||
<input matInput [formControlName]="'account'" />
|
||||
</mat-form-field>
|
||||
<mat-error *ngIf="composeForm.get('account')?.hasError('required')">
|
||||
계좌번호는 필수 입력입니다.
|
||||
</mat-error>
|
||||
<mat-form-field>
|
||||
<mat-label>보유금액</mat-label>
|
||||
<input matInput [formControlName]="'holdingMoney'" />
|
||||
</mat-form-field>
|
||||
<div class="flex flex-col w-full">
|
||||
<div class="flex items-center w-full mt-6">
|
||||
<!-- 은행명 -->
|
||||
<mat-form-field class="w-full">
|
||||
<mat-label>은행명</mat-label>
|
||||
<mat-select [formControlName]="'bankId'" placeholder="은행 선택">
|
||||
<mat-option *ngFor="let bank of banks" [value]="bank.getId()">
|
||||
{{ bank.getName() }}
|
||||
</mat-option>
|
||||
<!-- <mat-option [value]="'0'"> 국민은행 </mat-option> -->
|
||||
</mat-select>
|
||||
<mat-error
|
||||
*ngIf="withdrawComposeForm?.get('bankId')?.hasError('required')"
|
||||
>
|
||||
은행명은 필수 입력입니다.
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col w-full">
|
||||
<div class="flex items-center w-full mt-6">
|
||||
<!-- 계좌번호 -->
|
||||
<mat-form-field class="w-1/2 pl-2">
|
||||
<mat-label>계좌번호</mat-label>
|
||||
<input matInput [formControlName]="'accountNumber'" />
|
||||
<mat-error
|
||||
*ngIf="
|
||||
withdrawComposeForm?.get('accountNumber')?.hasError('required')
|
||||
"
|
||||
>
|
||||
계좌번호는 필수 입력입니다.
|
||||
</mat-error>
|
||||
</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 -->
|
||||
<mat-form-field>
|
||||
<mat-label>출금금액</mat-label>
|
||||
<input #inputAmount matInput [formControlName]="'amount'" value="" placeholder="최소출금 50,000원 부터" />
|
||||
<mat-error *ngIf="composeForm.get('amount')?.hasError('required')">
|
||||
출금금액은 필수 입력입니다.
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<div class="flex flex-col w-full">
|
||||
<div class="flex items-center w-full mt-6">
|
||||
<!-- 보유그앰 -->
|
||||
|
||||
<mat-form-field class="w-1/2 pr-2">
|
||||
<mat-label>보유금액</mat-label>
|
||||
<input matInput [formControlName]="'holdingMoney'" />
|
||||
</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 -->
|
||||
<div
|
||||
|
@ -120,13 +150,31 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>출금비밀번호</mat-label>
|
||||
<input #inputAmount matInput />
|
||||
<mat-error *ngIf="composeForm.get('amount')?.hasError('required')">
|
||||
출금비밀번호는 필수 입력입니다.
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<div class="flex flex-col w-full">
|
||||
<div class="flex items-center w-full mt-6">
|
||||
<!-- 출금비밀번호 -->
|
||||
<!-- 비밀번호 -->
|
||||
<mat-form-field class="w-60">
|
||||
<mat-label>출금비밀번호</mat-label>
|
||||
<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 mt-4 sm:mt-0">
|
||||
<!-- Save as draft -->
|
||||
|
|
|
@ -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<WithdrawComposeComponent>,
|
||||
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('');
|
||||
|
|
Loading…
Reference in New Issue
Block a user