Commit 9c39a2ca by Adarsh K

Merge branch 'adarsh' into 'master'

Adarsh See merge request !86
parents 6d59bc4b 48c4b6dd
// 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"
]
}
}
......@@ -144,6 +144,7 @@ export class AppComponent {
'review'
];
const currentUrl = this.router.url.split('/');
console.log(currentUrl);
const index = restrictedUrl.findIndex(x => x === currentUrl[1]);
// console.log(currentUrl[1], index, this.state);
if (index > -1 || this.tabData === false) {
......
......@@ -125,8 +125,8 @@ export class HomePage implements OnInit {
this.address = address.address;
console.log(address.latLng);
this.centerService.getNearBy(
address.latLng._lat,
address.latLng._long,
address.latLng.latitude,
address.latLng.longitude,
this.service.distance
);
this.loader = false;
......
......@@ -141,7 +141,7 @@
}
.ellipse {
white-space: nowrap;
width: 180px;
width: 150px;
overflow: hidden;
text-overflow: ellipsis;
}
......
......@@ -51,8 +51,8 @@ export class TrackorderPage implements OnInit {
getDirection() {
this.order = this.myorder.selItem;
this.origin = { lat: this.order.pickupLocation._lat, lng: this.order.pickupLocation._long };
this.destination = { lat: this.order.deliveryLocation._lat, lng: this.order.deliveryLocation._long };
this.origin = { lat: this.order.pickupLocation.latitude, lng: this.order.pickupLocation.longitude };
this.destination = { lat: this.order.deliveryLocation.latitude, lng: this.order.deliveryLocation.longitude };
this.renderOptions = { polylineOptions: { strokeColor: 'rgba(69, 67, 152,1)' }, suppressMarkers: true };
this.markerOptions = {
origin: {
......
......@@ -137,7 +137,7 @@ export class AddressService {
public async getNearBy(centerId, userId, distance) {
// latitude, longitude, distance, userId
console.log(centerId);
console.log(centerId, userId, distance);
if (centerId) {
this.afs.collection('centers').doc(centerId).ref.get().then((doc) => {
if (doc.exists) {
......@@ -145,8 +145,7 @@ export class AddressService {
const center = doc.data();
const This = this;
const state = true;
const latitude = center.latLng._lat;
const longitude = center.latLng._long;
this.centerLoc = {
cId: center.cId,
centerImg: center.centerImg,
......@@ -157,17 +156,23 @@ export class AddressService {
location: center.location,
status: center.status
};
console.log(this.centerLoc);
const latitude = center.latLng.latitude;
const longitude = center.latLng.longitude;
const lat = 0.0144927536231884;
const lon = 0.0181818181818182;
console.log(latitude + ' - ' + lat + ' * ' + distance);
const lowerLat = latitude - lat * distance;
const lowerLon = longitude - lon * distance;
const greaterLat = latitude + lat * distance;
const greaterLon = longitude + lon * distance;
console.log(lowerLat, lowerLon, greaterLat, greaterLon);
const lesserGeopoint = new firebase.firestore.GeoPoint(lowerLat, lowerLon);
const greaterGeopoint = new firebase.firestore.GeoPoint(
greaterLat,
......
......@@ -140,7 +140,7 @@ export class OrdersService {
const promise = new Promise(resolve => {
distinctShops.forEach(item => {
console.log(item);
const pickup = new firebase.firestore.GeoPoint(centerLoc.latLng._lat, centerLoc.latLng._long);
const pickup = new firebase.firestore.GeoPoint(centerLoc.latLng.longitude, centerLoc.latLng.longitude);
const products = {};
const cartItem = cartGroup[item];
let prodPrice = 0;
......
......@@ -23,9 +23,9 @@ export class ProductsService {
this.fav = [];
this.prodSlideImg = [];
this.service.get('userData').then(data => {
console.log(data);
this.user = JSON.parse(data);
this.getFavlist(this.user.id);
console.log(this.user);
// this.getFavlist(this.user.uid);
});
}
......
......@@ -70,29 +70,43 @@ export class ShoppersService {
const This = this;
const state = true;
this.shoppers = [];
const itemsFound = {};
console.log(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) {
Object.keys(shoppers)
.forEach(function eachKey(key) {
shoppeerList.push(key);
});
console.log(shoppeerList);
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;
}
}
console.log(shopItems);
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
'shoppers',
ref => ref.where('uid', 'in', shoppeerList).where('status', '==', state).orderBy('name', 'asc')
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 = [];
console.log(value);
const res = value;
if (res.length > 0) {
res.forEach(item => {
......@@ -116,15 +130,19 @@ export class ShoppersService {
rate: item.rate,
centerId: item.centerId
};
if (!itemsFound[shopper.uid]) {
this.shoppers.push(shopper);
itemsFound[shopper.uid] = true;
}
});
// console.log(this.shoppers);
} else {
// alert('No Orders Found');
}
});
}
}
} else {
console.log(this.shoppers);
this.shoppers = [];
this.shoppers.length = 0;
}
......
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