dev #14305 Изменение дизайна WPA Кофе-лайка: block user with no info

This commit is contained in:
nikolay 2023-05-17 11:42:50 +04:00
parent 2fa05b391e
commit c5e4f3c229
5 changed files with 19 additions and 16 deletions

View File

@ -1,10 +1,7 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import { MainComponent } from './pages/main/main.component'; import { MainComponent } from './pages/main/main.component';
import { GuestCardComponent } from './pages/guest-card/guest-card.component';
import { LoginComponent } from './pages/login/login.component';
import { AuthGuard } from './guards/auth-guard.guard'; import { AuthGuard } from './guards/auth-guard.guard';
import { LoyalityProgramComponent } from './pages/loyality-program/loyality-program.component';
const routes: Routes = [ const routes: Routes = [
{ {
@ -12,15 +9,7 @@ const routes: Routes = [
loadChildren: () => null as any, loadChildren: () => null as any,
// component: GuestCardComponent, // component: GuestCardComponent,
// canActivate: [AuthGuard] // canActivate: [AuthGuard]
}, },
{
path: 'login',
component: LoginComponent
},
{
path: 'loyality-program',
component: LoyalityProgramComponent,
}
// { path: '**', component: NotFoundComponent } // { path: '**', component: NotFoundComponent }
]; ];

View File

@ -88,14 +88,19 @@
[lastOrder]="lastPurchase" [lastOrder]="lastPurchase"
[loading]="loyaltyProgram.purchaseData.$loading" [loading]="loyaltyProgram.purchaseData.$loading"
></app-last-order> ></app-last-order>
<a class="guest-card__loyalty-program" routerLink="loyality-program" <a class="guest-card__loyalty-program" routerLink="loyality-program"
>Подробнее о правилах <br /> >Подробнее о правилах <br />
Программы лояльности</a Программы лояльности</a
> >
</div> </div>
<app-footer></app-footer> <app-footer></app-footer>
</ng-container> </ng-container>
<ng-container *ngIf="this.loyaltyProgram.purchaseData.$loading || !customerInfo"> <ng-container *ngIf="!customerInfo && !loyaltyProgram.purchaseData.$loading">
<div class="not-found">
<p>Данные недоступны, попробуйте позже</p>
</div>
</ng-container>
<ng-container *ngIf="loyaltyProgram.purchaseData.$loading">
<ng-container <ng-container
*ngTemplateOutlet="spinner; context: { $implicit: 85 }" *ngTemplateOutlet="spinner; context: { $implicit: 85 }"
></ng-container> ></ng-container>

View File

@ -206,6 +206,14 @@
.wrapper { .wrapper {
padding-top: 20px; padding-top: 20px;
} }
.not-found {
display: flex;
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
}
} }
app-accordion { app-accordion {

View File

@ -35,6 +35,7 @@ export class GuestCardComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
const token = this.cookiesService.getItem('token'); const token = this.cookiesService.getItem('token');
this.loyaltyProgram.purchaseData.$loading = true;
this.wpJsonService this.wpJsonService
.getCustomerInfo( .getCustomerInfo(
environment.systemId, environment.systemId,
@ -68,7 +69,7 @@ export class GuestCardComponent implements OnInit {
deleteToken(): void { deleteToken(): void {
this.cookiesService.logout(); this.cookiesService.logout();
} }
logout() { logout() {
const bottomSheet = this._bottomSheet.open(ExitComponent); const bottomSheet = this._bottomSheet.open(ExitComponent);

View File

@ -22,7 +22,7 @@ export class LoyaltyProgramService {
lastPeriod: [], lastPeriod: [],
lastPurchases: [], lastPurchases: [],
currentPurchases: [], currentPurchases: [],
$loading: true, $loading: false,
get currentAmount(): number { get currentAmount(): number {
const amount = this.currentPurchases.reduce( const amount = this.currentPurchases.reduce(
(accumulator, currentValue) => { (accumulator, currentValue) => {