This commit is contained in:
Park Byung Eun 2022-08-28 08:47:53 +00:00
parent 62278134f6
commit 6d4ab2bb43
2 changed files with 73 additions and 7 deletions

View File

@ -36,12 +36,22 @@
<div class="flex items-center mt-2 mb-2 ml-6"> <div class="flex items-center mt-2 mb-2 ml-6">
<div> <div>
<button mat-flat-button class="bet-mat-small-8" [color]="'primary'"> <button
mat-flat-button
class="bet-mat-small-8"
[color]="'primary'"
(click)="onClickDeposit(0)"
>
입금처리 입금처리
</button> </button>
</div> </div>
<div> <div>
<button mat-flat-button class="bet-mat-small-8" [color]="'primary'"> <button
mat-flat-button
class="bet-mat-small-8"
[color]="'primary'"
(click)="onClickDeposit(1)"
>
대기처리 대기처리
</button> </button>
</div> </div>
@ -141,7 +151,9 @@
class="deposit-grid z-10 sticky top-0 grid gap-4 py-4 px-6 md:px-8 shadow text-md font-semibold text-secondary bg-gray-50 dark:bg-black dark:bg-opacity-5" class="deposit-grid z-10 sticky top-0 grid gap-4 py-4 px-6 md:px-8 shadow text-md font-semibold text-secondary bg-gray-50 dark:bg-black dark:bg-opacity-5"
> >
<div> <div>
<mat-checkbox></mat-checkbox> <mat-checkbox
(change)="__onChangeChkDepositsAll($event)"
></mat-checkbox>
</div> </div>
<div>구분</div> <div>구분</div>
<div> <div>
@ -198,7 +210,11 @@
class="deposit-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b" class="deposit-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b"
> >
<div> <div>
<mat-checkbox></mat-checkbox> <mat-checkbox
#chkDeposits
[value]="deposit.getId()"
(change)="__onChangeChkDeposits($event)"
></mat-checkbox>
</div> </div>
<!-- 구분 --> <!-- 구분 -->
<div> <div>

View File

@ -5,7 +5,9 @@ import {
Component, Component,
OnDestroy, OnDestroy,
OnInit, OnInit,
QueryList,
ViewChild, ViewChild,
ViewChildren,
ViewEncapsulation, ViewEncapsulation,
} from '@angular/core'; } from '@angular/core';
import { import {
@ -14,7 +16,7 @@ import {
FormGroup, FormGroup,
Validators, Validators,
} from '@angular/forms'; } from '@angular/forms';
import { MatCheckboxChange } from '@angular/material/checkbox'; import { MatCheckbox, MatCheckboxChange } from '@angular/material/checkbox';
import { MatPaginator } from '@angular/material/paginator'; import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort'; import { MatSort } from '@angular/material/sort';
import { import {
@ -34,7 +36,10 @@ import { Deposit } from '../models/deposit';
import { DepositPagination } from '../models/deposit-pagination'; import { DepositPagination } from '../models/deposit-pagination';
import { DepositService } from '../services/deposit.service'; import { DepositService } from '../services/deposit.service';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { ListMemberBankDepositsResponse } from 'app/modules/proto/c2se/member_bank_deposit_pb'; import {
ListMemberBankDepositsResponse,
UpdateMemberBankDepositForStateRequest,
} from 'app/modules/proto/c2se/member_bank_deposit_pb';
import { import {
MemberBankDeposit, MemberBankDeposit,
MemberBankDepositState, MemberBankDepositState,
@ -43,6 +48,7 @@ import { MemberModel } from 'app/modules/proto/models/member_pb';
import { ListMembersResponse } from 'app/modules/proto/c2se/member_pb'; import { ListMembersResponse } from 'app/modules/proto/c2se/member_pb';
import { ListMemberClassesResponse } from 'app/modules/proto/c2se/member_class_pb'; import { ListMemberClassesResponse } from 'app/modules/proto/c2se/member_class_pb';
import { MemberClass } from 'app/modules/proto/models/member_class_pb'; import { MemberClass } from 'app/modules/proto/models/member_class_pb';
import { MemberBankDepositService } from 'app/modules/polyglot/member_bank_deposit/services/member_bank_deposit.service';
@Component({ @Component({
selector: 'deposit-list', selector: 'deposit-list',
@ -79,9 +85,12 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild(MatPaginator) private _paginator!: MatPaginator; @ViewChild(MatPaginator) private _paginator!: MatPaginator;
@ViewChild(MatSort) private _sort!: MatSort; @ViewChild(MatSort) private _sort!: MatSort;
@ViewChildren('chkDeposits') chkDeposits!: QueryList<MatCheckbox>;
listMember!: MemberModel[]; listMember!: MemberModel[];
memberClasses!: MemberClass[]; memberClasses!: MemberClass[];
bankDeposit$!: Observable<MemberBankDeposit[] | undefined>; bankDeposit$!: Observable<MemberBankDeposit[] | undefined>;
__checkedDeposits: string[] = [];
__isSearchOpened = false; __isSearchOpened = false;
isLoading = false; isLoading = false;
@ -100,7 +109,8 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
private _fuseConfirmationService: FuseConfirmationService, private _fuseConfirmationService: FuseConfirmationService,
private _formBuilder: FormBuilder, private _formBuilder: FormBuilder,
private _depositService: DepositService, private _depositService: DepositService,
private router: Router private router: Router,
private _bankDepositService: MemberBankDepositService
) {} ) {}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
@ -239,6 +249,46 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
return item.id || index; return item.id || index;
} }
onClickDeposit(type: number): void {
if (this.__checkedDeposits.length === 0) {
return;
}
let req: UpdateMemberBankDepositForStateRequest;
this.__checkedDeposits.map((v) => {
req = new UpdateMemberBankDepositForStateRequest();
req.setId(v);
req.setState(2);
this._bankDepositService
.updateMemberBankDepositForState()
.then((result) => {
console.log(result);
})
.catch((reson) => console.log(reson));
});
}
__onChangeChkDepositsAll(event: MatCheckboxChange): void {
let checked = event.checked;
this.chkDeposits.forEach((c, i) => {
c.checked = checked;
});
this.__updateCheckedDeposits();
}
__onChangeChkDeposits(event: MatCheckboxChange): void {
this.__updateCheckedDeposits();
}
__updateCheckedDeposits(): void {
this.__checkedDeposits = [];
this.chkDeposits.forEach((c, i) => {
if (c.checked) {
this.__checkedDeposits.push(c.value);
}
});
}
__getMemberRefferByMemberId(memberId: string): string | undefined { __getMemberRefferByMemberId(memberId: string): string | undefined {
const member = this.__getMemberById(memberId); const member = this.__getMemberById(memberId);