회원 상태, 레벨 수정

This commit is contained in:
Park Byung Eun 2022-09-14 08:42:06 +00:00
parent 1f875b708e
commit dd50a301c3
4 changed files with 196 additions and 20 deletions

View File

@ -12,6 +12,18 @@
<!-- Title -->
<div class="text-4xl font-extrabold tracking-tight">
<span>{{ title }}</span>
<span
><fuse-alert
class="ml-8 pl-8"
*ngIf="changeResultShowAlert"
[appearance]="'outline'"
[showIcon]="false"
[type]="alertConfig.type"
[@shake]="alertConfig.type === 'error'"
>
{{ alertConfig.message }}
</fuse-alert></span
>
<div *ngIf="!!__isAllPage">
<button
mat-flat-button
@ -23,6 +35,7 @@
</button>
</div>
</div>
<div class="flex shrink-0 items-center mt-6 sm:mt-0 sm:ml-4">
<!-- Search -->
<div>
@ -43,12 +56,12 @@
상태 변경
</button>
<mat-menu #menuChangeMemberState="matMenu">
<button mat-menu-item>정상</button>
<button mat-menu-item>대기</button>
<button mat-menu-item>탈퇴</button>
<button mat-menu-item>휴면</button>
<button mat-menu-item>블랙</button>
<button mat-menu-item>정지</button>
<button mat-menu-item (click)="__onChangeState(1)">정상</button>
<button mat-menu-item (click)="__onChangeState(2)">대기</button>
<button mat-menu-item (click)="__onChangeState(3)">탈퇴</button>
<button mat-menu-item (click)="__onChangeState(4)">휴면</button>
<button mat-menu-item (click)="__onChangeState(5)">블랙</button>
<button mat-menu-item (click)="__onChangeState(6)">정지</button>
</mat-menu>
<button mat-button [matMenuTriggerFor]="menuChangeMemberLevel">
레벨 변경
@ -176,7 +189,7 @@
</mat-menu>
</div>
<hr style="margin: 7px 0px" />
<div [matTooltip]="__getRateTooltop()">요율</div>
<div [matTooltip]="__getRateTooltop(partner)">요율</div>
<hr style="margin: 7px 0px" />
<div>
<div>2 3 2 1 5</div>
@ -202,14 +215,16 @@
LV
{{ partner.getMemberLevel()?.getName()?.substring(5, 6) }}
<hr style="margin: 7px 0px" />
{{ __getStateString(partner) }}
{{ __getMemberState(partner) }}
</div>
<!-- 예금주 -->
<div class="hidden lg:block">
{{ partner.getBankAccount()?.getName() }}
</div>
<!-- 정산종류 -->
<div class="hidden lg:block">정산종류</div>
<div class="hidden lg:block">
{{ __getMemberSettlementType(partner) }}
</div>
<!-- 보유금 -->
<div class="hidden lg:block">
캐쉬: 2,900

View File

