Commit b79b7ad8 by Adarsh K

comments

parent 522787f4
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</ion-menu-toggle> </ion-menu-toggle>
<div class="sidemenu_list"> <div class="sidemenu_list">
<ul> <ul>
<ion-menu-toggle> <ion-menu-toggle (click)="hideTab()">
<li (click)="vieworder('home')">Shop</li> <li (click)="vieworder('home')">Shop</li>
</ion-menu-toggle> </ion-menu-toggle>
<!-- <li>About us</li> --> <!-- <li>About us</li> -->
......
...@@ -89,6 +89,10 @@ export class AppComponent { ...@@ -89,6 +89,10 @@ export class AppComponent {
}); });
} }
hideTab() {
alert('asdasdas');
}
async finishpop(data: any) { async finishpop(data: any) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: DeliverypopPage, component: DeliverypopPage,
...@@ -109,12 +113,12 @@ export class AppComponent { ...@@ -109,12 +113,12 @@ export class AppComponent {
'login', 'login',
'signup', 'signup',
'address', 'address',
'forgot' 'forgot',
'feedback'
]; ];
const currentUrl = this.router.url.split('/'); const currentUrl = this.router.url.split('/');
const index = restrictedUrl.findIndex(x => x === currentUrl[1]); const index = restrictedUrl.findIndex(x => x === currentUrl[1]);
// console.log(currentUrl[1], index, this.state); // console.log(currentUrl[1], index, this.state);
console.log(this.tabData);
if (index > -1 || this.tabData === false) { if (index > -1 || this.tabData === false) {
return true; return true;
} else { } else {
......
<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()"></button>
</button>
<div class="nav_title floatLeft"> <div class="nav_title floatLeft">
<input class="search_bar" placeholder="Search here.. eg:shirts, retailers etc..." (click)="clickSearch()"> <input
class="search_bar"
placeholder="Search here.. eg:shirts, retailers etc..."
(click)="clickSearch()"
/>
</div> </div>
<button class="nav_btn nav_search floatRight" *ngIf="!searchShow"> <button class="nav_btn nav_search floatRight" *ngIf="!searchShow"></button>
</button> <button
<button class="nav_btn nav_close floatRight" *ngIf="searchShow" (click)="searchClose()"> class="nav_btn nav_close floatRight"
</button> *ngIf="searchShow"
(click)="searchClose()"
></button>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<ion-content> <ion-content>
...@@ -16,10 +21,20 @@ ...@@ -16,10 +21,20 @@
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
<img [src]="shopper.featuredImage" onerror="this.src='./../../assets/getmi_malls/featured/featured1.png'"> class="feature_product"
(click)="goToPage('productlist', shopper)"
>
<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>
...@@ -33,15 +48,22 @@ ...@@ -33,15 +48,22 @@
</div> </div>
<div class="nearby_shop_list"> <div class="nearby_shop_list">
<ul *ngIf="shopperService.shoppers && shopperService.shoppers.length > 0"> <ul *ngIf="shopperService.shoppers && shopperService.shoppers.length > 0">
<li *ngFor="let shopper of shopperService.shoppers" (click)="goToPage('productlist', shopper)"> <li
*ngFor="let shopper of shopperService.shoppers"
(click)="goToPage('productlist', shopper)"
>
<div class="nearby_image"> <div class="nearby_image">
<img [src]="shopper.profilePic" onerror="this.src='./../../assets/getmi_malls/store298/stores1.png'"> <img
[src]="shopper.profilePic"
onerror="this.src='./../../assets/getmi_malls/store298/stores1.png'"
/>
</div> </div>
<div class="nearby_detail"> <div class="nearby_detail">
<h5> <h5>
<span class="floatLeft">{{shopper.name}}</span> <span class="floatLeft">{{shopper.name}}</span>
<span class="floatRight">0 <span class="floatRight"
<img src="../assets/Path61_2.png"> >0
<img src="../assets/Path61_2.png" />
</span> </span>
<div class="clear"></div> <div class="clear"></div>
</h5> </h5>
...@@ -50,13 +72,14 @@ ...@@ -50,13 +72,14 @@
<div class="clear"></div> <div class="clear"></div>
</li> </li>
</ul> </ul>
<div
class="no-result-wrapper"
*ngIf="shopperService.shoppers.length === 0"
>
<img src="../../assets/basket.png" />
<h1>No result found</h1>
<button (click)="goToPage('home')">home</button>
</div>
</div> </div>
</div> </div>
</ion-content> </ion-content>
<div class="search_item_list" *ngIf="searchShow" [@slideInOut]>
<ul>
<li>sample</li>
</ul>
</div>
\ No newline at end of file
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
p { p {
margin: 0px; margin: 0px;
text-align: right; text-align: right;
background-image: url("../../assets/Path 55_2.png"); background-image: url('../../assets/Path 55_2.png');
background-position: left; background-position: left;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 12px; background-size: 12px;
...@@ -296,14 +296,14 @@ ...@@ -296,14 +296,14 @@
.styled-checkbox { .styled-checkbox {
position: absolute; // take it out of document flow position: absolute; // take it out of document flow
opacity: 0; // hide it opacity: 0; // hide it
&+label { & + label {
position: relative; position: relative;
cursor: pointer; cursor: pointer;
padding: 0; padding: 0;
width: 100%; width: 100%;
} }
// Box. // Box.
&+label:before { & + label:before {
content: ''; content: '';
margin-right: 10px; margin-right: 10px;
display: inline-block; display: inline-block;
...@@ -314,21 +314,21 @@ ...@@ -314,21 +314,21 @@
background: white; background: white;
border: 1px solid rgba(215, 213, 228, 1); border: 1px solid rgba(215, 213, 228, 1);
} }
&:checked+label:before { &:checked + label:before {
background: #29285b; background: #29285b;
} }
// Disabled state label. // Disabled state label.
&:disabled+label { &:disabled + label {
color: #b8b8b8; color: #b8b8b8;
cursor: auto; cursor: auto;
} }
// Disabled box. // Disabled box.
&:disabled+label:before { &:disabled + label:before {
box-shadow: none; box-shadow: none;
background: #ddd; background: #ddd;
} }
// Checkmark. Could be replaced with an image // Checkmark. Could be replaced with an image
&:checked+label:after { &:checked + label:after {
content: ''; content: '';
position: absolute; position: absolute;
left: 6px; left: 6px;
...@@ -336,7 +336,8 @@ ...@@ -336,7 +336,8 @@
background: white; background: white;
width: 2px; width: 2px;
height: 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; 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); transform: rotate(45deg);
} }
} }
...@@ -361,3 +362,27 @@ ...@@ -361,3 +362,27 @@
} }
} }
} }
.no-result-wrapper {
text-align: center;
img {
width: 100px;
}
h1 {
font-size: 18px;
font-weight: bolder;
text-transform: uppercase;
color: #3b394d;
}
button {
background-color: #29285b;
border-radius: 8px;
height: 50px;
width: 48%;
color: #fff;
font-size: 18px;
font-weight: lighter;
text-transform: uppercase;
margin-top: 10px;
}
}
...@@ -59,10 +59,21 @@ ...@@ -59,10 +59,21 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<button (click)="onFeedbackSubmit(feedbackForm)" class="login_btn"> <button
(click)="onFeedbackSubmit(feedbackForm)"
class="login_btn"
[disabled]="submitted"
>
SENT SENT
</button> </button>
</div> </div>
</div> </div>
</form> </form>
</ion-content> </ion-content>
<div class="loader" *ngIf="feedService.loader">
<div class="lds-ripple">
<div></div>
<div></div>
</div>
</div>
...@@ -4,7 +4,7 @@ import { SubjectService } from '../../config/subject.service'; ...@@ -4,7 +4,7 @@ import { SubjectService } from '../../config/subject.service';
import { NgForm } from '@angular/forms'; import { NgForm } from '@angular/forms';
import { FeedbackData } from '../../config/services/feedback'; import { FeedbackData } from '../../config/services/feedback';
import { FeedbackService } from '../../config/feedback.service'; import { FeedbackService } from '../../config/feedback.service';
import { ToastController } from '@ionic/angular'; import { ServiceService } from '../../config/service.service';
@Component({ @Component({
selector: 'app-feedback', selector: 'app-feedback',
templateUrl: './feedback.page.html', templateUrl: './feedback.page.html',
...@@ -24,7 +24,7 @@ export class FeedbackPage implements OnInit { ...@@ -24,7 +24,7 @@ export class FeedbackPage implements OnInit {
private location: Location, private location: Location,
public subjectService: SubjectService, public subjectService: SubjectService,
public feedService: FeedbackService, public feedService: FeedbackService,
public toastController: ToastController public service: ServiceService
) { ) {
// Gets userdata // Gets userdata
this.subjectService.getUserData().subscribe(userData => { this.subjectService.getUserData().subscribe(userData => {
...@@ -39,8 +39,12 @@ export class FeedbackPage implements OnInit { ...@@ -39,8 +39,12 @@ export class FeedbackPage implements OnInit {
onFeedbackSubmit(form: NgForm) { onFeedbackSubmit(form: NgForm) {
this.submitted = true; this.submitted = true;
if (form.valid) { console.log(form.value);
if (form.valid && form.value.message !== '') {
this.feedService.feedbackCreate(form.value); this.feedService.feedbackCreate(form.value);
} else {
this.submitted = false;
this.service.showToast('Invalid request!', 'top', 'my-error', 1000);
} }
} }
......
...@@ -205,14 +205,3 @@ ...@@ -205,14 +205,3 @@
</div> </div>
</ion-content> </ion-content>
</div> </div>
<div class="search_item_list" *ngIf="searchShow" [@slideInOut]>
<ul *ngIf="searchService.searchList">
<li
*ngFor="let search of searchService.searchList"
(click)="viewPage(search)"
>
{{search.text}}
</li>
</ul>
</div>
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<!-- <button (click)="goToPage('addaddresss')">Address</button> --> <!-- <button (click)="goToPage('addaddresss')">Address</button> -->
</div> </div>
</div> </div>
<div class="loader" *ngIf="loader"> <div class="loader" *ngIf="authService.loader">
<div class="lds-ripple"> <div class="lds-ripple">
<div></div> <div></div>
<div></div> <div></div>
......
...@@ -112,6 +112,17 @@ ...@@ -112,6 +112,17 @@
<li> <li>
<input <input
class="styled-checkbox" class="styled-checkbox"
id="styled-checkbox-5"
type="radio"
value="a-z"
name="sort"
(click)="setValue($event.target.value)"
/>
<label for="styled-checkbox-5">Name A - Z</label>
</li>
<li>
<input
class="styled-checkbox"
id="styled-checkbox-3" id="styled-checkbox-3"
type="radio" type="radio"
value="low" value="low"
...@@ -131,6 +142,7 @@ ...@@ -131,6 +142,7 @@
/> />
<label for="styled-checkbox-4">Price High - Low</label> <label for="styled-checkbox-4">Price High - Low</label>
</li> </li>
<!-- <li> <!-- <li>
<input class="styled-checkbox" id="styled-checkbox-5" type="radio" value="rate" name="sort" (click)="setValue($event.target.value)"> <input class="styled-checkbox" id="styled-checkbox-5" type="radio" value="rate" name="sort" (click)="setValue($event.target.value)">
<label for="styled-checkbox-5">Rating</label> <label for="styled-checkbox-5">Rating</label>
...@@ -152,13 +164,3 @@ ...@@ -152,13 +164,3 @@
</div> </div>
</div> </div>
</ion-content> </ion-content>
<div class="search_item_list" *ngIf="searchShow" [@slideInOut]>
<ul *ngIf="searchService.searchList">
<li
*ngFor="let search of searchService.searchList"
(click)="viewPage(search)"
>
{{search.text}}
</li>
</ul>
</div>
...@@ -32,6 +32,7 @@ export class ProductlistPage implements OnInit { ...@@ -32,6 +32,7 @@ export class ProductlistPage implements OnInit {
searchShow = false; searchShow = false;
sortValue: string; sortValue: string;
loader: boolean; loader: boolean;
shopperId: any;
constructor( constructor(
private router: Router, private router: Router,
...@@ -46,6 +47,7 @@ export class ProductlistPage implements OnInit { ...@@ -46,6 +47,7 @@ export class ProductlistPage implements OnInit {
this.loader = true; this.loader = true;
this.service.get('params').then(val => { this.service.get('params').then(val => {
this.data = val; this.data = val;
this.shopperId = this.data.uid;
console.log(this.data); console.log(this.data);
this.prodService.prodList(this.data.uid); this.prodService.prodList(this.data.uid);
setTimeout(() => { setTimeout(() => {
...@@ -117,7 +119,7 @@ export class ProductlistPage implements OnInit { ...@@ -117,7 +119,7 @@ export class ProductlistPage implements OnInit {
submit() { submit() {
console.log(this.sortValue); console.log(this.sortValue);
this.prodService.filterSearch(this.sortValue); this.prodService.filterSearch(this.sortValue, this.shopperId);
} }
checkFavStatus(index) { checkFavStatus(index) {
......
...@@ -28,9 +28,11 @@ ...@@ -28,9 +28,11 @@
<ion-slides <ion-slides
pager="false" pager="false"
[options]="slideOpts" [options]="slideOpts"
*ngIf="shopperService.activeshoppers && shopperService.activeshoppers.length > 0" *ngIf="shopperService.activeshoppers && filterFunction(shopperService.activeshoppers).length > 0"
>
<ion-slide
*ngFor="let shopper of filterFunction(shopperService.activeshoppers)"
> >
<ion-slide *ngFor="let shopper of shopperService.activeshoppers">
<div <div
class="feature_product" class="feature_product"
(click)="goToPage('productlist', shopper)" (click)="goToPage('productlist', shopper)"
...@@ -85,9 +87,3 @@ ...@@ -85,9 +87,3 @@
</div> </div>
</div> </div>
</ion-content> </ion-content>
<div class="search_item_list" *ngIf="searchShow" [@slideInOut]>
<ul>
<li>sample</li>
</ul>
</div>
...@@ -31,6 +31,7 @@ export class StorelistPage implements OnInit { ...@@ -31,6 +31,7 @@ export class StorelistPage implements OnInit {
}; };
data: any; data: any;
loader: boolean; loader: boolean;
centerId: any;
constructor( constructor(
public router: Router, public router: Router,
...@@ -44,6 +45,7 @@ export class StorelistPage implements OnInit { ...@@ -44,6 +45,7 @@ export class StorelistPage implements OnInit {
this.loader = true; this.loader = true;
this.service.get('params').then(val => { this.service.get('params').then(val => {
this.data = val; this.data = val;
this.centerId = this.data.cId;
this.shopperService.shopperList(this.data.cId, 'centerId'); this.shopperService.shopperList(this.data.cId, 'centerId');
setTimeout(() => { setTimeout(() => {
this.loader = false; this.loader = false;
...@@ -82,4 +84,8 @@ export class StorelistPage implements OnInit { ...@@ -82,4 +84,8 @@ export class StorelistPage implements OnInit {
searchClose() { searchClose() {
this.searchShow = false; this.searchShow = false;
} }
filterFunction(featuredStore): any[] {
return featuredStore.filter(store => store.centerId === this.centerId);
}
} }
...@@ -76,7 +76,7 @@ export class AuthService { ...@@ -76,7 +76,7 @@ export class AuthService {
}) })
.catch(error => { .catch(error => {
this.loader = false; this.loader = false;
window.alert(error.message); this.service.showToast(error.message, 'bottom', 'my-error', 1000);
}); });
} }
...@@ -100,7 +100,12 @@ export class AuthService { ...@@ -100,7 +100,12 @@ export class AuthService {
this.router.navigateByUrl('nearby'); this.router.navigateByUrl('nearby');
} else { } else {
this.loader = false; this.loader = false;
window.alert('Please input valid OTP'); this.service.showToast(
'Please input valid OTP',
'bottom',
'my-error',
1000
);
} }
}); });
} }
...@@ -149,7 +154,7 @@ export class AuthService { ...@@ -149,7 +154,7 @@ export class AuthService {
console.log(result); console.log(result);
}) })
.catch(err => { .catch(err => {
alert(err.message); this.service.showToast(err.message, 'bottom', 'my-error', 1000);
}); });
} catch (error) { } catch (error) {
This.loader = false; This.loader = false;
......
...@@ -5,21 +5,24 @@ import { ...@@ -5,21 +5,24 @@ import {
} from '@angular/fire/firestore'; } from '@angular/fire/firestore';
import { take } from 'rxjs/operators'; import { take } from 'rxjs/operators';
import { FeedbackData } from './services/feedback'; import { FeedbackData } from './services/feedback';
import { ToastController } from '@ionic/angular'; import { ServiceService } from './service.service';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class FeedbackService { export class FeedbackService {
loader: boolean;
constructor( constructor(
public afs: AngularFirestore, public afs: AngularFirestore,
public toastController: ToastController, private router: Router,
private router: Router private service: ServiceService
) {} ) {
this.loader = false;
}
feedbackCreate(data: FeedbackData) { feedbackCreate(data: FeedbackData) {
console.log(data); this.loader = true;
this.afs this.afs
.collection('feedback') .collection('feedback')
.add({}) .add({})
...@@ -30,19 +33,21 @@ export class FeedbackService { ...@@ -30,19 +33,21 @@ export class FeedbackService {
.doc(data.feedbackId) .doc(data.feedbackId)
.set(data) .set(data)
.then(() => { .then(() => {
// SHows success toast this.service
this.toastController .showToast(
.create({ 'Thank you for your feedback!',
message: 'Thank you for your Feedback!', 'top',
duration: 2000, 'my-toast',
position: 'top', 2000
cssClass: 'my-toast' )
}) .then(() => {
.then(res => { this.loader = false;
res.present();
setTimeout(() => { setTimeout(() => {
this.router.navigateByUrl('home'); this.router.navigateByUrl('home');
}, 2100); }, 2100);
})
.catch(err => {
this.loader = false;
}); });
}); });
}); });
......
...@@ -61,7 +61,10 @@ export class ProductsService { ...@@ -61,7 +61,10 @@ export class ProductsService {
const prodRef: AngularFirestoreCollection<any> = this.afs.collection( const prodRef: AngularFirestoreCollection<any> = this.afs.collection(
`products`, `products`,
ref => ref =>
ref.where('shopperId', '==', shopperId).where('status', '==', state) ref
.orderBy('category', 'asc')
.where('shopperId', '==', shopperId)
.where('status', '==', state)
); );
prodRef.valueChanges().subscribe(value => { prodRef.valueChanges().subscribe(value => {
this.product = []; this.product = [];
...@@ -101,7 +104,7 @@ export class ProductsService { ...@@ -101,7 +104,7 @@ export class ProductsService {
}); });
} }
public async filterSearch(sortValue: string) { public async filterSearch(sortValue: string, shopperId: string) {
const This = this; const This = this;
const state = true; const state = true;
// console.log(sortValue); // console.log(sortValue);
...@@ -117,15 +120,19 @@ export class ProductsService { ...@@ -117,15 +120,19 @@ export class ProductsService {
order = 'desc'; order = 'desc';
} }
if (sortValue === 'rate') { if (sortValue === 'a-z') {
// field = 'price'; field = 'prodName';
// order = 'desc'; order = 'asc';
} }
// tslint:disable-next-line:max-line-length // tslint:disable-next-line:max-line-length
const prodRef: AngularFirestoreCollection<any> = this.afs.collection( const prodRef: AngularFirestoreCollection<any> = this.afs.collection(
`products`, `products`,
ref => ref.where('status', '==', state).orderBy(field, order) ref =>
ref
.where('status', '==', state)
.where('shopperId', '==', shopperId)
.orderBy(field, order)
); );
prodRef.valueChanges().subscribe(value => { prodRef.valueChanges().subscribe(value => {
this.product = []; this.product = [];
......
...@@ -28,8 +28,8 @@ export class SearchService { ...@@ -28,8 +28,8 @@ export class SearchService {
ref => ref =>
ref ref
.where('status', '==', state) .where('status', '==', state)
.orderBy('name') .orderBy('searchName')
.startAt(inputText.toUpperCase()) .startAt(inputText.toLowerCase())
.endAt(inputText.toLowerCase() + '\uf8ff') .endAt(inputText.toLowerCase() + '\uf8ff')
.limit(5) .limit(5)
); );
...@@ -55,7 +55,7 @@ export class SearchService { ...@@ -55,7 +55,7 @@ export class SearchService {
ref ref
.where('status', '==', state) .where('status', '==', state)
.orderBy('prodName') .orderBy('prodName')
.startAt(inputText.toUpperCase()) .startAt(inputText.toLowerCase())
.endAt(inputText.toLowerCase() + '\uf8ff') .endAt(inputText.toLowerCase() + '\uf8ff')
.limit(5) .limit(5)
); );
...@@ -82,7 +82,7 @@ export class SearchService { ...@@ -82,7 +82,7 @@ export class SearchService {
ref ref
.where('status', '==', state) .where('status', '==', state)
.orderBy('catName') .orderBy('catName')
.startAt(inputText.toUpperCase()) .startAt(inputText.toLowerCase())
.endAt(inputText.toLowerCase() + '\uf8ff') .endAt(inputText.toLowerCase() + '\uf8ff')
.limit(5) .limit(5)
); );
......
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
import { Storage } from "@ionic/storage"; import { Storage } from '@ionic/storage';
import { ToastController } from '@ionic/angular';
@Injectable({ @Injectable({
providedIn: "root" providedIn: 'root'
}) })
export class ServiceService { export class ServiceService {
state: boolean; state: boolean;
constructor(public storage: Storage) { constructor(
public storage: Storage,
public toastController: ToastController
) {
this.state = true; this.state = true;
} }
...@@ -25,7 +29,7 @@ export class ServiceService { ...@@ -25,7 +29,7 @@ export class ServiceService {
public clear() { public clear() {
this.storage.clear().then(() => { this.storage.clear().then(() => {
console.log("all keys cleared"); console.log('all keys cleared');
}); });
} }
...@@ -48,4 +52,25 @@ export class ServiceService { ...@@ -48,4 +52,25 @@ export class ServiceService {
} }
return response; return response;
} }
showToast(msg, positions, className, durations = 2000) {
try {
const promise1 = new Promise((resolve, reject) => {
this.toastController
.create({
message: msg,
duration: durations,
position: positions,
cssClass: className
})
.then(res => {
res.present();
resolve(true);
});
});
return promise1;
} catch (error) {
console.log('error: ' + error);
}
}
} }
...@@ -14,6 +14,7 @@ export interface Shopper { ...@@ -14,6 +14,7 @@ export interface Shopper {
rate: any; rate: any;
workingHours: string; workingHours: string;
featuredImage: string; featuredImage: string;
centerId: string;
} }
export interface ShopperData { export interface ShopperData {
...@@ -36,4 +37,3 @@ export interface ShopperData { ...@@ -36,4 +37,3 @@ export interface ShopperData {
rate: any; rate: any;
workingHours: string; workingHours: string;
} }
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
import { AngularFireAuth } from "@angular/fire/auth"; import { AngularFireAuth } from '@angular/fire/auth';
import { import {
AngularFirestore, AngularFirestore,
AngularFirestoreDocument, AngularFirestoreDocument,
AngularFirestoreCollection AngularFirestoreCollection
} from "@angular/fire/firestore"; } from '@angular/fire/firestore';
import { Shopper } from "./services/shopper"; import { Shopper } from './services/shopper';
import * as firebase from "firebase"; import * as firebase from 'firebase';
@Injectable({ @Injectable({
providedIn: "root" providedIn: 'root'
}) })
export class ShoppersService { export class ShoppersService {
shoppers: Shopper[] = []; shoppers: Shopper[] = [];
...@@ -24,8 +24,8 @@ export class ShoppersService { ...@@ -24,8 +24,8 @@ export class ShoppersService {
const This = this; const This = this;
const state = true; const state = true;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection( const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"shoppers", 'shoppers',
ref => ref.where(type, "==", centerId).where("status", "==", state) ref => ref.where(type, '==', centerId).where('status', '==', state)
); );
orderRef.valueChanges().subscribe(value => { orderRef.valueChanges().subscribe(value => {
this.shoppers = []; this.shoppers = [];
...@@ -48,7 +48,8 @@ export class ShoppersService { ...@@ -48,7 +48,8 @@ export class ShoppersService {
workingHours: item.workingHours, workingHours: item.workingHours,
caption: item.caption, caption: item.caption,
centre: item.centre, centre: item.centre,
rate: item.rate rate: item.rate,
centerId: item.centerId
}; };
this.shoppers.push(shopper); this.shoppers.push(shopper);
}); });
...@@ -63,8 +64,8 @@ export class ShoppersService { ...@@ -63,8 +64,8 @@ export class ShoppersService {
const This = this; const This = this;
const state = true; const state = true;
const orderRef: AngularFirestoreCollection<any> = this.afs.collection( const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"shoppers", 'shoppers',
ref => ref.where("featured", "==", state).where("status", "==", state) ref => ref.where('featured', '==', state).where('status', '==', state)
); );
orderRef.valueChanges().subscribe(value => { orderRef.valueChanges().subscribe(value => {
this.activeshoppers = []; this.activeshoppers = [];
...@@ -87,7 +88,8 @@ export class ShoppersService { ...@@ -87,7 +88,8 @@ export class ShoppersService {
workingHours: item.workingHours, workingHours: item.workingHours,
caption: item.caption, caption: item.caption,
centre: item.centre, centre: item.centre,
rate: item.rate rate: item.rate,
centerId: item.centerId
}; };
this.activeshoppers.push(shopper); this.activeshoppers.push(shopper);
}); });
...@@ -117,12 +119,12 @@ export class ShoppersService { ...@@ -117,12 +119,12 @@ export class ShoppersService {
greaterLon greaterLon
); );
const orderRef: AngularFirestoreCollection<any> = this.afs.collection( const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
"shoppers", 'shoppers',
ref => ref =>
ref ref
.where("centre.latLng", ">", lesserGeopoint) .where('centre.latLng', '>', lesserGeopoint)
.where("centre.latLng", "<", greaterGeopoint) .where('centre.latLng', '<', greaterGeopoint)
.where("status", "==", state) .where('status', '==', state)
); );
orderRef.valueChanges().subscribe(value => { orderRef.valueChanges().subscribe(value => {
this.nearshoppers = []; this.nearshoppers = [];
...@@ -145,7 +147,8 @@ export class ShoppersService { ...@@ -145,7 +147,8 @@ export class ShoppersService {
workingHours: item.workingHours, workingHours: item.workingHours,
caption: item.caption, caption: item.caption,
centre: item.centre, centre: item.centre,
rate: item.rate rate: item.rate,
centerId: item.centerId
}; };
this.nearshoppers.push(shopper); this.nearshoppers.push(shopper);
}); });
......
...@@ -665,3 +665,9 @@ ion-header { ...@@ -665,3 +665,9 @@ ion-header {
--border-radius: 4px; --border-radius: 4px;
--color: #fff; --color: #fff;
} }
.my-error {
--background: rgb(212, 43, 38);
--border-radius: 4px;
--color: #fff;
}
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