dev #15189 фикс мерджа
This commit is contained in:
parent
188f93e2b3
commit
a8240ed0db
@ -7,27 +7,57 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { MessageService } from 'primeng/api';
|
import { MessageService } from 'primeng/api';
|
||||||
import { AppComponent } from '../app.component';
|
import { getTypeDevice, pwaInstalled } from 'src/app/utils';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[appDownloadApp]',
|
selector: '[appDownloadApp]',
|
||||||
})
|
})
|
||||||
export class DownloadAppDirective implements OnInit {
|
export class DownloadAppDirective implements OnInit {
|
||||||
|
public deviceType: 'ios' | 'android' | null = null;
|
||||||
|
public deferredPrompt: any;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private messageService: MessageService,
|
private messageService: MessageService,
|
||||||
public renderer: Renderer2,
|
public renderer: Renderer2,
|
||||||
private el: ElementRef
|
private el: ElementRef,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
if (AppComponent.pwaInstalled) {
|
getTypeDevice();
|
||||||
|
if (this.deviceType === 'ios') {
|
||||||
|
this.el.nativeElement.style.display = 'block';
|
||||||
|
}
|
||||||
|
this.checkInstalled();
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkInstalled(): Promise<void> {
|
||||||
|
if (window.matchMedia('(display-mode: standalone)').matches
|
||||||
|
|| await pwaInstalled()) {
|
||||||
this.el.nativeElement.style.display = 'none';
|
this.el.nativeElement.style.display = 'none';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HostListener('window:beforeinstallprompt', ['$event'])
|
||||||
|
onBeforeInstallPrompt(e: any) {
|
||||||
|
e.preventDefault();
|
||||||
|
this.deferredPrompt = e;
|
||||||
|
if (this.deferredPrompt) {
|
||||||
|
this.el.nativeElement.style.display = 'block';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@HostListener('window:appinstalled', ['$event'])
|
||||||
|
onAppInstalled(e: any) {
|
||||||
|
// Prevent Chrome 67 and earlier from automatically showing the prompt
|
||||||
|
e.preventDefault();
|
||||||
|
// Stash the event so it can be triggered later.
|
||||||
|
this.deferredPrompt = e;
|
||||||
|
this.el.nativeElement.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
@HostListener('click', ['$event'])
|
@HostListener('click', ['$event'])
|
||||||
async downloadApp(event: MouseEvent) {
|
async downloadApp(event: MouseEvent) {
|
||||||
if (!AppComponent.pwaPrompt) {
|
if (!this.deferredPrompt) {
|
||||||
this.messageService.clear();
|
this.messageService.clear();
|
||||||
this.messageService.add({
|
this.messageService.add({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
@ -35,8 +65,8 @@ export class DownloadAppDirective implements OnInit {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AppComponent.pwaPrompt.prompt();
|
this.deferredPrompt.prompt();
|
||||||
AppComponent.pwaPrompt.userChoice.then((res: any) => {
|
this.deferredPrompt.userChoice.then((res: any) => {
|
||||||
if (res.outcome === 'accepted') {
|
if (res.outcome === 'accepted') {
|
||||||
this.messageService.clear();
|
this.messageService.clear();
|
||||||
this.messageService.add({
|
this.messageService.add({
|
||||||
@ -44,7 +74,8 @@ export class DownloadAppDirective implements OnInit {
|
|||||||
summary: 'Спасибо за установку!',
|
summary: 'Спасибо за установку!',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
AppComponent.pwaPrompt = null;
|
this.deferredPrompt = null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,19 +1,23 @@
|
|||||||
<div class="info-order">
|
|
||||||
<ng-container *ngIf="lastOrder">
|
|
||||||
<h2>Ваш предыдущий заказ</h2>
|
<h2>Ваш предыдущий заказ</h2>
|
||||||
|
<div class="info-order">
|
||||||
<p class="flex"><span>Дата: </span>
|
<p class="flex"><span>Дата: </span>
|
||||||
<span class="info" *ngIf="!loading">{{lastOrder!.last_purchase_date}}</span>
|
<span *ngIf="!loading">{{(lastOrder?.transactionCreateDate | date:'dd.MM.yyyyг.') || 'Данные не найдены'}}</span>
|
||||||
|
<ng-container *ngIf="loading">
|
||||||
|
<ng-container
|
||||||
|
*ngTemplateOutlet="spinner; context: { $implicit: 24 }"
|
||||||
|
></ng-container>
|
||||||
|
</ng-container>
|
||||||
</p>
|
</p>
|
||||||
<p class="flex"><span>На сумму: </span>
|
<p class="flex"><span>На сумму: </span>
|
||||||
<span class="info" *ngIf="!loading">{{lastOrder?.last_purchase_sum}}₽</span>
|
<span *ngIf="!loading">{{lastOrder?.orderSum ? lastOrder?.orderSum + ' ₽' : 'Данные не найдены'}}</span>
|
||||||
</p>
|
<ng-container *ngIf="loading">
|
||||||
|
<ng-container
|
||||||
|
*ngTemplateOutlet="spinner; context: { $implicit: 24 }"
|
||||||
|
></ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="!lastOrder">
|
|
||||||
<p class="flex">
|
|
||||||
<span>Покупок за последние пол года не было</span>
|
|
||||||
</p>
|
</p>
|
||||||
</ng-container>
|
|
||||||
</div>
|
</div>
|
||||||
|
<img src="./assets/970х250_3.png" alt="" width="100%" />
|
||||||
<a href="https://yandex.ru/profile/151770398186" target="_blank">
|
<a href="https://yandex.ru/profile/151770398186" target="_blank">
|
||||||
<button class="evaluate-order">Оценить заказ</button>
|
<button class="evaluate-order">Оценить заказ</button>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { LastPurchase } from 'src/app/interface/data';
|
import { Purchase } from 'src/app/interface/data';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-last-order[lastOrder]',
|
selector: 'app-last-order[lastOrder]',
|
||||||
@ -7,11 +7,12 @@ import { LastPurchase } from 'src/app/interface/data';
|
|||||||
styleUrls: ['./last-order.component.scss']
|
styleUrls: ['./last-order.component.scss']
|
||||||
})
|
})
|
||||||
export class LastOrderComponent implements OnInit {
|
export class LastOrderComponent implements OnInit {
|
||||||
@Input() lastOrder?: LastPurchase;
|
@Input() lastOrder?: Purchase;
|
||||||
@Input() loading!: boolean;
|
@Input() loading!: boolean;
|
||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,12 +4,12 @@
|
|||||||
<div class="loyality-program">
|
<div class="loyality-program">
|
||||||
<app-accordion header="Условия начисления бонусов">
|
<app-accordion header="Условия начисления бонусов">
|
||||||
<p>
|
<p>
|
||||||
Ваш текущий уровень {{ authService.userInfo?.current_level_and_cashback?.current_level ?? '--' }},
|
Ваш текущий уровень {{ authService.userInfo?.customer_level }},
|
||||||
поэтому вам начисляется {{ authService.currentLvlPeriod.percent }}% от суммы покупки.
|
поэтому вам начисляется {{ authService.currentLvlPeriod.percent }}% от суммы покупки.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Смена уровня произойдет в начале следующего квартала,
|
Смена уровня произойдет в начале следующего квартала,
|
||||||
{{ authService.currentPeriod[1]
|
{{ authService.purchaseData.currentPeriod[1]
|
||||||
.locale("ru")
|
.locale("ru")
|
||||||
.format("DD.MM.YY") }}.
|
.format("DD.MM.YY") }}.
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user