@ -53,13 +53,19 @@ import { MemberModel, MemberState } from 'app/modules/proto/models/member_pb';
import {
ListMembersRequest,
ListMembersResponse,
UpdateMemberForStateRequest,
UpdateMemberRequest,
} from 'app/modules/proto/c2se/member_pb';
import { MatCheckbox, MatCheckboxChange } from '@angular/material/checkbox';
import { ListMemberLevelsResponse } from 'app/modules/proto/c2se/member_level_pb';
import {
ListMemberLevelsResponse,
UpdateMemberLevelRequest,
} from 'app/modules/proto/c2se/member_level_pb';
import { MemberLevel } from 'app/modules/proto/models/member_level_pb';
import { Pagination } from 'app/modules/proto/protobuf/pagination_pb';
import { VendorService } from 'app/modules/polyglot/api/services/vendor.service';
import { environment } from 'environments/environment';
import { FuseAlertType } from '@fuse/components/alert';
@Component({
selector: 'partner-list',
@ -101,6 +107,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChildren('chkUsers') chkUsers!: QueryList<MatCheckbox>;
listMember!: MemberModel[];
listPartner$!: Observable<MemberModel[] | undefined>;
listMemberLevels$!: Observable<MemberLevel[] | undefined>;
@ -114,11 +121,21 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
__members: MemberModel[] = [];
__checkedUsers: string[] = [];
alertTitle = '알림';
title: string = '';
btnTitle: string = '';
memberClassId = '';
signoutBlockConfigForm!: FormGroup;
fuseAlertConfirmConfigForm!: FormGroup;
changeResultShowAlert: boolean = false;
alertConfig: { type: FuseAlertType; message: string } = {
type: 'success',
message: '회원 정보가 수정 되었습니다.',
};
private _unsubscribeAll: Subject<any> = new Subject<any>();
@ -173,6 +190,28 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
console.log(this.router.url);
break;
}
this.fuseAlertConfirmConfigForm = 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,
});
}
// -----------------------------------------------------------------------------------------------------
@ -199,9 +238,11 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
this._activatedRoute.data.subscribe((data) => {
let listMemberResult: ListMembersResponse.Result = data['listPartner'];
this.listPartner$ = of(listMemberResult.getMembersList());
this.listMember = listMemberResult.getMembersList();
let listMemberLevelsResult: ListMemberLevelsResponse.Result =
data['listMemberLevels'];
this.listMemberLevels$ = of(listMemberLevelsResult.getMemberLevelsList());
// Mark for check
@ -380,19 +421,98 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
});
}
__getRateTooltop(): string {
private showAlert(type: FuseAlertType, message: string): void {
// Set the alert
this.changeResultShowAlert = true;
this.alertConfig = {
type,
message,
};
this._changeDetectorRef.markForCheck();
}
private async showConfirmAlert(
title: string,
message: string
): Promise<boolean> {
this.fuseAlertConfirmConfigForm.get('title')?.setValue(title);
this.fuseAlertConfirmConfigForm.get('message')?.setValue(message);
return new Promise<boolean>((resolve, reject) => {
const dialogRef = this._fuseConfirmationService.open(
this.fuseAlertConfirmConfigForm.value
);
dialogRef.afterClosed().subscribe((result) => {
if (result === 'confirmed') {
resolve(true);
} else {
resolve(false);
}
});
});
}
private closeChangeAlert(): void {
setTimeout(() => {
this.changeResultShowAlert = false;
this._changeDetectorRef.markForCheck();
}, 5000);
}
__onChangeState(type: number): void {
let count = 0;
const totalCount = this.chkUsers.length;
this.showConfirmAlert(
this.alertTitle,
'선택된 회원 상태를 모두 수정하시겠습니까?'
).then((result) => {
if (!!result) {
this.__checkedUsers.forEach((memberId: string) => {
const req = new UpdateMemberForStateRequest();
const findMember = this.listMember.find(
(m) => m.getId() === memberId
);
req.setId(findMember!.getId());
req.setState(type as any);
this.__memberService
.updateMemberForState(req)
.then((result) => {
count++;
})
.catch((reson) => {
this.showAlert('error', '회원 상태 변경이 실패하였습니다.');
})
.finally(() => {
if (count === totalCount) {
this.showAlert('success', '회원 상태가 수정 되었습니다.');
this.closeChangeAlert();
}
});
});
}
});
}
__getRateTooltop(partner: MemberModel): string {
const tempRate = 0;
const memberSettlement = partner.getMemberSettlementSetting();
const resultTooltip = `
\n -바카라: ${tempRate}% \n -룰렛: ${tempRate}% \n -드레곤타이거: ${tempRate}% \n -그외:${tempRate}% \n 슬롯:${tempRate}% \n 카지노루징: ${tempRate}% \n 슬롯루징: ${tempRate}%
\n
-바카라: ${memberSettlement?.getRateCasinoBacara()}% \n
-룰렛: ${memberSettlement?.getRateCasinoRoulette()}% \n
-드레곤타이거: ${memberSettlement?.getRateCasinoDragonTiger()}% \n
-그외:${memberSettlement?.getRateCasino()}% \n
슬롯:${memberSettlement?.getRateSlot()}% \n
카지노루징: ${memberSettlement?.getRateCasinoLoosing()}% \n
슬롯루징: ${memberSettlement?.getRateSlotLoosing()}%
`;
return resultTooltip;
}
__getStateString(state: any): string {
console.log(state.getState());
return '정상';
}
__signoutBlockConfirmConfig(): void {
this.signoutBlockConfigForm = this._formBuilder.group({
title: '알림',
@ -446,6 +566,45 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
__onClickChangeLevel(member_level_id: string): void {
console.log('member_level_id', member_level_id);
let count = 0;
const totalCount = this.chkUsers.length;
this.showConfirmAlert(
this.alertTitle,
'선택된 회원 레벨을 모두 수정하시겠습니까?'
).then((result) => {
if (!!result) {
this.__checkedUsers.forEach((memberId: string) => {
const req = new UpdateMemberRequest();
const findMember = this.listMember.find(
(m) => m.getId() === memberId
);
req.setId(findMember!.getId());
req.setMemberLevelId(member_level_id);
this.__memberService
.updateMember(req)
.then((result) => {
count++;
})
.catch((reson) => {
this.showAlert('error', '회원 레벨 수정이 실패하였습니다.');
})
.finally(() => {
if (count === totalCount) {
this.showAlert('success', '회원 레벨이 수정 되었습니다.');
this.closeChangeAlert();
}
});
});
}
});
}
__getMemberSettlementType(member: MemberModel): string | undefined {
const type = member.getMemberSettlementSetting()?.getSettlementType();
return type === 1 ? '롤링' : '';
}
__getMemberState(member: MemberModel): string {

View File

@ -32,6 +32,7 @@ export const partnerRoutes: Route[] = [
component: ListComponent,
resolve: {
listPartner: PartnerListForMainOfficeResolver,
listMemberLevels: ListMemberLevelsResolver,
},
},
{
@ -39,6 +40,7 @@ export const partnerRoutes: Route[] = [
component: ListComponent,
resolve: {
listPartner: PartnerListForBranchResolver,
listMemberLevels: ListMemberLevelsResolver,
},
},
{
@ -46,6 +48,7 @@ export const partnerRoutes: Route[] = [
component: ListComponent,
resolve: {
listPartner: PartnerListForDivisionResolver,
listMemberLevels: ListMemberLevelsResolver,
},
},
{
@ -53,6 +56,7 @@ export const partnerRoutes: Route[] = [
component: ListComponent,
resolve: {
listPartner: PartnerListForOfficeResolver,
listMemberLevels: ListMemberLevelsResolver,
},
},
{
@ -60,6 +64,7 @@ export const partnerRoutes: Route[] = [
component: ListComponent,
resolve: {
listPartner: PartnerListForStoreResolver,
listMemberLevels: ListMemberLevelsResolver,
},
},
];

View File

@ -425,9 +425,6 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
/* const dialogRef; */
const req = new UpdateMemberRequest();
req.setId(this.currentMember?.getId());
switch (this.selectedPanel) {
case 'accountInfo':
this.modifyMemberDefaultInfo();