design fix
Showing
<ion-app> | <ion-app> | ||
<ion-split-pane> | <ion-split-pane> | ||
<ion-menu> | <ion-menu> | ||
<ion-content> | <ion-content> | ||
<div class="side_menu_wrapper"> | <div class="side_menu_wrapper"> | ||
<ion-menu-toggle> | <ion-menu-toggle> | ||
<div class="top_banner"> | <div class="top_banner"> | ||
<div class="top_image"></div> | <div class="top_image"> | ||
<div class="top_detail"> | <img src="../assets/avatar.png"> | ||
<h4>John Doe</h4> | </div> | ||
<p>[email protected]</p> | <div class="top_detail"> | ||
</div> | <h4>John Doe</h4> | ||
<div class="clear"></div> | <p>[email protected]</p> | ||
</div> | </div> | ||
</ion-menu-toggle> | <div class="clear"></div> | ||
<div class="sidemenu_list"> | </div> | ||
<ul> | </ion-menu-toggle> | ||
<ion-menu-toggle> | <div class="sidemenu_list"> | ||
<li (click)="vieworder('home')">Shop</li> | <ul> | ||
</ion-menu-toggle> | <ion-menu-toggle> | ||
<li>About us</li> | <li (click)="vieworder('home')">Shop</li> | ||
<ion-menu-toggle> | </ion-menu-toggle> | ||
<li (click)="vieworder('myorder')">View Order</li> | <li>About us</li> | ||
</ion-menu-toggle> | <ion-menu-toggle> | ||
<li (click)="vieworder('myorder')">View Order</li> | |||
</ion-menu-toggle> | |||
<div class="sub_menu"> | <div class="sub_menu"> | ||
<ul *ngIf="categoryService.activecategories"> | <ul *ngIf="categoryService.activecategories"> | ||
<ion-menu-toggle> | <ion-menu-toggle> | ||
<li | <li *ngFor="let category of categoryService.activecategories" (click)="goToPage('catstorelist', category)"> | ||
*ngFor="let category of categoryService.activecategories" | {{ category.catName }} | ||
(click)="goToPage('catstorelist', category)" | </li> | ||
> | </ion-menu-toggle> | ||
{{ category.catName }} | <!-- <li>Women's Fashion</li> | ||
</li> | |||
</ion-menu-toggle> | |||
<!-- <li>Women's Fashion</li> | |||
<li>Features</li> | <li>Features</li> | ||
<li>Bags</li> | <li>Bags</li> | ||
<li>Shoes</li> | <li>Shoes</li> | ||
<li>Electronics</li> --> | <li>Electronics</li> --> | ||
</ul> | </ul> | ||
</div> | </div> | ||
<li>Complaints & Feedback</li> | <li>Complaints & Feedback</li> | ||
<li> | <li> | ||
<span class="floatLeft" (click)="authService.SignOut()" | <span class="floatLeft" (click)="authService.SignOut()">Logout</span> | ||
>Logout</span | <span class="floatRight version">Version 0.1.0.2</span> | ||
> | <div class="clear"></div> | ||
<span class="floatRight version">Version 0.1.0.2</span> | </li> | ||
<div class="clear"></div> | </ul> | ||
</li> | </div> | ||
</ul> | </div> | ||
</div> | </ion-content> | ||
</div> | </ion-menu> | ||
</ion-content> | <ion-router-outlet main></ion-router-outlet> | ||
</ion-menu> | </ion-split-pane> | ||
<ion-router-outlet main></ion-router-outlet> | |||
</ion-split-pane> | |||
</ion-app> | </ion-app> | ||
<div class="common_tab" [hidden]="fetchCase() === true"> | <div class="common_tab" [hidden]="fetchCase() === true"> | ||
<ul> | <ul> | ||
<li (click)="goToPage('home')"> | <li (click)="goToPage('home')"> | ||
<div | <div class="icon_sec m1_icon" [class.m1_icon_act]="sec_active1" (click)="setActive1()"></div> | ||
class="icon_sec m1_icon" | </li> | ||
[class.m1_icon_act]="sec_active1" | <li (click)="goToPage('catagory')"> | ||
(click)="setActive1()" | <div class="icon_sec m2_icon" [class.m2_icon_act]="sec_active2" (click)="setActive2()"></div> | ||
></div> | </li> | ||
</li> | <li (click)="searchModal()"> | ||
<li (click)="goToPage('catagory')"> | <div class="icon_sec m3_icon" [class.m3_icon_act]="sec_active3" (click)="setActive3()"></div> | ||
<div | </li> | ||
class="icon_sec m2_icon" | <!-- <li (click)="goToPage('cart')"> | ||
[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> | <div class="icon_sec m4_icon" [class.m4_icon_act]="sec_active4" (click)="setActive4()"></div> | ||
</li> --> | </li> --> | ||
<li (click)="goToPage('myorder')"> | <li (click)="goToPage('myorder')"> | ||
<div | <div class="icon_sec m5_icon" [class.m5_icon_act]="sec_active5" (click)="setActive5()"></div> | ||
class="icon_sec m5_icon" | </li> | ||
[class.m5_icon_act]="sec_active5" | <li (click)="goToPage('profile')"> | ||
(click)="setActive5()" | <div class="icon_sec m6_icon" [class.m6_icon_act]="sec_active6" (click)="setActive6()"></div> | ||
></div> | </li> | ||
</li> | </ul> | ||
<li (click)="goToPage('profile')"> | </div> | ||
<div | \ No newline at end of file | ||
class="icon_sec m6_icon" | |||
[class.m6_icon_act]="sec_active6" | |||
(click)="setActive6()" | |||
></div> | |||
</li> | |||
</ul> | |||
</div> |
src/app/noresult/noresult.module.ts
0 → 100644
src/app/noresult/noresult.page.html
0 → 100644
src/app/noresult/noresult.page.scss
0 → 100644
src/app/noresult/noresult.page.spec.ts
0 → 100644
src/app/noresult/noresult.page.ts
0 → 100644
src/assets/avatar.png
0 → 100644
26.5 KB
src/assets/basket.png
0 → 100644
9.86 KB
import { Injectable } from '@angular/core'; | import { Injectable } from "@angular/core"; | ||
import { User, Signup, Address } from './services/user'; | import { User, Signup, Address } from "./services/user"; | ||
import { auth } from 'firebase/app'; | import { auth } from "firebase/app"; | ||
import { Router, ActivatedRoute } from '@angular/router'; | import { Router, ActivatedRoute } from "@angular/router"; | ||
import { AngularFireAuth } from '@angular/fire/auth'; | import { AngularFireAuth } from "@angular/fire/auth"; | ||
import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection } from '@angular/fire/firestore'; | import { | ||
import { ServiceService } from './../config/service.service'; | AngularFirestore, | ||
import { SubjectService } from './../config/subject.service'; | AngularFirestoreDocument, | ||
import { GooglePlus } from '@ionic-native/google-plus/ngx'; | AngularFirestoreCollection | ||
import { take } from 'rxjs/operators'; | } from "@angular/fire/firestore"; | ||
import { from } from 'rxjs'; | 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({ | @Injectable({ | ||
providedIn: 'root' | providedIn: "root" | ||
}) | }) | ||
export class AuthService { | export class AuthService { | ||
userData: any; | userData: any; | ||
... | @@ -26,84 +30,97 @@ export class AuthService { | ... | @@ -26,84 +30,97 @@ export class AuthService { |
private subjectService: SubjectService, | private subjectService: SubjectService, | ||
private googlePlus: GooglePlus | private googlePlus: GooglePlus | ||
) { | ) { | ||
this.type = 1; | this.type = 1; | ||
this.afAuth.authState.subscribe(user => { | this.afAuth.authState.subscribe(user => { | ||
if (user) { | if (user) { | ||
this.subjectService.sendLoginData(false); | this.subjectService.sendLoginData(false); | ||
this.userData = user; | this.userData = user; | ||
console.log(this.userData); | console.log(this.userData); | ||
this.service.set('user', JSON.stringify(this.userData)); | this.service.set("user", JSON.stringify(this.userData)); | ||
if (this.type === 1) { | if (this.type === 1) { | ||
this.router.navigateByUrl('home'); | this.router.navigateByUrl("home"); | ||
} else { | |||
this.router.navigateByUrl('verification'); | |||
} | |||
} else { | } else { | ||
this.subjectService.sendLoginData(true); | this.router.navigateByUrl("verification"); | ||
this.service.set('user', null); | |||
JSON.parse(localStorage.getItem('user')); | |||
this.router.navigateByUrl('login'); | |||
} | } | ||
}); | } 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) { | public async SignIn(email: string, password: string) { | ||
return this.afAuth.auth.signInWithEmailAndPassword(email, password).then((result) => { | return this.afAuth.auth | ||
console.log('success'); | .signInWithEmailAndPassword(email, password) | ||
document.body.scrollTop = document.documentElement.scrollTop = 0; | .then(result => { | ||
this.SetUserData(result.user); | console.log("success"); | ||
}).catch((error) => { | document.body.scrollTop = document.documentElement.scrollTop = 0; | ||
window.alert(error.message); | this.SetUserData(result.user); | ||
}); | }) | ||
.catch(error => { | |||
window.alert(error.message); | |||
}); | |||
} | } | ||
public async verify(otp: string) { | public async verify(otp: string) { | ||
console.log(this.userData.uid, otp); | console.log(this.userData.uid, otp); | ||
// tslint:disable-next-line:radix | // tslint:disable-next-line:radix | ||
// const otpnew = parseInt(otp); | // const otpnew = parseInt(otp); | ||
const custRef: AngularFirestoreCollection<any> = this.afs.collection('customers', ref => ref.where('otp', '==', otp) | const custRef: AngularFirestoreCollection<any> = this.afs.collection( | ||
.where('uid', '==', this.userData.uid) | "customers", | ||
ref => ref.where("otp", "==", otp).where("uid", "==", this.userData.uid) | |||
); | ); | ||
custRef.valueChanges().pipe(take(1)).subscribe((value: User[]) => { | custRef | ||
if (value.length > 0) { | .valueChanges() | ||
this.afs.collection('customers').doc(this.userData.uid).update({otp: ''}); | .pipe(take(1)) | ||
this.service.set('type', 1); | .subscribe((value: User[]) => { | ||
this.router.navigateByUrl('nearby'); | if (value.length > 0) { | ||
} else { | this.afs | ||
window.alert('Please input valid OTP'); | .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) { | public async google(type: number) { | ||
this.type = type; | this.type = type; | ||
// this.googlePlus.login({}).then(res => console.log(res)).catch(err => console.error(err)); | // this.googlePlus.login({}).then(res => console.log(res)).catch(err => console.error(err)); | ||
this.afAuth.auth.signInWithPopup(new auth.GoogleAuthProvider()).then((result) => { | this.afAuth.auth | ||
console.log('success'); | .signInWithPopup(new auth.GoogleAuthProvider()) | ||
console.log(result); | .then(result => { | ||
this.socialSignUp(result); | console.log("success"); | ||
}); | console.log(result); | ||
this.socialSignUp(result); | |||
}); | |||
} | } | ||
public async facebook(type: number) { | public async facebook(type: number) { | ||
this.type = type; | this.type = type; | ||
this.afAuth.auth.signInWithPopup(new auth.FacebookAuthProvider()).then((result) => { | this.afAuth.auth | ||
console.log('success'); | .signInWithPopup(new auth.FacebookAuthProvider()) | ||
console.log(result); | .then(result => { | ||
}); | console.log("success"); | ||
console.log(result); | |||
}); | |||
} | } | ||
get isLoggedIn(): boolean { | 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; | return user !== null && user.emailVerified !== false ? true : false; | ||
} | } | ||
SetUserData(user: any) { | SetUserData(user: any) { | ||
const userRef: AngularFirestoreDocument<any> = this.afs.doc( | |||
const userRef: AngularFirestoreDocument<any> = this.afs.doc(`customers/${user.uid}`); | `customers/${user.uid}` | ||
userRef.valueChanges().subscribe((value) => { | ); | ||
userRef.valueChanges().subscribe(value => { | |||
const userData: User = { | const userData: User = { | ||
uid: value.uid, | uid: value.uid, | ||
emailId: value.emailId, | emailId: value.emailId, | ||
... | @@ -116,7 +133,7 @@ export class AuthService { | ... | @@ -116,7 +133,7 @@ export class AuthService { |
currency: value.currency, | currency: value.currency, | ||
otp: value.otp, | otp: value.otp, | ||
loginType: value.loginType | loginType: value.loginType | ||
}; | }; | ||
console.log(userData); | console.log(userData); | ||
}); | }); | ||
} | } | ||
... | @@ -124,8 +141,8 @@ export class AuthService { | ... | @@ -124,8 +141,8 @@ export class AuthService { |
public async SignOut() { | public async SignOut() { | ||
return this.afAuth.auth.signOut().then(() => { | return this.afAuth.auth.signOut().then(() => { | ||
this.subjectService.sendLoginData(true); | this.subjectService.sendLoginData(true); | ||
this.service.remove('user'); | this.service.remove("user"); | ||
console.log('logout'); | console.log("logout"); | ||
}); | }); | ||
} | } | ||
... | @@ -133,13 +150,13 @@ export class AuthService { | ... | @@ -133,13 +150,13 @@ export class AuthService { |
this.type = 2; | this.type = 2; | ||
console.log(userData.user); | console.log(userData.user); | ||
const currencyData = { | const currencyData = { | ||
currId: '123', | currId: "123", | ||
currName: 'Australian dollar', | currName: "Australian dollar", | ||
symbol: 'A$' | symbol: "A$" | ||
}; | }; | ||
const otp = Math.floor(1000 + Math.random() * 9000); | const otp = Math.floor(1000 + Math.random() * 9000); | ||
userData = userData.user; | userData = userData.user; | ||
const postData: User = { | const postData: User = { | ||
uid: userData.uid, | uid: userData.uid, | ||
status: true, | status: true, | ||
profilePhoto: userData.photoURL, | profilePhoto: userData.photoURL, | ||
... | @@ -154,91 +171,104 @@ export class AuthService { | ... | @@ -154,91 +171,104 @@ export class AuthService { |
}; | }; | ||
this.userPostData = postData; | this.userPostData = postData; | ||
console.log(postData); | console.log(postData); | ||
this.afs.collection('customers').doc(userData.uid).set(postData).then(() => { | this.afs | ||
console.log('successs'); | .collection("customers") | ||
}); | .doc(userData.uid) | ||
.set(postData) | |||
.then(() => { | |||
console.log("successs"); | |||
}); | |||
} | } | ||
signup(userData: Signup) { | signup(userData: Signup) { | ||
this.type = 2; | this.type = 2; | ||
console.log(userData); | console.log(userData); | ||
const otp = Math.floor(1000 + Math.random() * 9000); | const otp = Math.floor(1000 + Math.random() * 9000); | ||
this.afAuth.auth.createUserWithEmailAndPassword(userData.emailId, userData.password).then((result) => { | this.afAuth.auth | ||
console.log(result.user); | .createUserWithEmailAndPassword(userData.emailId, userData.password) | ||
this.afAuth.auth.currentUser.sendEmailVerification(); | .then(result => { | ||
const currencyData = { | console.log(result.user); | ||
currId: '123', | this.afAuth.auth.currentUser.sendEmailVerification(); | ||
currName: 'Australian dollar', | const currencyData = { | ||
symbol: 'A$' | currId: "123", | ||
}; | currName: "Australian dollar", | ||
const custData = result.user; | symbol: "A$" | ||
const postData: User = { | }; | ||
uid: custData.uid, | const custData = result.user; | ||
status: true, | const postData: User = { | ||
profilePhoto: '', | uid: custData.uid, | ||
phoneVerified: false, | status: true, | ||
phone: userData.phone, | profilePhoto: "", | ||
name: userData.name, | phoneVerified: false, | ||
emailVerified: false, | phone: userData.phone, | ||
emailId: userData.emailId, | name: userData.name, | ||
currency: currencyData, | emailVerified: false, | ||
otp: otp.toString(), | emailId: userData.emailId, | ||
loginType: 0 | currency: currencyData, | ||
}; | otp: otp.toString(), | ||
this.userPostData = postData; | loginType: 0 | ||
console.log(postData); | }; | ||
this.afs.collection('customers').doc(custData.uid).set(postData).then(() => { | this.userPostData = postData; | ||
console.log('successs'); | 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) { | createAddress(addressData: Address) { | ||
console.log(addressData); | console.log(addressData); | ||
console.log(this.userData.uid); | console.log(this.userData.uid); | ||
this.afs.collection('address').add({ | this.afs | ||
uid: this.userData.uid | .collection("address") | ||
}).then((docRef) => { | .add({ | ||
console.log(docRef); | uid: this.userData.uid | ||
const addrData = { | }) | ||
uid: this.userData.uid, | .then(docRef => { | ||
addressType: addressData.addressType, | console.log(docRef); | ||
area: addressData.area, | const addrData = { | ||
city: addressData.city, | uid: this.userData.uid, | ||
country: addressData.country, | addressType: addressData.addressType, | ||
district: addressData.district, | area: addressData.area, | ||
firstAddress: addressData.firstAddress, | city: addressData.city, | ||
landmark: addressData.landmark, | country: addressData.country, | ||
zip: addressData.zip, | district: addressData.district, | ||
secondAddress: addressData.secondAddress, | firstAddress: addressData.firstAddress, | ||
state: addressData.state, | landmark: addressData.landmark, | ||
addrId: docRef.id, | zip: addressData.zip, | ||
default: 1 | secondAddress: addressData.secondAddress, | ||
}; | state: addressData.state, | ||
const neworderId = docRef.id; | addrId: docRef.id, | ||
console.log(addrData); | default: 1 | ||
this.afs.collection('address').doc(neworderId).set(addrData).then(() => { | }; | ||
console.log('Address add Successfully'); | const neworderId = docRef.id; | ||
this.service.set('user', JSON.stringify(this.userData)); | console.log(addrData); | ||
this.router.navigateByUrl('home'); | this.afs | ||
document.body.scrollTop = document.documentElement.scrollTop = 0; | .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; | return false; | ||
} | } | ||
} | } | ||
/*displayName: "Adarsh Techware" | /*displayName: "Adarsh Techware" | ||
email: "[email protected]" | email: "[email protected]" | ||
emailVerified: true | emailVerified: true | ||
: "https://lh4.googleusercontent.com/-h0rs2pE-Azw/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rcjNtapRhKoG09NKifQsv_lQPC_2A/photo.jpg" | : "https://lh4.googleusercontent.com/-h0rs2pE-Azw/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rcjNtapRhKoG09NKifQsv_lQPC_2A/photo.jpg" | ||
: "vT498Fz6X0Z6l5l5iNn5hxfwz692" | : "vT498Fz6X0Z6l5l5iNn5hxfwz692" | ||
providerData: [Gl]*/ | providerData: [Gl]*/ | ||