Commit 83fec59c by Adarsh K

Merge branch 'adarsh' into 'master'

Adarsh See merge request !84
parents 523b5916 2b6b7cdd
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
<preference name="SplashShowOnlyFirstTime" value="false" /> <preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" /> <preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="5000" /> <preference name="SplashScreenDelay" value="5000" />
<preference name="KeyboardResize" value="true" />
<preference name="resizeOnFullScreen" value="true" />
<platform name="android"> <platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android"> <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:networkSecurityConfig="@xml/network_security_config" /> <application android:networkSecurityConfig="@xml/network_security_config" />
...@@ -105,5 +107,4 @@ ...@@ -105,5 +107,4 @@
<plugin name="cordova-plugin-nativegeocoder" spec="3.2.2" /> <plugin name="cordova-plugin-nativegeocoder" spec="3.2.2" />
<plugin name="cordova-plugin-statusbar" spec="^2.4.2" /> <plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
<plugin name="cordova-plugin-ionic-keyboard" spec="2.2.0" /> <plugin name="cordova-plugin-ionic-keyboard" spec="2.2.0" />
<engine name="android" spec="7.1.4" />
</widget> </widget>
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
"@ionic-native/google-plus": "^5.19.1", "@ionic-native/google-plus": "^5.19.1",
"@ionic-native/keyboard": "^5.21.6", "@ionic-native/keyboard": "^5.21.6",
"@ionic-native/native-geocoder": "^5.19.1", "@ionic-native/native-geocoder": "^5.19.1",
"@ionic-native/navigation-bar": "^5.21.6",
"@ionic-native/social-sharing": "^5.20.0", "@ionic-native/social-sharing": "^5.20.0",
"@ionic-native/splash-screen": "^5.19.1", "@ionic-native/splash-screen": "^5.19.1",
"@ionic-native/status-bar": "^5.19.1", "@ionic-native/status-bar": "^5.19.1",
...@@ -37,22 +38,25 @@ ...@@ -37,22 +38,25 @@
"@types/googlemaps": "^3.39.2", "@types/googlemaps": "^3.39.2",
"agm-direction": "^0.7.9", "agm-direction": "^0.7.9",
"call-number": "^1.0.1", "call-number": "^1.0.1",
"cordova-android": "7.1.4", "cordova-android": "^8.1.0",
"cordova-plugin-device": "^2.0.3", "cordova-plugin-device": "^2.0.3",
"cordova-plugin-geolocation": "^4.0.2", "cordova-plugin-geolocation": "^4.0.2",
"cordova-plugin-googleplus": "^8.4.0", "cordova-plugin-googleplus": "^8.4.0",
"cordova-plugin-ionic-keyboard": "2.2.0", "cordova-plugin-ionic-keyboard": "2.2.0",
"cordova-plugin-ionic-webview": "^4.1.3", "cordova-plugin-ionic-webview": "^4.1.3",
"cordova-plugin-nativegeocoder": "^3.2.2", "cordova-plugin-nativegeocoder": "^3.2.2",
"cordova-plugin-navigationbar": "^1.0.31",
"cordova-plugin-splashscreen": "^5.0.3", "cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "^2.4.3", "cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.4", "cordova-plugin-whitelist": "^1.3.4",
"cordova-plugin-x-socialsharing": "^5.6.4", "cordova-plugin-x-socialsharing": "^5.6.4",
"cordova-sqlite-storage": "^3.4.1", "cordova-sqlite-storage": "^3.4.1",
"core-js": "^2.6.11", "core-js": "^2.6.11",
"elementtree": "^0.1.7",
"es6-promise-plugin": "^4.2.2", "es6-promise-plugin": "^4.2.2",
"firebase": "^6.6.2", "firebase": "^7.6.1",
"mx.ferreyra.callnumber": "0.0.2", "mx.ferreyra.callnumber": "0.0.2",
"properties-parser": "^0.3.1",
"rxjs": "^6.5.4", "rxjs": "^6.5.4",
"rxjs-compat": "^6.5.4", "rxjs-compat": "^6.5.4",
"tslib": "^1.9.0", "tslib": "^1.9.0",
...@@ -108,10 +112,11 @@ ...@@ -108,10 +112,11 @@
}, },
"mx.ferreyra.callnumber": {}, "mx.ferreyra.callnumber": {},
"call-number": {}, "call-number": {},
"cordova-plugin-ionic-keyboard": {} "cordova-plugin-ionic-keyboard": {},
"cordova-plugin-navigationbar": {}
}, },
"platforms": [ "platforms": [
"android" "android"
] ]
} }
} }
\ No newline at end of file
...@@ -18,7 +18,7 @@ import { CategoriesService } from './../config/category.service'; ...@@ -18,7 +18,7 @@ import { CategoriesService } from './../config/category.service';
import { SearchmodalPage } from './searchmodal/searchmodal.page'; import { SearchmodalPage } from './searchmodal/searchmodal.page';
import { trigger, transition, animate, style } from '@angular/animations'; import { trigger, transition, animate, style } from '@angular/animations';
import { NavigationBar } from '@ionic-native/navigation-bar/ngx';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: 'app.component.html', templateUrl: 'app.component.html',
...@@ -66,7 +66,8 @@ export class AppComponent { ...@@ -66,7 +66,8 @@ export class AppComponent {
public service: ServiceService, public service: ServiceService,
public categoryService: CategoriesService, public categoryService: CategoriesService,
public subjectService: SubjectService, public subjectService: SubjectService,
private route: ActivatedRoute private route: ActivatedRoute,
private navigationBar: NavigationBar
) { ) {
console.log(this.router.url); console.log(this.router.url);
this.state = true; this.state = true;
...@@ -101,6 +102,8 @@ export class AppComponent { ...@@ -101,6 +102,8 @@ export class AppComponent {
initializeApp() { initializeApp() {
this.platform.ready().then(() => { this.platform.ready().then(() => {
const autoHide = true;
this.navigationBar.setUp(autoHide);
this.statusBar.styleDefault(); this.statusBar.styleDefault();
this.statusBar.hide(); this.statusBar.hide();
this.statusBar.overlaysWebView(false); this.statusBar.overlaysWebView(false);
......
...@@ -8,6 +8,7 @@ import { StatusBar } from '@ionic-native/status-bar/ngx'; ...@@ -8,6 +8,7 @@ import { StatusBar } from '@ionic-native/status-bar/ngx';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { IonicStorageModule } from '@ionic/storage'; import { IonicStorageModule } from '@ionic/storage';
import { GooglePlus } from '@ionic-native/google-plus/ngx'; import { GooglePlus } from '@ionic-native/google-plus/ngx';
import { NavigationBar } from '@ionic-native/navigation-bar/ngx';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
...@@ -62,8 +63,9 @@ import { Keyboard } from '@ionic-native/keyboard/ngx'; ...@@ -62,8 +63,9 @@ import { Keyboard } from '@ionic-native/keyboard/ngx';
GooglePlus, GooglePlus,
SocialSharing, SocialSharing,
sanitizeHtmlPipe, sanitizeHtmlPipe,
NavigationBar,
Keyboard Keyboard
], ],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule {} export class AppModule { }
...@@ -55,4 +55,10 @@ ...@@ -55,4 +55,10 @@
</div> </div>
</div> </div>
</div> </div>
<div class="loader" *ngIf="loader">
<div class="lds-ripple">
<div></div>
<div></div>
</div>
</div>
</ion-content> </ion-content>
\ No newline at end of file
...@@ -31,6 +31,7 @@ export class CatStorelistPage implements OnInit { ...@@ -31,6 +31,7 @@ export class CatStorelistPage implements OnInit {
slidesPerView: 1.5 slidesPerView: 1.5
}; };
data: any; data: any;
loader: boolean;
constructor( constructor(
public router: Router, public router: Router,
...@@ -41,15 +42,19 @@ export class CatStorelistPage implements OnInit { ...@@ -41,15 +42,19 @@ export class CatStorelistPage implements OnInit {
private modalController: ModalController, private modalController: ModalController,
private subjectService: SubjectService private subjectService: SubjectService
) { ) {
this.loader = true;
this.service.get('catParams').then(val => { this.service.get('catParams').then(val => {
this.data = val; this.data = val;
if (this.data.catId === '0') { if (this.data.catId === '0') {
this.shopperService.shopperList(true, 'status'); this.shopperService.shopperList(true, 'status');
} else { } else {
console.log('error'); this.shopperService.categoryShopperList(this.data.catId);
this.shopperService.shopperList(this.data.catId, 'catId');
} }
}); });
const This = this;
setTimeout(() => {
This.loader = false;
}, 2000);
} }
async clickSearch() { async clickSearch() {
......
...@@ -47,7 +47,7 @@ export class ChangedetailsPage implements OnInit { ...@@ -47,7 +47,7 @@ export class ChangedetailsPage implements OnInit {
// }); // });
} }
ngOnInit() {} ngOnInit() { }
goToPage(path, data = null) { goToPage(path, data = null) {
this.router.navigateByUrl(path, { queryParams: data }); this.router.navigateByUrl(path, { queryParams: data });
...@@ -68,7 +68,7 @@ export class ChangedetailsPage implements OnInit { ...@@ -68,7 +68,7 @@ export class ChangedetailsPage implements OnInit {
form.value.password && form.value.password &&
form.value.password === form.value.confirmPassword form.value.password === form.value.confirmPassword
) { ) {
this.register.updateData(form.value, this.userData.uid); this.register.updateData(form.value, this.userData);
this.register.updatePassword( this.register.updatePassword(
form.value.currentPassword, form.value.currentPassword,
form.value.password form.value.password
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
<div class="nav_title floatLeft relative"> <div class="nav_title floatLeft relative">
<!-- <input class="search_bar" placeholder="Search here.. eg:shirts, retailers etc..." (click)="clickSearch()" (input)="searchFun($event.target.value)" #searchText> --> <!-- <input class="search_bar" placeholder="Search here.. eg:shirts, retailers etc..." (click)="clickSearch()" (input)="searchFun($event.target.value)" #searchText> -->
<input class="search_bar" placeholder="Search here.. eg:shirts, retailers etc..." (click)="goToPage('searchmodal')" /> <input class="search_bar" placeholder="Search here.. eg:shirts, retailers etc..."
(click)="goToPage('searchmodal')" />
</div> </div>
<button class="nav_btn nav_search floatRight" *ngIf="!searchShow" (click)="goToPage('searchmodal')"></button> <button class="nav_btn nav_search floatRight" *ngIf="!searchShow" (click)="goToPage('searchmodal')"></button>
<button class="nav_btn nav_close floatRight" *ngIf="searchShow" (click)="searchClose()"></button> <button class="nav_btn nav_close floatRight" *ngIf="searchShow" (click)="searchClose()"></button>
...@@ -31,7 +32,8 @@ ...@@ -31,7 +32,8 @@
<h5>{{center.centerName}}</h5> <h5>{{center.centerName}}</h5>
<p>{{center.description}}</p> <p>{{center.description}}</p>
</div> </div>
<img [src]="center.centerImg" onerror="this.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>
</ion-slides> </ion-slides>
</div> </div>
...@@ -39,10 +41,12 @@ ...@@ -39,10 +41,12 @@
Featured Stores Featured Stores
</div> </div>
<div class="featured_slider"> <div class="featured_slider">
<ion-slides pager="false" [options]="slideOpts" *ngIf="shopperService.activeshoppers && shopperService.activeshoppers.length > 0"> <ion-slides pager="false" [options]="slideOpts"
*ngIf="shopperService.activeshoppers && shopperService.activeshoppers.length > 0">
<ion-slide *ngFor="let shopper of shopperService.activeshoppers"> <ion-slide *ngFor="let shopper of shopperService.activeshoppers">
<div class="feature_product" (click)="goToPage('productlist', shopper)"> <div class="feature_product" (click)="goToPage('productlist', shopper)">
<img [src]="shopper.featuredImage" onerror="this.src='./../../assets/getmi_malls/featured/featured1.png'" /> <img [src]="shopper.featuredImage"
onerror="this.src='./../../assets/getmi_malls/featured/featured1.png'" />
<div class="feature_overlay"> <div class="feature_overlay">
<h5>{{shopper.name}}</h5> <h5>{{shopper.name}}</h5>
<p>{{shopper.caption}}</p> <p>{{shopper.caption}}</p>
...@@ -71,7 +75,8 @@ ...@@ -71,7 +75,8 @@
<ul *ngIf="centerService.nearcenters && centerService.nearcenters.length > 0"> <ul *ngIf="centerService.nearcenters && centerService.nearcenters.length > 0">
<li *ngFor="let center of centerService.nearcenters" (click)="goToPage('storelist', center)"> <li *ngFor="let center of centerService.nearcenters" (click)="goToPage('storelist', center)">
<div class="nearby_image"> <div class="nearby_image">
<img [src]="center.centerImg" onerror="this.src='./../../assets/getmi_malls/mall_298/mall2.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>
...@@ -88,12 +93,14 @@ ...@@ -88,12 +93,14 @@
</ul> </ul>
</div> </div>
<div class="home_sub_header"> <div class="home_sub_header">
Featured Catagories Featured Categories
</div> </div>
<div class="featured_catagory_list"> <div class="featured_catagory_list">
<ul *ngIf="categoriesService.activecategories && categoriesService.activecategories.length > 0"> <ul *ngIf="categoriesService.activecategories && categoriesService.activecategories.length > 0">
<li *ngFor="let categories of categoriesService.activecategories" (click)="goToPage('catstorelist', categories)"> <li *ngFor="let categories of categoriesService.activecategories"
<img [src]="categories.catImage" onerror="this.src='../assets/handsome-man-outdoors-drinking-coffee-with-sunglasses-guy-with-beard-instagram-effect_1212-818@3x.png'" /> (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"> <div class="featured_overlay">
<h4>{{categories.catName}}</h4> <h4>{{categories.catName}}</h4>
</div> </div>
...@@ -113,7 +120,8 @@ ...@@ -113,7 +120,8 @@
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<ion-content class="sort_wrappper"> <ion-content class="sort_wrappper">
<agm-map [zoom]="20" [latitude]="lat" [longitude]="lng" [disableDefaultUI]="false" [zoomControl]="false" [backgroundColor]="'rgba(29, 27, 130,0.2)'"> <agm-map [zoom]="20" [latitude]="lat" [longitude]="lng" [disableDefaultUI]="false" [zoomControl]="false"
[backgroundColor]="'rgba(29, 27, 130,0.2)'">
<agm-marker [latitude]="lat" [longitude]="lng" [iconUrl]=" <agm-marker [latitude]="lat" [longitude]="lng" [iconUrl]="
{ {
url: './assets/pin.svg', url: './assets/pin.svg',
...@@ -133,7 +141,9 @@ ...@@ -133,7 +141,9 @@
<li *ngFor="let address of addressService.addressList; let i = index"> <li *ngFor="let address of addressService.addressList; let i = index">
<div class="floatLeft"> <div class="floatLeft">
{{address.default}} {{address.default}}
<input class="styled-checkbox" name="addressId" id="styled-checkbox-{{i}}" type="radio" (click)="setDefault(address)" [value]="address.addressId" #addressType [checked]="address.defaultVal == 1" /> <input class="styled-checkbox" name="addressId" id="styled-checkbox-{{i}}" type="radio"
(click)="setDefault(address)" [value]="address.addressId" #addressType
[checked]="address.defaultVal == 1" />
<label for="styled-checkbox-{{i}}"> <label for="styled-checkbox-{{i}}">
{{address.addressType}} {{address.addressType}}
</label> </label>
......
...@@ -25,6 +25,7 @@ export class ProductdetailPage implements OnInit { ...@@ -25,6 +25,7 @@ export class ProductdetailPage implements OnInit {
data: any; data: any;
slideData: any[]; slideData: any[];
loader: boolean; loader: boolean;
custId: any;
bannerOptions = { bannerOptions = {
slidesPerView: 1, slidesPerView: 1,
...@@ -70,6 +71,7 @@ export class ProductdetailPage implements OnInit { ...@@ -70,6 +71,7 @@ export class ProductdetailPage implements OnInit {
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;
const This = this; const This = this;
this.cartService.cartList(data.uid); this.cartService.cartList(data.uid);
} }
...@@ -171,16 +173,16 @@ export class ProductdetailPage implements OnInit { ...@@ -171,16 +173,16 @@ export class ProductdetailPage implements OnInit {
} }
changeFav(index) { changeFav(index) {
this.prodService.changeFav(index, 'yes'); this.prodService.changeFav(index, 'yes', this.custId);
const state = this.prodService.fav.findIndex(x => x === index); const state = this.prodService.fav.findIndex(x => x === index);
// console.log(state); // console.log(state);
// console.log(this.prodService.fav); // console.log(this.prodService.fav);
if (state > -1) { if (state > -1) {
this.prodService.fav.splice(state, 1); this.prodService.fav.splice(state, 1);
this.prodService.changeFav(index, 'yes'); this.prodService.changeFav(index, 'yes', this.custId);
} else { } else {
this.prodService.fav.push(index); this.prodService.fav.push(index);
this.prodService.changeFav(index, 'no'); this.prodService.changeFav(index, 'no', this.custId);
} }
return; return;
// console.log(this.prodService.fav); // console.log(this.prodService.fav);
......
...@@ -46,7 +46,7 @@ export class ProductlistPage implements OnInit { ...@@ -46,7 +46,7 @@ export class ProductlistPage implements OnInit {
private subjectService: SubjectService private subjectService: SubjectService
) { ) {
this.loader = true; this.loader = true;
const users = this.service.get('user').then(data => { const users = this.service.get('userData').then(data => {
if (data) { if (data) {
data = JSON.parse(data); data = JSON.parse(data);
this.custId = data.uid; this.custId = data.uid;
...@@ -72,8 +72,10 @@ export class ProductlistPage implements OnInit { ...@@ -72,8 +72,10 @@ export class ProductlistPage implements OnInit {
} }
}); });
const users = this.service.get('user').then(data => { const users = this.service.get('user').then(data => {
console.log(data);
if (data) { if (data) {
data = JSON.parse(data); data = JSON.parse(data);
this.custId = data.uid;
this.prodService.getFavlist(data.uid); this.prodService.getFavlist(data.uid);
} }
}); });
...@@ -129,10 +131,10 @@ export class ProductlistPage implements OnInit { ...@@ -129,10 +131,10 @@ export class ProductlistPage implements OnInit {
console.log(this.prodService.fav); console.log(this.prodService.fav);
if (state > -1) { if (state > -1) {
this.prodService.fav.splice(state, 1); this.prodService.fav.splice(state, 1);
this.prodService.changeFav(index, 'yes'); this.prodService.changeFav(index, 'yes', this.custId);
} else { } else {
this.prodService.fav.push(index); this.prodService.fav.push(index);
this.prodService.changeFav(index, 'no'); this.prodService.changeFav(index, 'no', this.custId);
} }
return; return;
console.log(this.prodService.fav); console.log(this.prodService.fav);
......
...@@ -59,8 +59,6 @@ export class ProfilePage implements OnInit { ...@@ -59,8 +59,6 @@ export class ProfilePage implements OnInit {
this.service.get('user').then(data => { this.service.get('user').then(data => {
if (data) { if (data) {
this.userData = JSON.parse(data); this.userData = JSON.parse(data);
this.wishService.wishList(this.userData.uid);
console.log(this.userData);
} }
}); });
...@@ -69,7 +67,9 @@ export class ProfilePage implements OnInit { ...@@ -69,7 +67,9 @@ export class ProfilePage implements OnInit {
// Get user Data // Get user Data
this.service.get('userData').then(data => { this.service.get('userData').then(data => {
if (data) { if (data) {
console.log(data);
this.loggedUser = JSON.parse(data); this.loggedUser = JSON.parse(data);
this.wishService.wishList(this.loggedUser.uid);
} }
}); });
}); });
......
...@@ -98,7 +98,6 @@ ...@@ -98,7 +98,6 @@
font-weight: 900; font-weight: 900;
} }
.styled-checkbox { .styled-checkbox {
// take it out of document flow
opacity: 0; // hide it opacity: 0; // hide it
&+label { &+label {
position: relative; position: relative;
......
...@@ -22,7 +22,8 @@ export class ProductsService { ...@@ -22,7 +22,8 @@ export class ProductsService {
this.product = []; this.product = [];
this.fav = []; this.fav = [];
this.prodSlideImg = []; this.prodSlideImg = [];
this.service.get('user').then(data => { this.service.get('userData').then(data => {
console.log(data);
this.user = JSON.parse(data); this.user = JSON.parse(data);
this.getFavlist(this.user.uid); this.getFavlist(this.user.uid);
}); });
...@@ -263,12 +264,12 @@ export class ProductsService { ...@@ -263,12 +264,12 @@ export class ProductsService {
}); });
} }
public async changeFav(index, type) { public async changeFav(index, type, custId) {
// console.log(index, type, this.user.uid); console.log(index, type, custId);
if (type === 'no') { if (type === 'no') {
this.afs this.afs
.collection('favourite') .collection('favourite')
.doc(this.user.uid) .doc(custId)
.valueChanges() .valueChanges()
.pipe( .pipe(
take(1) // Here you can limit to only emit once, using the take operator take(1) // Here you can limit to only emit once, using the take operator
...@@ -277,7 +278,7 @@ export class ProductsService { ...@@ -277,7 +278,7 @@ export class ProductsService {
if (value === undefined) { if (value === undefined) {
this.afs this.afs
.collection('favourite') .collection('favourite')
.doc(this.user.uid) .doc(custId)
.set({ .set({
[index]: true [index]: true
}); });
...@@ -287,14 +288,14 @@ export class ProductsService { ...@@ -287,14 +288,14 @@ export class ProductsService {
// console.log(value); // console.log(value);
this.afs this.afs
.collection('favourite') .collection('favourite')
.doc(this.user.uid) .doc(custId)
.set(value); .set(value);
} }
}); });
} else { } else {
this.afs this.afs
.collection('favourite') .collection('favourite')
.doc(this.user.uid) .doc(custId)
.valueChanges() .valueChanges()
.pipe( .pipe(
take(1) // Here you can limit to only emit once, using the take operator take(1) // Here you can limit to only emit once, using the take operator
...@@ -309,7 +310,7 @@ export class ProductsService { ...@@ -309,7 +310,7 @@ export class ProductsService {
// console.log(value); // console.log(value);
this.afs this.afs
.collection('favourite') .collection('favourite')
.doc(this.user.uid) .doc(custId)
.set(value); .set(value);
} else { } else {
// console.log(value); // console.log(value);
......
...@@ -16,7 +16,11 @@ export class ShoppersService { ...@@ -16,7 +16,11 @@ export class ShoppersService {
shoppers: Shopper[] = []; shoppers: Shopper[] = [];
activeshoppers: Shopper[] = []; activeshoppers: Shopper[] = [];
nearshoppers: Shopper[] = []; nearshoppers: Shopper[] = [];
constructor(public afs: AngularFirestore, public afAuth: AngularFireAuth, public service: ServiceService) { constructor(
public afs: AngularFirestore,
public afAuth: AngularFireAuth,
public service: ServiceService
) {
this.featuredshopperList(); this.featuredshopperList();
this.getNearBy(-33.87276, 151.20534, this.service.distance); this.getNearBy(-33.87276, 151.20534, this.service.distance);
} }
...@@ -62,6 +66,121 @@ export class ShoppersService { ...@@ -62,6 +66,121 @@ export class ShoppersService {
}); });
} }
public async categoryShopperList(catId = null) {
const This = this;
const state = true;
this.shoppers = [];
const catRef = this.afs.collection('shopcategories').doc(catId).get().subscribe((data) => {
console.log(data.data());
let shoppeerList = [];
const shoppers = data.data();
if (shoppers && Object.keys(shoppers).length > 0) {
Object.keys(shoppers)
.forEach(function eachKey(key) {
shoppeerList.push(key);
});
console.log(shoppeerList);
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
'shoppers',
ref => ref.where('uid', 'in', shoppeerList).where('status', '==', state).orderBy('name', 'asc')
);
/* this.documentosCol = this.afs.collection('shoppers', ref => ref.where('pagada', 'in', [true, false]));*/
orderRef.valueChanges().subscribe(value => {
this.shoppers = [];
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,
location: item.location,
rate: item.rate,
centerId: item.centerId
};
this.shoppers.push(shopper);
});
// console.log(this.shoppers);
} else {
// alert('No Orders Found');
}
});
} else {
console.log(this.shoppers);
this.shoppers = [];
this.shoppers.length = 0;
}
});
/* .then(doc => {
if (!doc.exists) {
console.log('No such document!');
} else {
console.log('Document data:', doc.data());
}
})
.catch(err => {
console.log('Error getting document', err);
}); */
/*const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
'shoppers',
ref => ref.where(type, '==', centerId).where('status', '==', state).orderBy('name', 'asc')
);
orderRef.valueChanges().subscribe(value => {
this.shoppers = [];
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,
location: item.location,
rate: item.rate,
centerId: item.centerId
};
this.shoppers.push(shopper);
});
// console.log(this.shoppers);
} else {
// alert('No Orders Found');
}
});*/
}
public async featuredshopperList() { public async featuredshopperList() {
const This = this; const This = this;
const state = true; const state = true;
......
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