dev #14384 Правка ошибок отображения WPA КофеЛайк: show info when wallet balance is negative

This commit is contained in:
nikolay 2023-06-23 13:33:02 +04:00
parent 3ff34525ed
commit 03771d2012
5 changed files with 21 additions and 5 deletions

View File

@ -206,5 +206,10 @@ export interface UserInfo {
id: string;
name: string | null;
phone: string;
walletBalances: UserInfoWalletBalance[];
walletBalances: UserInfoWalletBalance[] | { error: ResponseError };
}
export interface ResponseError {
code: number;
msg: string;
}

View File

@ -7,8 +7,13 @@
<p id="level-percent">Кэшбек {{ authService.currentLvlPeriod.percent }}%</p>
</div>
<p class="top-info__bonus">
{{ Math.floor(authService.getBalanceAmount(authService.userInfo.walletBalances)) }}
бонусов
<ng-container *nfIf="!isNegativebalance">
{{ Math.floor(authService.getBalanceAmount($any(authService.userInfo.walletBalances))) }}
бонусов
</ng-container>
<ng-container *ngIf="isNegativeBalance">
Ошибка! Отрицательный баланс бонусов
</ng-container>
</p>
</div>
<div class="guest-card__qr" (click)="qrCodeClick()">

View File

@ -6,6 +6,7 @@ import { MessageService } from 'primeng/api';
import { MessagingService } from 'src/app/services/messaging.service';
import { DeviceType, getTypeDevice } from 'src/app/utils';
import { AuthService } from 'src/app/services/auth.service';
import { ResponseError } from 'src/app/interface/data';
@Component({
selector: 'app-guest-card',
@ -17,6 +18,11 @@ export class GuestCardComponent implements OnInit {
private isQrCodeClicked: boolean = false;
public Math: Math = Math;
public showBack: boolean = false;
public negativeBalance: boolean = false;
get isNegativeBalance(): boolean {
return !Array.isArray(this.authService.userInfo?.walletBalances);
}
constructor(
private _bottomSheet: MatBottomSheet,
@ -27,6 +33,7 @@ export class GuestCardComponent implements OnInit {
) { }
ngOnInit(): void {
this.negativeBalance = !Array.isArray(this.authService.userInfo?.walletBalances);
this.showBack = getTypeDevice() === DeviceType.android;
this.requestPermission();

View File

@ -1 +0,0 @@
nikolay@arch.6700:1687496762

View File

@ -4,7 +4,7 @@ import { WpJsonService } from './wp-json.service';
import { environment } from 'src/environments/environment';
import { JsonrpcService, RpcService } from './jsonrpc.service';
import { MessageService } from 'primeng/api';
import { UserInfo, Purchase, lvlPeriod, UserInfoWalletBalance } from '../interface/data';
import { UserInfo, Purchase, lvlPeriod, UserInfoWalletBalance, ResponseError } from '../interface/data';
import { lvlPeriods } from 'src/app/app.constants';
import moment, { Moment } from 'moment-timezone';
import { Router } from '@angular/router';