Commit 9ce99726 by Adarsh K

sprint 1

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