-
-
+
+ 출금비밀번호
+
+
+ 출금비밀번호는 필수 입력입니다.
+
+
+
+
-
+
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 51a1295..cf89a98 100644
--- a/src/app/modules/beteran/compose/compose/withdraw-compose.component.ts
+++ b/src/app/modules/beteran/compose/compose/withdraw-compose.component.ts
@@ -1,6 +1,9 @@
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 { MemberBankWithdrawService } from 'app/modules/polyglot/member_bank_withdraw/services/member_bank_withdraw.service';
+import { CreateMemberBankWithdrawRequest } from 'app/modules/proto/c2se/member_bank_withdraw_pb';
@Component({
selector: 'withdraw-compose',
@@ -9,24 +12,18 @@ import { MatDialogRef } from '@angular/material/dialog';
})
export class WithdrawComposeComponent implements OnInit {
composeForm!: FormGroup;
- copyFields: { cc: boolean; bcc: boolean } = {
- cc: false,
- bcc: false,
+ alert: { type: FuseAlertType; message: string } = {
+ type: 'success',
+ message: '출금신청이 완료 되었습니다.',
};
- quillModules: any = {
- toolbar: [
- ['bold', 'italic', 'underline'],
- [{ align: [] }, { list: 'ordered' }, { list: 'bullet' }],
- ['clean'],
- ],
- };
-
+ showAlert: boolean = false;
/**
* Constructor
*/
constructor(
public matDialogRef: MatDialogRef
,
- private _formBuilder: FormBuilder
+ private _formBuilder: FormBuilder,
+ private _memberBankWithdrawService: MemberBankWithdrawService
) {}
// -----------------------------------------------------------------------------------------------------
@@ -39,11 +36,8 @@ export class WithdrawComposeComponent implements OnInit {
ngOnInit(): void {
// Create the form
this.composeForm = this._formBuilder.group({
- to: ['', [Validators.required, Validators.email]],
- cc: ['', [Validators.email]],
- bcc: ['', [Validators.email]],
- subject: [''],
- body: ['', [Validators.required]],
+ accountHolder: ['', [Validators.required]],
+ amount: ['', [Validators.required]],
});
}
@@ -51,21 +45,6 @@ export class WithdrawComposeComponent implements OnInit {
// @ Public methods
// -----------------------------------------------------------------------------------------------------
- /**
- * Show the copy field with the given field name
- *
- * @param name
- */
- showCopyField(name: string): void {
- // Return if the name is not one of the available names
- if (name !== 'cc' && name !== 'bcc') {
- return;
- }
-
- // Show the field
- this.copyFields[name] = true;
- }
-
/**
* Save and close
*/
@@ -90,5 +69,51 @@ export class WithdrawComposeComponent implements OnInit {
/**
* Send the message
*/
- send(): void {}
+ send(): void {
+ if (!this.composeForm.valid) {
+ return;
+ }
+
+ this.composeForm?.disable();
+
+ const req = new CreateMemberBankWithdrawRequest();
+ const amount = this.composeForm.get('amount')?.value as number;
+ const holder = this.composeForm.get('accountHolder')?.value as string;
+ req.setAmount(amount);
+ req.setName(holder);
+ req.setMemo('test');
+
+ this._memberBankWithdrawService
+ .createMemberBankWithdraw(
+ // req - 에러나서 지워둠. 이담
+ )
+ .then(() => {
+ console.log();
+ this.showAlert = true;
+ })
+ .catch((e) => {
+ this.showAlert = true;
+ this.alert = { type: 'error', message: '출금신청이 실패 하였습니다.' };
+ // Re-enable the form
+ this.composeForm?.enable();
+
+ // Reset the form
+ })
+ .finally(() =>
+ setTimeout(() => {
+ this.matDialogRef.close();
+ }, 2000)
+ );
+ // req.set
+ }
+
+ __changeAmount(amount: string): void {
+ const amountInput = this.composeForm.get('amount');
+
+ if (amount === '0') {
+ amountInput?.setValue('');
+ return;
+ }
+ amountInput?.setValue(amount);
+ }
}