Commit 7219db02 by Adarsh K

Merge branch 'arjunlatest' into 'master'

Arjunlatest See merge request !49
parents e46929e7 cf1983f6
......@@ -97,7 +97,9 @@ const routes: Routes = [
loadChildren: './searchmodal/searchmodal.module#SearchmodalPageModule'
}, { path: 'noresult', loadChildren: './noresult/noresult.module#NoresultPageModule' },
{ path: 'feedback', loadChildren: './feedback/feedback.module#FeedbackPageModule' },
{ path: 'address', loadChildren: './address/address.module#AddressPageModule' }
{ path: 'address', loadChildren: './address/address.module#AddressPageModule' },
{ path: 'success', loadChildren: './success/success.module#SuccessPageModule' },
{ path: 'failed', loadChildren: './failed/failed.module#FailedPageModule' }
];
@NgModule({
......
......@@ -9,7 +9,7 @@
<h4>CART</h4>
</div>
<button class="nav_btn floatRight">
</button>
<div class="clear"></div>
</div>
......@@ -27,6 +27,11 @@
</ul>
</div>
<div class="cart_content">
<div class="no-items-wrapper">
<img src="../../assets/noitem.png">
<h1>There is no products added</h1>
<button>Shop Now</button>
</div>
<ion-slides pager="false" [options]="cartwizard" (ionSlideDidChange)="slideChanged()">
<ion-slide>
<div class="cart_list" *ngIf="cartService.carts">
......@@ -63,9 +68,10 @@
<div class="checkout_list">
<h5>
<span class="floatLeft">ITEMS</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$ {{cartService.cartTotal}}</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$
{{cartService.cartTotal}}</span>
<div class="clear"></div>
</h5>
</h5>
<ion-grid class="p0" *ngIf="cartService.carts && cartService.carts.length > 0">
<ion-row *ngFor="let carts of cartService.carts">
<ion-col size="6" class="p0">
......@@ -89,7 +95,7 @@
<ion-row>
<ion-col class="p0">
<h6>
{{custAddress.building}},<br/> {{custAddress.landmark}},<br/> {{custAddress.address}}
{{custAddress.building}},<br /> {{custAddress.landmark}},<br /> {{custAddress.address}}
</h6>
</ion-col>
</ion-row>
......@@ -149,25 +155,29 @@
<hr>
<div class="coupon_code">
<input class="" placeholder="COUPON CODE" #promo><button class="add_btn" (click)="promoApply(promo.value)">ADD</button>
<br/>&nbsp;<h6>GET50</h6>
<br />&nbsp;
<h6>GET50</h6>
<span *ngIf="discountApplied" style="color: red">Promocode applied successfully </span>
</div>
<br/>
<br />
<h6>
<span class="floatLeft">PRODUCT COST</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$ {{cartService.cartTotal}}</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$
{{cartService.cartTotal}}</span>
<div class="clear"></div>
</h6>
<h6>
<span class="floatLeft">DELIVERY CHARGE</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$ {{getDeliveryCharge(cartService.cartTotal)}}</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$
{{getDeliveryCharge(cartService.cartTotal)}}</span>
<div class="clear"></div>
</h6>
<h6>
<span class="floatLeft">GST/TAX</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$ {{getTax(cartService.cartTotal)}}</span>
<span class="floatRight" *ngIf="cartService.cartTotal">A$
{{getTax(cartService.cartTotal)}}</span>
<div class="clear"></div>
</h6>
<h6 *ngIf="discountApplied">
......@@ -182,7 +192,8 @@
<p class="textLeft">Total Price:</p>
</ion-col>
<ion-col>
<p class="textRight" *ngIf="cartService.cartTotal">A$ {{getTotal(cartService.cartTotal)}}</p>
<p class="textRight" *ngIf="cartService.cartTotal">A$ {{getTotal(cartService.cartTotal)}}
</p>
</ion-col>
</ion-row>
</div>
......@@ -200,6 +211,7 @@
</div>
</ion-slide>
</ion-slides>
</div>
</div>
</div>
......@@ -262,5 +274,4 @@
</div>
</ion-content>
</div>
</div>
\ No newline at end of file
......@@ -403,6 +403,30 @@
font-weight: 900;
}
}
.no-items-wrapper {
text-align: center;
padding-top: 40%;
img {
width: 100px;
}
h1 {
font-size: 18px;
font-weight: bolder;
text-transform: uppercase;
color: #3B394D;
}
button {
background-color: #29285b;
border-radius: 8px;
height: 50px;
width: 48%;
color: #fff;
font-size: 18px;
font-weight: lighter;
text-transform: uppercase;
margin-top: 10px;
}
}
}
}
}
......
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { FailedPage } from './failed.page';
const routes: Routes = [
{
path: '',
component: FailedPage
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
declarations: [FailedPage]
})
export class FailedPageModule {}
<ion-content>
<div class="orderfailed-wrapper">
<div class="head">
<img src="../../assets/failed.png">
<h1>Order Failed</h1>
</div>
<div class="content">
<h1>Something went wrong</h1>
<h2>Please check your network or details you <br> provided and try again</h2>
</div>
<button>View Orders</button>
<h3>home</h3>
</div>
</ion-content>
\ No newline at end of file
.orderfailed-wrapper {
padding: 20px;
text-align: center;
.head {
img {
width: 60px;
}
h1 {
font-size: 18px;
text-transform: uppercase;
color: #29285B;
font-weight: bolder;
margin-top: 15px;
}
}
.content {
margin-top: 30px;
h1 {
color: #B0AEC7;
font-weight: bolder;
margin: 0;
font-size: 16px;
}
h2 {
color: #B0AEC7;
margin-top: 5px;
font-size: 16px;
}
}
button {
background-color: #29285b;
border-radius: 8px;
height: 50px;
width: 48%;
color: #fff;
font-size: 18px;
font-weight: lighter;
text-transform: uppercase;
margin-top: 25px;
margin-bottom: 50px;
}
h3 {
color: #29285b;
background: none;
font-size: 20px;
font-weight: bolder;
text-transform: uppercase;
margin-top: 50px;
margin-bottom: 50px;
}
}
\ No newline at end of file
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FailedPage } from './failed.page';
describe('FailedPage', () => {
let component: FailedPage;
let fixture: ComponentFixture<FailedPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FailedPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(FailedPage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-failed',
templateUrl: './failed.page.html',
styleUrls: ['./failed.page.scss'],
})
export class FailedPage implements OnInit {
constructor() { }
ngOnInit() {
}
}
<div class="nav_header">
<button class="nav_btn nav_back floatLeft" (click)="goBack()">
<button class="nav_btn nav_back floatLeft" (click)="goBack()">
<img src="../assets/Group17_2.png" />
</button>
<div class="nav_title floatLeft">
<input
class="search_bar"
placeholder="Search here.. eg:shirts, retailers etc..."
(click)="clickSearch()"
/>
</div>
<button
class="nav_btn nav_search floatRight"
*ngIf="!searchShow"
(click)="clickSearch()"
></button>
<button
class="nav_btn nav_close floatRight"
*ngIf="searchShow"
(click)="searchClose()"
></button>
<div class="clear"></div>
<div class="nav_title floatLeft">
<input class="search_bar" placeholder="Search here.. eg:shirts, retailers etc..." (click)="clickSearch()" />
</div>
<button class="nav_btn nav_search floatRight" *ngIf="!searchShow" (click)="clickSearch()"></button>
<button class="nav_btn nav_close floatRight" *ngIf="searchShow" (click)="searchClose()"></button>
<div class="clear"></div>
</div>
<ion-content>
<div class="product_list">
<div class="product_taskbar">
<div class="filter floatLeft" (click)="istoggle()"></div>
<div class="viewset floatRight">
<div
class="grid_view grid_act floatRight"
(click)="gridToggle()"
[class.line_view]="onGrid"
></div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="product_title" *ngIf="data">
{{data.shopName}}
</div>
<ul
[class.grid_view]="onGrid"
*ngIf="prodService.product && prodService.product.length > 0"
>
<li *ngFor="let product of prodService.product; let i = index">
<div class="product_image">
<img
[src]="product.image"
onerror="this.src='../assets/[email protected]'"
(click)="prodDetails(i)"
/>
<div
[ngClass]="checkFavStatus(product.prodId)"
(click)="changeFav(product.prodId)"
></div>
<div class="featured_badge" *ngIf="product.featured">Featured</div>
<div class="product_list">
<div class="product_taskbar">
<div class="filter floatLeft" (click)="istoggle()">
</div>
<div class="viewset floatRight">
<div class="grid_view grid_act floatRight" (click)="gridToggle()" [class.line_view]="onGrid">
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="product_title" *ngIf="data">
{{data.shopName}}
</div>
<h5 class="ellipse" (click)="prodDetails(i)">{{product.prodName}}</h5>
<p (click)="prodDetails(i)">
A$ {{product.price}}<span class="offer" *ngIf="product.discount > 0"
>-{{product.discount}}%</span
<ul [class.grid_view]="onGrid" *ngIf="prodService.product && prodService.product.length > 0">
<li *ngFor="let product of prodService.product; let i = index">
<div class="product_image">
<div class="load-back">
<img [src]="product.image" onerror="this.src='../assets/[email protected]'" (click)="prodDetails(i)">
</div>
<div [ngClass]="checkFavStatus(product.prodId)" (click)="changeFav(product.prodId)">
</div>
<div class="featured_badge" *ngIf="product.featured">Featured</div>
</div>
<h5 class="ellipse" (click)="prodDetails(i)">{{product.prodName}}</h5>
<p (click)="prodDetails(i)">A$ {{product.price}}<span class="offer" *ngIf="product.discount > 0">-{{product.discount}}%</span></p>
</li>
</ul>
</div>
<ul [class.grid_view]="onGrid" *ngIf="prodService.product && prodService.product.length > 0">
<li *ngFor="let product of prodService.product; let i = index">
<div class="product_image">
<img [src]="product.image" onerror="this.src='../assets/[email protected]'" (click)="prodDetails(i)" />
<div [ngClass]="checkFavStatus(product.prodId)" (click)="changeFav(product.prodId)"></div>
<div class="featured_badge" *ngIf="product.featured">Featured</div>
</div>
<h5 class="ellipse" (click)="prodDetails(i)">{{product.prodName}}</h5>
<p (click)="prodDetails(i)">
A$ {{product.price}}<span class="offer" *ngIf="product.discount > 0">-{{product.discount}}%</span
>
</p>
</li>
......@@ -114,12 +106,7 @@
</div>
</ion-content>
<div class="search_item_list" *ngIf="searchShow" [@slideInOut]>
<ul *ngIf="searchService.searchList">
<li
*ngFor="let search of searchService.searchList"
(click)="viewPage(search)"
>
{{search.text}}
</li>
</ul>
</div>
<ul *ngIf="searchService.searchList">
<li *ngFor="let search of searchService.searchList" (click)="viewPage(search)">{{search.text}}</li>
</ul>
</div>
\ No newline at end of file
......@@ -256,4 +256,11 @@
}
}
}
}
.load-back {
height: 100%;
width: 100%;
background-image: url("../../assets/giphy.gif");
background-position: center;
}
\ No newline at end of file
<div class="nav_header">
<ion-menu-toggle>
<button class="nav_btn nav_menu floatLeft"></button>
</ion-menu-toggle>
<div class="nav_title floatLeft">
<img src="../../assets/Group [email protected]" />
</div>
<div class="clear"></div>
<ion-menu-toggle>
<button class="nav_btn nav_menu floatLeft"></button>
</ion-menu-toggle>
<div class="nav_title floatLeft">
<img src="../../assets/Group [email protected]" />
</div>
<div class="clear"></div>
</div>
<ion-content>
<div class="profile_wrapper" *ngIf="loggedUser">
<div class="profile_banner">
<!-- <div class="profile_circle">
<div class="profile_wrapper" *ngIf="loggedUser">
<div class="profile_banner">
<!-- <div class="profile_circle">
<div class="edit"></div>
</div> -->
<div class="profile_circle">
<img
[src]="loggedUser.profilePhoto"
onerror="this.src='./../../assets/profile_banner.png'"
/>
<div class="edit"></div>
<input type="file" accept="image/*" (change)="fileChange($event)" />
</div>
<div class="profile_circle">
<img [src]="loggedUser.profilePhoto" onerror="this.src='./../../assets/profile_banner.png'" />
<div class="edit"></div>
<input type="file" accept="image/*" (change)="fileChange($event)" />
</div>
<h5>{{loggedUser.name}}</h5>
<p (click)="istoggle()">LOGOUT</p>
</div>
<div class="account_wrapper">
<div class="account_header">
<h5 class="floatLeft">ACCOUNT INFORMATION</h5>
<span
class="floatRight"
(click)="goToPage('changedetails', user && user)"
><img src="../../assets/edit.png"
/></span>
<div class="clear"></div>
</div>
<div class="row">
<ion-row>
<ion-col class="textLeft p0">
<p>
Phone
<span *ngIf="loggedUser.phoneVerified == true">Verified</span>
<span *ngIf="loggedUser.phoneVerified == false"
>Not Verified yet</span
>
</p>
</ion-col>
<ion-col class="textRight p0">
<h6>{{loggedUser.phone}}</h6>
</ion-col>
</ion-row>
</div>
<div class="row">
<ion-row>
<ion-col class="textLeft p0">
<p>
Email<span *ngIf="userData && userData.emailVerified == true"
>Verified</span
>
<span *ngIf="loggedUser.emailVerified == false"
>Not Verified yet</span
>
</p>
</ion-col>
<ion-col class="textRight p0">
<h6>{{loggedUser.emailId}}</h6>
</ion-col>
</ion-row>
</div>
<hr />
<ion-row>
<ion-col class="textLeft p0">
<p>Wishlist</p>
</ion-col>
<ion-col class="textRight p0" (click)="goToPage('wishlist')">
<h6>(3)</h6>
</ion-col>
</ion-row>
<hr />
<ion-row>
<ion-col class="textLeft p0">
<p>Address</p>
</ion-col>
<ion-col class="textRight p0" (click)="goToPage('address')">
<h6 *ngIf="addressService.addList">
({{addressService.addressList.length}})
</h6>
</ion-col>
</ion-row>
<hr />
<!-- <ion-row>
<ion-col class="textLeft p0">
<p>My Cards</p>
</ion-col>
<ion-col class="textRight p0" (click)="goToPage('addcard')">
<h6>
<ion-icon name="arrow-forward"></ion-icon>
</h6>
</ion-col>
</ion-row>
<hr /> -->
<ion-row>
<ion-col class="textLeft p0">
<p>My Order</p>
</ion-col>
<ion-col class="textRight p0" (click)="goToPage('myorder')">
<h6>
<ion-icon name="arrow-forward"></ion-icon>
</h6>
</ion-col>
</ion-row>
<hr />
<ion-row>
<ion-col class="textLeft p0">
<p>Currency</p>
</ion-col>
<ion-col class="textRight p0">
<h6>
<span>AUD</span>
</h6>
</ion-col>
</ion-row>
</div>
</div>
<div class="logout-pop-wrapper" *ngIf="isShow" [@slideInOut]>
<div class="logout_inner">
<h4>Logout</h4>
<p>Are you sure to Logout ?</p>
<div class="logout_footer">
<button class="btn-cancel floatLeft" (click)="istoggle();">
Cancel
</button>
<button
class="btn-logout floatRight"
(click)="authService.SignOut(); istoggle()"
>
Logout
</button>
<h5>{{loggedUser.name}}</h5>
<p (click)="istoggle()">LOGOUT</p>
</div>
<div class="account_wrapper">
<div class="account_header">
<h5 class="floatLeft">ACCOUNT INFORMATION</h5>
<span class="floatRight" (click)="goToPage('changedetails', user && user)"><img
src="../../assets/edit.png" /></span>
<div class="clear"></div>
</div>
<div class="row">
<ion-row>
<ion-col class="textLeft p0">
<p>
Phone
<span *ngIf="loggedUser.phoneVerified == true">Verified</span>
<span *ngIf="loggedUser.phoneVerified == false">Not Verified yet</span>
</p>
</ion-col>
<ion-col class="textRight p0">
<h6>{{loggedUser.phone}}</h6>
</ion-col>
</ion-row>
</div>
<div class="row">
<ion-row>
<ion-col class="textLeft p0">
<p>
Email<span *ngIf="userData && userData.emailVerified == true">Verified</span>
<span *ngIf="loggedUser.emailVerified == false">Not Verified yet</span>
</p>
</ion-col>
<ion-col class="textRight p0">
<h6>{{loggedUser.emailId}}</h6>
</ion-col>
</ion-row>
</div>
<hr />
<ion-row>
<ion-col class="textLeft p0">
<p>Wishlist</p>
</ion-col>
<ion-col class="textRight p0">
<h6>(3)</h6>
</ion-col>
</ion-row>
<hr />
<ion-row>
<ion-col class="textLeft p0">
<p>Address</p>
</ion-col>
<ion-col class="textRight p0">
<h6>(1)</h6>
</ion-col>
</ion-row>
<hr />
<ion-row>
<ion-col class="textLeft p0">
<p>My Cards</p>
</ion-col>
<ion-col class="textRight p0">
<h6>
<ion-icon name="arrow-forward"></ion-icon>
</h6>
</ion-col>
</ion-row>
<hr />
<ion-row>
<ion-col class="textLeft p0">
<p>My Order</p>
</ion-col>
<ion-col class="textRight p0" (click)="goToPage('myorder')">
<h6>
<ion-icon name="arrow-forward"></ion-icon>
</h6>
</ion-col>
</ion-row>
<hr />
<ion-row>
<ion-col class="textLeft p0">
<p>Currency</p>
</ion-col>
<ion-col class="textRight p0">
<h6>
<span>AUD</span>
</h6>
</ion-col>
</ion-row>
</div>
<div class="logout-pop-wrapper" *ngIf="isShow" [@slideInOut]>
<div class="logout_inner">
<h4>Logout</h4>
<p>Are you sure to Logout ?</p>
<div class="logout_footer">
<button class="btn-cancel floatLeft" (click)="istoggle();">
Cancel
</button>
<button class="btn-logout floatRight" (click)="authService.SignOut(); istoggle()">
Logout
</button>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</ion-content>
</ion-content>
\ No newline at end of file
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { SuccessPage } from './success.page';
const routes: Routes = [
{
path: '',
component: SuccessPage
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
declarations: [SuccessPage]
})
export class SuccessPageModule {}
<ion-content>
<div class="success_wrapper">
<div class="cart_head">
<div class="cart_menu_header">
<ul>
<li class="textCenter active">CART</li>
<li class="textCenter">
<hr>
</li>
<li class="textCenter">CHECKOUT</li>
<li class="textCenter">
<hr>
</li>
<li class="textCenter">FINISH</li>
</ul>
</div>
<div class="success-set">
<img src="../../assets/white_tick.png">
<h1>Order is placed</h1>
<h2>June 26th 2019, 03:00 PM</h2>
</div>
</div>
<div class="product-countdown">
<h1>The product will be delivered in</h1>
<h2>00:59<span>30</span></h2>
<button>View Orders</button>
<h3>home</h3>
</div>
</div>
</ion-content>
\ No newline at end of file
.success_wrapper {
width: 100%;
.cart_head {
width: 100%;
height: auto;
background-image: url("../../assets/[email protected]");
background-position: center bottom;
background-repeat: no-repeat;
background-size: cover;
padding-bottom: 35px;
.nav_header {
position: static;
background-color: transparent;
.nav_title {
h4 {
color: #FFF;
}
}
}
.cart_menu_header {
padding: 50px 20px 20px 20px;
ul {
margin: 0px;
padding: 10px;
background-color: rgba(273, 273, 273, 0.1);
border-radius: 10px;
li {
list-style: none;
color: #FFF;
width: 20%;
display: inline-block;
font-weight: 700;
font-size: 13px;
hr {
height: 0px;
border-top: none;
width: 90%;
margin-top: 0px;
margin-bottom: 0px;
position: relative;
margin: 0 auto;
border-bottom: 2px dashed rgba(176, 174, 199, 1);
bottom: 4px;
}
}
}
}
.success-set {
text-align: center;
margin-top: 50px;
img {
width: 75px;
}
h1 {
color: #fff;
font-size: 18px;
font-weight: bolder;
margin-top: 5px;
margin-bottom: 0;
text-transform: uppercase;
}
h2 {
color: #fff;
font-size: 12px;
font-weight: lighter;
margin-top: 2px;
}
}
}
.product-countdown {
padding: 20px;
text-align: center;
margin-top: 25px;
h1 {
color: #B0AEC7;
font-size: 16px;
margin-top: 10px;
}
h2 {
color: #3B394D;
font-size: 40px;
font-weight: bolder;
margin-top: 15px;
span {
font-size: 16px;
font-weight: lighter;
}
}
button {
background-color: #29285b;
border-radius: 8px;
height: 50px;
width: 48%;
color: #fff;
font-size: 18px;
font-weight: lighter;
text-transform: uppercase;
margin-top: 25px;
margin-bottom: 50px;
}
h3 {
color: #29285b;
background: none;
font-size: 20px;
font-weight: bolder;
text-transform: uppercase;
margin-top: 20px;
margin-bottom: 50px;
}
}
}
@media only screen and (max-width: 350px) {
.cart_head {
padding-bottom: 15px !important;
.cart_menu_header {
padding: 20px !important;
ul {
li {
font-size: 12px !important;
}
}
}
.success-set {
margin-top: 0 !important;
}
}
}
\ No newline at end of file
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SuccessPage } from './success.page';
describe('SuccessPage', () => {
let component: SuccessPage;
let fixture: ComponentFixture<SuccessPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SuccessPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SuccessPage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-success',
templateUrl: './success.page.html',
styleUrls: ['./success.page.scss'],
})
export class SuccessPage implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { Injectable } from '@angular/core';
import { User, Signup, Address } from './services/user';
import { auth } from 'firebase/app';
import { Router, ActivatedRoute } from '@angular/router';
import { AngularFireAuth } from '@angular/fire/auth';
import { Injectable } from "@angular/core";
import { User, Signup, Address } from "./services/user";
import { auth } from "firebase/app";
import { Router, ActivatedRoute } from "@angular/router";
import { AngularFireAuth } from "@angular/fire/auth";
import {
AngularFirestore,
AngularFirestoreDocument,
AngularFirestoreCollection
} from '@angular/fire/firestore';
import { ServiceService } from './../config/service.service';
import { SubjectService } from './../config/subject.service';
import { GooglePlus } from '@ionic-native/google-plus/ngx';
import { take } from 'rxjs/operators';
import { from } from 'rxjs';
} from "@angular/fire/firestore";
import { ServiceService } from "./../config/service.service";
import { SubjectService } from "./../config/subject.service";
import { GooglePlus } from "@ionic-native/google-plus/ngx";
import { take } from "rxjs/operators";
import { from } from "rxjs";
@Injectable({
providedIn: 'root'
providedIn: "root"
})
export class AuthService {
constructor(
......@@ -32,24 +32,24 @@ export class AuthService {
this.subjectService.sendLoginData(false);
this.userData = user;
console.log(this.userData);
this.service.set('user', JSON.stringify(this.userData));
this.service.set("user", JSON.stringify(this.userData));
this.SetUserData(user);
if (this.type === 1) {
this.router.navigateByUrl('home');
this.router.navigateByUrl("home");
} else {
this.router.navigateByUrl('verification');
this.router.navigateByUrl("verification");
}
} else {
this.subjectService.sendLoginData(true);
this.service.set('user', null);
JSON.parse(localStorage.getItem('user'));
this.router.navigateByUrl('login');
this.service.set("user", null);
JSON.parse(localStorage.getItem("user"));
this.router.navigateByUrl("login");
}
});
}
get isLoggedIn(): boolean {
const user = JSON.parse(localStorage.getItem('user'));
const user = JSON.parse(localStorage.getItem("user"));
return user !== null && user.emailVerified !== false ? true : false;
}
userData: any;
......@@ -62,7 +62,7 @@ export class AuthService {
return this.afAuth.auth
.signInWithEmailAndPassword(email, password)
.then(result => {
console.log('success');
console.log("success");
document.body.scrollTop = document.documentElement.scrollTop = 0;
this.SetUserData(result.user);
})
......@@ -76,8 +76,8 @@ export class AuthService {
// tslint:disable-next-line:radix
// const otpnew = parseInt(otp);
const custRef: AngularFirestoreCollection<any> = this.afs.collection(
'customers',
ref => ref.where('otp', '==', otp).where('uid', '==', this.userData.uid)
"customers",
ref => ref.where("otp", "==", otp).where("uid", "==", this.userData.uid)
);
custRef
.valueChanges()
......@@ -85,20 +85,20 @@ export class AuthService {
.subscribe((value: User[]) => {
if (value.length > 0) {
this.afs
.collection('customers')
.collection("customers")
.doc(this.userData.uid)
.update({ otp: '', phoneVerified: true });
this.service.set('type', 1);
this.router.navigateByUrl('nearby');
.update({ otp: "", phoneVerified: true });
this.service.set("type", 1);
this.router.navigateByUrl("nearby");
} else {
window.alert('Please input valid OTP');
window.alert("Please input valid OTP");
}
});
}
profilePic(pic) {
this.afs
.collection('customers')
.collection("customers")
.doc(this.userData.uid)
.update({ profilePhoto: pic });
}
......@@ -109,7 +109,7 @@ export class AuthService {
this.afAuth.auth
.signInWithPopup(new auth.GoogleAuthProvider())
.then(result => {
console.log('success');
console.log("success");
console.log(result.additionalUserInfo.isNewUser);
if (
result.additionalUserInfo &&
......@@ -125,7 +125,7 @@ export class AuthService {
this.afAuth.auth
.signInWithPopup(new auth.FacebookAuthProvider())
.then(result => {
console.log('success');
console.log("success");
console.log(result);
});
}
......@@ -149,7 +149,7 @@ export class AuthService {
loginType: value.loginType
};
this.loggedUser = userData;
this.service.set('userData', JSON.stringify(this.loggedUser));
this.service.set("userData", JSON.stringify(this.loggedUser));
this.subjectService.sendUserData(JSON.stringify(this.loggedUser));
console.log(this.loggedUser);
});
......@@ -158,8 +158,8 @@ export class AuthService {
public async SignOut() {
return this.afAuth.auth.signOut().then(() => {
this.subjectService.sendLoginData(true);
this.service.remove('user');
console.log('logout');
this.service.remove("user");
console.log("logout");
});
}
......@@ -167,9 +167,9 @@ export class AuthService {
this.type = 2;
console.log(userData.user);
const currencyData = {
currId: '123',
currName: 'Australian dollar',
symbol: 'A$'
currId: "123",
currName: "Australian dollar",
symbol: "A$"
};
const otp = Math.floor(1000 + Math.random() * 9000);
userData = userData.user;
......@@ -189,11 +189,11 @@ export class AuthService {
this.userPostData = postData;
console.log(postData);
this.afs
.collection('customers')
.collection("customers")
.doc(userData.uid)
.set(postData)
.then(() => {
console.log('successs');
console.log("successs");
});
}
......@@ -207,15 +207,15 @@ export class AuthService {
console.log(result.user);
this.afAuth.auth.currentUser.sendEmailVerification();
const currencyData = {
currId: '123',
currName: 'Australian dollar',
symbol: 'A$'
currId: "123",
currName: "Australian dollar",
symbol: "A$"
};
const custData = result.user;
const postData: User = {
uid: custData.uid,
status: true,
profilePhoto: '',
profilePhoto: "",
phoneVerified: false,
phone: userData.phone,
name: userData.name,
......@@ -228,11 +228,11 @@ export class AuthService {
this.userPostData = postData;
console.log(postData);
this.afs
.collection('customers')
.collection("customers")
.doc(custData.uid)
.set(postData)
.then(() => {
console.log('successs');
console.log("successs");
});
})
.catch(error => {
......@@ -245,7 +245,7 @@ export class AuthService {
console.log(this.userData.uid);
this.afs
.collection('address')
.collection("address")
.add({
uid: this.userData.uid
})
......@@ -269,13 +269,13 @@ export class AuthService {
const neworderId = docRef.id;
console.log(addrData);
this.afs
.collection('address')
.collection("address")
.doc(neworderId)
.set(addrData)
.then(() => {
console.log('Address add Successfully');
this.service.set('user', JSON.stringify(this.userData));
this.router.navigateByUrl('home');
console.log("Address add Successfully");
this.service.set("user", JSON.stringify(this.userData));
this.router.navigateByUrl("home");
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
});
......
......@@ -416,6 +416,10 @@ app-deliverypop {
padding: 0px !important;
}
app-success {
padding: 0px !important;
}
.nav_header {
position: fixed;
top: 0px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment