Commit 9ce99726 by Adarsh K

sprint 1

parent 7b0cfb74
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<preference name="ScrollEnabled" value="false" /> <preference name="ScrollEnabled" value="false" />
<preference name="android-minSdkVersion" value="19" /> <preference name="android-minSdkVersion" value="19" />
<preference name="BackupWebStorage" value="none" /> <preference name="BackupWebStorage" value="none" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="SplashMaintainAspectRatio" value="true" /> <preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" /> <preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" /> <preference name="SplashShowOnlyFirstTime" value="false" />
......
...@@ -89,4 +89,4 @@ ...@@ -89,4 +89,4 @@
"android" "android"
] ]
} }
} }
\ No newline at end of file
...@@ -22,32 +22,49 @@ ...@@ -22,32 +22,49 @@
</div> </div>
<div class="incoming_order"> <div class="incoming_order">
<!-- [options]="orderOptions" (ionSlideDidChange)="slideChanged()" [hidden]="currentIndex ==3" #slides--> <!-- [options]="orderOptions" (ionSlideDidChange)="slideChanged()" [hidden]="currentIndex ==3" #slides-->
<ion-slides pager="false"> <ion-slides pager="false" [options]="orderOptions">
<ion-slide *ngFor="let order of myorder.orders; let i = index"> <ion-slide *ngFor="let order of myorder.orders; let i = index">
<div class="incoming_order_wrapper"> <div class="incoming_order_wrapper">
<div class="incoming_detail"> <div class="incoming_detail">
<div class="image"> <div class="order_info">
<img [src]="order.image" /> <h5 class="floatLeft">{{order.orderCode}}</h5>
<div class="clear"></div>
</div> </div>
<div class="image_detail"> <div *ngFor="let product of order.product">
<h5>{{order.prodName}}</h5> <div class="image">
<p>Women's Fashion</p> <img [src]="product.image" />
<ul> </div>
<li>{{order.color}}</li> <div class="image_detail">
<li>{{order.size}}</li> <h5>{{product.prodName}}</h5>
</ul> <p>Women's Fashion</p>
<h6> <ul>
<span class="floatLeft">Quantity:</span> <li>{{product.color}}</li>
<span class="floatLeft"> <li>{{product.size}}</li>
<div class="quality">{{order.qty}}</div> </ul>
</span><strong class="floatLeft"> {{order.amount}}</strong> <h6>
<span class="payment floatLeft">Paid</span> <span class="floatLeft">Quantity:</span>
<div class="clear"></div> <span class="floatLeft">
</h6> <div class="quality">{{product.qty}}</div>
</span><strong class="floatLeft">A$ {{product.price}}</strong>
<span class="payment floatLeft">Paid</span>
<div class="clear"></div>
</h6>
</div>
<div class="clear"></div>
<hr>
</div> </div>
<div class="order_info">
<h5 class="floatRight">Total Amount: {{order.amount}}</h5>
<div class="clear"></div>
</div>
</div> </div>
<div class="btn_bay" *ngIf="order.orderStatus === 1"> <div class="btn_bay" *ngIf="order.orderStatus === 1">
<button class="reject" (click)="reject(order.orderId)">REJECT</button> <button class="reject" (click)="reject(order.orderId, i)">REJECT</button>
<button class="accept" (click)="accept(order.orderId)">ACCEPT</button> <button class="accept" (click)="accept(order.orderId)">ACCEPT</button>
</div> </div>
<div *ngIf="order.shopperState != 0"> <div *ngIf="order.shopperState != 0">
...@@ -63,7 +80,7 @@ ...@@ -63,7 +80,7 @@
<button class="track" (click)="goToPage('trackorder')">03<span>Mnt</span> <strong>TRACK <button class="track" (click)="goToPage('trackorder')">03<span>Mnt</span> <strong>TRACK
RIDER</strong></button> 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, 2)" *ngIf="order.shopperState == 1">MARKED AS PACKED</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 [ngClass]="{'disabled':order.orderStatus <= 3}" class="marked" (click)="shopperTrack(order.orderId, 3)" *ngIf="order.shopperState == 2" [disabled]="order.orderStatus <= 3">RIDER HAS PICKED</button>
<button class="marked" *ngIf="order.shopperState == 3">PROCESSING...</button> <button class="marked" *ngIf="order.shopperState == 3">PROCESSING...</button>
</div> </div>
</div> </div>
...@@ -83,11 +100,11 @@ ...@@ -83,11 +100,11 @@
<li *ngFor="let pastorder of myorder.pastOrders"> <li *ngFor="let pastorder of myorder.pastOrders">
<div class="incoming_detail"> <div class="incoming_detail">
<div class="image"> <div class="image">
<img [src]="pastorder.image" /> <img [src]="pastorder.product[0].image" />
</div> </div>
<div class="image_detail"> <div class="image_detail">
<h5>{{pastorder.prodName}}</h5> <h5>{{pastorder.product[0].prodName}}</h5>
<p>{{pastorder.color}}, {{pastorder.size}} <strong>1</strong></p> <p>{{pastorder.product[0].color}}, {{pastorder.product[0].size}} <strong>1</strong></p>
<h6><strong class="floatLeft"> {{pastorder.amount}}</strong> <h6><strong class="floatLeft"> {{pastorder.amount}}</strong>
<span class="payment floatLeft">Paid</span> <span class="payment floatLeft">Paid</span>
<div class="clear"></div> <div class="clear"></div>
...@@ -101,8 +118,8 @@ ...@@ -101,8 +118,8 @@
<button [ngClass]="(pastorder.orderStatus == 8)? 'cancelled': 'finished'">{{orderState(pastorder.orderStatus)}}</button> <button [ngClass]="(pastorder.orderStatus == 8)? 'cancelled': 'finished'">{{orderState(pastorder.orderStatus)}}</button>
</ion-col> </ion-col>
</ion-row> </ion-row>
</div> </div>
<div class="clear"></div>
</div> </div>
</li> </li>
<!-- <li> <!-- <li>
......
...@@ -85,13 +85,22 @@ ...@@ -85,13 +85,22 @@
padding: 15px; padding: 15px;
width: 100%; width: 100%;
.incoming_detail { .incoming_detail {
height: 170px; min-height: 170px;
padding: 15px; padding: 15px;
border: 1px solid rgba(46, 204, 113, 1); border: 1px solid rgba(46, 204, 113, 1);
border-radius: 10px; border-radius: 10px;
border-bottom-left-radius: 0px; border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px; border-bottom-right-radius: 0px;
border-bottom: none; border-bottom: none;
.order_info{
padding-top: 10px;
padding-bottom: 10px;
h5{
margin:0px;
padding:0px;
font-size: 16px;
}
}
.image { .image {
width: 85px; width: 85px;
height: 85px; height: 85px;
......
...@@ -16,7 +16,7 @@ export class HomePage implements OnInit { ...@@ -16,7 +16,7 @@ export class HomePage implements OnInit {
orderOptions = { orderOptions = {
initialSlide: 1, initialSlide: 1,
speed: 500, speed: 500,
allowTouchMove: false slidesPerView: 1.1,
}; };
constructor( constructor(
...@@ -52,8 +52,9 @@ export class HomePage implements OnInit { ...@@ -52,8 +52,9 @@ export class HomePage implements OnInit {
}); });
} }
reject(orderId: string) { reject(orderId: string, index: number) {
this.myorder.rideChange(orderId, 9); this.myorder.rideChange(orderId, 8);
this.myorder.removeItem(index);
} }
accept(orderId: string) { accept(orderId: string) {
...@@ -77,8 +78,16 @@ export class HomePage implements OnInit { ...@@ -77,8 +78,16 @@ export class HomePage implements OnInit {
return 'Delivered'; return 'Delivered';
break; break;
case 9: case 9:
return 'Completed';
break;
case 8:
return 'Rejected'; return 'Rejected';
break; break;
case 10:
return 'Not Received';
break;
case 0:
return 'Cancelled';
default: default:
return 'Finished'; return 'Finished';
} }
......
...@@ -32,7 +32,7 @@ export class MyordersService { ...@@ -32,7 +32,7 @@ export class MyordersService {
}); });
} }
public async orgorderList(shopperId) { /*public async orgorderList(shopperId) {
console.log('called'); console.log('called');
console.log(shopperId); console.log(shopperId);
const This = this; const This = this;
...@@ -71,7 +71,7 @@ export class MyordersService { ...@@ -71,7 +71,7 @@ export class MyordersService {
// alert('No Orders Found'); // alert('No Orders Found');
} }
}); });
} }*/
public async orderList(shopperId) { public async orderList(shopperId) {
console.log('called'); console.log('called');
...@@ -79,7 +79,7 @@ export class MyordersService { ...@@ -79,7 +79,7 @@ export class MyordersService {
const This = this; const This = this;
this.orders = []; this.orders = [];
const orderRef: AngularFirestoreCollection<any> = this.afs.collection('orders', ref => ref.where('shopperId', '==', shopperId) const orderRef: AngularFirestoreCollection<any> = this.afs.collection('orders', ref => ref.where('shopperId', '==', shopperId)
.where('orderStatus', '<=', 4)); .where('orderStatus', '<=', 5));
orderRef.stateChanges().subscribe((value) => { orderRef.stateChanges().subscribe((value) => {
console.log('called'); console.log('called');
const res = value; const res = value;
...@@ -88,13 +88,10 @@ export class MyordersService { ...@@ -88,13 +88,10 @@ export class MyordersService {
const item = items.payload.doc.data(); const item = items.payload.doc.data();
console.log(item); console.log(item);
const orderId = item.orderId; const orderId = item.orderId;
const orderStatus = item.orderStatus;
console.log(item); console.log(item);
const order: Myorder = { const order: Myorder = {
prodName: item.prodName,
color: item.color,
image: item.image,
amount: item.amount, amount: item.amount,
qty: item.qty,
status: item.status, status: item.status,
orderStatus: item.orderStatus, orderStatus: item.orderStatus,
bookDate: item.bookDate, bookDate: item.bookDate,
...@@ -105,19 +102,24 @@ export class MyordersService { ...@@ -105,19 +102,24 @@ export class MyordersService {
riderName: 'John', riderName: 'John',
orderId: item.orderId, orderId: item.orderId,
orderCode: item.orderCode, orderCode: item.orderCode,
size: item.size, product: this.service.key2Array(item.product),
shopperState: item.shopperState !== undefined ? item.shopperState : 0, shopperState: item.shopperState !== undefined ? item.shopperState : 0,
time: '60' time: '60'
}; };
if (items.type === 'added') { if (items.type === 'added') {
this.orders.push(order); this.orders.push(order);
} else { } else if (items.type === 'modified') {
console.log(orderId); console.log(orderId);
const index = this.orders.findIndex(obj => obj.orderId === orderId); const index = this.orders.findIndex(obj => obj.orderId === orderId);
if (index > 0) { console.log(index);
this.orders[index] = order; if (index >= 0) {
if (orderStatus <= 4) {
this.orders[index] = order;
} else {
this.orders.splice(index, 1);
}
} }
} } else {}
}); });
console.log(this.orders); console.log(this.orders);
} else { } else {
...@@ -126,6 +128,10 @@ export class MyordersService { ...@@ -126,6 +128,10 @@ export class MyordersService {
}); });
} }
public async removeItem(index: number) {
this.orders.splice(index, 1);
}
public async pastOrderList(shopperId) { public async pastOrderList(shopperId) {
console.log('called'); console.log('called');
console.log(shopperId); console.log(shopperId);
...@@ -139,11 +145,7 @@ export class MyordersService { ...@@ -139,11 +145,7 @@ export class MyordersService {
res.forEach((item) => { res.forEach((item) => {
console.log(item); console.log(item);
const order: Myorder = { const order: Myorder = {
prodName: item.prodName,
color: item.color,
image: item.image,
amount: item.amount, amount: item.amount,
qty: item.qty,
status: item.status, status: item.status,
orderStatus: item.orderStatus, orderStatus: item.orderStatus,
bookDate: item.bookDate, bookDate: item.bookDate,
...@@ -154,7 +156,7 @@ export class MyordersService { ...@@ -154,7 +156,7 @@ export class MyordersService {
riderName: 'John', riderName: 'John',
orderId: item.orderId, orderId: item.orderId,
orderCode: item.orderCode, orderCode: item.orderCode,
size: item.size, product: this.service.key2Array(item.product),
shopperState: item.shopperState !== undefined ? item.shopperState : 0, shopperState: item.shopperState !== undefined ? item.shopperState : 0,
time: '60' time: '60'
}; };
......
export interface Myorder { export interface Myorder {
amount: string; amount: string;
prodName: any;
image: string;
size: string;
color: string;
qty: number;
bookDate: any; bookDate: any;
pickupAddress: string; pickupAddress: string;
pickupLocation: any; pickupLocation: any;
...@@ -17,5 +12,6 @@ export interface Myorder { ...@@ -17,5 +12,6 @@ export interface Myorder {
riderName: string; riderName: string;
time: string; time: string;
shopperState: boolean; shopperState: boolean;
product: any;
} }
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