From 2da99fbd15f2b5f11859f4fc589738b2616bbc29 Mon Sep 17 00:00:00 2001 From: Park Byung Eun Date: Fri, 26 Aug 2022 09:44:37 +0000 Subject: [PATCH] =?UTF-8?q?=EC=9E=85=EA=B8=88=EC=8B=A0=EC=B2=AD=20?= =?UTF-8?q?=EC=A7=84=ED=96=89=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/beteran/compose/compose.module.ts | 3 + .../compose/deposit-compose.component.html | 148 +++++++++--------- .../compose/deposit-compose.component.ts | 99 ++++++++---- .../services/member_bank_deposit.service.ts | 6 +- 4 files changed, 146 insertions(+), 110 deletions(-) diff --git a/src/app/modules/beteran/compose/compose.module.ts b/src/app/modules/beteran/compose/compose.module.ts index 3dc2872..701bf13 100644 --- a/src/app/modules/beteran/compose/compose.module.ts +++ b/src/app/modules/beteran/compose/compose.module.ts @@ -7,6 +7,7 @@ import { MatTabsModule } from '@angular/material/tabs'; import { MatInputModule } from '@angular/material/input'; import { MatDialogModule } from '@angular/material/dialog'; import { MatSelectModule } from '@angular/material/select'; +import { MatButtonToggleModule } from '@angular/material/button-toggle'; import { FuseCardModule } from '@fuse/components/card'; import { SharedModule } from 'app/shared/shared.module'; @@ -26,6 +27,8 @@ import { COMPOSE } from './compose'; MatInputModule, MatDialogModule, MatSelectModule, + MatButtonToggleModule, + FuseCardModule, SharedModule, diff --git a/src/app/modules/beteran/compose/compose/deposit-compose.component.html b/src/app/modules/beteran/compose/compose/deposit-compose.component.html index 114eb35..f166d15 100644 --- a/src/app/modules/beteran/compose/compose/deposit-compose.component.html +++ b/src/app/modules/beteran/compose/compose/deposit-compose.component.html @@ -3,7 +3,7 @@
-
deposit
+
입금신청
+ + {{ alert.message }} +
- To - -
- - Cc - - - Bcc - -
-
- - - - Cc - - - - - - Bcc - + 입금자명 + + + 입금자명은 필수 입력입니다. + - Subject - + 입금금액 + + + 입금금액은 필수 입력입니다. + - - -
-
- - - - - - - - + +
- -
- - +
+
+
-
diff --git a/src/app/modules/beteran/compose/compose/deposit-compose.component.ts b/src/app/modules/beteran/compose/compose/deposit-compose.component.ts index d56e036..89fd62b 100644 --- a/src/app/modules/beteran/compose/compose/deposit-compose.component.ts +++ b/src/app/modules/beteran/compose/compose/deposit-compose.component.ts @@ -1,32 +1,32 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { MatDialogRef } from '@angular/material/dialog'; +import { fuseAnimations } from '@fuse/animations'; +import { FuseAlertType } from '@fuse/components/alert'; +import { MemberBankDepositService } from 'app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service'; +import { CreateMemberBankDepositRequest } from 'app/modules/proto/c2se/member_bank_deposit_pb'; @Component({ selector: 'deposit-compose', templateUrl: './deposit-compose.component.html', encapsulation: ViewEncapsulation.None, + animations: fuseAnimations, }) export class DepositComposeComponent implements OnInit { composeForm!: FormGroup; - copyFields: { cc: boolean; bcc: boolean } = { - cc: false, - bcc: false, - }; - quillModules: any = { - toolbar: [ - ['bold', 'italic', 'underline'], - [{ align: [] }, { list: 'ordered' }, { list: 'bullet' }], - ['clean'], - ], - }; + alert: { type: FuseAlertType; message: string } = { + type: 'success', + message: '입금신청이 완료 되었습니다.', + }; + showAlert: boolean = false; /** * Constructor */ constructor( public matDialogRef: MatDialogRef, - private _formBuilder: FormBuilder + private _formBuilder: FormBuilder, + private _memberBankDepositService: MemberBankDepositService ) {} // ----------------------------------------------------------------------------------------------------- @@ -39,11 +39,8 @@ export class DepositComposeComponent 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 +48,6 @@ export class DepositComposeComponent 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 +72,56 @@ export class DepositComposeComponent implements OnInit { /** * Send the message */ - send(): void {} + send(): void { + if (!this.composeForm.valid) { + return; + } + + this.composeForm?.disable(); + + const req = new CreateMemberBankDepositRequest(); + 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._memberBankDepositService + .createMemberBankDeposit(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 + }); + // req.set + } + + __changeAmount(amount: string): void { + const amountInput = this.composeForm.get('amount'); + + if (amount === '0') { + amountInput?.setValue(''); + return; + } + amountInput?.setValue(amount); + } + + __contactDeposit(): void { + this.showAlert = true; + this.alert = { + type: 'success', + message: '입금 계좌문의가 전달되었습니다!', + }; + + setTimeout(() => { + this.showAlert = false; + }, 5000); + } } diff --git a/src/app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service.ts b/src/app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service.ts index 429c7ef..9b8df87 100644 --- a/src/app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service.ts +++ b/src/app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service.ts @@ -43,11 +43,11 @@ export class MemberBankDepositService { // @ Public methods // ----------------------------------------------------------------------------------------------------- - createMemberBankDeposit(): Promise { + createMemberBankDeposit( + req: CreateMemberBankDepositRequest + ): Promise { return new Promise( (resolve, reject) => { - let req = new CreateMemberBankDepositRequest(); - this.__natsService .request( SUBJECT_CREATE_MEMBER_BANK_DEPOSIT,