Merge branch 'adarsh' into 'master'
Adarsh
See merge request !25
Showing
.git.zip
0 → 100644
File added
... | @@ -24,9 +24,9 @@ | ... | @@ -24,9 +24,9 @@ |
"@angular/platform-browser-dynamic": "~8.1.2", | "@angular/platform-browser-dynamic": "~8.1.2", | ||
"@angular/router": "~8.1.2", | "@angular/router": "~8.1.2", | ||
"@ionic-native/core": "^5.0.0", | "@ionic-native/core": "^5.0.0", | ||
"@ionic-native/geolocation": "^5.0.0", | "@ionic-native/geolocation": "^5.15.1", | ||
"@ionic-native/google-plus": "^5.0.0-beta.0", | "@ionic-native/google-plus": "^5.0.0-beta.0", | ||
"@ionic-native/native-geocoder": "^5.0.0", | "@ionic-native/native-geocoder": "^5.15.1", | ||
"@ionic-native/splash-screen": "^5.0.0", | "@ionic-native/splash-screen": "^5.0.0", | ||
"@ionic-native/status-bar": "^5.12.0", | "@ionic-native/status-bar": "^5.12.0", | ||
"@ionic/angular": "^4.7.1", | "@ionic/angular": "^4.7.1", | ||
... | @@ -46,6 +46,7 @@ | ... | @@ -46,6 +46,7 @@ |
"core-js": "^2.5.4", | "core-js": "^2.5.4", | ||
"firebase": "^6.4.0", | "firebase": "^6.4.0", | ||
"rxjs": "~6.5.1", | "rxjs": "~6.5.1", | ||
"rxjs-compat": "^6.5.3", | |||
"tslib": "^1.9.0", | "tslib": "^1.9.0", | ||
"zone.js": "~0.9.1" | "zone.js": "~0.9.1" | ||
}, | }, | ||
... | ... |
... | @@ -13,30 +13,12 @@ | ... | @@ -13,30 +13,12 @@ |
<div class="home_sub_header"> | <div class="home_sub_header"> | ||
Featured Catagories | Featured Catagories | ||
</div> | </div> | ||
<div class="featured_catagory_list"> | <div class="featured_catagory_list" > | ||
<ul> | <ul *ngIf="categoriesService.activecategories && categoriesService.activecategories.length > 0"> | ||
<li (click)="goToPage('productlist')"> | <li *ngFor="let categories of categoriesService.activecategories" (click)="goToPage('catstorelist', categories)"> | ||
<img src="../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png"> | <img [src]="categories.catImage" onerror="this.src='../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png'"> | ||
<div class="featured_overlay"> | <div class="featured_overlay"> | ||
<h4>Men's Fashion</h4> | <h4>{{categories.catName}}</h4> | ||
</div> | |||
</li> | |||
<li (click)="goToPage('productlist')"> | |||
<img src="../assets/beautiful-woman-with-cocktail-suitcase-bed-hootel-room_118454-1593@3x.png"> | |||
<div class="featured_overlay"> | |||
<h4>Women's Fashion</h4> | |||
</div> | |||
</li> | |||
<li (click)="goToPage('productlist')"> | |||
<img src="./assets/[email protected]"> | |||
<div class="featured_overlay"> | |||
<h4>Bags</h4> | |||
</div> | |||
</li> | |||
<li (click)="goToPage('productlist')"> | |||
<img src="../assets/blue-striped-female-sneakers-colorful-background-top-view-flat-lay-minimal-background_77190-500@3x.png"> | |||
<div class="featured_overlay"> | |||
<h4>Shoes</h4> | |||
</div> | </div> | ||
</li> | </li> | ||
</ul> | </ul> | ||
... | ... |
src/app/catstorelist/catstorelist.module.ts
0 → 100644
src/app/catstorelist/catstorelist.page.html
0 → 100644
src/app/catstorelist/catstorelist.page.scss
0 → 100644
This diff is collapsed.
Click to expand it.
src/app/catstorelist/catstorelist.page.ts
0 → 100644
... | @@ -23,27 +23,13 @@ | ... | @@ -23,27 +23,13 @@ |
</ion-col> | </ion-col> | ||
</ion-row> | </ion-row> | ||
</div> | </div> | ||
<ion-slides pager="true"> | <ion-slides pager="true" *ngIf="centerService.centers && centerService.centers.length > 0"> | ||
<ion-slide> | <ion-slide *ngFor="let center of centerService.centers"> | ||
<div class="banner_slide" (click)="goToPage('storelist')"> | <div class="banner_slide" (click)="goToPage('storelist', center)"> | ||
<h5>Chadstone</h5> | <h5>{{center.centerName}}</h5> | ||
<p>The fashion capital</p> | <p>{{center.description}}</p> | ||
</div> | </div> | ||
<img src="./../../assets/getmi_malls/mall_banner/mall_4.png"> | <img [src]="center.centerImg" onerror="this.src='./../../assets/getmi_malls/mall_banner/mall_4.png'"> | ||
</ion-slide> | |||
<ion-slide> | |||
<div class="banner_slide" (click)="goToPage('storelist')"> | |||
<h5>Westfield Knox</h5> | |||
<p>Your one-stop hub for Shopping & Fun</p> | |||
</div> | |||
<img src="./../../assets/getmi_malls/mall_banner/mall_1.png"> | |||
</ion-slide> | |||
<ion-slide> | |||
<div class="banner_slide" (click)="goToPage('storelist')"> | |||
<h5>Emporium Melbourne</h5> | |||
<p>The luxury shopping centre</p> | |||
</div> | |||
<img src="./../../assets/getmi_malls/mall_banner/mall_5.png"> | |||
</ion-slide> | </ion-slide> | ||
</ion-slides> | </ion-slides> | ||
</div> | </div> | ||
... | @@ -51,22 +37,13 @@ | ... | @@ -51,22 +37,13 @@ |
Featured Stores | Featured Stores | ||
</div> | </div> | ||
<div class="featured_slider"> | <div class="featured_slider"> | ||
<ion-slides pager="false" [options]="slideOpts"> | <ion-slides pager="false" [options]="slideOpts" *ngIf="shopperService.activeshoppers && shopperService.activeshoppers.length > 0"> | ||
<ion-slide> | <ion-slide *ngFor="let shopper of shopperService.activeshoppers"> | ||
<div class="feature_product" (click)="goToPage('productlist')"> | <div class="feature_product" (click)="goToPage('productlist', shopper)"> | ||
<img src="./../../assets/getmi_malls/featured/featured1.png"> | <img [src]="shopper.featuredImage" onerror="this.src='./../../assets/getmi_malls/featured/featured1.png'"> | ||
<div class="feature_overlay"> | |||
<h5>Witchery</h5> | |||
<p>Shop Women's Fashion</p> | |||
</div> | |||
</div> | |||
</ion-slide> | |||
<ion-slide> | |||
<div class="feature_product" (click)="goToPage('productlist')"> | |||
<img src="./../../assets/getmi_malls/featured/featured2.png"> | |||
<div class="feature_overlay"> | <div class="feature_overlay"> | ||
<h5>VonZipper</h5> | <h5>{{shopper.name}}</h5> | ||
<p>Lifestyle & Personality</p> | <p>{{shopper.caption}}</p> | ||
</div> | </div> | ||
</div> | </div> | ||
</ion-slide> | </ion-slide> | ||
... | @@ -90,69 +67,21 @@ | ... | @@ -90,69 +67,21 @@ |
<div class="clear"></div> | <div class="clear"></div> | ||
</div> | </div> | ||
<div class="nearby_shop_list"> | <div class="nearby_shop_list"> | ||
<ul> | <ul *ngIf="centerService.nearcenters && centerService.nearcenters.length > 0"> | ||
<li (click)="goToPage('storelist')"> | <li *ngFor="let center of centerService.nearcenters" (click)="goToPage('storelist', center)"> | ||
<div class="nearby_image"> | |||
<img src="./../../assets/getmi_malls/mall_298/mall1.png"> | |||
</div> | |||
<div class="nearby_detail"> | |||
<h5> | |||
<span class="floatLeft">Queen Victoria Building</span> | |||
<span class="floatRight">5 | |||
<img src="../assets/Path61_2.png"> | |||
</span> | |||
<div class="clear"></div> | |||
</h5> | |||
<p>Men's & Women's Fashion</p> | |||
</div> | |||
<div class="clear"></div> | |||
</li> | |||
<li (click)="goToPage('storelist')"> | |||
<div class="nearby_image"> | |||
<img src="./../../assets/getmi_malls/mall_298/mall2.png"> | |||
</div> | |||
<div class="nearby_detail"> | |||
<h5> | |||
<span class="floatLeft">Westfield Knox</span> | |||
<span class="floatRight">4 | |||
<img src="../assets/Path61_2.png"> | |||
</span> | |||
<div class="clear"></div> | |||
</h5> | |||
<p>Your one-stop hub for Shopping & Fun</p> | |||
</div> | |||
<div class="clear"></div> | |||
</li> | |||
<li (click)="goToPage('storelist')"> | |||
<div class="nearby_image"> | |||
<img src="./../../assets/getmi_malls/mall_298/mall4.png"> | |||
</div> | |||
<div class="nearby_detail"> | |||
<h5> | |||
<span class="floatLeft">Chadstone</span> | |||
<span class="floatRight">5 | |||
<img src="../assets/Path61_2.png"> | |||
</span> | |||
<div class="clear"></div> | |||
</h5> | |||
<p>The fashion capital</p> | |||
</div> | |||
<div class="clear"></div> | |||
</li> | |||
<li (click)="goToPage('storelist')"> | |||
<div class="nearby_image"> | <div class="nearby_image"> | ||
<img src="./../../assets/getmi_malls/mall_298/mall5.png"> | <img [src]="center.centerImg" onerror="this.src='./../../assets/getmi_malls/mall_298/mall2.png'"> | ||
</div> | </div> | ||
<div class="nearby_detail"> | <div class="nearby_detail"> | ||
<h5> | <h5> | ||
<span class="floatLeft">Emporium Melbourne</span> | <span class="floatLeft">{{center.centerName}}</span> | ||
<span class="floatRight">4 | <span class="floatRight">0 | ||
<img src="../assets/Path61_2.png"> | <img src="../assets/Path61_2.png"> | ||
</span> | </span> | ||
<div class="clear"></div> | <div class="clear"></div> | ||
</h5> | </h5> | ||
<p>The luxury shopping centre</p> | <p>{{center.description}}</p> | ||
</div> | </div> | ||
<div class="clear"></div> | <div class="clear"></div> | ||
</li> | </li> | ||
... | @@ -162,29 +91,11 @@ | ... | @@ -162,29 +91,11 @@ |
Featured Catagories | Featured Catagories | ||
</div> | </div> | ||
<div class="featured_catagory_list"> | <div class="featured_catagory_list"> | ||
<ul> | <ul *ngIf="categoriesService.activecategories && categoriesService.activecategories.length > 0"> | ||
<li (click)="goToPage('productlist')"> | <li *ngFor="let categories of categoriesService.activecategories" (click)="goToPage('catstorelist', categories)"> | ||
<img src="../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png"> | <img [src]="categories.catImage" onerror="this.src='../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png'"> | ||
<div class="featured_overlay"> | |||
<h4>Men's Fashion</h4> | |||
</div> | |||
</li> | |||
<li (click)="goToPage('productlist')"> | |||
<img src="../assets/beautiful-woman-with-cocktail-suitcase-bed-hootel-room_118454-1593@3x.png"> | |||
<div class="featured_overlay"> | |||
<h4>Women's Fashion</h4> | |||
</div> | |||
</li> | |||
<li (click)="goToPage('productlist')"> | |||
<img src="./assets/[email protected]"> | |||
<div class="featured_overlay"> | |||
<h4>Bags</h4> | |||
</div> | |||
</li> | |||
<li (click)="goToPage('productlist')"> | |||
<img src="../assets/blue-striped-female-sneakers-colorful-background-top-view-flat-lay-minimal-background_77190-500@3x.png"> | |||
<div class="featured_overlay"> | <div class="featured_overlay"> | ||
<h4>Shoes</h4> | <h4>{{categories.catName}}</h4> | ||
</div> | </div> | ||
</li> | </li> | ||
</ul> | </ul> | ||
... | ... |
... | @@ -19,7 +19,9 @@ | ... | @@ -19,7 +19,9 @@ |
<ion-row> | <ion-row> | ||
<ion-col size="8"> | <ion-col size="8"> | ||
<h3>{{product.prodName}}</h3> | <h3>{{product.prodName}}</h3> | ||
<p><strong><span><img src="../assets/Path61_2.png"></span>4</strong>Lulu Fashion, {{product.category}} | <p><strong><span><img src="../assets/Path61_2.png"></span>0</strong> {{product.category}}, {{product.subCate}} | ||
<br/> | |||
<span *ngFor="let tag of product.tag">#{{tag}}</span> | |||
</p> | </p> | ||
</ion-col> | </ion-col> | ||
<ion-col size="4"> | <ion-col size="4"> | ||
... | @@ -37,8 +39,8 @@ | ... | @@ -37,8 +39,8 @@ |
<li> | <li> | ||
<button id="custom_check_button"> | <button id="custom_check_button"> | ||
<label> | <label> | ||
<input id="{{size.sizeId}}" type="radio" name="services" value="{{size.sizeId}}" (click)="cartService.choose_size(size.sizeName)" [checked]="i==0"> | <input id="{{size}}" type="radio" name="services" value="{{size}}" (click)="cartService.choose_size(size)" [checked]="i==0"> | ||
<p>{{size.sizeName}}</p> | <p>{{size}}</p> | ||
</label> | </label> | ||
</button> | </button> | ||
</li> | </li> | ||
... | @@ -49,7 +51,7 @@ | ... | @@ -49,7 +51,7 @@ |
<h5>Description</h5> | <h5>Description</h5> | ||
<p>{{product.prodDesc}} | <p>{{product.prodDesc}} | ||
</p> | </p> | ||
<h5> | <!--<h5> | ||
<span class="floatLeft">Reviews</span><span class="floatRight" (click)="goToPage('reviewlist')">MORE</span> | <span class="floatLeft">Reviews</span><span class="floatRight" (click)="goToPage('reviewlist')">MORE</span> | ||
<div class="clear"></div> | <div class="clear"></div> | ||
</h5> | </h5> | ||
... | @@ -112,57 +114,23 @@ | ... | @@ -112,57 +114,23 @@ |
<div class="clear"></div> | <div class="clear"></div> | ||
</li> | </li> | ||
</ul> | </ul> | ||
</div> | </div> --> | ||
<h5> | <h5 *ngIf="product.similar && product.similar.length > 0"> | ||
<span class="floatLeft">Related Products</span><span class="floatRight">MORE</span> | <span class="floatLeft">Related Products</span><span class="floatRight" (click)="goToPage('productlist', data)">MORE</span> | ||
<div class="clear"></div> | <div class="clear"></div> | ||
</h5> | </h5> | ||
<div class="related_product_slider"> | <div class="related_product_slider"> | ||
<ul> | <ul *ngIf="product.similar && product.similar.length > 0"> | ||
<ion-slides pager="false" [options]="relatedProd"> | <ion-slides pager="false" [options]="relatedProd"> | ||
<ion-slide> | <ion-slide *ngFor="let similar of product.similar"> | ||
<li (click)="goToPage('productdetail')"> | <li (click)="viewProd(similar)"> | ||
<div class="product_image"> | |||
<img src="../assets/[email protected]"> | |||
<div class="fav_icon"> | |||
</div> | |||
</div> | |||
<h5>European Style V Neck</h5> | |||
<p>AU$99.00</p> | |||
</li> | |||
</ion-slide> | |||
<ion-slide> | |||
<li (click)="goToPage('productdetail')"> | |||
<div class="product_image"> | |||
<img src="../assets/Recommended-Ball-Gown-Floor-Length-V-Neck-Lace-Organza-Prom-Dress-OD850662@3x.png"> | |||
<div class="fav_icon"> | |||
</div> | |||
</div> | |||
<h5>European Style V Neck</h5> | |||
<p>AU$99.00</p> | |||
</li> | |||
</ion-slide> | |||
<ion-slide> | |||
<li (click)="goToPage('productdetail')"> | |||
<div class="product_image"> | |||
<img src="../assets/[email protected]"> | |||
<div class="fav_icon"> | |||
</div> | |||
</div> | |||
<h5>European Style V Neck</h5> | |||
<p>AU$99.00 <span class="offer">-8%</span></p> | |||
</li> | |||
</ion-slide> | |||
<ion-slide> | |||
<li (click)="goToPage('productdetail')"> | |||
<div class="product_image"> | <div class="product_image"> | ||
<img src="../assets/[email protected]"> | <img [src]="similar.image" onerror="this.src='../assets/[email protected]'"> | ||
<div class="fav_icon"> | <div class="fav_icon"> | ||
</div> | </div> | ||
<div class="featured_badge">Featured</div> | |||
</div> | </div> | ||
<h5>European Style V Neck</h5> | <h5>{{similar.prodName}}</h5> | ||
<p>AU$99.00<span>AU$110.00</span></p> | <p>{{similar.price}}</p> | ||
</li> | </li> | ||
</ion-slide> | </ion-slide> | ||
</ion-slides> | </ion-slides> | ||
... | ... |
... | @@ -23,19 +23,19 @@ | ... | @@ -23,19 +23,19 @@ |
</div> | </div> | ||
<div class="clear"></div> | <div class="clear"></div> | ||
</div> | </div> | ||
<div class="product_title"> | <div class="product_title" *ngIf="data"> | ||
Women's Fashion | {{data.shopName}} | ||
</div> | </div> | ||
<ul [class.grid_view]="onGrid" *ngIf="prodService.product && prodService.product.length > 0"> | <ul [class.grid_view]="onGrid" *ngIf="prodService.product && prodService.product.length > 0"> | ||
<li *ngFor="let product of prodService.product; let i = index" (click)="prodDetails(i)"> | <li *ngFor="let product of prodService.product; let i = index"> | ||
<div class="product_image"> | <div class="product_image"> | ||
<img [src]="product.image" onerror="this.src='../assets/[email protected]'"> | <img [src]="product.image" onerror="this.src='../assets/[email protected]'" (click)="prodDetails(i)"> | ||
<div class="fav_icon"> | <div class="fav_icon" (click)="changeFav(product.prodId)" *ngIf="checkFavStatus(product.prodId)"> | ||
</div> | </div> | ||
<div class="featured_badge" *ngIf="product.featured">Featured</div> | <div class="featured_badge" *ngIf="product.featured">Featured</div> | ||
</div> | </div> | ||
<h5>{{product.prodName}}</h5> | <h5 class="ellipse" (click)="prodDetails(i)">{{product.prodName}}</h5> | ||
<p>A$ {{product.price}}<span class="offer" *ngIf="product.discount > 0">-{{product.discount}}%</span></p> | <p (click)="prodDetails(i)">A$ {{product.price}}<span class="offer" *ngIf="product.discount > 0">-{{product.discount}}%</span></p> | ||
</li> | </li> | ||
</ul> | </ul> | ||
</div> | </div> | ||
... | ... |
import { Injectable } from '@angular/core'; | import { Injectable } from '@angular/core'; | ||
import { User } 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 } from '@angular/fire/firestore'; | import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection } from '@angular/fire/firestore'; | ||
import { ServiceService } from './../config/service.service'; | import { ServiceService } from './../config/service.service'; | ||
import { GooglePlus } from '@ionic-native/google-plus/ngx'; | import { GooglePlus } from '@ionic-native/google-plus/ngx'; | ||
import { take } from 'rxjs/operators'; | |||
import { from } from 'rxjs'; | import { from } from 'rxjs'; | ||
@Injectable({ | @Injectable({ | ||
... | @@ -13,6 +14,8 @@ import { from } from 'rxjs'; | ... | @@ -13,6 +14,8 @@ import { from } from 'rxjs'; |
}) | }) | ||
export class AuthService { | export class AuthService { | ||
userData: any; | userData: any; | ||
type: number; | |||
userPostData: any; | |||
constructor( | constructor( | ||
public afs: AngularFirestore, | public afs: AngularFirestore, | ||
... | @@ -21,12 +24,18 @@ export class AuthService { | ... | @@ -21,12 +24,18 @@ export class AuthService { |
private service: ServiceService, | private service: ServiceService, | ||
private googlePlus: GooglePlus | private googlePlus: GooglePlus | ||
) { | ) { | ||
this.type = 1; | |||
this.afAuth.authState.subscribe(user => { | this.afAuth.authState.subscribe(user => { | ||
if (user) { | if (user) { | ||
this.userData = user; | this.userData = user; | ||
console.log(this.userData); | |||
this.service.set('user', JSON.stringify(this.userData)); | this.service.set('user', JSON.stringify(this.userData)); | ||
if (this.type === 1) { | |||
this.router.navigateByUrl('home'); | this.router.navigateByUrl('home'); | ||
} else { | } else { | ||
this.router.navigateByUrl('verification'); | |||
} | |||
} else { | |||
this.service.set('user', null); | this.service.set('user', null); | ||
JSON.parse(localStorage.getItem('user')); | JSON.parse(localStorage.getItem('user')); | ||
this.router.navigateByUrl('login'); | this.router.navigateByUrl('login'); | ||
... | @@ -44,16 +53,37 @@ export class AuthService { | ... | @@ -44,16 +53,37 @@ export class AuthService { |
}); | }); | ||
} | } | ||
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) | |||
); | |||
custRef.valueChanges().pipe(take(1)).subscribe((value: User[]) => { | |||
if (value.length > 0) { | |||
this.afs.collection('customers').doc(this.userData.uid).update({otp: ''}); | |||
this.router.navigateByUrl('addaddresss'); | |||
} else { | |||
window.alert('Please input valid OTP'); | |||
} | |||
}); | |||
public async google() { | } | ||
public async google(type: number) { | |||
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.signInWithPopup(new auth.GoogleAuthProvider()).then((result) => { | ||
console.log('success'); | console.log('success'); | ||
console.log(result); | console.log(result); | ||
this.socialSignUp(result); | |||
}); | }); | ||
} | } | ||
public async facebook() { | public async facebook(type: number) { | ||
this.type = type; | |||
this.afAuth.auth.signInWithPopup(new auth.FacebookAuthProvider()).then((result) => { | this.afAuth.auth.signInWithPopup(new auth.FacebookAuthProvider()).then((result) => { | ||
console.log('success'); | console.log('success'); | ||
console.log(result); | console.log(result); | ||
... | @@ -62,7 +92,7 @@ export class AuthService { | ... | @@ -62,7 +92,7 @@ export class AuthService { |
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) { | ||
... | @@ -78,7 +108,9 @@ export class AuthService { | ... | @@ -78,7 +108,9 @@ export class AuthService { |
phone: value.phone, | phone: value.phone, | ||
phoneVerified: value.phoneVerified, | phoneVerified: value.phoneVerified, | ||
status: value.status, | status: value.status, | ||
currency: value.currency | currency: value.currency, | ||
otp: value.otp, | |||
loginType: value.loginType | |||
}; | }; | ||
console.log(userData); | console.log(userData); | ||
}); | }); | ||
... | @@ -91,5 +123,116 @@ export class AuthService { | ... | @@ -91,5 +123,116 @@ export class AuthService { |
}); | }); | ||
} | } | ||
socialSignUp(userData: any) { | |||
this.type = 2; | |||
console.log(userData.user); | |||
const currencyData = { | |||
currId: '123', | |||
currName: 'Australian dollar', | |||
symbol: 'A$' | |||
}; | |||
const otp = Math.floor(1000 + Math.random() * 9000); | |||
userData = userData.user; | |||
const postData: User = { | |||
uid: userData.uid, | |||
status: true, | |||
profilePhoto: userData.photoURL, | |||
phoneVerified: false, | |||
phone: userData.phoneNumber, | |||
name: userData.displayName, | |||
emailVerified: userData.emailVerified, | |||
emailId: userData.email, | |||
currency: currencyData, | |||
otp: otp.toString(), | |||
loginType: 1 | |||
}; | |||
this.userPostData = postData; | |||
console.log(postData); | |||
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'); | |||
}); | |||
}).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; | |||
}); | |||
}); | |||
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]*/ | |||
... | @@ -41,20 +41,21 @@ export class CartsService { | ... | @@ -41,20 +41,21 @@ export class CartsService { |
} | } | ||
public async buyNow(product: Products) { | public async buyNow(product: Products) { | ||
this.color = 'Blue'; | |||
this.prodId = product.prodId; | this.prodId = product.prodId; | ||
const prodRef = firebase.firestore().collection('products').doc(this.prodId); | const prodRef = firebase.firestore().collection('products').doc(this.prodId); | ||
const cartRef: AngularFirestoreCollection<any> = this.afs.collection('carts', ref => ref.where('size', '==', this.size) | const cartRef: AngularFirestoreCollection<any> = this.afs.collection('carts', ref => ref.where('size', '==', this.size) | ||
.where('color', '==', this.color) | .where('color', '==', Object.keys(product.color)[0]) | ||
.where('custId', '==', this.custId) | .where('custId', '==', this.custId) | ||
.where('product', '==', prodRef) | .where('product', '==', prodRef) | ||
); | ); | ||
cartRef.valueChanges().pipe(take(1)).subscribe((value: Cart[]) => { | ; | ||
cartRef.valueChanges().pipe(take(1)).subscribe((value) => { | |||
console.log(value); | console.log(value); | ||
if (value.length === 0) { | if (value.length === 0) { | ||
product.image = product.image === undefined ? '../assets/[email protected]' : product.image; | |||
const cart: Cart = { | const cart: Cart = { | ||
color: this.color, | color: Object.keys(product.color)[0], | ||
custId: this.custId, | custId: this.custId, | ||
shopperId: product.shopperId, | shopperId: product.shopperId, | ||
product: firebase.firestore().doc(`products/${this.prodId}`), | product: firebase.firestore().doc(`products/${this.prodId}`), | ||
... | @@ -66,6 +67,7 @@ export class CartsService { | ... | @@ -66,6 +67,7 @@ export class CartsService { |
qty: 1, | qty: 1, | ||
size: this.size | size: this.size | ||
}; | }; | ||
console.log(cart); | |||
this.afs.collection('carts').add(cart).then((docRef) => { | this.afs.collection('carts').add(cart).then((docRef) => { | ||
const neworderId = docRef.id; | const neworderId = docRef.id; | ||
this.afs.collection('carts').doc(neworderId).update({cartId: docRef.id}).then(() => { | this.afs.collection('carts').doc(neworderId).update({cartId: docRef.id}).then(() => { | ||
... | @@ -76,7 +78,16 @@ export class CartsService { | ... | @@ -76,7 +78,16 @@ export class CartsService { |
console.error('Error adding document: ', error); | console.error('Error adding document: ', error); | ||
}); | }); | ||
} else { | } else { | ||
alert('Item already added in the cart'); | console.log(value); | ||
// alert('Item already added in the cart'); | |||
const cartId = value[0].cartId; | |||
// tslint:disable-next-line:radix | |||
const qty = parseInt(value[0].qty) + 1; | |||
this.afs.collection('carts').doc(cartId).update({qty: `${qty}`}).then(() => { | |||
console.log('Booking Successfully'); | |||
document.body.scrollTop = document.documentElement.scrollTop = 0; | |||
}); | |||
} | } | ||
}); | }); | ||
} | } | ||
... | @@ -101,7 +112,10 @@ export class CartsService { | ... | @@ -101,7 +112,10 @@ export class CartsService { |
qty: item.qty, | qty: item.qty, | ||
size: item.size, | size: item.size, | ||
}; | }; | ||
this.cartTotal += item.price; | console.log(item.price, item.qty); | ||
if (item.price) { | |||
this.cartTotal += item.price * item.qty; | |||
} | |||
/*const prodItem = item.product.get().then((property) => { | /*const prodItem = item.product.get().then((property) => { | ||
const response = property.data(); | const response = property.data(); | ||
cartItem.prodName = response.prodName; | cartItem.prodName = response.prodName; | ||
... | @@ -123,6 +137,32 @@ export class CartsService { | ... | @@ -123,6 +137,32 @@ export class CartsService { |
this.size = size; | this.size = size; | ||
} | } | ||
removeCount(index) { | |||
// tslint:disable-next-line:radix | |||
const qty = this.carts[index].qty > 1 ? this.carts[index].qty - 1 : this.carts[index].qty; | |||
this.carts[index].qty = qty; | |||
console.log(this.carts[index].qty); | |||
this.afs.collection('carts').doc(this.carts[index].cartId).update({ | |||
qty: this.carts[index].qty | |||
}); | |||
} | |||
addCount(index) { | |||
const qty = this.carts[index].qty + 1; | |||
this.cartTotal = 0; | |||
this.carts[index].qty = qty; | |||
this.afs.collection('carts').doc(this.carts[index].cartId).update({ | |||
qty: this.carts[index].qty | |||
}); | |||
} | |||
removeItem(index) { | |||
this.afs.collection('carts').doc(this.carts[index].cartId).delete(); | |||
} | |||
} | } |
src/config/category.service.ts
0 → 100644
src/config/center.service.ts
0 → 100644
src/config/services/category.ts
0 → 100644
src/config/services/center.ts
0 → 100644
src/config/services/shopper.ts
0 → 100644
src/config/shopper.service.ts
0 → 100644
Please
register
or
sign in
to comment