Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
getme
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
amal
getme
Commits
7a18b8c8
Commit
7a18b8c8
authored
Sep 04, 2019
by
Adarsh K
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
order
parent
55b5532e
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
99 additions
and
12 deletions
+99
-12
package.json
package.json
+0
-0
app.component.ts
src/app/app.component.ts
+52
-1
deliverypop.page.html
src/app/deliverypop/deliverypop.page.html
+5
-4
deliverypop.page.ts
src/app/deliverypop/deliverypop.page.ts
+16
-3
myorder.page.html
src/app/myorder/myorder.page.html
+1
-1
myorder.page.ts
src/app/myorder/myorder.page.ts
+18
-3
myorder.service.ts
src/config/myorder.service.ts
+1
-0
order.service.ts
src/config/order.service.ts
+5
-0
myorder.ts
src/config/services/myorder.ts
+1
-0
No files found.
package.json
View file @
7a18b8c8
src/app/app.component.ts
View file @
7a18b8c8
...
...
@@ -3,6 +3,11 @@ import { Router, ActivatedRoute } from '@angular/router';
import
{
Platform
}
from
'@ionic/angular'
;
import
{
SplashScreen
}
from
'@ionic-native/splash-screen/ngx'
;
import
{
StatusBar
}
from
'@ionic-native/status-bar/ngx'
;
import
{
AngularFirestore
,
AngularFirestoreDocument
,
AngularFirestoreCollection
}
from
'@angular/fire/firestore'
;
import
*
as
firebase
from
'firebase'
;
import
{
ModalController
}
from
'@ionic/angular'
;
import
{
DeliverypopPage
}
from
'./deliverypop/deliverypop.page'
;
@
Component
({
selector
:
'app-root'
,
...
...
@@ -14,9 +19,12 @@ export class AppComponent {
private
platform
:
Platform
,
private
splashScreen
:
SplashScreen
,
private
statusBar
:
StatusBar
,
private
router
:
Router
private
router
:
Router
,
public
afs
:
AngularFirestore
,
public
modalController
:
ModalController
)
{
this
.
initializeApp
();
this
.
orderState
();
}
...
...
@@ -27,6 +35,49 @@ export class AppComponent {
});
}
async
finishpop
(
data
:
any
)
{
const
modal
=
await
this
.
modalController
.
create
({
component
:
DeliverypopPage
,
componentProps
:
data
});
return
await
modal
.
present
();
}
orderState
()
{
console
.
log
(
'called'
);
const
custId
=
'WwHnLICVY2dvZGUHuKqasiTB91a2'
;
firebase
.
firestore
().
collection
(
'orders'
).
where
(
'custId'
,
'=='
,
custId
)
.
onSnapshot
((
snapData
)
=>
{
snapData
.
docChanges
().
forEach
((
change
)
=>
{
if
(
change
.
type
===
'modified'
)
{
const
data
=
change
.
doc
.
data
();
if
(
data
.
orderStatus
===
7
)
{
this
.
finishpop
(
data
);
}
}
});
});
/*
.onSnapshot(function(snapshot) {
snapshot.docChanges().forEach(function(change) {
if (change.type === "added") {
console.log("New city: ", change.doc.data());
}
if (change.type === "modified") {
console.log("Modified city: ", change.doc.data());
}
if (change.type === "removed") {
console.log("Removed city: ", change.doc.data());
}
});
}); */
}
vieworder
(
path
,
data
=
null
)
{
...
...
src/app/deliverypop/deliverypop.page.html
View file @
7a18b8c8
...
...
@@ -14,18 +14,18 @@
</div>
<img
src=
"../assets/white_tick.png"
>
<h4>
RIDER HAS
<br>
DELIVERED YOUR ORDER
</h4>
<p>
June 26th 2019, 03:00 PM
</p>
<p>
{{currDate | date: 'MMM d, y, h:mm:ss a'}}
</p>
</div>
</div>
</ion-content>
<ion-footer
padding
>
<div
class=
"row"
>
<button
class=
"login_btn"
>
I GOT MY ORDER
</button>
<button
class=
"login_btn"
(
click
)="
changeOrder
(
9
)"
>
I GOT MY ORDER
</button>
</div>
<div
class=
"row"
>
<button
class=
"resend_btn"
>
I DIDN'T GOT THE ORDER
</button>
<button
class=
"resend_btn"
(
click
)="
changeOrder
(
10
)"
>
I DIDN'T GOT THE ORDER
</button>
</div>
<div
class=
"row"
>
<button
class=
"cancel_btn"
>
CANCEL THIS ORDER
</button>
<button
class=
"cancel_btn"
(
click
)="
changeOrder
(
0
)"
>
CANCEL THIS ORDER
</button>
</div>
</ion-footer>
\ No newline at end of file
src/app/deliverypop/deliverypop.page.ts
View file @
7a18b8c8
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ModalController
,
NavParams
}
from
'@ionic/angular'
;
import
{
OrdersService
}
from
'./../../config/order.service'
;
@
Component
({
selector
:
'app-deliverypop'
,
...
...
@@ -7,18 +8,30 @@ import { ModalController, NavParams } from '@ionic/angular';
styleUrls
:
[
'./deliverypop.page.scss'
],
})
export
class
DeliverypopPage
implements
OnInit
{
currDate
=
new
Date
();
params
:
any
;
orderId
:
string
;
constructor
(
private
modalController
:
ModalController
,
private
navParams
:
NavParams
private
navParams
:
NavParams
,
public
orderService
:
OrdersService
)
{
}
ngOnInit
()
{
this
.
params
=
this
.
navParams
.
data
;
console
.
log
(
this
.
navParams
.
data
);
}
async
closeModal
()
{
const
onClosedData
:
string
=
"Wrapped Up!"
;
const
onClosedData
=
'Wrapped Up!'
;
await
this
.
modalController
.
dismiss
(
onClosedData
);
}
changeOrder
(
status
:
number
)
{
this
.
orderId
=
this
.
params
.
orderId
;
this
.
orderService
.
changeOrder
(
this
.
orderId
,
status
).
then
(()
=>
{
this
.
closeModal
();
});
}
}
src/app/myorder/myorder.page.html
View file @
7a18b8c8
...
...
@@ -21,7 +21,7 @@
</div>
<div
class=
"order_other"
>
<h6
class=
"floatRight"
>
{{ order.bookDate.seconds * 1000 | date:'MMMM dd, y' }}
</h6>
<span
class=
"floatRight"
*
ngIf=
"order.orderStatus < 3 || order.orderStatus >= 7"
>
{{getStatus(order.orderStatus)}}
</span>
<span
class=
"floatRight"
*
ngIf=
"order.orderStatus < 3 || order.orderStatus >= 7"
(
click
)="
acceptOrder
(
order
)"
>
{{getStatus(order.orderStatus)}}
</span>
<div
class=
"clear"
></div>
<button
class=
"track_btn"
*
ngIf=
"order.orderStatus >= 3 && order.orderStatus < 7"
(
click
)="
orderDetails
(
i
)"
>
TRACK
</button>
<div
class=
"clear"
></div>
...
...
src/app/myorder/myorder.page.ts
View file @
7a18b8c8
...
...
@@ -21,12 +21,12 @@ export class MyorderPage implements OnInit {
)
{
}
ngOnInit
()
{
this
.
finishpop
();
}
async
finishpop
()
{
async
finishpop
(
data
:
any
)
{
const
modal
=
await
this
.
modalController
.
create
({
component
:
DeliverypopPage
component
:
DeliverypopPage
,
componentProps
:
data
});
return
await
modal
.
present
();
}
...
...
@@ -46,6 +46,12 @@ export class MyorderPage implements OnInit {
document
.
body
.
scrollTop
=
document
.
documentElement
.
scrollTop
=
0
;
}
acceptOrder
(
order
:
any
)
{
if
(
order
.
orderStatus
===
7
)
{
this
.
finishpop
(
order
);
}
}
getStatus
(
status
:
number
)
{
switch
(
status
)
{
case
1
:
...
...
@@ -69,9 +75,18 @@ export class MyorderPage implements OnInit {
case
7
:
return
'Delivered'
;
break
;
case
9
:
return
'Completed'
;
break
;
case
8
:
return
'Rejected'
;
break
;
case
10
:
return
'Not Received'
;
break
;
case
0
:
return
'Cancelled'
;
break
;
default
:
return
'Finished'
;
}
...
...
src/config/myorder.service.ts
View file @
7a18b8c8
...
...
@@ -55,6 +55,7 @@ export class MyordersService {
deliveryLocation
:
item
.
deliveryLocation
,
pickupLocation
:
item
.
pickupLocation
,
riderName
:
'John'
,
orderId
:
item
.
orderId
,
size
:
item
.
size
,
time
:
'60'
};
...
...
src/config/order.service.ts
View file @
7a18b8c8
...
...
@@ -99,6 +99,11 @@ export class OrdersService {
}
public
async
changeOrder
(
orderId
,
status
)
{
console
.
log
(
orderId
,
status
);
this
.
afs
.
collection
(
'orders'
).
doc
(
orderId
).
update
({
orderStatus
:
status
});
}
public
async
buyNow
(
product
:
Products
)
{
//
}
...
...
src/config/services/myorder.ts
View file @
7a18b8c8
...
...
@@ -11,6 +11,7 @@ export interface Myorder {
status
:
number
;
orderStatus
:
number
;
riderName
:
string
;
orderId
:
string
;
time
:
string
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment