This commit is contained in:
Park Byung Eun 2022-08-30 08:17:58 +00:00
parent 950f0b5835
commit c93a972425

View File

@ -129,7 +129,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
memberSettleForm!: FormGroup; memberSettleForm!: FormGroup;
memberGameSettingForm!: FormGroup; memberGameSettingForm!: FormGroup;
passwordConfirmConfigForm!: FormGroup; fuseAlertConfirmConfigForm!: FormGroup;
/* currentMember?: User; */ /* currentMember?: User; */
currentMember?: MemberModel; currentMember?: MemberModel;
@ -150,6 +150,9 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
}; };
changePasswordResultShowAlert: boolean = false; changePasswordResultShowAlert: boolean = false;
alertTitle = '알림';
alertChangePasswordMessage = '비밀번호를 변경 하시겠습니까?';
alertUpdateMemberMessage = '회원을 수정 하시겠습니까?';
private _unsubscribeAll: Subject<any> = new Subject<any>(); private _unsubscribeAll: Subject<any> = new Subject<any>();
@ -223,7 +226,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
canBetSlot: [], canBetSlot: [],
}); });
this.passwordConfirmConfigForm = this._formBuilder.group({ this.fuseAlertConfirmConfigForm = this._formBuilder.group({
title: '알림', title: '알림',
message: '비밀번호를 변경 하시겠습니까?', message: '비밀번호를 변경 하시겠습니까?',
icon: this._formBuilder.group({ icon: this._formBuilder.group({
@ -407,6 +410,8 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
return; return;
} }
/* const dialogRef; */
const req = new UpdateMemberRequest(); const req = new UpdateMemberRequest();
req.setId(this.currentMember?.getId()); req.setId(this.currentMember?.getId());
@ -434,89 +439,100 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
} }
private modifyMemberDefaultInfo(): void { private modifyMemberDefaultInfo(): void {
if (!this.currentMember?.getId()) { this.showConfirmAlert(this.alertTitle, this.alertUpdateMemberMessage).then(
return; (result) => {
} if (!!result && !!this.currentMember?.getId()) {
const req = new UpdateMemberRequest();
req.setId(this.currentMember?.getId());
const req = new UpdateMemberRequest(); const {
req.setId(this.currentMember?.getId()); username,
signinPw,
nickname,
ownCash,
mobilePhoneNumber,
levelName,
state,
isExcahngeMoney,
comp,
coupon,
siteUrl,
hodingGameMoney,
} = this.memberDefaultForm.value;
const { if (!!levelName && levelName !== '') {
username, const level = this.memberLevels.find(
signinPw, (v) => v.getName() === levelName
nickname, );
ownCash, if (!!level) req.setMemberLevelId(level?.getId());
mobilePhoneNumber, }
levelName, if (!!mobilePhoneNumber && mobilePhoneNumber !== '') {
state, req.setMobilePhoneNumber(mobilePhoneNumber);
isExcahngeMoney, }
comp, if (!!siteUrl && siteUrl !== '') {
coupon, const site = this.sites.find((v) => v.getUrl() === siteUrl);
siteUrl, if (!!site) req.setSiteId(site.getId());
hodingGameMoney, }
} = this.memberDefaultForm.value;
if (!!levelName && levelName !== '') { this._memberService
const level = this.memberLevels.find((v) => v.getName() === levelName); .updateMember(req)
if (!!level) req.setMemberLevelId(level?.getId()); .then((result) => {
} console.log(result);
if (!!mobilePhoneNumber && mobilePhoneNumber !== '') { this.showAlert('success', '수정이 완료되었습니다.');
req.setMobilePhoneNumber(mobilePhoneNumber); })
} .catch((resson) => {
if (!!siteUrl && siteUrl !== '') { this.showAlert('error', '수정 실패 잠시 후 다시 시도하세요.');
const site = this.sites.find((v) => v.getUrl() === siteUrl); })
if (!!site) req.setSiteId(site.getId()); .finally(() => this.closeChangePasswordAlert());
} }
}
this._memberService );
.updateMember(req)
.then((result) => {
console.log(result);
this.showAlert('success', '수정이 완료되었습니다.');
})
.catch((resson) => {
this.showAlert('error', '수정 실패 잠시 후 다시 시도하세요.');
})
.finally(() => this.closeChangePasswordAlert());
} }
private modifyMemberBankAccountInfo(): void { private modifyMemberBankAccountInfo(): void {
if (!this.memberBankForm.valid) { if (!this.memberBankForm.valid) {
return; return;
} }
const {
exchangePw,
exchangePwConfirm,
bankName,
accountHolder,
accountNumber,
description,
} = this.memberBankForm.value;
const bankId = this.currentMember?.getBankAccount()?.getId(); this.showConfirmAlert(this.alertTitle, this.alertUpdateMemberMessage).then(
const bankReq = new UpdateMemberBankAccountRequest(); (result) => {
const bankFind = this.banks.find((v) => v.getName() === bankName); if (!!result) {
const {
exchangePw,
exchangePwConfirm,
bankName,
accountHolder,
accountNumber,
description,
} = this.memberBankForm.value;
if (!bankId || !bankFind) { const bankId = this.currentMember?.getBankAccount()?.getId();
console.log('Error bankId undefined or bankFind undefined'); const bankReq = new UpdateMemberBankAccountRequest();
return; const bankFind = this.banks.find((v) => v.getName() === bankName);
}
bankReq.setAccountNumber(accountNumber); if (!bankId || !bankFind) {
bankReq.setBankId(bankFind?.getId()); console.log('Error bankId undefined or bankFind undefined');
bankReq.setId(bankId); return;
bankReq.setMemo(description); }
bankReq.setName(accountHolder);
this._memberBankAccountService bankReq.setAccountNumber(accountNumber);
.updateMemberBankAccount(bankReq) bankReq.setBankId(bankFind?.getId());
.then((result) => { bankReq.setId(bankId);
this.showAlert('success', '수정이 완료되었습니다.'); bankReq.setMemo(description);
}) bankReq.setName(accountHolder);
.catch((reson) => {
this.showAlert('error', '수정 실패 잠시 후 다시 시도하세요.'); this._memberBankAccountService
}) .updateMemberBankAccount(bankReq)
.finally(() => this.closeChangePasswordAlert()); .then((result) => {
this.showAlert('success', '수정이 완료되었습니다.');
})
.catch((reson) => {
this.showAlert('error', '수정 실패 잠시 후 다시 시도하세요.');
})
.finally(() => this.closeChangePasswordAlert());
}
}
);
} }
private modifyMemberSttlemtSettingInfo(): void { private modifyMemberSttlemtSettingInfo(): void {
@ -524,67 +540,83 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
return; return;
} }
const { this.showConfirmAlert(this.alertTitle, this.alertUpdateMemberMessage).then(
rateCasinoBacara, (result) => {
rateCasinoRoulette, if (!!result) {
rateCasinoDragonTiger, const {
rateCasino, rateCasinoBacara,
rateSlot, rateCasinoRoulette,
rateCasinoLoosing, rateCasinoDragonTiger,
rateSlotLoosing, rateCasino,
canFirstChargeComp, rateSlot,
canPerChargeComp, rateCasinoLoosing,
canExchange, rateSlotLoosing,
manualPaymentTypeForPartner, canFirstChargeComp,
} = this.memberSettleForm.value; canPerChargeComp,
canExchange,
manualPaymentTypeForPartner,
} = this.memberSettleForm.value;
const updateSSReq = new UpdateMemberSettlementSettingRequest(); const updateSSReq = new UpdateMemberSettlementSettingRequest();
updateSSReq.setId( updateSSReq.setId(
this.currentMember?.getMemberSettlementSetting()?.getId()! this.currentMember?.getMemberSettlementSetting()?.getId()!
);
updateSSReq.setRateCasinoBacara(rateCasinoBacara);
updateSSReq.setRateCasinoRoulette(rateCasinoRoulette);
updateSSReq.setRateCasinoDragonTiger(rateCasinoDragonTiger);
updateSSReq.setRateCasino(rateCasino);
updateSSReq.setRateSlot(rateSlot);
updateSSReq.setRateCasinoLoosing(rateCasinoLoosing);
updateSSReq.setRateSlotLoosing(rateSlotLoosing);
updateSSReq.setCanFirstChargeComp(canFirstChargeComp);
updateSSReq.setCanPerChargeComp(canPerChargeComp);
updateSSReq.setCanExchange(canExchange);
updateSSReq.setManualPaymentTypeForPartner(
manualPaymentTypeForPartner
);
this._memberSettlementSettingService
.updateMemberSettlementSetting(updateSSReq)
.then((result) => {
this.showAlert('success', '수정이 완료되었습니다.');
})
.catch((reson) => {
this.showAlert('error', '수정 실패 잠시 후 다시 시도하세요.');
})
.finally(() => this.closeChangePasswordAlert());
}
}
); );
updateSSReq.setRateCasinoBacara(rateCasinoBacara);
updateSSReq.setRateCasinoRoulette(rateCasinoRoulette);
updateSSReq.setRateCasinoDragonTiger(rateCasinoDragonTiger);
updateSSReq.setRateCasino(rateCasino);
updateSSReq.setRateSlot(rateSlot);
updateSSReq.setRateCasinoLoosing(rateCasinoLoosing);
updateSSReq.setRateSlotLoosing(rateSlotLoosing);
updateSSReq.setCanFirstChargeComp(canFirstChargeComp);
updateSSReq.setCanPerChargeComp(canPerChargeComp);
updateSSReq.setCanExchange(canExchange);
updateSSReq.setManualPaymentTypeForPartner(manualPaymentTypeForPartner);
this._memberSettlementSettingService
.updateMemberSettlementSetting(updateSSReq)
.then((result) => {
this.showAlert('success', '수정이 완료되었습니다.');
})
.catch((reson) => {
this.showAlert('error', '수정 실패 잠시 후 다시 시도하세요.');
})
.finally(() => this.closeChangePasswordAlert());
} }
private modifyMemberGameSettingInfo(): void { private modifyMemberGameSettingInfo(): void {
const { canBetPowerball, canBetCasino, canBetSlot } = this.showConfirmAlert(this.alertTitle, this.alertUpdateMemberMessage).then(
this.memberGameSettingForm.value; (result) => {
if (!!result) {
const { canBetPowerball, canBetCasino, canBetSlot } =
this.memberGameSettingForm.value;
const updateGSReq = new UpdateMemberGameSettingRequest(); const updateGSReq = new UpdateMemberGameSettingRequest();
updateGSReq.setId(this.currentMember?.getMemberGameSetting()?.getId()!); updateGSReq.setId(
updateGSReq.setCanBetPowerball(canBetPowerball); this.currentMember?.getMemberGameSetting()?.getId()!
updateGSReq.setCanBetCasino(canBetCasino); );
updateGSReq.setCanBetSlot(canBetSlot); updateGSReq.setCanBetPowerball(canBetPowerball);
updateGSReq.setCanBetCasino(canBetCasino);
updateGSReq.setCanBetSlot(canBetSlot);
this._memberGameSettingService this._memberGameSettingService
.updateMemberGameSetting(updateGSReq) .updateMemberGameSetting(updateGSReq)
.then((result) => { .then((result) => {
this.showAlert('success', '수정이 완료되었습니다.'); this.showAlert('success', '수정이 완료되었습니다.');
}) })
.catch((reson) => { .catch((reson) => {
this.showAlert('error', '수정 실패 잠시 후 다시 시도하세요.'); this.showAlert('error', '수정 실패 잠시 후 다시 시도하세요.');
}) })
.finally(() => this.closeChangePasswordAlert()); .finally(() => this.closeChangePasswordAlert());
}
}
);
} }
/** /**
* Navigate to the panel * Navigate to the panel
@ -637,14 +669,11 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
return; return;
} }
const dialogRef = this._fuseConfirmationService.open( this.showConfirmAlert(
this.passwordConfirmConfigForm.value this.alertTitle,
); this.alertChangePasswordMessage
).then((result) => {
/* const dialogRef = this._matDialog.open(AddComposeComponent); */ if (!!result) {
dialogRef.afterClosed().subscribe((result) => {
if (result === 'confirmed') {
const req = new UpdateMemberForPasswordRequest(); const req = new UpdateMemberForPasswordRequest();
req.setPassword(password); req.setPassword(password);
req.setId(this.currentMember!.getId()); req.setId(this.currentMember!.getId());
@ -682,14 +711,11 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
return; return;
} }
const dialogRef = this._fuseConfirmationService.open( this.showConfirmAlert(
this.passwordConfirmConfigForm.value this.alertTitle,
); this.alertChangePasswordMessage
).then((result) => {
/* const dialogRef = this._matDialog.open(AddComposeComponent); */ if (!!result) {
dialogRef.afterClosed().subscribe((result) => {
if (result === 'confirmed') {
const req = new UpdateMemberBankAccountForExchangePasswordRequest(); const req = new UpdateMemberBankAccountForExchangePasswordRequest();
req.setExchangePassword(password); req.setExchangePassword(password);
req.setId(this.currentMember!.getId()); req.setId(this.currentMember!.getId());
@ -717,23 +743,26 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
return; return;
} }
const req = new UpdateMemberForStateRequest(); this.showConfirmAlert(
req.setId(this.currentMember!.getId()); this.alertTitle,
req.setState(state); '회원 상태를 수정하시겠습니까?'
).then((result) => {
if (!!result) {
const req = new UpdateMemberForStateRequest();
req.setId(this.currentMember!.getId());
req.setState(state);
this._memberService this._memberService
.updateMemberForState(req) .updateMemberForState(req)
.then((result) => { .then((result) => {
this.showAlert('success', '회원 상태가 수정 되었습니다.'); this.showAlert('success', '회원 상태가 수정 되었습니다.');
}) })
.catch((reson) => { .catch((reson) => {
this.showAlert('error', '회원 상태 변경이 실패하였습니다.'); this.showAlert('error', '회원 상태 변경이 실패하였습니다.');
}) })
.finally(() => this.closeChangePasswordAlert()); .finally(() => this.closeChangePasswordAlert());
} }
});
__changeMemberState(): void {
const state = this.memberDefaultForm.get('state')?.value;
} }
private showAlert(type: FuseAlertType, message: string): void { private showAlert(type: FuseAlertType, message: string): void {
@ -752,4 +781,26 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
this._changeDetectorRef.markForCheck(); this._changeDetectorRef.markForCheck();
}, 5000); }, 5000);
} }
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);
}
});
});
}
} }