Merge branch 'tasty-coffee' of https://git.hlcompany.ru/git/usersite into tasty-coffee
# Conflicts: # angular/angular.json # angular/src/app/app.component.ts # angular/src/app/interface/data.ts # angular/src/app/presentation-options/default-option/components/navbar/navbar.component.html # angular/src/app/presentation-options/default-option/components/navbar/navbar.component.scss # angular/src/app/presentation-options/default-option/components/navbar/navbar.component.ts # angular/src/app/presentation-options/default-option/default-option.module.ts # angular/src/app/presentation-options/default-option/pages/guest-card/guest-card.component.html # angular/src/app/presentation-options/default-option/pages/guest-card/guest-card.component.scss # angular/src/app/presentation-options/default-option/pages/guest-card/guest-card.component.ts # angular/src/app/presentation-options/default-option/pages/login/login.component.html # angular/src/app/presentation-options/default-option/pages/login/login.component.scss # angular/src/app/services/auth.service.ts # angular/src/environments/environment.prod.ts # angular/src/environments/environment.ts # angular/src/manifest.webmanifest # angular/src/styles.scss
This commit is contained in:
commit
188f93e2b3
@ -7,57 +7,27 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { MessageService } from 'primeng/api';
|
import { MessageService } from 'primeng/api';
|
||||||
import { getTypeDevice, pwaInstalled } from 'src/app/utils';
|
import { AppComponent } from '../app.component';
|
||||||
|
|
||||||
@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 {
|
||||||
getTypeDevice();
|
if (AppComponent.pwaInstalled) {
|
||||||
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 (!this.deferredPrompt) {
|
if (!AppComponent.pwaPrompt) {
|
||||||
this.messageService.clear();
|
this.messageService.clear();
|
||||||
this.messageService.add({
|
this.messageService.add({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
@ -65,8 +35,8 @@ export class DownloadAppDirective implements OnInit {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.deferredPrompt.prompt();
|
AppComponent.pwaPrompt.prompt();
|
||||||
this.deferredPrompt.userChoice.then((res: any) => {
|
AppComponent.pwaPrompt.userChoice.then((res: any) => {
|
||||||
if (res.outcome === 'accepted') {
|
if (res.outcome === 'accepted') {
|
||||||
this.messageService.clear();
|
this.messageService.clear();
|
||||||
this.messageService.add({
|
this.messageService.add({
|
||||||
@ -74,8 +44,7 @@ export class DownloadAppDirective implements OnInit {
|
|||||||
summary: 'Спасибо за установку!',
|
summary: 'Спасибо за установку!',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.deferredPrompt = null;
|
AppComponent.pwaPrompt = null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,6 +75,7 @@
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
line-height: 19px;
|
line-height: 19px;
|
||||||
letter-spacing: -0.5px;
|
letter-spacing: -0.5px;
|
||||||
|
color: var(--text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.price,
|
.price,
|
||||||
|
|||||||
13
angular/src/app/pipes/safe-html.pipe.ts
Normal file
13
angular/src/app/pipes/safe-html.pipe.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
|
import { DomSanitizer } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
@Pipe({
|
||||||
|
name: 'safeHtml',
|
||||||
|
})
|
||||||
|
export class SafeHtmlPipe implements PipeTransform {
|
||||||
|
constructor(private sanitizer: DomSanitizer) {}
|
||||||
|
|
||||||
|
transform(html: string) {
|
||||||
|
return this.sanitizer.bypassSecurityTrustHtml(html);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -14,7 +14,7 @@
|
|||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
letter-spacing: -0.24px;
|
letter-spacing: -0.24px;
|
||||||
color: #6a737c;
|
color: var(--text-color_1);
|
||||||
}
|
}
|
||||||
.phone-number {
|
.phone-number {
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
@ -23,7 +23,7 @@
|
|||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
letter-spacing: -0.408px;
|
letter-spacing: -0.408px;
|
||||||
color: #d9d9d9;
|
color: var(--text-color);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,23 +1,19 @@
|
|||||||
<h2>Ваш предыдущий заказ</h2>
|
|
||||||
<div class="info-order">
|
<div class="info-order">
|
||||||
|
<ng-container *ngIf="lastOrder">
|
||||||
|
<h2>Ваш предыдущий заказ</h2>
|
||||||
<p class="flex"><span>Дата: </span>
|
<p class="flex"><span>Дата: </span>
|
||||||
<span *ngIf="!loading">{{(lastOrder?.transactionCreateDate | date:'dd.MM.yyyyг.') || 'Данные не найдены'}}</span>
|
<span class="info" *ngIf="!loading">{{lastOrder!.last_purchase_date}}</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 *ngIf="!loading">{{lastOrder?.orderSum ? lastOrder?.orderSum + ' ₽' : 'Данные не найдены'}}</span>
|
<span class="info" *ngIf="!loading">{{lastOrder?.last_purchase_sum}}₽</span>
|
||||||
<ng-container *ngIf="loading">
|
|
||||||
<ng-container
|
|
||||||
*ngTemplateOutlet="spinner; context: { $implicit: 24 }"
|
|
||||||
></ng-container>
|
|
||||||
</ng-container>
|
|
||||||
</p>
|
</p>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="!lastOrder">
|
||||||
|
<p class="flex">
|
||||||
|
<span>Покупок за последние пол года не было</span>
|
||||||
|
</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,19 +1,18 @@
|
|||||||
:host {
|
:host {
|
||||||
padding: 24px 16px 0px;
|
padding: 24px 16px 0px;
|
||||||
|
|
||||||
& > h2 {
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: 15px;
|
|
||||||
line-height: 20px;
|
|
||||||
letter-spacing: -0.24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
& > .info-order {
|
& > .info-order {
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 16px;
|
line-height: 16px;
|
||||||
|
h2 {
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 20px;
|
||||||
|
letter-spacing: -0.24px;
|
||||||
|
}
|
||||||
span {
|
span {
|
||||||
color: var(--text-color_1);
|
color: var(--text-color_1);
|
||||||
}
|
}
|
||||||
@ -23,6 +22,9 @@
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
.info {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.evaluate-order {
|
.evaluate-order {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { Purchase } from 'src/app/interface/data';
|
import { LastPurchase } from 'src/app/interface/data';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-last-order[lastOrder]',
|
selector: 'app-last-order[lastOrder]',
|
||||||
@ -7,12 +7,11 @@ import { Purchase } 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?: Purchase;
|
@Input() lastOrder?: LastPurchase;
|
||||||
@Input() loading!: boolean;
|
@Input() loading!: boolean;
|
||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
width: 48px;
|
width: 48px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
background: var(--button-color);
|
background: var(--main-color_2);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|||||||
@ -4,12 +4,12 @@
|
|||||||
<div class="loyality-program">
|
<div class="loyality-program">
|
||||||
<app-accordion header="Условия начисления бонусов">
|
<app-accordion header="Условия начисления бонусов">
|
||||||
<p>
|
<p>
|
||||||
Ваш текущий уровень {{ authService.userInfo?.customer_level }},
|
Ваш текущий уровень {{ authService.userInfo?.current_level_and_cashback?.current_level ?? '--' }},
|
||||||
поэтому вам начисляется {{ authService.currentLvlPeriod.percent }}% от суммы покупки.
|
поэтому вам начисляется {{ authService.currentLvlPeriod.percent }}% от суммы покупки.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Смена уровня произойдет в начале следующего квартала,
|
Смена уровня произойдет в начале следующего квартала,
|
||||||
{{ authService.purchaseData.currentPeriod[1]
|
{{ authService.currentPeriod[1]
|
||||||
.locale("ru")
|
.locale("ru")
|
||||||
.format("DD.MM.YY") }}.
|
.format("DD.MM.YY") }}.
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
.loyality-program {
|
.loyality-program {
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { environment } from "src/environments/environment.prod";
|
import { environment } from 'src/environments/environment.prod';
|
||||||
|
|
||||||
export enum DeviceType {
|
export enum DeviceType {
|
||||||
ios,
|
ios,
|
||||||
@ -12,7 +12,9 @@ export function getTypeDevice(): DeviceType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function pwaInstalled(): Promise<boolean> {
|
export async function pwaInstalled(): Promise<boolean> {
|
||||||
if ("getInstalledRelatedApps" in navigator) {
|
if (window.matchMedia('(display-mode: standalone)').matches) return true;
|
||||||
|
|
||||||
|
if ('getInstalledRelatedApps' in navigator) {
|
||||||
const apps = await (window.navigator as any).getInstalledRelatedApps();
|
const apps = await (window.navigator as any).getInstalledRelatedApps();
|
||||||
for (const app of apps) {
|
for (const app of apps) {
|
||||||
if (app.url == environment.manifestUrl) {
|
if (app.url == environment.manifestUrl) {
|
||||||
@ -22,3 +24,9 @@ export async function pwaInstalled(): Promise<boolean> {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function format(s: string, ...args: string[]) {
|
||||||
|
return s.replace(/{(\d+)}/g, function (match, number) {
|
||||||
|
return typeof args[number] != 'undefined' ? args[number] : match;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 291 KiB After Width: | Height: | Size: 288 KiB |
BIN
angular/src/assets/broken.jpg
Normal file
BIN
angular/src/assets/broken.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
22
angular/src/assets/coffee-like-logo.svg
Normal file
22
angular/src/assets/coffee-like-logo.svg
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<!-- Creator: CorelDRAW -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="35.6446mm" height="51.1881mm" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
|
||||||
|
viewBox="0 0 4756.71 6830.97"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:xodm="http://www.corel.com/coreldraw/odm/2003">
|
||||||
|
<defs>
|
||||||
|
<style type="text/css">
|
||||||
|
<![CDATA[
|
||||||
|
.fil0 {fill:#005C50;fill-rule:nonzero}
|
||||||
|
]]>
|
||||||
|
</style>
|
||||||
|
</defs>
|
||||||
|
<g id="Слой_x0020_1">
|
||||||
|
<metadata id="CorelCorpID_0Corel-Layer"/>
|
||||||
|
<path class="fil0" d="M3624.79 6537.21l-2493 0 -593.79 -5550.88 3680.77 0 -593.98 5550.88zm961.94 -6281.71l-202.72 0 -78.95 -255.5 -3853.44 0 -78.85 255.5 -202.76 0 -170 550.53 241.74 0 644.49 6024.94 2984.16 0 644.68 -6024.94 241.65 0 -169.99 -550.53z"/>
|
||||||
|
<polygon class="fil0" points="1026.49,2860.81 3728.55,2860.81 3874.58,1495.52 880.44,1495.52 "/>
|
||||||
|
<polygon class="fil0" points="1202.08,4502.38 3552.85,4502.38 3699.07,3135.98 1055.9,3135.98 "/>
|
||||||
|
<polygon class="fil0" points="1377.49,6144.24 3379.23,6144.24 3523.42,4777.69 1231.56,4777.69 "/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
Loading…
Reference in New Issue
Block a user