Commit c0b3bf75 by Adarsh K

latest changes

parent fb0e5b67
......@@ -27,13 +27,13 @@ const routes: Routes = [
{ 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' }
];
@NgModule({
imports: [
......
......@@ -15,20 +15,24 @@
</div>
<div class="sidemenu_list">
<ul>
<li>Shop</li>
<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>
<li>Men's Fashion</li>
<li>Women's Fashion</li>
<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>
<li>Electronics</li> -->
</ul>
</div>
<li>Complaints & Feedback</li>
......@@ -45,7 +49,7 @@
<ion-router-outlet main></ion-router-outlet>
</ion-split-pane>
</ion-app>
<div class="common_tab">
<div class="common_tab" [hidden]="getState()">
<ul>
<li>
<div class="icon_sec m1_icon" [class.m1_icon_act]="sec_active1" (click)="setActive1()"></div>
......
......@@ -8,7 +8,8 @@ import * as firebase from 'firebase';
import { ModalController } from '@ionic/angular';
import { DeliverypopPage } from './deliverypop/deliverypop.page';
import { AuthService } from './../config/auth.service';
import { ServiceService } from './../config/service.service';
import { CategoriesService } from './../config/category.service';
@Component({
selector: 'app-root',
......@@ -33,7 +34,9 @@ export class AppComponent {
private router: Router,
public afs: AngularFirestore,
public modalController: ModalController,
public authService: AuthService
public authService: AuthService,
public service: ServiceService,
public categoryService: CategoriesService
) {
this.initializeApp();
this.orderState();
......@@ -106,6 +109,10 @@ export class AppComponent {
}
getState() {
return this.service.state;
}
orderState() {
console.log('called');
const custId = 'WwHnLICVY2dvZGUHuKqasiTB91a2';
......@@ -147,4 +154,10 @@ export class AppComponent {
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
goToPage(path, data = null) {
this.service.set('params', data);
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
}
......@@ -30,8 +30,8 @@
<ion-slide>
<div class="cart_list" *ngIf="cartService.carts">
<ul *ngIf="cartService.carts.length > 0">
<li *ngFor="let carts of cartService.carts">
<div class="close"></div>
<li *ngFor="let carts of cartService.carts; let i= index">
<div class="close" (click)="cartService.removeItem(i)"></div>
<div class="cart_image"><img [src]="carts.image" onerror="this.src=''" /></div>
<div class="cart_detail">
<h4>{{carts.prodName}}</h4>
......@@ -39,9 +39,9 @@
<h5>A$ {{carts.price}}</h5>
</div>
<div class="cart_count">
<div class="add" (click)="addCount()">+</div>
<div class="count">{{count}}</div>
<div class="remove" (click)="removeCount()">-</div>
<div class="add" (click)="cartService.addCount(i)">+</div>
<div class="count">{{carts.qty}}</div>
<div class="remove" (click)="cartService.removeCount(i)">-</div>
</div>
<div class="clear"></div>
</li>
......
......@@ -13,30 +13,12 @@
<div class="home_sub_header">
Featured Catagories
</div>
<div class="featured_catagory_list">
<ul>
<li (click)="goToPage('productlist')">
<img src="../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png">
<div class="featured_catagory_list" >
<ul *ngIf="categoriesService.activecategories && categoriesService.activecategories.length > 0">
<li *ngFor="let categories of categoriesService.activecategories" (click)="goToPage('catstorelist', categories)">
<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">
<h4>Shoes</h4>
<h4>{{categories.catName}}</h4>
</div>
</li>
</ul>
......
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Location } from '@angular/common';
import { CategoriesService } from './../../config/category.service';
import { ServiceService } from './../../config/service.service';
@Component({
selector: 'app-catagory',
......@@ -8,16 +10,23 @@ import { Location } from '@angular/common';
styleUrls: ['./catagory.page.scss'],
})
export class CatagoryPage implements OnInit {
data: any;
constructor(
public router: Router,
public location: Location
) { }
public location: Location,
public categoriesService: CategoriesService,
public service: ServiceService
) {
this.service.get('params').then((val) => {
this.data = val;
});
}
ngOnInit() {
}
goToPage(path, data = null) {
this.service.set('params', data);
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
......
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 { CatStorelistPage } from './catstorelist.page';
const routes: Routes = [
{
path: '',
component: CatStorelistPage
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
declarations: [CatStorelistPage]
})
export class CatStorelistPageModule {}
<div class="nav_header">
<button class="nav_btn nav_back floatLeft" (click)="goBack()">
</button>
<div class="nav_title floatLeft">
<input class="search_bar" placeholder="Search here.. eg:shirts, retailers etc..."> </div>
<button class="nav_btn nav_search floatRight">
</button>
<div class="clear"></div>
</div>
<ion-content>
<div class="home_wrapper">
<div class="home_sub_header">
Featured Stores
</div>
<div class="featured_slider">
<ion-slides pager="false" [options]="slideOpts" *ngIf="shopperService.activeshoppers && shopperService.activeshoppers.length > 0">
<ion-slide *ngFor="let shopper of shopperService.activeshoppers">
<div class="feature_product" (click)="goToPage('productlist', shopper)">
<img [src]="shopper.featuredImage" onerror="this.src='./../../assets/getmi_malls/featured/featured1.png'">
<div class="feature_overlay">
<h5>{{shopper.name}}</h5>
<p>{{shopper.caption}}</p>
</div>
</div>
</ion-slide>
</ion-slides>
</div>
<div class="home_sub_header" *ngIf="data">
{{data.catName}}
</div>
<div class="nearby_shop_list">
<ul *ngIf="shopperService.shoppers && shopperService.shoppers.length > 0">
<li *ngFor="let shopper of shopperService.shoppers" (click)="goToPage('productlist', shopper)">
<div class="nearby_image">
<img [src]="shopper.profilePic" onerror="this.src='./../../assets/getmi_malls/store298/stores1.png'">
</div>
<div class="nearby_detail">
<h5>
<span class="floatLeft">{{shopper.name}}</span>
<span class="floatRight">0
<img src="../assets/Path61_2.png">
</span>
<div class="clear"></div>
</h5>
<p>{{shopper.caption}}</p>
</div>
<div class="clear"></div>
</li>
</ul>
</div>
</div>
</ion-content>
\ No newline at end of file
.home_wrapper {
width: 100%;
.home_banner {
width: 100%;
height: 300px;
padding-top: 80px;
position: relative;
background-color: #fff;
.home_banner_title {
padding: 10px;
position: absolute;
top: 0px;
left: 0px;
right: 0px;
img {
width: 100px;
}
p {
margin: 0px;
text-align: right;
background-image: url("../../assets/Path 55_2.png");
background-position: left;
background-repeat: no-repeat;
background-size: 12px;
padding-left: 20px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
ion-slides {
width: 100%;
height: 100%;
ion-slide {
width: 100%;
height: 100%;
position: relative;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
.banner_slide {
position: absolute;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
-webkit-box-shadow: inset 0px -128px 63px -45px rgba(0, 0, 0, 0.75);
-moz-box-shadow: inset 0px -128px 63px -45px rgba(0, 0, 0, 0.75);
box-shadow: inset 0px -128px 63px -45px rgba(0, 0, 0, 0.75);
padding-top: 160px;
padding-left: 20px;
padding-right: 20px;
h5 {
color: #fff;
margin: 0px;
padding: 0px;
text-align: left;
font-weight: bold;
letter-spacing: 2px;
padding-bottom: 5px;
font-size: 14px;
}
p {
color: #fff;
margin: 0px;
padding: 0px;
text-align: left;
font-size: 20px;
font-weight: lighter;
}
}
}
}
}
.home_sub_header {
padding: 10px;
padding-top: 20px;
padding-bottom: 20px;
color: rgba(59, 57, 77, 1);
font-weight: 900;
}
.featured_slider {
padding-left: 10px;
padding-right: 10px;
.feature_product {
width: 100%;
height: 130px;
position: relative;
background-color: #a8a8a8;
border: 2px solid #fff;
img {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
.feature_overlay {
position: absolute;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
background-color: rgba(0, 0, 0, 0.75);
padding: 15px;
padding-top: 60px;
h5 {
color: #fff;
margin: 0px;
padding: 0px;
text-align: left;
font-weight: bold;
letter-spacing: 2px;
padding-bottom: 2px;
font-size: 14px;
}
p {
color: #fff;
margin: 0px;
padding: 0px;
text-align: left;
font-size: 20px;
font-weight: lighter;
}
}
}
}
.nearby_shop_list {
ul {
margin: 0px;
padding-left: 10px;
padding-right: 10px;
li {
list-style: none;
padding-bottom: 10px;
.nearby_image {
width: 120px;
height: 125px;
float: left;
background-color: #a8a8a8;
border-radius: 8px;
img {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
}
.nearby_detail {
width: calc(100% - 120px);
float: left;
padding-left: 20px;
padding-top: 40px;
h5 {
margin: 0px;
padding: 0px;
color: rgba(59, 57, 77, 1);
font-weight: 900;
padding-bottom: 2px;
img {
width: 16px;
}
}
p {
margin: 0px;
padding: 0px;
color: rgba(176, 174, 199);
}
}
}
}
}
.featured_catagory_list {
padding: 10px;
ul {
margin: 0px;
padding: 0px;
li {
list-style: none;
position: relative;
height: 120px;
width: 100%;
border-radius: 8px;
margin-bottom: 10px;
&:nth-child(odd) {
text-align: left;
}
&:nth-child(even) {
text-align: right;
}
img {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
.featured_overlay {
position: absolute;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
border-radius: 8px;
background-color: rgba(0, 0, 0, 0.75);
color: #fff;
padding: 45px;
padding-left: 20px;
padding-right: 20px;
h4 {
margin: 0px;
font-size: 26px;
font-weight: 900;
}
}
}
}
}
}
.sort_wrappper {
height: 100vh;
width: 100%;
position: fixed;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
background: rgba(0, 0, 0, 0.6);
z-index: 99;
.sort_inner {
margin: 0 auto;
width: 90%;
padding: 10px;
padding-left: 15px;
padding-right: 15px;
padding-bottom: 15px;
background-color: #fff;
position: relative;
-webkit-box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.3);
box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.3);
top: 25%;
border-radius: 0px;
h4 {
text-align: center;
color: rgba(59, 57, 77, 1);
margin: 0px;
font-weight: bold;
padding: 10px;
font-size: 18px;
border-bottom: 1px solid rgba(0, 0, 0, 0.16);
padding-bottom: 20px;
margin-bottom: 30px;
}
.search_box {
width: calc(100% - 100px);
height: 45px;
border: none;
border-bottom: 1px solid rgba(0, 0, 0, 0.16);
}
.search_btn {
width: 100px;
height: 45px;
background-color: rgba(41, 40, 91, 1);
border: none;
color: #fff;
font-size: 16px;
}
ul {
margin: 0px;
padding: 0px;
li {
list-style: none;
border-bottom: 1px solid rgba(0, 0, 0, 0.16);
padding-top: 10px;
padding-bottom: 10px;
.styled-checkbox {
position: absolute; // take it out of document flow
opacity: 0; // hide it
&+label {
position: relative;
cursor: pointer;
padding: 0;
width: 100%;
}
// Box.
&+label:before {
content: '';
margin-right: 10px;
display: inline-block;
vertical-align: text-top;
width: 20px;
height: 20px;
border-radius: 5px;
background: white;
border: 1px solid rgba(215, 213, 228, 1);
}
&:checked+label:before {
background: #29285b;
}
// Disabled state label.
&:disabled+label {
color: #b8b8b8;
cursor: auto;
}
// Disabled box.
&:disabled+label:before {
box-shadow: none;
background: #ddd;
}
// Checkmark. Could be replaced with an image
&:checked+label:after {
content: '';
position: absolute;
left: 6px;
top: 10px;
background: white;
width: 2px;
height: 2px;
box-shadow: 2px 0 0 white, 4px 0 0 white, 4px -2px 0 white, 4px -4px 0 white, 4px -6px 0 white, 4px -8px 0 white;
transform: rotate(45deg);
}
}
}
}
.sort_footer {
padding-top: 10px;
button {
border-radius: 8px;
height: 40px;
width: 48%;
color: #fff;
font-size: 15px;
font-weight: lighter;
}
.submit {
background-color: rgba(41, 40, 91, 1);
}
.cancel {
background-color: rgba(215, 213, 228, 1);
}
}
}
}
\ No newline at end of file
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CatStorelistPage } from './catstorelist.page';
describe('StorelistPage', () => {
let component: CatStorelistPage;
let fixture: ComponentFixture<CatStorelistPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CatStorelistPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CatStorelistPage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Location } from '@angular/common';
import { ServiceService } from './../../config/service.service';
import { ShoppersService } from './../../config/shopper.service';
@Component({
selector: 'app-catstorelist',
templateUrl: './catstorelist.page.html',
styleUrls: ['./catstorelist.page.scss'],
})
export class CatStorelistPage implements OnInit {
slideOpts = {
slidesPerView: 1.5
};
data: any;
constructor(
public router: Router,
public location: Location,
public service: ServiceService,
public shopperService: ShoppersService,
) {
this.service.get('params').then((val) => {
this.data = val;
this.shopperService.shopperList(this.data.catId, 'catId');
});
}
ngOnInit() {}
goToPage(path, data = null) {
this.service.set('params', data);
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
goBack() {
this.location.back();
}
}
......@@ -25,7 +25,7 @@
</div>
<ion-slides pager="true" *ngIf="centerService.centers && centerService.centers.length > 0">
<ion-slide *ngFor="let center of centerService.centers">
<div class="banner_slide" (click)="goToPage('storelist')">
<div class="banner_slide" (click)="goToPage('storelist', center)">
<h5>{{center.centerName}}</h5>
<p>{{center.description}}</p>
</div>
......@@ -39,7 +39,7 @@
<div class="featured_slider">
<ion-slides pager="false" [options]="slideOpts" *ngIf="shopperService.activeshoppers && shopperService.activeshoppers.length > 0">
<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]="shopper.featuredImage" onerror="this.src='./../../assets/getmi_malls/featured/featured1.png'">
<div class="feature_overlay">
<h5>{{shopper.name}}</h5>
......@@ -67,69 +67,21 @@
<div class="clear"></div>
</div>
<div class="nearby_shop_list">
<ul>
<li (click)="goToPage('storelist')">
<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>
<ul *ngIf="centerService.nearcenters && centerService.nearcenters.length > 0">
<li *ngFor="let center of centerService.nearcenters" (click)="goToPage('storelist', center)">
<li (click)="goToPage('storelist')">
<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 class="nearby_detail">
<h5>
<span class="floatLeft">Emporium Melbourne</span>
<span class="floatRight">4
<span class="floatLeft">{{center.centerName}}</span>
<span class="floatRight">0
<img src="../assets/Path61_2.png">
</span>
<div class="clear"></div>
</h5>
<p>The luxury shopping centre</p>
<p>{{center.description}}</p>
</div>
<div class="clear"></div>
</li>
......@@ -139,29 +91,11 @@
Featured Catagories
</div>
<div class="featured_catagory_list">
<ul>
<li (click)="goToPage('productlist')">
<img 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">
<ul *ngIf="categoriesService.activecategories && categoriesService.activecategories.length > 0">
<li *ngFor="let categories of categoriesService.activecategories" (click)="goToPage('catstorelist', categories)">
<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>Shoes</h4>
<h4>{{categories.catName}}</h4>
</div>
</li>
</ul>
......
......@@ -5,6 +5,9 @@ import { Router, ActivatedRoute } from '@angular/router';
import { MenuController } from '@ionic/angular';
import { CenterService } from './../../config/center.service';
import { ShoppersService } from './../../config/shopper.service';
import { CategoriesService } from './../../config/category.service';
import { ServiceService } from './../../config/service.service';
import { from } from 'rxjs';
@Component({
selector: 'app-home',
......@@ -38,7 +41,9 @@ export class HomePage implements OnInit {
private location: Location,
public menuCtrl: MenuController,
public centerService: CenterService,
public shopperService: ShoppersService
public shopperService: ShoppersService,
public categoriesService: CategoriesService,
public service: ServiceService
) { }
ngOnInit() {
......@@ -50,6 +55,8 @@ export class HomePage implements OnInit {
}
goToPage(path, data = null) {
console.log(data);
this.service.set('params', data);
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
......
......@@ -42,7 +42,7 @@
<h4>Don't have an account? <strong (click)="goToPage('signup')">SIGNUP</strong></h4>
</div>
<button (click)="goToPage('addaddresss')">Address</button>
<!-- <button (click)="goToPage('addaddresss')">Address</button> -->
</div>
</div>
</ion-content>
\ No newline at end of file
......@@ -19,7 +19,9 @@
<ion-row>
<ion-col size="8">
<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>&nbsp; {{product.category}}, {{product.subCate}}
<br/>
<span *ngFor="let tag of product.tag">#{{tag}}</span>
</p>
</ion-col>
<ion-col size="4">
......@@ -37,8 +39,8 @@
<li>
<button id="custom_check_button">
<label>
<input id="{{size.sizeId}}" type="radio" name="services" value="{{size.sizeId}}" (click)="cartService.choose_size(size.sizeName)" [checked]="i==0">
<p>{{size.sizeName}}</p>
<input id="{{size}}" type="radio" name="services" value="{{size}}" (click)="cartService.choose_size(size)" [checked]="i==0">
<p>{{size}}</p>
</label>
</button>
</li>
......@@ -49,7 +51,7 @@
<h5>Description</h5>
<p>{{product.prodDesc}}
</p>
<h5>
<!--<h5>
<span class="floatLeft">Reviews</span><span class="floatRight" (click)="goToPage('reviewlist')">MORE</span>
<div class="clear"></div>
</h5>
......@@ -112,57 +114,23 @@
<div class="clear"></div>
</li>
</ul>
</div>
<h5>
<span class="floatLeft">Related Products</span><span class="floatRight">MORE</span>
</div> -->
<h5 *ngIf="product.similar && product.similar.length > 0">
<span class="floatLeft">Related Products</span><span class="floatRight" (click)="goToPage('productlist', data)">MORE</span>
<div class="clear"></div>
</h5>
<div class="related_product_slider">
<ul>
<ul *ngIf="product.similar && product.similar.length > 0">
<ion-slides pager="false" [options]="relatedProd">
<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</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')">
<ion-slide *ngFor="let similar of product.similar">
<li (click)="viewProd(similar)">
<div class="product_image">
<img src="../assets/[email protected]">
<img [src]="similar.image" onerror="this.src='../assets/[email protected]'">
<div class="fav_icon">
</div>
<div class="featured_badge">Featured</div>
</div>
<h5>European Style V Neck</h5>
<p>AU$99.00<span>AU$110.00</span></p>
<h5>{{similar.prodName}}</h5>
<p>{{similar.price}}</p>
</li>
</ion-slide>
</ion-slides>
......
......@@ -5,6 +5,7 @@ import { Products } from './../../config/services/product';
import { Order } from './../../config/services/order';
import { CartsService } from './../../config/cart.service';
import { ProductsService } from './../../config/products.service';
import { ServiceService } from './../../config/service.service';
import { map } from 'rxjs/operators';
@Component({
......@@ -15,7 +16,7 @@ import { map } from 'rxjs/operators';
export class ProductdetailPage implements OnInit {
product: Products;
order: Order;
data: any;
slideOpts = {
slidesPerView: 3.5
};
......@@ -29,16 +30,29 @@ export class ProductdetailPage implements OnInit {
private route: ActivatedRoute,
private location: Location,
private cartService: CartsService,
private prodService: ProductsService
private prodService: ProductsService,
private service: ServiceService
) {
const params = this.prodService.selItem;
this.service.state = true;
this.prodService.similarProd(params.shopperId, params.category, params.subCate, params.prodId);
this.service.get('params').then((val) => {
this.data = val;
});
}
ngOnInit() {
console.log('here');
console.log(this.prodService.selItem);
const params = this.prodService.selItem;
this.getProd(params);
}
getProd(params) {
if (params) {
const prod: Products = {
prodId: params.prodId,
subCate: params.subCate,
tag: params.tag,
prodName: params.prodName,
prodCode: params.prodCode,
prodDesc: params.prodDesc,
......@@ -55,8 +69,7 @@ export class ProductdetailPage implements OnInit {
shopper: params.shopper,
skuCode: params.skuCode,
status: params.status,
size: params.size,
currency: params.currency
size: params.size
};
this.product = prod;
} else {
......@@ -79,6 +92,7 @@ export class ProductdetailPage implements OnInit {
}
goBack() {
this.service.state = false;
this.location.back();
}
......@@ -87,9 +101,13 @@ export class ProductdetailPage implements OnInit {
if (type === 1) {
this.router.navigateByUrl('cart');
} else {
alert('Product added to cart');
// alert('Product added to cart');
}
});
}
viewProd(prod) {
this.getProd(prod);
}
}
......@@ -23,19 +23,19 @@
</div>
<div class="clear"></div>
</div>
<div class="product_title">
Women's Fashion
<div class="product_title" *ngIf="data">
{{data.shopName}}
</div>
<ul [class.grid_view]="onGrid" *ngIf="prodService.product && prodService.product.length > 0">
<li *ngFor="let product of prodService.product; let i = index" (click)="prodDetails(i)">
<li *ngFor="let product of prodService.product; let i = index">
<div class="product_image">
<img [src]="product.image" onerror="this.src='../assets/[email protected]'">
<div class="fav_icon">
<img [src]="product.image" onerror="this.src='../assets/[email protected]'" (click)="prodDetails(i)">
<div class="fav_icon" (click)="changeFav(product.prodId)" *ngIf="checkFavStatus(product.prodId)">
</div>
<div class="featured_badge" *ngIf="product.featured">Featured</div>
</div>
<h5>{{product.prodName}}</h5>
<p>A$ {{product.price}}<span class="offer" *ngIf="product.discount > 0">-{{product.discount}}%</span></p>
<h5 class="ellipse" (click)="prodDetails(i)">{{product.prodName}}</h5>
<p (click)="prodDetails(i)">A$ {{product.price}}<span class="offer" *ngIf="product.discount > 0">-{{product.discount}}%</span></p>
</li>
</ul>
</div>
......
......@@ -126,6 +126,12 @@
}
}
}
.ellipse {
white-space: nowrap;
width: 180px;
overflow: hidden;
text-overflow: ellipsis;
}
}
.sort_wrappper {
......
......@@ -3,7 +3,7 @@ import { Location } from '@angular/common';
import { trigger, transition, animate, style } from '@angular/animations';
import { Router, ActivatedRoute, NavigationExtras } from '@angular/router';
import { ProductsService } from './../../config/products.service';
import { ServiceService } from './../../config/service.service';
@Component({
selector: 'app-productlist',
......@@ -25,18 +25,25 @@ export class ProductlistPage implements OnInit {
onGrid = false;
isShow = false;
data: any;
constructor(
private router: Router,
private route: ActivatedRoute,
private location: Location,
public prodService: ProductsService
) { }
ngOnInit() {
this.prodService.prodList();
public prodService: ProductsService,
public service: ServiceService
) {
this.service.state = false;
this.service.get('params').then((val) => {
this.data = val;
console.log(this.data);
this.prodService.prodList(this.data.uid);
});
}
ngOnInit() {}
goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
......@@ -51,7 +58,7 @@ export class ProductlistPage implements OnInit {
window.history.back();
}
gridToggle(){
gridToggle() {
this.onGrid = !this.onGrid;
}
......@@ -60,4 +67,22 @@ export class ProductlistPage implements OnInit {
this.router.navigateByUrl('productdetail');
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
changeFav(index) {
const state = this.prodService.fav.findIndex(x => x === index);
if (state > -1) {
this.prodService.fav.splice(state, 1);
this.prodService.changeFav(index, 'yes');
} else {
this.prodService.fav.push(index);
this.prodService.changeFav(index, 'no');
}
console.log(this.prodService.fav);
}
checkFavStatus(index) {
const state = this.prodService.fav.findIndex(x => x === index);
console.log(state);
return state > -1 ? true : true;
}
}
......@@ -13,77 +13,36 @@
Featured Stores
</div>
<div class="featured_slider">
<ion-slides pager="false" [options]="slideOpts">
<ion-slide>
<div class="feature_product" (click)="goToPage('productlist')">
<img src="./../../assets/getmi_malls/featured/featured1.png">
<ion-slides pager="false" [options]="slideOpts" *ngIf="shopperService.activeshoppers && shopperService.activeshoppers.length > 0">
<ion-slide *ngFor="let shopper of shopperService.activeshoppers">
<div class="feature_product" (click)="goToPage('productlist', shopper)">
<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">
<h5>VonZipper</h5>
<p>Lifestyle & Personality</p>
<h5>{{shopper.name}}</h5>
<p>{{shopper.caption}}</p>
</div>
</div>
</ion-slide>
</ion-slides>
</div>
<div class="home_sub_header">
Stores in Chadstone
<div class="home_sub_header" *ngIf="data">
{{data.centerName}}
</div>
<div class="nearby_shop_list">
<ul>
<li (click)="goToPage('catagory')">
<div class="nearby_image">
<img src="./../../assets/getmi_malls/store298/stores1.png">
</div>
<div class="nearby_detail">
<h5>
<span class="floatLeft">Witchery</span>
<span class="floatRight">5
<img src="../assets/Path61_2.png">
</span>
<div class="clear"></div>
</h5>
<p>Shop Women's Fashion</p>
</div>
<div class="clear"></div>
</li>
<li (click)="goToPage('catagory')">
<div class="nearby_image">
<img src="./../../assets/getmi_malls/store298/stores2.png">
</div>
<div class="nearby_detail">
<h5>
<span class="floatLeft">Tigerlily</span>
<span class="floatRight">4
<img src="../assets/Path61_2.png">
</span>
<div class="clear"></div>
</h5>
<p>Fun, Free-Spirited Clothing</p>
</div>
<div class="clear"></div>
</li>
<li (click)="goToPage('catagory')">
<ul *ngIf="shopperService.shoppers && shopperService.shoppers.length > 0">
<li *ngFor="let shopper of shopperService.shoppers" (click)="goToPage('productlist', shopper)">
<div class="nearby_image">
<img src="./../../assets/getmi_malls/store298/stores3.png">
<img [src]="shopper.profilePic" onerror="this.src='./../../assets/getmi_malls/store298/stores1.png'">
</div>
<div class="nearby_detail">
<h5>
<span class="floatLeft">VonZipper</span>
<span class="floatRight">5
<span class="floatLeft">{{shopper.name}}</span>
<span class="floatRight">0
<img src="../assets/Path61_2.png">
</span>
<div class="clear"></div>
</h5>
<p>Lifestyle & Personality</p>
<p>{{shopper.caption}}</p>
</div>
<div class="clear"></div>
</li>
......
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Router } from '@angular/router';
import { Location } from '@angular/common';
import { ServiceService } from './../../config/service.service';
import { ShoppersService } from './../../config/shopper.service';
@Component({
selector: 'app-storelist',
......@@ -12,16 +14,24 @@ export class StorelistPage implements OnInit {
slideOpts = {
slidesPerView: 1.5
};
data: any;
constructor(
public router: Router,
public location: Location
) { }
ngOnInit() {
public location: Location,
public service: ServiceService,
public shopperService: ShoppersService,
) {
this.service.get('params').then((val) => {
this.data = val;
this.shopperService.shopperList(this.data.cId, 'centerId');
});
}
ngOnInit() {}
goToPage(path, data = null) {
this.service.set('params', data);
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
......
......@@ -12,7 +12,7 @@
<div class="form_div">
<div class="row">
<p>We have sent and OTP to</p>
<h6>+01 4265 259 482 </h6>
<h6>+01 {{authService.userPostData.phone}} </h6>
</div>
<div class="row">
<input class="" type="number" placeholder="Type OTP" maxlength="4" #otp required>
......@@ -23,6 +23,7 @@
<div class="row">
<button class="resend_btn" (click)="authService.resend()">RESEND</button>
</div>
<h6>OTP: {{authService.userPostData.otp}}</h6>
</div>
</div>
......
......@@ -15,6 +15,7 @@ import { from } from 'rxjs';
export class AuthService {
userData: any;
type: number;
userPostData: any;
constructor(
public afs: AngularFirestore,
......@@ -30,9 +31,9 @@ export class AuthService {
console.log(this.userData);
this.service.set('user', JSON.stringify(this.userData));
if (this.type === 1) {
// this.router.navigateByUrl('home');
this.router.navigateByUrl('home');
} else {
// this.router.navigateByUrl('verification');
this.router.navigateByUrl('verification');
}
} else {
this.service.set('user', null);
......@@ -54,6 +55,8 @@ 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)
);
......@@ -128,6 +131,7 @@ export class AuthService {
currName: 'Australian dollar',
symbol: 'A$'
};
const otp = Math.floor(1000 + Math.random() * 9000);
userData = userData.user;
const postData: User = {
uid: userData.uid,
......@@ -139,9 +143,10 @@ export class AuthService {
emailVerified: userData.emailVerified,
emailId: userData.email,
currency: currencyData,
otp: Math.floor(1000 + Math.random() * 9000),
otp: otp.toString(),
loginType: 1
};
this.userPostData = postData;
console.log(postData);
this.afs.collection('customers').doc(userData.uid).set(postData).then(() => {
console.log('successs');
......@@ -151,6 +156,7 @@ export class AuthService {
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();
......@@ -170,9 +176,10 @@ export class AuthService {
emailVerified: false,
emailId: userData.emailId,
currency: currencyData,
otp: Math.floor(1000 + Math.random() * 9000),
otp: otp.toString(),
loginType: 0
};
this.userPostData = postData;
console.log(postData);
this.afs.collection('customers').doc(custData.uid).set(postData).then(() => {
console.log('successs');
......
......@@ -41,20 +41,21 @@ export class CartsService {
}
public async buyNow(product: Products) {
this.color = 'Blue';
this.prodId = product.prodId;
const prodRef = firebase.firestore().collection('products').doc(this.prodId);
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('product', '==', prodRef)
);
cartRef.valueChanges().pipe(take(1)).subscribe((value: Cart[]) => {
;
cartRef.valueChanges().pipe(take(1)).subscribe((value) => {
console.log(value);
if (value.length === 0) {
product.image = product.image === undefined ? '../assets/[email protected]' : product.image;
const cart: Cart = {
color: this.color,
color: Object.keys(product.color)[0],
custId: this.custId,
shopperId: product.shopperId,
product: firebase.firestore().doc(`products/${this.prodId}`),
......@@ -66,6 +67,7 @@ export class CartsService {
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(() => {
......@@ -76,7 +78,16 @@ export class CartsService {
console.error('Error adding document: ', error);
});
} 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 {
qty: item.qty,
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 response = property.data();
cartItem.prodName = response.prodName;
......@@ -123,6 +137,32 @@ export class CartsService {
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();
}
}
import { Injectable } from '@angular/core';
import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection } from '@angular/fire/firestore';
import { Category } from './services/category';
import * as firebase from 'firebase';
import { ServiceService } from './service.service';
@Injectable({
providedIn: 'root'
})
export class CategoriesService {
categories: Category[] = [];
activecategories: Category[] = [];
constructor(
public afs: AngularFirestore,
public service: ServiceService
) {
this.categoryList();
this.activeCategory();
}
public async categoryList() {
const This = this;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('shopcategory');
orderRef.valueChanges().subscribe((value) => {
this.categories = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item);
const category: Category = {
catId: item.catId,
catName: item.catName,
catImage: item.catImage,
featured: item.featured,
status: item.status
};
this.categories.push(category);
});
console.log(this.categories);
} else {
// alert('No Orders Found');
}
});
}
public async activeCategory() {
const This = this;
const state = true;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('shopcategory', ref => ref.where('status', '==', state));
orderRef.valueChanges().subscribe((value) => {
this.activecategories = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item);
const category: Category = {
catId: item.catId,
catName: item.catName,
catImage: item.catImage,
featured: item.featured,
status: item.status
};
this.activecategories.push(category);
});
console.log(this.activecategories);
} else {
// alert('No Orders Found');
}
});
}
}
......@@ -8,10 +8,12 @@ import * as firebase from 'firebase';
})
export class CenterService {
centers: Centers[] = [];
nearcenters: Centers[] = [];
constructor(
public afs: AngularFirestore
) {
this.centerList();
this.getNearBy(10.0159, 76.3419, 10);
}
public async centerList() {
......@@ -47,4 +49,49 @@ export class CenterService {
});
}
public async getNearBy(latitude, longitude, distance) {
const This = this;
const state = true;
const lat = 0.0144927536231884;
const lon = 0.0181818181818182;
const lowerLat = latitude - (lat * distance);
const lowerLon = longitude - (lon * distance);
const greaterLat = latitude + (lat * distance);
const greaterLon = longitude + (lon * distance);
const lesserGeopoint = new firebase.firestore.GeoPoint(lowerLat, lowerLon);
const greaterGeopoint = new firebase.firestore.GeoPoint(greaterLat, greaterLon);
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('centers', ref => ref.where('latLng', '>', lesserGeopoint)
.where('latLng', '<', greaterGeopoint).where('status', '==', state));
orderRef.valueChanges().subscribe((value) => {
this.nearcenters = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item);
if (item.centerName === undefined) {
return;
}
const center: Centers = {
centerName: item.centerName,
description: item.description,
location: item.location,
latLng: item.latLng,
featured: item.featured,
centerImg: item.centerImg,
status: item.status,
cId: item.cId
};
this.nearcenters.push(center);
});
console.log(this.nearcenters);
} else {
// alert('No Orders Found');
}
});
}
}
......@@ -8,16 +8,26 @@ import { ServiceService } from './../config/service.service';
})
export class ProductsService {
product: Products[] = [];
fav: any[];
selItem: Products;
similar: Products[] = [];
user: any;
constructor(
public afs: AngularFirestore,
public service: ServiceService
) { }
) {
this.service.get('user').then(data => {
this.user = JSON.parse(data);
this.getFavlist(this.user.uid);
});
}
public async prodList() {
public async prodList(shopperId: string) {
const This = this;
const prodRef: AngularFirestoreCollection<any> = this.afs.collection(`products`);
const state = true;
console.log(shopperId);
const prodRef: AngularFirestoreCollection<any> = this.afs.collection(`products`, ref => ref.where('shopperId', '==', shopperId)
.where('status', '==', state));
prodRef.valueChanges().subscribe((value) => {
this.product = [];
const res = value;
......@@ -30,8 +40,8 @@ export class ProductsService {
prodCode: item.prodCode,
prodDesc: item.prodDesc,
prodStatus: item.prodStatus,
brand: item.brand.brandName,
category: item.category.catName,
brand: item.brand,
category: item.category,
shopperId: item.shopperId,
color: item.color,
discount: item.discount,
......@@ -42,20 +52,91 @@ export class ProductsService {
shopper: item.shopper,
skuCode: item.skuCode,
status: item.status,
size: this.service.key2Array(item.size),
currency: item.currency
size: this.service.splitSep(item.size),
subCate: item.subCate,
tag: this.service.splitSep(item.tag)
};
this.product.push(prod);
});
console.log(this.product);
} else {
alert('No Products Found');
// alert('No Products Found');
}
});
}
similarProd(shopperId, category, subCate, prodId) {
const This = this;
const state = true;
console.log(shopperId);
const prodRef: AngularFirestoreCollection<any> = this.afs.collection(`products`, ref => ref.where('shopperId', '==', shopperId)
.where('status', '==', state).where('category', '==', category).where('subCate', '==', subCate).where('prodId', '>', prodId)
.where('prodId', '<', prodId));
prodRef.valueChanges().subscribe((value) => {
this.similar = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item.size);
const prod: Products = {
prodId: item.prodId,
prodName: item.prodName,
prodCode: item.prodCode,
prodDesc: item.prodDesc,
prodStatus: item.prodStatus,
brand: item.brand,
category: item.category,
shopperId: item.shopperId,
color: item.color,
discount: item.discount,
featured: item.featured,
image: item.image,
price: item.price,
qty: item.qty,
shopper: item.shopper,
skuCode: item.skuCode,
status: item.status,
size: this.service.splitSep(item.size),
subCate: item.subCate,
tag: this.service.splitSep(item.tag)
};
this.similar.push(prod);
});
console.log(this.similar);
} else {
// alert('No Products Found');
}
});
}
public async setProd(item: Products) {
this.selItem = item;
}
public async getFavlist(userId: string) {
const favRef: AngularFirestoreDocument<any> = this.afs.collection(`favourite`).doc(userId);
favRef.valueChanges().subscribe((value) => {
if (Object.keys(value).length > 0) {
this.fav = this.service.splitSep(value);
console.log(this.fav);
}
console.log(value);
});
}
public async changeFav(index, type) {
console.log(index, type);
if (type === 'yes') {
this.afs.collection('favourite').doc(this.user.uid).update({
[index]: true
});
} else {
this.afs.collection(`favourite`).doc(this.user.uid).update({
[index]: null
});
}
}
}
......@@ -6,7 +6,11 @@ import { Storage } from '@ionic/storage';
})
export class ServiceService {
constructor(public storage: Storage) { }
state: boolean;
constructor(public storage: Storage) {
this.state = true;
}
public set(settingName: string, value: any) {
return this.storage.set(`setting:${ settingName }`, value);
......@@ -36,5 +40,16 @@ export class ServiceService {
return response;
}
public splitSep(item: object) {
const response = [];
for (const key in item) {
if (item.hasOwnProperty(key)) {
response.push(key);
}
}
return response;
}
}
export interface Category {
catId: string;
catName: string;
catImage: any;
featured: boolean;
status: boolean;
}
export class Categories {
constructor(
public catName: string,
public featured: boolean,
public catImage: any,
public status: boolean,
public catId?: string,
) {
}
}
export interface Products {
brand: string;
category: string;
color: string;
color: any;
discount: number;
featured: boolean;
image: string;
......@@ -14,17 +14,9 @@ export interface Products {
shopperId: string;
qty: number;
shopper: string;
size: Size[];
size: string[];
skuCode: string;
status: boolean;
currency: {
currId: string;
currName: string;
symbol: string
};
}
export interface Size {
sizeId: string;
sizeName: string;
subCate: boolean;
tag: string[];
}
......@@ -8,7 +8,7 @@ export interface User {
emailVerified: boolean;
status: boolean;
loginType: number;
otp: number;
otp: string;
currency: {
currId: string;
currName: string;
......
......@@ -10,17 +10,19 @@ import * as firebase from 'firebase';
export class ShoppersService {
shoppers: Shopper[] = [];
activeshoppers: Shopper[] = [];
nearshoppers: Shopper[] = [];
constructor(
public afs: AngularFirestore,
public afAuth: AngularFireAuth,
) {
this.featuredshopperList();
this.getNearBy(10.0159, 76.3419, 10);
}
public async shopperList(centerId: string) {
public async shopperList(centerId: string, type: string) {
const This = this;
const state = true;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('shoppers', ref => ref.where('centerId', '==', centerId)
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('shoppers', ref => ref.where(type, '==', centerId)
.where('status', '==', state));
orderRef.valueChanges().subscribe((value) => {
this.shoppers = [];
......@@ -33,7 +35,7 @@ export class ShoppersService {
emailId: item.emailId,
phone: item.phone,
uid: item.uid,
profilePhoto: item.profilePhoto,
profilePhoto: item.profilePic,
status: item.status,
address: item.address,
featured: item.featured,
......@@ -70,7 +72,7 @@ export class ShoppersService {
emailId: item.emailId,
phone: item.phone,
uid: item.uid,
profilePhoto: item.profilePhoto,
profilePhoto: item.profilePic,
status: item.status,
address: item.address,
featured: item.featured,
......@@ -91,4 +93,54 @@ export class ShoppersService {
});
}
public async getNearBy(latitude, longitude, distance) {
const This = this;
const state = true;
const lat = 0.0144927536231884;
const lon = 0.0181818181818182;
const lowerLat = latitude - (lat * distance);
const lowerLon = longitude - (lon * distance);
const greaterLat = latitude + (lat * distance);
const greaterLon = longitude + (lon * distance);
const lesserGeopoint = new firebase.firestore.GeoPoint(lowerLat, lowerLon);
const greaterGeopoint = new firebase.firestore.GeoPoint(greaterLat, greaterLon);
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('shoppers', ref => ref.where('centre.latLng', '>', lesserGeopoint)
.where('centre.latLng', '<', greaterGeopoint).where('status', '==', state));
orderRef.valueChanges().subscribe((value) => {
this.nearshoppers = [];
const res = value;
if (res.length > 0) {
res.forEach((item) => {
console.log(item);
const shopper: Shopper = {
name: item.name,
emailId: item.emailId,
phone: item.phone,
uid: item.uid,
profilePhoto: item.profilePic,
status: item.status,
address: item.address,
featured: item.featured,
featuredImage: item.featuredImage,
shopName: item.shopName,
shopStatus: item.shopStatus,
workingHours: item.workingHours,
caption: item.caption,
centre: item.centre,
rate: item.rate
};
this.nearshoppers.push(shopper);
});
console.log(this.nearshoppers);
} else {
// alert('No Orders Found');
}
});
}
}
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