Commit 3d4110d8 by Adarsh K

category list

parent 2b6b7cdd
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
import { AppPage } from './app.po';
describe('new App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getPageTitle()).toContain('Tab One');
});
});
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get('/');
}
getPageTitle() {
return element(by.css('ion-title')).getText();
}
}
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}
......@@ -71,8 +71,9 @@ export class ShoppersService {
const state = true;
this.shoppers = [];
const catRef = this.afs.collection('shopcategories').doc(catId).get().subscribe((data) => {
this.shoppers = [];
console.log(data.data());
let shoppeerList = [];
const shoppeerList = [];
const shoppers = data.data();
if (shoppers && Object.keys(shoppers).length > 0) {
......@@ -83,46 +84,62 @@ export class ShoppersService {
});
console.log(shoppeerList);
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
'shoppers',
ref => ref.where('uid', 'in', shoppeerList).where('status', '==', state).orderBy('name', 'asc')
);
if (shoppeerList.length > 0) {
const counter = Math.ceil(shoppeerList.length / 10);
for (let i = 0; i < counter; i++) {
const shopItems = [];
for (let j = 0; j < 10; j++) {
const k = j + (i * 10);
if (shoppeerList.length > k) {
shopItems.push(shoppeerList[k]);
} else {
break;
}
/* this.documentosCol = this.afs.collection('shoppers', ref => ref.where('pagada', 'in', [true, false]));*/
}
console.log(shopItems);
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
'shoppers',
ref => ref.where('uid', 'in', shopItems).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);
orderRef.valueChanges().subscribe(value => {
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');
}
});
// console.log(this.shoppers);
} else {
// alert('No Orders Found');
}
});
}
} else {
console.log(this.shoppers);
this.shoppers = [];
......
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