Commit ce26e37d by Adarsh K

latest changes

parents 0681483b d464cc0a
...@@ -101,4 +101,4 @@ ...@@ -101,4 +101,4 @@
"android" "android"
] ]
} }
} }
\ No newline at end of file
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
<ion-menu> <ion-menu>
<ion-content> <ion-content>
<div class="side_menu_wrapper"> <div class="side_menu_wrapper">
<div class="top_banner" (click)="vieworder('profile')"> <ion-menu-toggle>
<div class="top_banner">
<div class="top_image"> <div class="top_image">
</div> </div>
...@@ -13,6 +14,7 @@ ...@@ -13,6 +14,7 @@
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
</ion-menu-toggle>
<div class="sidemenu_list"> <div class="sidemenu_list">
<ul> <ul>
<ion-menu-toggle> <ion-menu-toggle>
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
</div> </div>
<button class="nav_btn nav_search floatRight" *ngIf="!searchShow"> <button class="nav_btn nav_search floatRight" *ngIf="!searchShow">
</button> </button>
<button class="nav_btn nav_exit floatRight" *ngIf="searchShow" (click)="searchClose()"> <button class="nav_btn nav_close floatRight" *ngIf="searchShow" (click)="searchClose()">
</button> </button>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<ion-content> <ion-content>
...@@ -81,8 +81,8 @@ ...@@ -81,8 +81,8 @@
<h5> <h5>
<span class="floatLeft">{{center.centerName}}</span> <span class="floatLeft">{{center.centerName}}</span>
<span class="floatRight">0 <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>{{center.description}}</p> <p>{{center.description}}</p>
...@@ -109,8 +109,8 @@ ...@@ -109,8 +109,8 @@
<div *ngIf="isShow" [@slideInOut]> <div *ngIf="isShow" [@slideInOut]>
<div class="nav_header"> <div class="nav_header">
<button class="nav_btn nav_back floatLeft" (click)="istoggle()"> <button class="nav_btn nav_back floatLeft" (click)="istoggle()">
<img src="../assets/Group17_2.png"> <img src="../assets/Group17_2.png">
</button> </button>
<div class="nav_title floatLeft"> <div class="nav_title floatLeft">
<h4>CHANGE LOCATION</h4> <h4>CHANGE LOCATION</h4>
</div> </div>
...@@ -132,11 +132,11 @@ ...@@ -132,11 +132,11 @@
<input class="styled-checkbox" name="addressId" id="styled-checkbox-{{i}}" type="radio" (click)="setDefault(address.addressId)" [value]="address.addressId" #addressType [checked]="address.defaultVal == 1"> <input class="styled-checkbox" name="addressId" id="styled-checkbox-{{i}}" type="radio" (click)="setDefault(address.addressId)" [value]="address.addressId" #addressType [checked]="address.defaultVal == 1">
<label for="styled-checkbox-{{i}}"> {{address.addressType}} <label for="styled-checkbox-{{i}}"> {{address.addressType}}
</label> </label>
</div> </div>
<div class="floatLeft"> <div class="floatLeft">
<p> <p>
{{address.building}}, {{address.landmark}}, {{address.address}} {{address.building}}, {{address.landmark}}, {{address.address}}
</p> </p>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<button class="order_track floatRight" *ngIf="order.orderStatus >= 3 && order.orderStatus < 7" (click)="orderDetails(i)">Track Order</button> <button class="order_track floatRight" *ngIf="order.orderStatus >= 3 && order.orderStatus < 7" (click)="orderDetails(i)">Track Order</button>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div *ngFor="let product of order.product"> <div *ngFor="let product of order.product" (click)="viewOrder(order)">
<div class="order_image"><img [src]="product.image" onerror="" /></div> <div class="order_image"><img [src]="product.image" onerror="" /></div>
<div class="order_detail"> <div class="order_detail">
<h5 class="floatLeft">{{product.prodName}}</h5> <h5 class="floatLeft">{{product.prodName}}</h5>
......
...@@ -4,6 +4,7 @@ import { Router, ActivatedRoute } from '@angular/router'; ...@@ -4,6 +4,7 @@ import { Router, ActivatedRoute } from '@angular/router';
import { MyordersService } from './../../config/myorder.service'; import { MyordersService } from './../../config/myorder.service';
import { ModalController } from '@ionic/angular'; import { ModalController } from '@ionic/angular';
import { DeliverypopPage } from '../deliverypop/deliverypop.page'; import { DeliverypopPage } from '../deliverypop/deliverypop.page';
import { ServiceService } from './../../config/service.service';
@Component({ @Component({
selector: 'app-myorder', selector: 'app-myorder',
...@@ -18,7 +19,8 @@ export class MyorderPage implements OnInit { ...@@ -18,7 +19,8 @@ export class MyorderPage implements OnInit {
private route: ActivatedRoute, private route: ActivatedRoute,
private location: Location, private location: Location,
public myorder: MyordersService, public myorder: MyordersService,
public modalController: ModalController public modalController: ModalController,
public service: ServiceService
) { } ) { }
ngOnInit() { ngOnInit() {
...@@ -59,6 +61,13 @@ export class MyorderPage implements OnInit { ...@@ -59,6 +61,13 @@ export class MyorderPage implements OnInit {
} }
} }
viewOrder(data) {
console.log(data);
this.service.set('order', data);
this.router.navigateByUrl('orderplaced', { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
getStatus(status: number) { getStatus(status: number) {
switch (status) { switch (status) {
case 1: case 1:
......
<div class="nav_header"> <div class="nav_header">
<button class="nav_btn nav_back floatLeft" (click)="goBack()"> <button class="nav_btn nav_back floatLeft" (click)="goBack()" *ngIf="type === 0">
<img src="../assets/Group17_2.png"> <img src="../assets/Group17_2.png">
</button> </button>
<div class="nav_title floatLeft"> <div class="nav_title floatLeft">
......
...@@ -25,6 +25,7 @@ export class NearbyPage implements OnInit { ...@@ -25,6 +25,7 @@ export class NearbyPage implements OnInit {
addressData = new Address('', '', '', '', true, '', 0, ''); addressData = new Address('', '', '', '', true, '', 0, '');
successState: boolean; successState: boolean;
uid: string; uid: string;
type: any;
public searchElementRef: ElementRef; public searchElementRef: ElementRef;
constructor( constructor(
...@@ -37,12 +38,17 @@ export class NearbyPage implements OnInit { ...@@ -37,12 +38,17 @@ export class NearbyPage implements OnInit {
public service: ServiceService public service: ServiceService
) { ) {
this.successState = false; this.successState = false;
this.type = 0;
const users = this.service.get('user').then((data) => { const users = this.service.get('user').then((data) => {
if (data) { if (data) {
data = JSON.parse(data); data = JSON.parse(data);
this.uid = data.uid; this.uid = data.uid;
} }
}); });
this.service.get('type').then((data) => {
this.type = data;
});
} }
ngOnInit() { ngOnInit() {
...@@ -118,6 +124,10 @@ export class NearbyPage implements OnInit { ...@@ -118,6 +124,10 @@ export class NearbyPage implements OnInit {
this.successState = true; this.successState = true;
setTimeout(() => { setTimeout(() => {
this.successState = false; this.successState = false;
if (this.type === 1) {
this.service.set('type', 0);
this.router.navigateByUrl('home', { queryParams: null });
}
}, 3000); }, 3000);
} }
} }
......
<ion-content> <ion-content>
<div class="cart_wrapper"> <div class="cart_wrapper" *ngIf="data">
<div class="cart_head"> <div class="cart_head">
<div class="nav_header"> <div class="nav_header">
<button class="nav_btn nav_back_white floatLeft" (click)="goBack()"> <button class="nav_btn nav_back_white floatLeft" (click)="goBack()">
...@@ -14,16 +14,16 @@ ...@@ -14,16 +14,16 @@
</div> </div>
<img src="../assets/white_tick.png"> <img src="../assets/white_tick.png">
<h4>ORDER IS PLACED</h4> <h4>ORDER IS PLACED</h4>
<p>June 26th 2019, 03:00 PM</p> <p>{{ data.bookDate.seconds * 1000 | date:'MMMM dd, y' }}</p>
</div> </div>
<div class="order_status"> <div class="order_status">
<div class="clear"></div> <div class="clear"></div>
<div class="status_div go_green"> <div class="status_div go_green">
<h4>Order Placed</h4> <h4>Order Placed</h4>
<h6>June 26th 2019, 03:00PM</h6> <h6>{{ data.bookDate.seconds * 1000 | date:'MMMM dd, y' }}</h6>
</div> </div>
<div class="status_gap go_green"> <!-- <div class="status_gap go_green">
</div> </div>
<div class="status_div go_green"> <div class="status_div go_green">
<h4>Retailer Accepted</h4> <h4>Retailer Accepted</h4>
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</div> </div>
<div class="status_div"> <div class="status_div">
<h4>Your product is delivered</h4> <h4>Your product is delivered</h4>
</div> </div> -->
</div> </div>
<div class="nearby_shop_list"> <div class="nearby_shop_list">
<ul> <ul>
...@@ -65,8 +65,8 @@ ...@@ -65,8 +65,8 @@
</div> </div>
<div class="nearby_detail"> <div class="nearby_detail">
<h5> <h5>
<span class="floatLeft">Carnival Life</span> <span class="floatLeft">{{data.shopperName}}</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>
...@@ -77,20 +77,20 @@ ...@@ -77,20 +77,20 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="product_detail"> <div class="product_detail" *ngFor="let product of data.product">
<h6>Green, Small</h6> <h6>{{product.color}}, {{product.size}}</h6>
<h5>Quantity : <span>3</span></h5> <h5>Quantity : <span>{{product.qty}}</span></h5>
<h5>Amount : <strong>AU$99.00</strong><span class="afterpay">After Pay</span></h5> <h5>Amount : <strong>A$ {{product.price}}</strong><span class="afterpay">COD</span></h5>
<h5>Delivery time : <span>Delivery in 1 hour</span></h5> <h5>Delivery time : <span>Delivery in 1 hour</span></h5>
<h4>DELIVERY</h4> <h4>DELIVERY</h4>
<h5> <h5>
Shamjith KS<br> +00 0000 888 888<br> Carnival Infopark Infopark Kochi<br> 682030, Kerala, India {{deliveryAddress}}
</h5> </h5>
<button class="cancel_btn" (click)="goToPage('ordercancelled')">CANCEL THIS ORDER</button> <button class="cancel_btn" (click)="goToPage('ordercancelled')">CANCEL THIS ORDER</button>
<hr> <hr>
</div> </div>
<div class="related_product_slider"> <!-- <div class="related_product_slider">
<h5> <h5>
<span class="floatLeft">Related Products</span><span class="floatRight">MORE</span> <span class="floatLeft">Related Products</span><span class="floatRight">MORE</span>
<div class="clear"></div> <div class="clear"></div>
...@@ -144,6 +144,6 @@ ...@@ -144,6 +144,6 @@
</ion-slide> </ion-slide>
</ion-slides> </ion-slides>
</ul> </ul>
</div> </div> -->
</div> </div>
</ion-content> </ion-content>
\ No newline at end of file
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { ServiceService } from './../../config/service.service';
@Component({ @Component({
selector: 'app-orderplaced', selector: 'app-orderplaced',
...@@ -8,12 +9,18 @@ import { Router, ActivatedRoute } from '@angular/router'; ...@@ -8,12 +9,18 @@ import { Router, ActivatedRoute } from '@angular/router';
styleUrls: ['./orderplaced.page.scss'], styleUrls: ['./orderplaced.page.scss'],
}) })
export class OrderplacedPage implements OnInit { export class OrderplacedPage implements OnInit {
data: any;
constructor( constructor(
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private location: Location private location: Location,
) { } private service: ServiceService
) {
this.service.get('order').then(val => {
this.data = val;
});
}
ngOnInit() { ngOnInit() {
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
</div> </div>
<button class="nav_btn nav_cart floatRight" (click)="goToPage('cart')"> <button class="nav_btn nav_cart floatRight" (click)="goToPage('cart')">
<div class="not" *ngIf="cartService.carts">{{cartService.carts.length}}</div> <div class="not" *ngIf="cartService.carts">{{cartService.carts.length}}</div>
</button> </button>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<ion-content> <ion-content>
...@@ -14,14 +14,24 @@ ...@@ -14,14 +14,24 @@
<div class="product_banner"> <div class="product_banner">
<div [ngClass]="checkFavStatus(product.prodId)" (click)="changeFav(product.prodId)"></div> <div [ngClass]="checkFavStatus(product.prodId)" (click)="changeFav(product.prodId)"></div>
<div class="featured_badge" *ngIf="product.featured">Featured</div> <div class="featured_badge" *ngIf="product.featured">Featured</div>
<img [src]="product.image" onerror="this.src='../assets/[email protected]'"> <ion-slides pager="true" [options]="bannerOptions">
<ion-slide>
<img [src]="product.image" onerror="this.src='../assets/[email protected]'">
</ion-slide>
<ion-slide>
<img [src]="product.image" onerror="this.src='../assets/[email protected]'">
</ion-slide>
<ion-slide>
<img [src]="product.image" onerror="this.src='../assets/[email protected]'">
</ion-slide>
</ion-slides>
</div> </div>
<div class="product_header"> <div class="product_header">
<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>0</strong>&nbsp; {{product.category}}, {{product.subCate}} <p><strong><span><img src="../assets/Path61_2.png"></span>0</strong>&nbsp; {{product.category}}, {{product.subCate}}
<br/> <br />
<span *ngFor="let tag of product.tag">#{{tag}}&nbsp;</span> <span *ngFor="let tag of product.tag">#{{tag}}&nbsp;</span>
</p> </p>
</ion-col> </ion-col>
...@@ -31,25 +41,26 @@ ...@@ -31,25 +41,26 @@
</ion-col> </ion-col>
</ion-row> </ion-row>
</div> </div>
<div class="product_div_content"> <div class="product_div_content">
<h5>Color</h5> <h5>Color</h5>
<div class="size_div"> <div class="size_div">
<ul *ngIf="product.size"> <ul *ngIf="product.size">
<ion-slides pager="false" [options]="slideOpts"> <ion-slides pager="false" [options]="slideOpts">
<ion-slide *ngFor="let color of product.color; let i = index"> <ion-slide *ngFor="let color of product.color; let i = index">
<li> <li>
<button id="custom_check_button"> <button id="custom_check_button">
<label> <label>
<input id="{{color}}" type="radio" name="color" value="{{color}}" (click)="cartService.choose_color(color)" [checked]="i==0"> <input id="{{color}}" type="radio" name="color" value="{{color}}"
<p>{{color}}</p> (click)="cartService.choose_color(color)" [checked]="i==0">
</label> <p>{{color}}</p>
</label>
</button> </button>
</li> </li>
</ion-slide> </ion-slide>
</ion-slides> </ion-slides>
</ul> </ul>
</div> </div>
<h5>Size</h5> <h5>Size</h5>
<div class="size_div"> <div class="size_div">
<ul *ngIf="product.size"> <ul *ngIf="product.size">
...@@ -57,11 +68,12 @@ ...@@ -57,11 +68,12 @@
<ion-slide *ngFor="let size of product.size; let i = index"> <ion-slide *ngFor="let size of product.size; let i = index">
<li> <li>
<button id="custom_check_button"> <button id="custom_check_button">
<label> <label>
<input id="{{size}}" type="radio" name="services" value="{{size}}" (click)="cartService.choose_size(size)" [checked]="i==0"> <input id="{{size}}" type="radio" name="services" value="{{size}}"
<p>{{size}}</p> (click)="cartService.choose_size(size)" [checked]="i==0">
</label> <p>{{size}}</p>
</button> </label>
</button>
</li> </li>
</ion-slide> </ion-slide>
</ion-slides> </ion-slides>
...@@ -76,7 +88,7 @@ ...@@ -76,7 +88,7 @@
<button id="custom_check_button"> <button id="custom_check_button">
<label> <label>
<input id="1" type="radio" name="services" value="1"> <input id="1" type="radio" name="services" value="1">
<p><img src="../../assets/c1.png"></p> <p><img src="../../assets/c1.png"></p>
</label> </label>
</button> </button>
</li> </li>
...@@ -86,7 +98,7 @@ ...@@ -86,7 +98,7 @@
<button id="custom_check_button"> <button id="custom_check_button">
<label> <label>
<input id="2" type="radio" name="services" value="2"> <input id="2" type="radio" name="services" value="2">
<p><img src="../../assets/c2.png"></p> <p><img src="../../assets/c2.png"></p>
</label> </label>
</button> </button>
</li> </li>
...@@ -202,7 +214,8 @@ ...@@ -202,7 +214,8 @@
<li (click)="viewProd(similar)"> <li (click)="viewProd(similar)">
<div class="product_image"> <div class="product_image">
<img [src]="similar.image" onerror="this.src='../assets/[email protected]'"> <img [src]="similar.image" onerror="this.src='../assets/[email protected]'">
<div [ngClass]="checkFavStatus(similar.prodId)" (click)="changeFav(similar.prodId)"></div> <div [ngClass]="checkFavStatus(similar.prodId)" (click)="changeFav(similar.prodId)">
</div>
</div> </div>
<h5>{{similar.prodName}}</h5> <h5>{{similar.prodName}}</h5>
<p>{{similar.price}}</p> <p>{{similar.price}}</p>
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
position: absolute; position: absolute;
top: 15px; top: 15px;
right: 15px; right: 15px;
z-index: 2;
} }
.fav_fill { .fav_fill {
width: 30px; width: 30px;
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
position: absolute; position: absolute;
top: 15px; top: 15px;
right: 15px; right: 15px;
z-index: 2;
} }
.featured_badge { .featured_badge {
position: absolute; position: absolute;
...@@ -35,6 +37,7 @@ ...@@ -35,6 +37,7 @@
padding-left: 5px; padding-left: 5px;
padding-right: 5px; padding-right: 5px;
font-size: 13px; font-size: 13px;
z-index: 2;
} }
img { img {
width: 100%; width: 100%;
......
...@@ -11,12 +11,18 @@ import { map } from 'rxjs/operators'; ...@@ -11,12 +11,18 @@ import { map } from 'rxjs/operators';
@Component({ @Component({
selector: 'app-productdetail', selector: 'app-productdetail',
templateUrl: './productdetail.page.html', templateUrl: './productdetail.page.html',
styleUrls: ['./productdetail.page.scss'], styleUrls: ['./productdetail.page.scss']
}) })
export class ProductdetailPage implements OnInit { export class ProductdetailPage implements OnInit {
product: Products; product: Products;
order: Order; order: Order;
data: any; data: any;
bannerOptions = {
slidesPerView: 1,
speed: 2000,
autoplay: true
};
slideOpts = { slideOpts = {
slidesPerView: 3.5 slidesPerView: 3.5
}; };
...@@ -35,8 +41,13 @@ export class ProductdetailPage implements OnInit { ...@@ -35,8 +41,13 @@ export class ProductdetailPage implements OnInit {
) { ) {
const params = this.prodService.selItem; const params = this.prodService.selItem;
this.service.state = true; this.service.state = true;
this.prodService.similarProd(params.shopperId, params.category, params.subCate, params.prodId); this.prodService.similarProd(
this.service.get('params').then((val) => { params.shopperId,
params.category,
params.subCate,
params.prodId
);
this.service.get('params').then(val => {
this.data = val; this.data = val;
}); });
this.cartService.cartList(); this.cartService.cartList();
...@@ -52,26 +63,26 @@ export class ProductdetailPage implements OnInit { ...@@ -52,26 +63,26 @@ export class ProductdetailPage implements OnInit {
getProd(params) { getProd(params) {
if (params) { if (params) {
const prod: Products = { const prod: Products = {
prodId: params.prodId, prodId: params.prodId,
subCate: params.subCate, subCate: params.subCate,
tag: params.tag, tag: params.tag,
prodName: params.prodName, prodName: params.prodName,
prodCode: params.prodCode, prodCode: params.prodCode,
prodDesc: params.prodDesc, prodDesc: params.prodDesc,
prodStatus: params.prodStatus, prodStatus: params.prodStatus,
brand: params.brand, brand: params.brand,
category: params.category, category: params.category,
shopperId: params.shopperId, shopperId: params.shopperId,
color: params.color, color: params.color,
discount: params.discount, discount: params.discount,
featured: params.featured, featured: params.featured,
image: params.image, image: params.image,
price: params.price, price: params.price,
qty: params.qty, qty: params.qty,
shopper: params.shopper, shopper: params.shopper,
skuCode: params.skuCode, skuCode: params.skuCode,
status: params.status, status: params.status,
size: params.size size: params.size
}; };
this.product = prod; this.product = prod;
} else { } else {
...@@ -132,5 +143,4 @@ export class ProductdetailPage implements OnInit { ...@@ -132,5 +143,4 @@ export class ProductdetailPage implements OnInit {
return; return;
console.log(this.prodService.fav); console.log(this.prodService.fav);
} }
} }
...@@ -63,6 +63,7 @@ export class AuthService { ...@@ -63,6 +63,7 @@ export class AuthService {
custRef.valueChanges().pipe(take(1)).subscribe((value: User[]) => { custRef.valueChanges().pipe(take(1)).subscribe((value: User[]) => {
if (value.length > 0) { if (value.length > 0) {
this.afs.collection('customers').doc(this.userData.uid).update({otp: ''}); this.afs.collection('customers').doc(this.userData.uid).update({otp: ''});
this.service.set('type', 1);
this.router.navigateByUrl('nearby'); this.router.navigateByUrl('nearby');
} else { } else {
window.alert('Please input valid OTP'); window.alert('Please input valid OTP');
......
...@@ -29,7 +29,7 @@ export class CartsService { ...@@ -29,7 +29,7 @@ export class CartsService {
) { ) {
this.custId = ''; this.custId = '';
this.carts = []; this.carts = [];
const users = this.service.get('user').then((data) => { const users = this.service.get('user').then(data => {
if (data) { if (data) {
data = JSON.parse(data); data = JSON.parse(data);
this.custId = data.uid; this.custId = data.uid;
...@@ -40,65 +40,93 @@ export class CartsService { ...@@ -40,65 +40,93 @@ export class CartsService {
public async buyNow(product: Products) { public async buyNow(product: Products) {
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);
this.size = this.size === undefined ? product.size[0] : this.size; this.size = this.size === undefined ? product.size[0] : this.size;
this.color = this.color === undefined ? product.color[0] : this.color; this.color = this.color === undefined ? product.color[0] : this.color;
const cartRef: AngularFirestoreCollection<any> = this.afs.collection('carts', ref => ref.where('size', '==', this.size) const cartRef: AngularFirestoreCollection<any> = this.afs.collection(
.where('color', '==', this.color) 'carts',
.where('custId', '==', this.custId) ref =>
.where('product', '==', prodRef) ref
.where('size', '==', this.size)
.where('color', '==', this.color)
.where('custId', '==', this.custId)
.where('product', '==', prodRef)
); );
cartRef.valueChanges().pipe(take(1)).subscribe((value) => { cartRef
console.log(value); .valueChanges()
if (value.length === 0) { .pipe(take(1))
product.image = product.image === undefined ? '../assets/[email protected]' : product.image; .subscribe(value => {
const cart: Cart = {
color: this.color,
custId: this.custId,
shopperId: product.shopperId,
product: firebase.firestore().doc(`products/${this.prodId}`),
image: product.image,
prodId: product.prodId,
price: product.price,
prodName: product.prodName,
shopper: product.shopper,
qty: 1,
size: this.size
};
console.log(cart);
this.afs.collection('carts').add(cart).then((docRef) => {
const neworderId = docRef.id;
this.afs.collection('carts').doc(neworderId).update({cartId: docRef.id}).then(() => {
console.log('Booking Successfully');
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
}).catch((error) => {
console.error('Error adding document: ', error);
});
} else {
console.log(value); console.log(value);
// alert('Item already added in the cart'); if (value.length === 0) {
const cartId = value[0].cartId; product.image =
// tslint:disable-next-line:radix product.image === undefined
const qty = parseInt(value[0].qty) + 1; ? '../assets/[email protected]'
this.afs.collection('carts').doc(cartId).update({qty: `${qty}`}).then(() => { : product.image;
console.log('Booking Successfully'); const cart: Cart = {
document.body.scrollTop = document.documentElement.scrollTop = 0; color: this.color,
}); custId: this.custId,
} shopperId: product.shopperId,
}); product: firebase.firestore().doc(`products/${this.prodId}`),
image: product.image,
prodId: product.prodId,
price: product.price,
prodName: product.prodName,
shopper: product.shopper,
qty: 1,
size: this.size
};
console.log(cart);
this.afs
.collection('carts')
.add(cart)
.then(docRef => {
const neworderId = docRef.id;
this.afs
.collection('carts')
.doc(neworderId)
.update({ cartId: docRef.id })
.then(() => {
console.log('Booking Successfully');
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
})
.catch(error => {
console.error('Error adding document: ', error);
});
} else {
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;
});
}
});
} }
public async cartList() { public async cartList() {
const cartRef: AngularFirestoreCollection<any> = this.afs.collection('carts', ref => ref.where('custId', '==', this.custId)); const cartRef: AngularFirestoreCollection<any> = this.afs.collection(
cartRef.valueChanges().subscribe((value) => { 'carts',
ref => ref.where('custId', '==', this.custId)
);
cartRef.valueChanges().subscribe(value => {
this.carts = []; this.carts = [];
const res = value; const res = value;
this.cartTotal = 0; this.cartTotal = 0;
if (res.length > 0) { if (res.length > 0) {
res.forEach((item) => { res.forEach(item => {
const cartItem: CartItem = { const cartItem: CartItem = {
cartId: item.cartId, cartId: item.cartId,
color: item.color, color: item.color,
...@@ -109,7 +137,7 @@ export class CartsService { ...@@ -109,7 +137,7 @@ export class CartsService {
prodName: item.prodName, prodName: item.prodName,
image: item.image, image: item.image,
qty: item.qty, qty: item.qty,
size: item.size, size: item.size
}; };
console.log(item.price, item.qty); console.log(item.price, item.qty);
if (item.price) { if (item.price) {
...@@ -127,7 +155,7 @@ export class CartsService { ...@@ -127,7 +155,7 @@ export class CartsService {
this.carts.push(cartItem); this.carts.push(cartItem);
}); });
} else { } else {
// alert('No Products Found'); // alert('No Products Found');
} }
}); });
} }
...@@ -142,26 +170,37 @@ export class CartsService { ...@@ -142,26 +170,37 @@ export class CartsService {
removeCount(index) { removeCount(index) {
// tslint:disable-next-line:radix // tslint:disable-next-line:radix
const qty = this.carts[index].qty > 1 ? this.carts[index].qty - 1 : this.carts[index].qty; const qty =
this.carts[index].qty > 1
? this.carts[index].qty - 1
: this.carts[index].qty;
this.carts[index].qty = qty; this.carts[index].qty = qty;
console.log(this.carts[index].qty); console.log(this.carts[index].qty);
this.afs.collection('carts').doc(this.carts[index].cartId).update({ this.afs
qty: this.carts[index].qty .collection('carts')
}); .doc(this.carts[index].cartId)
.update({
qty: this.carts[index].qty
});
} }
addCount(index) { addCount(index) {
const qty = this.carts[index].qty + 1; const qty = this.carts[index].qty + 1;
this.cartTotal = 0; this.cartTotal = 0;
this.carts[index].qty = qty; this.carts[index].qty = qty;
this.afs.collection('carts').doc(this.carts[index].cartId).update({ this.afs
qty: this.carts[index].qty .collection('carts')
}); .doc(this.carts[index].cartId)
.update({
qty: this.carts[index].qty
});
} }
removeItem(index) { removeItem(index) {
this.afs.collection('carts').doc(this.carts[index].cartId).delete(); this.afs
.collection('carts')
.doc(this.carts[index].cartId)
.delete();
} }
checkPromo(promoCode: string) { checkPromo(promoCode: string) {
......
...@@ -102,6 +102,7 @@ export class MyordersService { ...@@ -102,6 +102,7 @@ export class MyordersService {
bookDate: item.bookDate, bookDate: item.bookDate,
deliveryLocation: item.deliveryLocation, deliveryLocation: item.deliveryLocation,
pickupLocation: item.pickupLocation, pickupLocation: item.pickupLocation,
deliveryAddress: item.deliveryAddress,
riderName: 'John', riderName: 'John',
orderId: item.orderId, orderId: item.orderId,
orderCode: item.orderCode, orderCode: item.orderCode,
......
...@@ -3,6 +3,7 @@ export interface Myorder { ...@@ -3,6 +3,7 @@ export interface Myorder {
bookDate: any; bookDate: any;
pickupLocation: any; pickupLocation: any;
deliveryLocation: any; deliveryLocation: any;
deliveryAddress: any;
status: number; status: number;
orderStatus: number; orderStatus: number;
riderName: string; riderName: string;
......
...@@ -141,6 +141,30 @@ button { ...@@ -141,6 +141,30 @@ button {
} }
} }
.product_banner {
ion-slides {
.swiper-pagination-bullets {
left: auto;
width: auto;
right: 15px;
bottom: 15px;
}
.swiper-pagination {
.swiper-pagination-bullet {
background-color: #fff;
width: 14px;
height: 3px;
border-radius: 0px;
opacity: 1;
margin: 0px;
}
.swiper-pagination-bullet-active {
background-color: rgba(41, 37, 81, 1);
}
}
}
}
/*------------------------------- /*-------------------------------
...@@ -513,6 +537,14 @@ app-deliverypop { ...@@ -513,6 +537,14 @@ app-deliverypop {
} }
} }
.nav_close {
background-image: url("./assets/close.png");
img {
width: 25px;
display: none;
}
}
.nav_cart { .nav_cart {
background-image: url("./assets/cart_icon.png"); background-image: url("./assets/cart_icon.png");
img { img {
......
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