Commit 4bd150d3 by Adarsh K

live changes

parent 879c02cd
......@@ -1458,6 +1458,21 @@
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/screen-orientation": {
"version": "5.13.0",
"resolved": "https://registry.npmjs.org/@ionic-native/screen-orientation/-/screen-orientation-5.13.0.tgz",
"integrity": "sha512-YLJJ97pDLWRSfbNNpFVfNLbIIXFzegavsvylSXIp3xJuaNDD6inKu93ozRxoiV/xYkdWwoUnw8eQxkDTGrP7jQ==",
"requires": {
"@types/cordova": "^0.0.34"
},
"dependencies": {
"@types/cordova": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
"integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
}
}
},
"@ionic-native/splash-screen": {
"version": "5.12.0",
"resolved": "https://registry.npmjs.org/@ionic-native/splash-screen/-/splash-screen-5.12.0.tgz",
......@@ -3609,6 +3624,11 @@
"resolved": "https://registry.npmjs.org/cordova-plugin-ionic-webview/-/cordova-plugin-ionic-webview-4.1.1.tgz",
"integrity": "sha512-y8drBhMdkHKUr0zu+UGkFGsDrkCsxjbCd3RzzlyDxcEzdHWvasRM5gyDiKBHkziT2iHYzEAjXwkT1ZXKU3OY9Q=="
},
"cordova-plugin-screen-orientation": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/cordova-plugin-screen-orientation/-/cordova-plugin-screen-orientation-3.0.2.tgz",
"integrity": "sha512-2w6CMC+HGvbhogJetalwGurL2Fx8DQCCPy3wlSZHN1/W7WoQ5n9ujVozcoKrY4VaagK6bxrPFih+ElkO8Uqfzg=="
},
"cordova-plugin-splashscreen": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/cordova-plugin-splashscreen/-/cordova-plugin-splashscreen-5.0.2.tgz",
......@@ -4344,6 +4364,11 @@
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",
"dev": true
},
"es6-promise-plugin": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/es6-promise-plugin/-/es6-promise-plugin-4.2.2.tgz",
"integrity": "sha512-uoA4aVplXI9oqUYJFBAVRwAqIN9/n9JgrTAUGX3qPbnSZVE5yY1+6/MsoN5f4xsaPO62WjPHOdtts6okMN6tNA=="
},
"es6-promisify": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
......
......@@ -22,6 +22,7 @@
"@angular/platform-browser-dynamic": "~8.1.2",
"@angular/router": "~8.1.2",
"@ionic-native/core": "^5.0.0",
"@ionic-native/screen-orientation": "^5.13.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.12.0",
"@ionic/angular": "^4.7.1",
......@@ -32,11 +33,13 @@
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^4.1.1",
"cordova-plugin-screen-orientation": "^3.0.2",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-sqlite-storage": "^3.3.0",
"core-js": "^2.5.4",
"es6-promise-plugin": "^4.2.2",
"firebase": "^6.4.2",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
......@@ -79,7 +82,8 @@
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-ionic-keyboard": {},
"cordova-sqlite-storage": {}
"cordova-sqlite-storage": {},
"cordova-plugin-screen-orientation": {}
},
"platforms": [
"android"
......
import { Component } from '@angular/core';
import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
declare var window: any;
@Component({
selector: 'app-root',
......@@ -9,11 +11,36 @@ import { StatusBar } from '@ionic-native/status-bar/ngx';
styleUrls: ['app.component.scss']
})
export class AppComponent {
currentScreenOrientation: string;
currentState: string;
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar
private statusBar: StatusBar,
private screenOrientation: ScreenOrientation
) {
this.currentState = '';
this.currentScreenOrientation = this.screenOrientation.type; // logs the current orientation, example: 'landscape'
console.log(this.currentScreenOrientation);
// detect orientation changes
/*this.screenOrientation.onChange().subscribe(
() => {
console.log('Orientation Changed');
}
);*/
window.addEventListener('orientationchange', _ => {
this.currentScreenOrientation = this.screenOrientation.type; // logs the current orientation, example: 'landscape'
console.log(this.currentScreenOrientation);
if (this.currentState !== this.currentScreenOrientation) {
this.currentState = this.currentScreenOrientation;
window.location.reload();
// const orient = this.currentScreenOrientation === 'portrait-primary' ? 'Portrait' : 'LandScape';
// console.log(orient);
// const orient = this.currentScreenOrientation === 'portrait-primary' ? this.setPortrait() : this.setLandscape();
}
});
this.initializeApp();
}
......@@ -21,8 +48,25 @@ export class AppComponent {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
this.screenOrientation.unlock();
this.statusBar.overlaysWebView(false);
});
}
setLandscape(){
// set to landscape
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE);
}
setPortrait(){
// set to portrait
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT);
}
unlockScreen(){
// allow user rotate
this.screenOrientation.unlock();
}
}
......@@ -4,6 +4,7 @@ import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { IonicStorageModule } from '@ionic/storage';
......@@ -37,6 +38,7 @@ import { AppRoutingModule } from './app-routing.module';
providers: [
StatusBar,
SplashScreen,
ScreenOrientation,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]
......
......@@ -62,7 +62,7 @@
<button class="track" (click)="goToPage('trackorder')">03<span>Mnt</span> <strong>TRACK
RIDER</strong></button>
<button class="marked" (click)="shopperTrack(order.orderId, 2)" *ngIf="order.shopperState == 1">MARKED AS PACKED</button>
<button class="marked" (click)="shopperTrack(order.orderId, 3)" *ngIf="order.shopperState == 2">RIDER PICKED</button>
<button [ngClass]="{'disabled':order.orderStatus != 6}" class="marked" (click)="shopperTrack(order.orderId, 3)" *ngIf="order.shopperState == 2" [disabled]="order.orderStatus != 6">RIDER PICKED</button>
<button class="marked" *ngIf="order.shopperState == 3">PROCESSING...</button>
</div>
</div>
......@@ -70,7 +70,7 @@
</ion-slide>
</ion-slides><!-- -->
</div>
<div class="order_header">
<div class="order_header" *ngIf="myorder.pastOrders && myorder.pastOrders.length > 0">
<h5 class="floatLeft">PAST SALES</h5>
<button class="view_btn floatRight" (click)="goToPage('pastsales')"> SEE ALL</button>
<div class="clear"></div>
......
......@@ -36,8 +36,6 @@ export class HomePage implements OnInit {
}
next() {
this.slides.slideNext();
}
......@@ -55,7 +53,7 @@ export class HomePage implements OnInit {
}
reject(orderId: string) {
this.myorder.rideChange(orderId, 8);
this.myorder.rideChange(orderId, 9);
}
accept(orderId: string) {
......@@ -78,7 +76,7 @@ export class HomePage implements OnInit {
case 7:
return 'Delivered';
break;
case 8:
case 9:
return 'Rejected';
break;
default:
......
......@@ -23,8 +23,10 @@ export class AuthService {
if (user) {
this.userData = user;
this.service.set('user', JSON.stringify(this.userData));
this.router.navigateByUrl('home');
} else {
this.service.set('user', null);
this.router.navigateByUrl('login');
JSON.parse(localStorage.getItem('user'));
}
});
......@@ -33,7 +35,6 @@ export class AuthService {
public async SignIn(email: string, password: string) {
return this.afAuth.auth.signInWithEmailAndPassword(email, password).then((result) => {
console.log('success');
this.router.navigateByUrl('home');
this.SetUserData(result.user);
}).catch((error) => {
window.alert(error.message);
......
......@@ -23,8 +23,8 @@ export class MyordersService {
data = JSON.parse(data);
this.shopperId = data.uid;
if (this.shopperId !== undefined) {
this.orderList(this.shopperId);
this.pastOrderList(this.shopperId);
// this.orderList(this.shopperId);
// this.pastOrderList(this.shopperId);
}
} else {
this.shopperId = 'qbTKza18mWVzYG9NLIbmjMbrYjG2';
......@@ -32,7 +32,7 @@ export class MyordersService {
});
}
public async orderList(shopperId) {
public async orgorderList(shopperId) {
console.log('called');
console.log(shopperId);
const This = this;
......@@ -73,6 +73,59 @@ export class MyordersService {
});
}
public async orderList(shopperId) {
console.log('called');
console.log(shopperId);
const This = this;
this.orders = [];
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('orders', ref => ref.where('shopperId', '==', shopperId)
.where('orderStatus', '<=', 4));
orderRef.stateChanges().subscribe((value) => {
console.log('called');
const res = value;
if (res.length > 0) {
res.forEach((items) => {
const item = items.payload.doc.data();
console.log(item);
const orderId = item.orderId;
console.log(item);
const order: Myorder = {
prodName: item.prodName,
color: item.color,
image: item.image,
amount: item.amount,
qty: item.qty,
status: item.status,
orderStatus: item.orderStatus,
bookDate: item.bookDate,
deliveryLocation: item.deliveryLocation,
deliveryAddress: item.deliveryAddress,
pickupAddress: item.pickupAddress,
pickupLocation: item.pickupLocation,
riderName: 'John',
orderId: item.orderId,
orderCode: item.orderCode,
size: item.size,
shopperState: item.shopperState !== undefined ? item.shopperState : 0,
time: '60'
};
if (items.type === 'added') {
this.orders.push(order);
} else {
console.log(orderId);
const index = this.orders.findIndex(obj => obj.orderId === orderId);
if (index > 0) {
this.orders[index] = order;
}
}
});
console.log(this.orders);
} else {
// alert('No Orders Found');
}
});
}
public async pastOrderList(shopperId) {
console.log('called');
console.log(shopperId);
......
......@@ -94,6 +94,10 @@ button {
cursor: pointer;
}
.disabled{
color:#ccc !important;
border:1px solid #ccc !important;
}
/*-------------------------------
......
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