Commit 26a80bf1 by Arjun

design fix

parent 1abb04f9
......@@ -11655,8 +11655,7 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"aproba": {
"version": "1.2.0",
......@@ -11699,8 +11698,7 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
......@@ -11711,8 +11709,7 @@
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -11829,8 +11826,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
......@@ -11842,7 +11838,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -11872,7 +11867,6 @@
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -11891,7 +11885,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -11985,7 +11978,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -12071,8 +12063,7 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -12108,7 +12099,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -12128,7 +12118,6 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -12172,14 +12161,12 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
}
}
},
......@@ -12702,7 +12689,6 @@
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -12721,7 +12707,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -12901,8 +12886,7 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -13008,8 +12992,7 @@
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
}
}
},
......
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{
path: '',
loadChildren: './landing/landing.module#LandingPageModule'
},
{ path: 'tabs', loadChildren: './tabs/tabs.module#TabsPageModule' },
{ path: 'login', loadChildren: './login/login.module#LoginPageModule' },
{ path: 'signup', loadChildren: './signup/signup.module#SignupPageModule' },
{
path: 'verification',
loadChildren: './verification/verification.module#VerificationPageModule'
},
{ path: 'forgot', loadChildren: './forgot/forgot.module#ForgotPageModule' },
{
path: 'changepass',
loadChildren: './changepass/changepass.module#ChangepassPageModule'
},
{
path: 'orderdelivered',
loadChildren:
'./orderdelivered/orderdelivered.module#OrderdeliveredPageModule'
},
{
path: 'orderplaced',
loadChildren: './orderplaced/orderplaced.module#OrderplacedPageModule'
},
{
path: 'ordercancelled',
loadChildren:
'./ordercancelled/ordercancelled.module#OrdercancelledPageModule'
},
{
path: 'myorder',
loadChildren: './myorder/myorder.module#MyorderPageModule'
},
{ path: 'cart', loadChildren: './cart/cart.module#CartPageModule' },
{
path: 'changedetails',
loadChildren: './changedetails/changedetails.module#ChangedetailsPageModule'
},
{
path: 'wishlist',
loadChildren: './wishlist/wishlist.module#WishlistPageModule'
},
{
path: 'addaddresss',
loadChildren: './addaddresss/addaddresss.module#AddaddresssPageModule'
},
{
path: 'profile',
loadChildren: './profile/profile.module#ProfilePageModule'
},
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
{
path: 'productlist',
loadChildren: './productlist/productlist.module#ProductlistPageModule'
},
{
path: 'productdetail',
loadChildren: './productdetail/productdetail.module#ProductdetailPageModule'
},
{
path: 'reviewlist',
loadChildren: './reviewlist/reviewlist.module#ReviewlistPageModule'
},
{
path: 'catagory',
loadChildren: './catagory/catagory.module#CatagoryPageModule'
},
{
path: 'trackorder',
loadChildren: './trackorder/trackorder.module#TrackorderPageModule'
},
{
path: 'storelist',
loadChildren: './storelist/storelist.module#StorelistPageModule'
},
{
path: 'catstorelist',
loadChildren: './catstorelist/catstorelist.module#CatStorelistPageModule'
},
{ path: 'nearby', loadChildren: './nearby/nearby.module#NearbyPageModule' },
{ path: 'review', loadChildren: './review/review.module#ReviewPageModule' },
{
path: 'delivery',
loadChildren: './delivery/delivery.module#DeliveryPageModule'
},
{
path: 'addcard',
loadChildren: './addcard/addcard.module#AddcardPageModule'
},
{
path: 'searchmodal',
loadChildren: './searchmodal/searchmodal.module#SearchmodalPageModule'
}, { path: 'noresult', loadChildren: './noresult/noresult.module#NoresultPageModule' }
const routes: Routes = [
{
path: '',
loadChildren: './landing/landing.module#LandingPageModule'
},
{ path: 'tabs', loadChildren: './tabs/tabs.module#TabsPageModule' },
{ path: 'login', loadChildren: './login/login.module#LoginPageModule' },
{ path: 'signup', loadChildren: './signup/signup.module#SignupPageModule' },
{
path: 'verification',
loadChildren: './verification/verification.module#VerificationPageModule'
},
{ path: 'forgot', loadChildren: './forgot/forgot.module#ForgotPageModule' },
{
path: 'changepass',
loadChildren: './changepass/changepass.module#ChangepassPageModule'
},
{
path: 'orderdelivered',
loadChildren:
'./orderdelivered/orderdelivered.module#OrderdeliveredPageModule'
},
{
path: 'orderplaced',
loadChildren: './orderplaced/orderplaced.module#OrderplacedPageModule'
},
{
path: 'ordercancelled',
loadChildren:
'./ordercancelled/ordercancelled.module#OrdercancelledPageModule'
},
{
path: 'myorder',
loadChildren: './myorder/myorder.module#MyorderPageModule'
},
{ path: 'cart', loadChildren: './cart/cart.module#CartPageModule' },
{
path: 'changedetails',
loadChildren: './changedetails/changedetails.module#ChangedetailsPageModule'
},
{
path: 'wishlist',
loadChildren: './wishlist/wishlist.module#WishlistPageModule'
},
{
path: 'addaddresss',
loadChildren: './addaddresss/addaddresss.module#AddaddresssPageModule'
},
{
path: 'profile',
loadChildren: './profile/profile.module#ProfilePageModule'
},
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
{
path: 'productlist',
loadChildren: './productlist/productlist.module#ProductlistPageModule'
},
{
path: 'productdetail',
loadChildren: './productdetail/productdetail.module#ProductdetailPageModule'
},
{
path: 'reviewlist',
loadChildren: './reviewlist/reviewlist.module#ReviewlistPageModule'
},
{
path: 'catagory',
loadChildren: './catagory/catagory.module#CatagoryPageModule'
},
{
path: 'trackorder',
loadChildren: './trackorder/trackorder.module#TrackorderPageModule'
},
{
path: 'storelist',
loadChildren: './storelist/storelist.module#StorelistPageModule'
},
{
path: 'catstorelist',
loadChildren: './catstorelist/catstorelist.module#CatStorelistPageModule'
},
{ path: 'nearby', loadChildren: './nearby/nearby.module#NearbyPageModule' },
{ path: 'review', loadChildren: './review/review.module#ReviewPageModule' },
{
path: 'delivery',
loadChildren: './delivery/delivery.module#DeliveryPageModule'
},
{
path: 'addcard',
loadChildren: './addcard/addcard.module#AddcardPageModule'
},
{
path: 'searchmodal',
loadChildren: './searchmodal/searchmodal.module#SearchmodalPageModule'
}
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule {}
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule {}
......
<ion-app>
<ion-split-pane>
<ion-menu>
<ion-content>
<div class="side_menu_wrapper">
<ion-menu-toggle>
<div class="top_banner">
<div class="top_image"></div>
<div class="top_detail">
<h4>John Doe</h4>
<p>[email protected]</p>
</div>
<div class="clear"></div>
</div>
</ion-menu-toggle>
<div class="sidemenu_list">
<ul>
<ion-menu-toggle>
<li (click)="vieworder('home')">Shop</li>
</ion-menu-toggle>
<li>About us</li>
<ion-menu-toggle>
<li (click)="vieworder('myorder')">View Order</li>
</ion-menu-toggle>
<ion-split-pane>
<ion-menu>
<ion-content>
<div class="side_menu_wrapper">
<ion-menu-toggle>
<div class="top_banner">
<div class="top_image">
<img src="../assets/avatar.png">
</div>
<div class="top_detail">
<h4>John Doe</h4>
<p>[email protected]</p>
</div>
<div class="clear"></div>
</div>
</ion-menu-toggle>
<div class="sidemenu_list">
<ul>
<ion-menu-toggle>
<li (click)="vieworder('home')">Shop</li>
</ion-menu-toggle>
<li>About us</li>
<ion-menu-toggle>
<li (click)="vieworder('myorder')">View Order</li>
</ion-menu-toggle>
<div class="sub_menu">
<ul *ngIf="categoryService.activecategories">
<ion-menu-toggle>
<li
*ngFor="let category of categoryService.activecategories"
(click)="goToPage('catstorelist', category)"
>
{{ category.catName }}
</li>
</ion-menu-toggle>
<!-- <li>Women's Fashion</li>
<div class="sub_menu">
<ul *ngIf="categoryService.activecategories">
<ion-menu-toggle>
<li *ngFor="let category of categoryService.activecategories" (click)="goToPage('catstorelist', category)">
{{ category.catName }}
</li>
</ion-menu-toggle>
<!-- <li>Women's Fashion</li>
<li>Features</li>
<li>Bags</li>
<li>Shoes</li>
<li>Electronics</li> -->
</ul>
</div>
<li>Complaints & Feedback</li>
<li>
<span class="floatLeft" (click)="authService.SignOut()"
>Logout</span
>
<span class="floatRight version">Version 0.1.0.2</span>
<div class="clear"></div>
</li>
</ul>
</div>
</div>
</ion-content>
</ion-menu>
<ion-router-outlet main></ion-router-outlet>
</ion-split-pane>
</ul>
</div>
<li>Complaints & Feedback</li>
<li>
<span class="floatLeft" (click)="authService.SignOut()">Logout</span>
<span class="floatRight version">Version 0.1.0.2</span>
<div class="clear"></div>
</li>
</ul>
</div>
</div>
</ion-content>
</ion-menu>
<ion-router-outlet main></ion-router-outlet>
</ion-split-pane>
</ion-app>
<div class="common_tab" [hidden]="fetchCase() === true">
<ul>
<li (click)="goToPage('home')">
<div
class="icon_sec m1_icon"
[class.m1_icon_act]="sec_active1"
(click)="setActive1()"
></div>
</li>
<li (click)="goToPage('catagory')">
<div
class="icon_sec m2_icon"
[class.m2_icon_act]="sec_active2"
(click)="setActive2()"
></div>
</li>
<li (click)="searchModal()">
<div
class="icon_sec m3_icon"
[class.m3_icon_act]="sec_active3"
(click)="setActive3()"
></div>
</li>
<!-- <li (click)="goToPage('cart')">
<ul>
<li (click)="goToPage('home')">
<div class="icon_sec m1_icon" [class.m1_icon_act]="sec_active1" (click)="setActive1()"></div>
</li>
<li (click)="goToPage('catagory')">
<div class="icon_sec m2_icon" [class.m2_icon_act]="sec_active2" (click)="setActive2()"></div>
</li>
<li (click)="searchModal()">
<div class="icon_sec m3_icon" [class.m3_icon_act]="sec_active3" (click)="setActive3()"></div>
</li>
<!-- <li (click)="goToPage('cart')">
<div class="icon_sec m4_icon" [class.m4_icon_act]="sec_active4" (click)="setActive4()"></div>
</li> -->
<li (click)="goToPage('myorder')">
<div
class="icon_sec m5_icon"
[class.m5_icon_act]="sec_active5"
(click)="setActive5()"
></div>
</li>
<li (click)="goToPage('profile')">
<div
class="icon_sec m6_icon"
[class.m6_icon_act]="sec_active6"
(click)="setActive6()"
></div>
</li>
</ul>
</div>
<li (click)="goToPage('myorder')">
<div class="icon_sec m5_icon" [class.m5_icon_act]="sec_active5" (click)="setActive5()"></div>
</li>
<li (click)="goToPage('profile')">
<div class="icon_sec m6_icon" [class.m6_icon_act]="sec_active6" (click)="setActive6()"></div>
</li>
</ul>
</div>
\ No newline at end of file
......@@ -17,7 +17,6 @@
width: 60px;
height: 60px;
float: left;
background-color: #fff;
border-radius: 50%;
img {
width: 100%;
......
......@@ -263,7 +263,7 @@
bottom: 0px;
left: 0px;
right: 0px;
padding: 20px;
padding: 20px 20px 50px 20px;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
background: #fff;
......
import { Component, OnInit, ViewChild, } from '@angular/core';
import { IonSlides } from '@ionic/angular';
import { Router, ActivatedRoute } from '@angular/router';
import { ServiceService } from './../../config/service.service';
import { SubjectService } from './../../config/subject.service';
import { Component, OnInit, ViewChild } from "@angular/core";
import { IonSlides } from "@ionic/angular";
import { Router, ActivatedRoute } from "@angular/router";
import { ServiceService } from "./../../config/service.service";
import { SubjectService } from "./../../config/subject.service";
@Component({
selector: 'app-landing',
templateUrl: './landing.page.html',
styleUrls: ['./landing.page.scss'],
selector: "app-landing",
templateUrl: "./landing.page.html",
styleUrls: ["./landing.page.scss"]
})
export class LandingPage implements OnInit {
constructor(
......@@ -15,21 +15,21 @@ export class LandingPage implements OnInit {
private route: ActivatedRoute,
private service: ServiceService,
public subjectService: SubjectService
) {
this.service.get('landing').then((data) => {
if (data === true) {
const user = JSON.parse(localStorage.getItem('user'));
console.log(user);
if (user) {
this.subjectService.sendLoginData(false);
this.goToPage('home');
} else {
this.subjectService.sendLoginData(true);
this.goToPage('login');
}
) {
this.service.get("landing").then(data => {
if (data === true) {
const user = JSON.parse(localStorage.getItem("user"));
console.log(user);
if (user) {
this.subjectService.sendLoginData(false);
this.goToPage("home");
} else {
this.subjectService.sendLoginData(true);
this.goToPage("login");
}
});
}
}
});
}
slideOpts = {
initialSlide: 0,
......@@ -37,7 +37,7 @@ export class LandingPage implements OnInit {
allowTouchMove: false
};
@ViewChild(IonSlides, { static: false })slides: IonSlides;
@ViewChild(IonSlides, { static: false }) slides: IonSlides;
currentIndex: any;
landingOptions = {
......@@ -46,16 +46,14 @@ export class LandingPage implements OnInit {
allowTouchMove: false
};
ngOnInit() {
}
ngOnInit() {}
goToPage(path, data = null) {
this.service.set('landing', true);
this.service.set("landing", true);
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
next() {
this.slides.slideNext();
}
......@@ -68,8 +66,6 @@ export class LandingPage implements OnInit {
this.slides.getActiveIndex().then(index => {
this.currentIndex = index;
console.log(this.currentIndex);
});
}
}
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 { NoresultPage } from './noresult.page';
const routes: Routes = [
{
path: '',
component: NoresultPage
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
declarations: [NoresultPage]
})
export class NoresultPageModule {}
<div class="nav_header">
<ion-menu-toggle>
<button class="nav_btn nav_menu floatLeft">
</button>
</ion-menu-toggle>
<div class="nav_title floatLeft">
<h4>Shirts</h4>
</div>
<button class="nav_btn nav_search floatRight" *ngIf="!searchShow">
</button>
<div class="clear"></div>
</div>
<ion-content>
<div class="no-result-wrapper">
<img src="../../assets/basket.png">
<h1>No result found</h1>
<button>home</button>
</div>
</ion-content>
\ No newline at end of file
.no-result-wrapper {
text-align: center;
padding-top: 40%;
img {
width: 100px;
}
h1 {
font-size: 22px;
font-weight: bolder;
text-transform: uppercase;
color: #3B394D;
}
button {
background-color: #29285b;
border-radius: 8px;
height: 50px;
width: 48%;
color: #fff;
font-size: 22px;
font-weight: lighter;
text-transform: uppercase;
margin-top: 10px;
}
}
\ No newline at end of file
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NoresultPage } from './noresult.page';
describe('NoresultPage', () => {
let component: NoresultPage;
let fixture: ComponentFixture<NoresultPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NoresultPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(NoresultPage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-noresult',
templateUrl: './noresult.page.html',
styleUrls: ['./noresult.page.scss'],
})
export class NoresultPage 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 { 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';
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";
@Injectable({
providedIn: 'root'
providedIn: "root"
})
export class AuthService {
userData: any;
......@@ -26,84 +30,97 @@ export class AuthService {
private subjectService: SubjectService,
private googlePlus: GooglePlus
) {
this.type = 1;
this.afAuth.authState.subscribe(user => {
if (user) {
this.subjectService.sendLoginData(false);
this.userData = user;
console.log(this.userData);
this.service.set('user', JSON.stringify(this.userData));
if (this.type === 1) {
this.router.navigateByUrl('home');
} else {
this.router.navigateByUrl('verification');
}
this.type = 1;
this.afAuth.authState.subscribe(user => {
if (user) {
this.subjectService.sendLoginData(false);
this.userData = user;
console.log(this.userData);
this.service.set("user", JSON.stringify(this.userData));
if (this.type === 1) {
this.router.navigateByUrl("home");
} else {
this.subjectService.sendLoginData(true);
this.service.set('user', null);
JSON.parse(localStorage.getItem('user'));
this.router.navigateByUrl('login');
this.router.navigateByUrl("verification");
}
});
} else {
this.subjectService.sendLoginData(true);
this.service.set("user", null);
JSON.parse(localStorage.getItem("user"));
this.router.navigateByUrl("login");
}
});
}
public async SignIn(email: string, password: string) {
return this.afAuth.auth.signInWithEmailAndPassword(email, password).then((result) => {
console.log('success');
document.body.scrollTop = document.documentElement.scrollTop = 0;
this.SetUserData(result.user);
}).catch((error) => {
window.alert(error.message);
});
return this.afAuth.auth
.signInWithEmailAndPassword(email, password)
.then(result => {
console.log("success");
document.body.scrollTop = document.documentElement.scrollTop = 0;
this.SetUserData(result.user);
})
.catch(error => {
window.alert(error.message);
});
}
public async verify(otp: string) {
console.log(this.userData.uid, otp);
// 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)
const custRef: AngularFirestoreCollection<any> = this.afs.collection(
"customers",
ref => ref.where("otp", "==", otp).where("uid", "==", this.userData.uid)
);
custRef.valueChanges().pipe(take(1)).subscribe((value: User[]) => {
if (value.length > 0) {
this.afs.collection('customers').doc(this.userData.uid).update({otp: ''});
this.service.set('type', 1);
this.router.navigateByUrl('nearby');
} else {
window.alert('Please input valid OTP');
}
});
custRef
.valueChanges()
.pipe(take(1))
.subscribe((value: User[]) => {
if (value.length > 0) {
this.afs
.collection("customers")
.doc(this.userData.uid)
.update({ otp: "" });
this.service.set("type", 1);
this.router.navigateByUrl("nearby");
} else {
window.alert("Please input valid OTP");
}
});
}
public async google(type: number) {
this.type = type;
// this.googlePlus.login({}).then(res => console.log(res)).catch(err => console.error(err));
this.afAuth.auth.signInWithPopup(new auth.GoogleAuthProvider()).then((result) => {
console.log('success');
console.log(result);
this.socialSignUp(result);
});
this.afAuth.auth
.signInWithPopup(new auth.GoogleAuthProvider())
.then(result => {
console.log("success");
console.log(result);
this.socialSignUp(result);
});
}
public async facebook(type: number) {
this.type = type;
this.afAuth.auth.signInWithPopup(new auth.FacebookAuthProvider()).then((result) => {
console.log('success');
console.log(result);
});
this.afAuth.auth
.signInWithPopup(new auth.FacebookAuthProvider())
.then(result => {
console.log("success");
console.log(result);
});
}
get isLoggedIn(): boolean {
const user = JSON.parse(localStorage.getItem('user'));
return(user !== null && user.emailVerified !== false) ? true : false;
const user = JSON.parse(localStorage.getItem("user"));
return user !== null && user.emailVerified !== false ? true : false;
}
SetUserData(user: any) {
const userRef: AngularFirestoreDocument<any> = this.afs.doc(`customers/${user.uid}`);
userRef.valueChanges().subscribe((value) => {
const userRef: AngularFirestoreDocument<any> = this.afs.doc(
`customers/${user.uid}`
);
userRef.valueChanges().subscribe(value => {
const userData: User = {
uid: value.uid,
emailId: value.emailId,
......@@ -116,7 +133,7 @@ export class AuthService {
currency: value.currency,
otp: value.otp,
loginType: value.loginType
};
};
console.log(userData);
});
}
......@@ -124,8 +141,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");
});
}
......@@ -133,13 +150,13 @@ 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;
const postData: User = {
const postData: User = {
uid: userData.uid,
status: true,
profilePhoto: userData.photoURL,
......@@ -154,91 +171,104 @@ export class AuthService {
};
this.userPostData = postData;
console.log(postData);
this.afs.collection('customers').doc(userData.uid).set(postData).then(() => {
console.log('successs');
});
this.afs
.collection("customers")
.doc(userData.uid)
.set(postData)
.then(() => {
console.log("successs");
});
}
signup(userData: Signup) {
this.type = 2;
console.log(userData);
const otp = Math.floor(1000 + Math.random() * 9000);
this.afAuth.auth.createUserWithEmailAndPassword(userData.emailId, userData.password).then((result) => {
console.log(result.user);
this.afAuth.auth.currentUser.sendEmailVerification();
const currencyData = {
currId: '123',
currName: 'Australian dollar',
symbol: 'A$'
};
const custData = result.user;
const postData: User = {
uid: custData.uid,
status: true,
profilePhoto: '',
phoneVerified: false,
phone: userData.phone,
name: userData.name,
emailVerified: false,
emailId: userData.emailId,
currency: currencyData,
otp: otp.toString(),
loginType: 0
};
this.userPostData = postData;
console.log(postData);
this.afs.collection('customers').doc(custData.uid).set(postData).then(() => {
console.log('successs');
this.afAuth.auth
.createUserWithEmailAndPassword(userData.emailId, userData.password)
.then(result => {
console.log(result.user);
this.afAuth.auth.currentUser.sendEmailVerification();
const currencyData = {
currId: "123",
currName: "Australian dollar",
symbol: "A$"
};
const custData = result.user;
const postData: User = {
uid: custData.uid,
status: true,
profilePhoto: "",
phoneVerified: false,
phone: userData.phone,
name: userData.name,
emailVerified: false,
emailId: userData.emailId,
currency: currencyData,
otp: otp.toString(),
loginType: 0
};
this.userPostData = postData;
console.log(postData);
this.afs
.collection("customers")
.doc(custData.uid)
.set(postData)
.then(() => {
console.log("successs");
});
})
.catch(error => {
window.alert(error.message);
});
}).catch((error) => {
window.alert(error.message);
});
}
createAddress(addressData: Address) {
console.log(addressData);
console.log(this.userData.uid);
this.afs.collection('address').add({
uid: this.userData.uid
}).then((docRef) => {
console.log(docRef);
const addrData = {
uid: this.userData.uid,
addressType: addressData.addressType,
area: addressData.area,
city: addressData.city,
country: addressData.country,
district: addressData.district,
firstAddress: addressData.firstAddress,
landmark: addressData.landmark,
zip: addressData.zip,
secondAddress: addressData.secondAddress,
state: addressData.state,
addrId: docRef.id,
default: 1
};
const neworderId = docRef.id;
console.log(addrData);
this.afs.collection('address').doc(neworderId).set(addrData).then(() => {
console.log('Address add Successfully');
this.service.set('user', JSON.stringify(this.userData));
this.router.navigateByUrl('home');
document.body.scrollTop = document.documentElement.scrollTop = 0;
this.afs
.collection("address")
.add({
uid: this.userData.uid
})
.then(docRef => {
console.log(docRef);
const addrData = {
uid: this.userData.uid,
addressType: addressData.addressType,
area: addressData.area,
city: addressData.city,
country: addressData.country,
district: addressData.district,
firstAddress: addressData.firstAddress,
landmark: addressData.landmark,
zip: addressData.zip,
secondAddress: addressData.secondAddress,
state: addressData.state,
addrId: docRef.id,
default: 1
};
const neworderId = docRef.id;
console.log(addrData);
this.afs
.collection("address")
.doc(neworderId)
.set(addrData)
.then(() => {
console.log("Address add Successfully");
this.service.set("user", JSON.stringify(this.userData));
this.router.navigateByUrl("home");
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
});
});
return false;
}
}
/*displayName: "Adarsh Techware"
email: "[email protected]"
emailVerified: true
: "https://lh4.googleusercontent.com/-h0rs2pE-Azw/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rcjNtapRhKoG09NKifQsv_lQPC_2A/photo.jpg"
: "vT498Fz6X0Z6l5l5iNn5hxfwz692"
providerData: [Gl]*/
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