diff --git a/src/app/components/footer-buttons/footer-buttons.component.html b/src/app/components/footer-buttons/footer-buttons.component.html index 44725e8..c482b53 100644 --- a/src/app/components/footer-buttons/footer-buttons.component.html +++ b/src/app/components/footer-buttons/footer-buttons.component.html @@ -1,4 +1,18 @@ diff --git a/src/app/components/footer-buttons/footer-buttons.component.scss b/src/app/components/footer-buttons/footer-buttons.component.scss index 40b3b19..103e6ec 100644 --- a/src/app/components/footer-buttons/footer-buttons.component.scss +++ b/src/app/components/footer-buttons/footer-buttons.component.scss @@ -1,25 +1,33 @@ :host { + .footer-buttons-container { position: fixed; bottom: 16px; - width: 100%; + right: 0; display: flex; - justify-content: center; + justify-content: flex-end; z-index: 9999; - .footer-buttons-container { - max-width: 400px; - width: 90vw; - &__button { - width: 100%; - height: 34px; - background: #09467f; - border: solid #fff 1px !important; - color: #fff; - border-radius: 5px; - font-weight: 600; - letter-spacing: 2px; - border: none; - margin-top: 8px; - cursor: pointer; - } + flex-direction: column; + align-items: flex-end; + padding: 0 8px; + &__button { + display: flex; + justify-content: center; + align-items: center; + width: 60px; + height: 60px; + background: #09467f; + border: solid #fff 1px !important; + color: #fff; + border-radius: 100%; + font-weight: 600; + letter-spacing: 2px; + border: none; + margin-top: 8px; + margin-right: 0; + cursor: pointer; + img { + width: 60%; + } } -} \ No newline at end of file + } +} diff --git a/src/app/pages/account/auth/auth.component.html b/src/app/pages/account/auth/auth.component.html index f71671d..350bb38 100644 --- a/src/app/pages/account/auth/auth.component.html +++ b/src/app/pages/account/auth/auth.component.html @@ -14,10 +14,12 @@ characterPattern="[0-9]" styleClass="woocommerce-Input woocommerce-Input--text input-text" name="phone" + type="tel" inputId="phone" autocomplete="phone" placeholder="+7 (000) 000-00-00" - [unmask]="true" + mask="+7 (999) 999-9999" + [unmask]="false" [(ngModel)]="phone" >

@@ -57,7 +59,8 @@ { + if (result.code === -1) { + this.messageService.add({ + severity: 'error', + summary: 'Произошла ошибка, попробуйте позже!', + }); + } if (result.code === 0) { this.isCodeConfirm = true; } @@ -53,7 +61,7 @@ export class AuthComponent { event.preventDefault(); this.jsonrpc.rpc({ method: 'getTokenByPhone', - params: [this.phoneToConfirm, this.code] + params: [this.phoneToConfirm, String(this.code)] }, RpcService.authService, false).subscribe({ next: (result) => { if (result.code === 0) { diff --git a/src/app/pages/account/ref-system/ref-system.component.html b/src/app/pages/account/ref-system/ref-system.component.html index ae45f4e..348a72c 100644 --- a/src/app/pages/account/ref-system/ref-system.component.html +++ b/src/app/pages/account/ref-system/ref-system.component.html @@ -13,8 +13,8 @@ > diff --git a/src/app/pages/main/main.component.ts b/src/app/pages/main/main.component.ts index 1e4163f..60b07d7 100644 --- a/src/app/pages/main/main.component.ts +++ b/src/app/pages/main/main.component.ts @@ -1,16 +1,23 @@ -import { Component, ComponentRef, ElementRef, EmbeddedViewRef, OnInit, Renderer2, ViewContainerRef } from "@angular/core"; -import { AngularFireMessaging } from "@angular/fire/compat/messaging"; -import { ActivatedRoute } from "@angular/router"; -import { CardComponent } from "src/app/components/card/card.component"; -import { AccountComponent } from "../account/account.component"; -import {MessageService} from 'primeng/api'; -import { MessagingService } from "src/app/services/messaging.service"; - +import { + Component, + ComponentRef, + ElementRef, + EmbeddedViewRef, + OnInit, + Renderer2, + ViewContainerRef, +} from '@angular/core'; +import { AngularFireMessaging } from '@angular/fire/compat/messaging'; +import { ActivatedRoute } from '@angular/router'; +import { CardComponent } from 'src/app/components/card/card.component'; +import { AccountComponent } from '../account/account.component'; +import { MessageService } from 'primeng/api'; +import { MessagingService } from 'src/app/services/messaging.service'; @Component({ - selector: 'app-main', - templateUrl: './main.component.html', - styleUrls: ['./main.component.scss'] + selector: 'app-main', + templateUrl: './main.component.html', + styleUrls: ['./main.component.scss'], }) export class MainComponent implements OnInit { private cardComponent!: ComponentRef; @@ -22,55 +29,73 @@ export class MainComponent implements OnInit { public message: any; constructor( - private route: ActivatedRoute, - private viewContainerRef: ViewContainerRef, - private afMessaging: AngularFireMessaging, - public el: ElementRef, - public renderer: Renderer2, - private messageService: MessageService, - private messagingService: MessagingService, + private route: ActivatedRoute, + private viewContainerRef: ViewContainerRef, + private afMessaging: AngularFireMessaging, + public el: ElementRef, + public renderer: Renderer2, + private messageService: MessageService, + private messagingService: MessagingService ) { renderer.listen('window', 'appinstalled', (evt) => { - console.log('INSTALLED!!!') - }) + console.log('INSTALLED!!!'); + }); renderer.listen('window', 'beforeinstallprompt', (e) => { - e.preventDefault() - this.deferredPrompt = e - }) - route.queryParams.subscribe( (params) => { - console.log('####: ', params) - if (params['token']) this.token = params['token'] + e.preventDefault(); + this.deferredPrompt = e; + }); + route.queryParams.subscribe((params) => { + console.log('####: ', params); + if (params['token']) this.token = params['token']; }); } - ngOnInit(): void { + ngOnInit(): void { this.appendAccount(); // this.checkRequestPermission() } downloadPWA() { + if (!this.deferredPrompt) { + this.messageService.add({ + severity: 'error', + summary: 'Не поддерживается в Вашем браузере!', + }); + return; + } this.deferredPrompt.prompt(); this.deferredPrompt.userChoice.then((res: any) => { if (res.outcome === 'accepted') { - this.messageService.add({severity:'success', summary:'Спасибо за установку!'}); - console.log('User Accepted!!!') + this.messageService.add({ + severity: 'success', + summary: 'Спасибо за установку!', + }); + console.log('User Accepted!!!'); } this.deferredPrompt = null; - }) + }); } checkRequestPermission() { - this.isPermissionNotifications = Notification.permission !== 'granted' ? false : true + this.isPermissionNotifications = + Notification.permission !== 'granted' ? false : true; } requestPermission() { - this.messagingService.requestPermission() - this.messagingService.receiveMessage() - this.message = this.messagingService.currentMessage - + if ('safari' in window) { + console.log('safari'); + + // var permissionData = window.safari.pushNotification.permission('web.com.example.domain'); + // $scope.checkRemotePermission(permissionData); + } else { + //FIREBASE HERE + this.messagingService.requestPermission(); + this.messagingService.receiveMessage(); + this.message = this.messagingService.currentMessage; + } } // test function - copyMessage(val: string | null){ + copyMessage(val: string | null) { const selBox = document.createElement('textarea'); selBox.style.position = 'fixed'; selBox.style.left = '0'; @@ -99,10 +124,11 @@ export class MainComponent implements OnInit { const route = this.route.snapshot.url[0]?.path; const element = document.getElementsByClassName('main-container'); if (element[0]) { - this.accountComponent = this.viewContainerRef.createComponent(AccountComponent); + this.accountComponent = + this.viewContainerRef.createComponent(AccountComponent); const domElem = (this.accountComponent.hostView as EmbeddedViewRef) .rootNodes[0] as HTMLElement; element[0].appendChild(domElem); } } -} \ No newline at end of file +} diff --git a/src/assets/download.svg b/src/assets/download.svg new file mode 100644 index 0000000..4208c63 --- /dev/null +++ b/src/assets/download.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/assets/notification.svg b/src/assets/notification.svg new file mode 100644 index 0000000..c473b2c --- /dev/null +++ b/src/assets/notification.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/index.html b/src/index.html index b698187..1c60836 100644 --- a/src/index.html +++ b/src/index.html @@ -12,6 +12,7 @@ +