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
1c76f555
Commit
1c76f555
authored
Sep 12, 2019
by
Adarsh K
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
live changes
parent
1772bb5a
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
171 additions
and
12 deletions
+171
-12
app.component.html
src/app/app.component.html
+1
-1
app.component.ts
src/app/app.component.ts
+3
-1
cart.page.html
src/app/cart/cart.page.html
+2
-2
home.page.ts
src/app/home/home.page.ts
+10
-3
landing.page.ts
src/app/landing/landing.page.ts
+1
-0
login.page.ts
src/app/login/login.page.ts
+7
-1
myorder.page.ts
src/app/myorder/myorder.page.ts
+3
-0
trackorder.module.ts
src/app/trackorder/trackorder.module.ts
+1
-1
auth.service.ts
src/config/auth.service.ts
+2
-1
myorder.service.ts
src/config/myorder.service.ts
+141
-2
No files found.
src/app/app.component.html
View file @
1c76f555
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
</div>
</div>
<li>
Complaints
&
Feedback
</li>
<li>
Complaints
&
Feedback
</li>
<li>
<li>
<span
class=
"floatLeft"
>
Logout
</span>
<span
class=
"floatLeft"
(
click
)="
authService
.
SignOut
()"
>
Logout
</span>
<span
class=
"floatRight version"
>
Version 1.2.0.3
</span>
<span
class=
"floatRight version"
>
Version 1.2.0.3
</span>
<div
class=
"clear"
></div>
<div
class=
"clear"
></div>
</li>
</li>
...
...
src/app/app.component.ts
View file @
1c76f555
...
@@ -7,6 +7,7 @@ import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection
...
@@ -7,6 +7,7 @@ import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection
import
*
as
firebase
from
'firebase'
;
import
*
as
firebase
from
'firebase'
;
import
{
ModalController
}
from
'@ionic/angular'
;
import
{
ModalController
}
from
'@ionic/angular'
;
import
{
DeliverypopPage
}
from
'./deliverypop/deliverypop.page'
;
import
{
DeliverypopPage
}
from
'./deliverypop/deliverypop.page'
;
import
{
AuthService
}
from
'./../config/auth.service'
;
@
Component
({
@
Component
({
...
@@ -21,7 +22,8 @@ export class AppComponent {
...
@@ -21,7 +22,8 @@ export class AppComponent {
private
statusBar
:
StatusBar
,
private
statusBar
:
StatusBar
,
private
router
:
Router
,
private
router
:
Router
,
public
afs
:
AngularFirestore
,
public
afs
:
AngularFirestore
,
public
modalController
:
ModalController
public
modalController
:
ModalController
,
public
authService
:
AuthService
)
{
)
{
this
.
initializeApp
();
this
.
initializeApp
();
this
.
orderState
();
this
.
orderState
();
...
...
src/app/cart/cart.page.html
View file @
1c76f555
...
@@ -176,9 +176,9 @@
...
@@ -176,9 +176,9 @@
<div
class=
"footer_btn"
*
ngIf=
"cartService.carts && cartService.carts.length > 0"
[
hidden
]="
currentIndex
!=
1
"
(
click
)="
next
(
2
);"
>
<div
class=
"footer_btn"
*
ngIf=
"cartService.carts && cartService.carts.length > 0"
[
hidden
]="
currentIndex
!=
1
"
(
click
)="
next
(
2
);"
>
PAY
PAY
</div>
</div>
<div
class=
"footer_btn"
[
hidden
]="
currentIndex
!=
2
"
(
click
)="
finishpop
()"
>
<
!-- <
div class="footer_btn" [hidden]="currentIndex != 2" (click)="finishpop()">
FINISH
FINISH
</div>
</div>
-->
</div>
</div>
</ion-content>
</ion-content>
<!-- <div class="loader">
<!-- <div class="loader">
...
...
src/app/home/home.page.ts
View file @
1c76f555
...
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
...
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import
{
Location
}
from
'@angular/common'
;
import
{
Location
}
from
'@angular/common'
;
import
{
trigger
,
transition
,
animate
,
style
}
from
'@angular/animations'
;
import
{
trigger
,
transition
,
animate
,
style
}
from
'@angular/animations'
;
import
{
Router
,
ActivatedRoute
}
from
'@angular/router'
;
import
{
Router
,
ActivatedRoute
}
from
'@angular/router'
;
import
{
MenuController
}
from
'@ionic/angular'
;
@
Component
({
@
Component
({
selector
:
'app-home'
,
selector
:
'app-home'
,
templateUrl
:
'./home.page.html'
,
templateUrl
:
'./home.page.html'
,
...
@@ -21,8 +22,8 @@ import { Router, ActivatedRoute } from '@angular/router';
...
@@ -21,8 +22,8 @@ import { Router, ActivatedRoute } from '@angular/router';
export
class
HomePage
implements
OnInit
{
export
class
HomePage
implements
OnInit
{
isShow
=
false
;
isShow
=
false
;
public
lat
:
number
=
51.678418
;
public
lat
=
51.678418
;
public
lng
:
number
=
7.809007
;
public
lng
=
7.809007
;
slideOpts
=
{
slideOpts
=
{
slidesPerView
:
1.5
slidesPerView
:
1.5
...
@@ -31,10 +32,16 @@ export class HomePage implements OnInit {
...
@@ -31,10 +32,16 @@ export class HomePage implements OnInit {
constructor
(
constructor
(
private
router
:
Router
,
private
router
:
Router
,
private
route
:
ActivatedRoute
,
private
route
:
ActivatedRoute
,
private
location
:
Location
private
location
:
Location
,
public
menuCtrl
:
MenuController
)
{
}
)
{
}
ngOnInit
()
{
ngOnInit
()
{
this
.
menuCtrl
.
enable
(
true
);
}
ionViewWillEnter
()
{
this
.
menuCtrl
.
enable
(
true
);
}
}
goToPage
(
path
,
data
=
null
)
{
goToPage
(
path
,
data
=
null
)
{
...
...
src/app/landing/landing.page.ts
View file @
1c76f555
...
@@ -26,6 +26,7 @@ export class LandingPage implements OnInit {
...
@@ -26,6 +26,7 @@ export class LandingPage implements OnInit {
this
.
service
.
get
(
'landing'
).
then
((
data
)
=>
{
this
.
service
.
get
(
'landing'
).
then
((
data
)
=>
{
if
(
data
===
true
)
{
if
(
data
===
true
)
{
const
user
=
JSON
.
parse
(
localStorage
.
getItem
(
'user'
));
const
user
=
JSON
.
parse
(
localStorage
.
getItem
(
'user'
));
console
.
log
(
user
);
if
(
user
)
{
if
(
user
)
{
this
.
goToPage
(
'home'
);
this
.
goToPage
(
'home'
);
}
else
{
}
else
{
...
...
src/app/login/login.page.ts
View file @
1c76f555
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Router
,
ActivatedRoute
}
from
'@angular/router'
;
import
{
Router
,
ActivatedRoute
}
from
'@angular/router'
;
import
{
AuthService
}
from
'./../../config/auth.service'
;
import
{
AuthService
}
from
'./../../config/auth.service'
;
import
{
MenuController
}
from
'@ionic/angular'
;
import
{
async
}
from
'q'
;
import
{
async
}
from
'q'
;
...
@@ -14,12 +15,17 @@ export class LoginPage implements OnInit {
...
@@ -14,12 +15,17 @@ export class LoginPage implements OnInit {
constructor
(
constructor
(
private
router
:
Router
,
private
router
:
Router
,
private
route
:
ActivatedRoute
,
private
route
:
ActivatedRoute
,
public
authService
:
AuthService
public
authService
:
AuthService
,
public
menuCtrl
:
MenuController
)
{
}
)
{
}
ngOnInit
()
{
ngOnInit
()
{
}
}
ionViewWillEnter
()
{
this
.
menuCtrl
.
enable
(
false
);
}
goToPage
(
path
,
data
=
null
)
{
goToPage
(
path
,
data
=
null
)
{
this
.
router
.
navigateByUrl
(
path
,
{
queryParams
:
data
});
this
.
router
.
navigateByUrl
(
path
,
{
queryParams
:
data
});
document
.
body
.
scrollTop
=
document
.
documentElement
.
scrollTop
=
0
;
document
.
body
.
scrollTop
=
document
.
documentElement
.
scrollTop
=
0
;
...
...
src/app/myorder/myorder.page.ts
View file @
1c76f555
...
@@ -21,6 +21,9 @@ export class MyorderPage implements OnInit {
...
@@ -21,6 +21,9 @@ export class MyorderPage implements OnInit {
)
{
}
)
{
}
ngOnInit
()
{
ngOnInit
()
{
this
.
myorder
.
orderState
().
subscribe
((
data
)
=>
{
console
.
log
(
data
);
});
}
}
async
finishpop
(
data
:
any
)
{
async
finishpop
(
data
:
any
)
{
...
...
src/app/trackorder/trackorder.module.ts
View file @
1c76f555
...
@@ -23,7 +23,7 @@ const routes: Routes = [
...
@@ -23,7 +23,7 @@ const routes: Routes = [
IonicModule
,
IonicModule
,
AgmDirectionModule
,
AgmDirectionModule
,
AgmCoreModule
.
forRoot
({
AgmCoreModule
.
forRoot
({
apiKey
:
'AIzaSy
AK3Av2e2dunqInYEaAVJPmzK5HTi0gubw
'
apiKey
:
'AIzaSy
Bn6hOlr6YHcZAmbptlsmbhvH5iQllWflE
'
}),
}),
RouterModule
.
forChild
(
routes
)
RouterModule
.
forChild
(
routes
)
],
],
...
...
src/config/auth.service.ts
View file @
1c76f555
...
@@ -23,9 +23,11 @@ export class AuthService {
...
@@ -23,9 +23,11 @@ export class AuthService {
if
(
user
)
{
if
(
user
)
{
this
.
userData
=
user
;
this
.
userData
=
user
;
this
.
service
.
set
(
'user'
,
JSON
.
stringify
(
this
.
userData
));
this
.
service
.
set
(
'user'
,
JSON
.
stringify
(
this
.
userData
));
this
.
router
.
navigateByUrl
(
'home'
);
}
else
{
}
else
{
this
.
service
.
set
(
'user'
,
null
);
this
.
service
.
set
(
'user'
,
null
);
JSON
.
parse
(
localStorage
.
getItem
(
'user'
));
JSON
.
parse
(
localStorage
.
getItem
(
'user'
));
this
.
router
.
navigateByUrl
(
'login'
);
}
}
});
});
}
}
...
@@ -33,7 +35,6 @@ export class AuthService {
...
@@ -33,7 +35,6 @@ export class AuthService {
public
async
SignIn
(
email
:
string
,
password
:
string
)
{
public
async
SignIn
(
email
:
string
,
password
:
string
)
{
return
this
.
afAuth
.
auth
.
signInWithEmailAndPassword
(
email
,
password
).
then
((
result
)
=>
{
return
this
.
afAuth
.
auth
.
signInWithEmailAndPassword
(
email
,
password
).
then
((
result
)
=>
{
console
.
log
(
'success'
);
console
.
log
(
'success'
);
this
.
router
.
navigateByUrl
(
'home'
);
document
.
body
.
scrollTop
=
document
.
documentElement
.
scrollTop
=
0
;
document
.
body
.
scrollTop
=
document
.
documentElement
.
scrollTop
=
0
;
this
.
SetUserData
(
result
.
user
);
this
.
SetUserData
(
result
.
user
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
...
...
src/config/myorder.service.ts
View file @
1c76f555
...
@@ -3,6 +3,8 @@ import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection
...
@@ -3,6 +3,8 @@ import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection
import
{
Myorder
}
from
'./services/myorder'
;
import
{
Myorder
}
from
'./services/myorder'
;
import
{
ServiceService
}
from
'./../config/service.service'
;
import
{
ServiceService
}
from
'./../config/service.service'
;
import
*
as
firebase
from
'firebase'
;
import
*
as
firebase
from
'firebase'
;
import
{
take
}
from
'rxjs/operators'
;
import
{
Observable
,
of
}
from
'rxjs'
;
@
Injectable
({
@
Injectable
({
providedIn
:
'root'
providedIn
:
'root'
...
@@ -23,6 +25,7 @@ export class MyordersService {
...
@@ -23,6 +25,7 @@ export class MyordersService {
this
.
custId
=
data
.
uid
;
this
.
custId
=
data
.
uid
;
if
(
this
.
custId
!==
undefined
)
{
if
(
this
.
custId
!==
undefined
)
{
this
.
orderList
(
this
.
custId
);
this
.
orderList
(
this
.
custId
);
// this.orderState();
}
}
}
else
{
}
else
{
this
.
custId
=
'WwHnLICVY2dvZGUHuKqasiTB91a2'
;
this
.
custId
=
'WwHnLICVY2dvZGUHuKqasiTB91a2'
;
...
@@ -30,13 +33,17 @@ export class MyordersService {
...
@@ -30,13 +33,17 @@ export class MyordersService {
});
});
}
}
public
async
orderList
(
custId
)
{
public
async
or
gor
derList
(
custId
)
{
console
.
log
(
'called'
);
console
.
log
(
'called'
);
console
.
log
(
custId
);
console
.
log
(
custId
);
const
This
=
this
;
const
This
=
this
;
const
orderRef
:
AngularFirestoreCollection
<
any
>
=
this
.
afs
.
collection
(
'orders'
,
ref
=>
ref
.
where
(
'custId'
,
'=='
,
custId
)
const
orderRef
:
AngularFirestoreCollection
<
any
>
=
this
.
afs
.
collection
(
'orders'
,
ref
=>
ref
.
where
(
'custId'
,
'=='
,
custId
)
.
orderBy
(
'bookDate'
,
'desc'
));
.
orderBy
(
'bookDate'
,
'desc'
));
orderRef
.
valueChanges
().
subscribe
((
value
)
=>
{
orderRef
.
stateChanges
().
subscribe
((
value
)
=>
{
console
.
log
(
value
[
0
].
payload
.
doc
.
data
());
});
orderRef
.
valueChanges
().
pipe
(
take
(
1
)).
subscribe
((
value
)
=>
{
console
.
log
(
value
);
console
.
log
(
value
);
this
.
orders
=
[];
this
.
orders
=
[];
const
res
=
value
;
const
res
=
value
;
...
@@ -65,7 +72,139 @@ export class MyordersService {
...
@@ -65,7 +72,139 @@ export class MyordersService {
}
else
{
}
else
{
alert
(
'No Orders Found'
);
alert
(
'No Orders Found'
);
}
}
this
.
orderState
();
});
}
public
async
orderList
(
custId
)
{
console
.
log
(
'called'
);
console
.
log
(
custId
);
const
This
=
this
;
this
.
orders
=
[];
const
orderRef
:
AngularFirestoreCollection
<
any
>
=
this
.
afs
.
collection
(
'orders'
,
ref
=>
ref
.
where
(
'custId'
,
'=='
,
custId
)
.
orderBy
(
'bookDate'
,
'desc'
));
orderRef
.
stateChanges
().
subscribe
((
value
)
=>
{
console
.
log
(
value
);
const
res
=
value
;
console
.
log
(
res
);
if
(
res
.
length
>
0
)
{
res
.
forEach
((
items
)
=>
{
const
item
=
items
.
payload
.
doc
.
data
();
console
.
log
(
item
);
const
orderId
=
item
.
orderId
;
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
,
pickupLocation
:
item
.
pickupLocation
,
riderName
:
'John'
,
orderId
:
item
.
orderId
,
size
:
item
.
size
,
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
);
}
});
}
public
orderState
():
Observable
<
Myorder
[]
>
{
console
.
log
(
'called'
);
const
custId
=
'WwHnLICVY2dvZGUHuKqasiTB91a2'
;
this
.
orders
=
[];
firebase
.
firestore
().
collection
(
'orders'
).
where
(
'custId'
,
'=='
,
custId
)
.
onSnapshot
((
snapData
)
=>
{
snapData
.
docChanges
().
forEach
((
change
)
=>
{
console
.
log
(
change
.
type
);
if
(
change
.
type
===
'modified'
)
{
const
item
=
change
.
doc
.
data
();
console
.
log
(
item
);
const
orderId
=
item
.
orderId
;
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
,
pickupLocation
:
item
.
pickupLocation
,
riderName
:
'John'
,
orderId
:
item
.
orderId
,
size
:
item
.
size
,
time
:
'60'
};
const
count
=
this
.
orders
.
length
;
for
(
let
index
=
0
;
index
<
count
;
index
++
)
{
if
(
this
.
orders
[
index
].
orderId
===
orderId
)
{
console
.
log
(
index
);
this
.
orders
[
index
]
=
order
;
console
.
log
(
this
.
orders
);
break
;
}
}
}
else
if
(
change
.
type
===
'added'
)
{
const
item
=
change
.
doc
.
data
();
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
,
pickupLocation
:
item
.
pickupLocation
,
riderName
:
'John'
,
orderId
:
item
.
orderId
,
size
:
item
.
size
,
time
:
'60'
};
this
.
orders
.
push
(
order
);
}
else
{
//
}
});
});
});
/*
.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());
}
});
}); */
return
of
(
this
.
orders
);
}
}
public
async
trackOrder
(
order
)
{
public
async
trackOrder
(
order
)
{
...
...
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