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
d99adcd2
Commit
d99adcd2
authored
Feb 28, 2020
by
Arjun
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into arjunlatest
parents
bb8fe035
13bbafef
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
104 additions
and
126 deletions
+104
-126
cart.page.ts
src/app/cart/cart.page.ts
+2
-2
home.page.ts
src/app/home/home.page.ts
+3
-2
myorder.page.html
src/app/myorder/myorder.page.html
+2
-2
myorder.page.ts
src/app/myorder/myorder.page.ts
+7
-0
nearby.module.ts
src/app/nearby/nearby.module.ts
+2
-2
nearby.page.html
src/app/nearby/nearby.page.html
+20
-85
nearby.page.ts
src/app/nearby/nearby.page.ts
+13
-4
preference.page.html
src/app/preference/preference.page.html
+1
-1
preference.page.ts
src/app/preference/preference.page.ts
+6
-2
productdetail.page.ts
src/app/productdetail/productdetail.page.ts
+1
-1
verification.page.html
src/app/verification/verification.page.html
+2
-9
address.service.ts
src/config/address.service.ts
+1
-2
auth.service.ts
src/config/auth.service.ts
+2
-2
cart.service.ts
src/config/cart.service.ts
+2
-2
center.service.ts
src/config/center.service.ts
+5
-2
myorder.service.ts
src/config/myorder.service.ts
+1
-1
order.service.ts
src/config/order.service.ts
+4
-4
service.service.ts
src/config/service.service.ts
+27
-1
shopper.service.ts
src/config/shopper.service.ts
+3
-2
No files found.
src/app/cart/cart.page.ts
View file @
d99adcd2
...
...
@@ -133,7 +133,7 @@ export class CartPage implements OnInit {
}
getTax
(
amount
)
{
return
Math
.
round
((
this
.
taxAmount
=
(
amount
*
10
)
/
100
)
).
toFixed
(
2
);
return
(
this
.
taxAmount
=
(
amount
*
10
)
/
100
).
toFixed
(
2
);
}
getwaypayk
()
{
...
...
@@ -154,7 +154,7 @@ export class CartPage implements OnInit {
}
goToPage
(
path
,
data
=
null
)
{
this
.
router
.
navigateByUrl
(
path
,
{
queryParams
:
data
});
this
.
router
.
navigateByUrl
(
path
,
{
queryParams
:
data
,
replaceUrl
:
true
});
document
.
body
.
scrollTop
=
document
.
documentElement
.
scrollTop
=
0
;
}
...
...
src/app/home/home.page.ts
View file @
d99adcd2
...
...
@@ -66,6 +66,7 @@ export class HomePage implements OnInit {
private
authService
:
AuthService
)
{
this
.
loader
=
false
;
this
.
address
=
'Pick your Location'
;
}
ngOnInit
()
{
...
...
@@ -89,7 +90,7 @@ export class HomePage implements OnInit {
navigator
.
geolocation
.
getCurrentPosition
(
position
=>
{
this
.
lat
=
position
.
coords
.
latitude
;
this
.
lng
=
position
.
coords
.
longitude
;
this
.
centerService
.
getNearBy
(
this
.
lat
,
this
.
lng
,
10
);
this
.
centerService
.
getNearBy
(
this
.
lat
,
this
.
lng
,
this
.
service
.
distance
);
this
.
getAddress
(
this
.
lat
,
this
.
lng
);
});
}
...
...
@@ -121,7 +122,7 @@ export class HomePage implements OnInit {
this
.
addressService
.
setDefaultAddress
(
address
.
addressId
,
this
.
custId
).
then
(()
=>
{
this
.
address
=
address
.
address
;
console
.
log
(
address
.
latLng
);
this
.
centerService
.
getNearBy
(
address
.
latLng
.
_lat
,
address
.
latLng
.
_long
,
10
);
this
.
centerService
.
getNearBy
(
address
.
latLng
.
_lat
,
address
.
latLng
.
_long
,
this
.
service
.
distance
);
this
.
loader
=
false
;
}).
catch
(
err
=>
{
this
.
loader
=
false
;
...
...
src/app/myorder/myorder.page.html
View file @
d99adcd2
...
...
@@ -30,7 +30,7 @@
<span
*
ngIf=
"product.size !== 'Any-Size'"
>
{{product.size}}
</span>
<span>
{{product.qty}}
</span>
</h5>
<p
*
ngIf=
"product.price"
>
A$ {{service.formatNumber(product.price)}}
</p>
<p
*
ngIf=
"product.price"
>
A$ {{service.formatNumber(product.price
.toFixed(2)
)}}
</p>
</div>
<div
class=
"order_other"
>
<h6
class=
"floatRight"
*
ngIf=
"order.bookDate"
>
...
...
@@ -47,7 +47,7 @@
</div>
<div
class=
"order_info"
>
<h5
class=
"floatRight"
>
TOTAL PRICE : {{
service.formatNumber(order.amoun
t)}}
</h5>
<h5
class=
"floatRight"
>
TOTAL PRICE : {{
getProductTotal(order.produc
t)}}
</h5>
<div
class=
"clear"
></div>
</div>
...
...
src/app/myorder/myorder.page.ts
View file @
d99adcd2
...
...
@@ -120,4 +120,11 @@ export class MyorderPage implements OnInit {
return
unescape
(
text
.
replace
(
/%uFFFD/g
,
''
));
}
getProductTotal
(
products
)
{
let
amtPrice
=
0
;
products
.
forEach
(
element
=>
{
amtPrice
+=
element
.
price
*
element
.
qty
;
});
return
'A$'
+
this
.
service
.
formatNumber
(
amtPrice
);
}
}
src/app/nearby/nearby.module.ts
View file @
d99adcd2
...
...
@@ -23,10 +23,10 @@ const routes: Routes = [
IonicModule
,
AgmDirectionModule
,
AgmCoreModule
.
forRoot
({
apiKey
:
"AIzaSyBn6hOlr6YHcZAmbptlsmbhvH5iQllWflE"
apiKey
:
'AIzaSyBn6hOlr6YHcZAmbptlsmbhvH5iQllWflE'
}),
RouterModule
.
forChild
(
routes
)
],
declarations
:
[
NearbyPage
]
})
export
class
NearbyPageModule
{}
export
class
NearbyPageModule
{
}
src/app/nearby/nearby.page.html
View file @
d99adcd2
<div
class=
"nav_header"
>
<button
class=
"nav_btn nav_back floatLeft"
(
click
)="
goBack
()"
>
<button
class=
"nav_btn nav_back floatLeft"
(
click
)="
goBack
()"
*
ngIf=
"authService.regState"
>
<img
src=
"../assets/Group17_2.png"
/>
</button>
<div
class=
"nav_title floatLeft"
>
...
...
@@ -9,119 +9,54 @@
</div>
<ion-content>
<div
class=
"nearby_map"
>
<agm-map
[
latitude
]="
latitude
"
[
longitude
]="
longitude
"
[
zoom
]="
8
"
[
backgroundColor
]="'
rgba
(
29
,
27
,
130
,
0
.
2
)'"
>
<agm-marker
[
latitude
]="
latitude
"
[
longitude
]="
longitude
"
[
markerDraggable
]="
true
"
(
dragEnd
)="
markerDragEnd
($
event
)"
></agm-marker>
<agm-map
[
latitude
]="
latitude
"
[
longitude
]="
longitude
"
[
zoom
]="
8
"
[
backgroundColor
]="'
rgba
(
29
,
27
,
130
,
0
.
2
)'"
>
<agm-marker
[
latitude
]="
latitude
"
[
longitude
]="
longitude
"
[
markerDraggable
]="
true
"
(
dragEnd
)="
markerDragEnd
($
event
)"
></agm-marker>
</agm-map>
<form
(
ngSubmit
)="
onSubmit
(
addressForm
.
value
);
addressForm
.
reset
()"
#
addressForm=
"ngForm"
method=
"post"
class=
"form-horizontal"
>
<form
(
ngSubmit
)="
onSubmit
(
addressForm
.
value
);
addressForm
.
reset
()"
#
addressForm=
"ngForm"
method=
"post"
class=
"form-horizontal"
>
<div
class=
"add_address_wrapper"
>
<h5>
DELIVERY
</h5>
<p>
{{address}}
</p>
<input
[(
ngModel
)]="
addressForm
.
building
"
name=
"building"
#
building=
"ngModel"
name=
"building"
required
placeholder=
"House No./ Building No"
/>
<div
class=
"md-errors-spacer"
[
hidden
]="
building
.
valid
||
landmark
.
pristine
"
class=
"ion-padding-start"
>
<input
[(
ngModel
)]="
addressForm
.
building
"
name=
"building"
#
building=
"ngModel"
name=
"building"
required
placeholder=
"House No./ Building No"
/>
<div
class=
"md-errors-spacer"
[
hidden
]="
building
.
valid
||
landmark
.
pristine
"
class=
"ion-padding-start"
>
Building Name is required
</div>
<input
[(
ngModel
)]="
addressForm
.
landmark
"
name=
"landmark"
#
landmark=
"ngModel"
name=
"landmark"
required
placeholder=
"Landmark"
/>
<div
class=
"md-errors-spacer"
[
hidden
]="
landmark
.
valid
||
landmark
.
pristine
"
class=
"ion-padding-start"
>
<input
[(
ngModel
)]="
addressForm
.
landmark
"
name=
"landmark"
#
landmark=
"ngModel"
name=
"landmark"
required
placeholder=
"Landmark"
/>
<div
class=
"md-errors-spacer"
[
hidden
]="
landmark
.
valid
||
landmark
.
pristine
"
class=
"ion-padding-start"
>
Landmark is required
</div>
<ion-grid>
<ion-row>
<ion-col>
<h6>
<input
class=
"styled-checkbox"
id=
"styled-check-1"
type=
"radio"
value=
"Home"
[(
ngModel
)]="
addressForm
.
addressType
"
name=
"addressType"
#
addressType=
"ngModel"
required
/>
<input
class=
"styled-checkbox"
id=
"styled-check-1"
type=
"radio"
value=
"Home"
[(
ngModel
)]="
addressForm
.
addressType
"
name=
"addressType"
#
addressType=
"ngModel"
required
/>
<label
for=
"styled-check-1"
><span>
Home
</span></label>
</h6>
</ion-col>
<ion-col>
<h6>
<input
class=
"styled-checkbox"
id=
"styled-check-2"
type=
"radio"
value=
"Work"
[(
ngModel
)]="
addressForm
.
addressType
"
name=
"addressType"
#
addressType=
"ngModel"
required
/>
<input
class=
"styled-checkbox"
id=
"styled-check-2"
type=
"radio"
value=
"Work"
[(
ngModel
)]="
addressForm
.
addressType
"
name=
"addressType"
#
addressType=
"ngModel"
required
/>
<label
for=
"styled-check-2"
><span>
Office
</span></label>
</h6>
</ion-col>
<ion-col>
<h6>
<input
class=
"styled-checkbox"
id=
"styled-check-3"
type=
"radio"
value=
"Other"
[(
ngModel
)]="
addressForm
.
addressType
"
name=
"addressType"
#
addressType=
"ngModel"
required
/>
<input
class=
"styled-checkbox"
id=
"styled-check-3"
type=
"radio"
value=
"Other"
[(
ngModel
)]="
addressForm
.
addressType
"
name=
"addressType"
#
addressType=
"ngModel"
required
/>
<label
for=
"styled-check-3"
><span>
Others
</span></label>
</h6>
</ion-col>
</ion-row>
<div
class=
"md-errors-spacer"
[
hidden
]="
addressType
.
valid
||
addressType
.
pristine
"
class=
"ion-padding-start"
>
<div
class=
"md-errors-spacer"
[
hidden
]="
addressType
.
valid
||
addressType
.
pristine
"
class=
"ion-padding-start"
>
Address Type is required
</div>
</ion-grid>
<button
class=
"add_btn"
type=
"submit"
[
disabled
]="!
addressForm
.
form
.
valid
"
>
<button
class=
"add_btn"
type=
"submit"
[
disabled
]="!
addressForm
.
form
.
valid
"
>
ADD
</button>
</div>
...
...
src/app/nearby/nearby.page.ts
View file @
d99adcd2
...
...
@@ -11,6 +11,7 @@ import { MapsAPILoader, MouseEvent } from '@agm/core';
import
{
Address
}
from
'./../../config/services/address'
;
import
{
AddressService
}
from
'./../../config/address.service'
;
import
{
ServiceService
}
from
'./../../config/service.service'
;
import
{
AuthService
}
from
'./../../config/auth.service'
;
import
{
NgForm
}
from
'@angular/forms'
;
import
*
as
firebase
from
'firebase'
;
/* import { google } from '@agm/core/services/google-maps-types'; */
...
...
@@ -41,7 +42,8 @@ export class NearbyPage implements OnInit {
private
mapsAPILoader
:
MapsAPILoader
,
private
ngZone
:
NgZone
,
public
addressService
:
AddressService
,
public
service
:
ServiceService
public
service
:
ServiceService
,
public
authService
:
AuthService
)
{
this
.
successState
=
false
;
this
.
type
=
0
;
...
...
@@ -67,7 +69,13 @@ export class NearbyPage implements OnInit {
// google maps zoom level
private
setCurrentLocation
()
{
console
.
log
(
'map-called'
);
if
(
'geolocation'
in
navigator
)
{
console
.
log
(
navigator
);
this
.
latitude
=
-
33.87276
;
this
.
longitude
=
151.20534
;
this
.
zoom
=
8
;
this
.
getAddress
(
this
.
latitude
,
this
.
longitude
);
navigator
.
geolocation
.
getCurrentPosition
(
position
=>
{
this
.
latitude
=
position
.
coords
.
latitude
;
this
.
longitude
=
position
.
coords
.
longitude
;
...
...
@@ -85,6 +93,7 @@ export class NearbyPage implements OnInit {
}
getAddress
(
latitude
,
longitude
)
{
this
.
geoCoder
=
new
google
.
maps
.
Geocoder
();
this
.
geoCoder
.
geocode
(
{
location
:
{
lat
:
latitude
,
lng
:
longitude
}
},
(
results
,
status
)
=>
{
...
...
@@ -96,10 +105,10 @@ export class NearbyPage implements OnInit {
this
.
address
=
results
[
0
].
formatted_address
;
console
.
log
(
this
.
address
);
}
else
{
window
.
alert
(
'No results found'
);
console
.
log
(
'No results found'
);
}
}
else
{
window
.
alert
(
'Geocoder failed due to: '
+
status
);
console
.
log
(
'Geocoder failed due to: '
+
status
);
}
}
);
...
...
@@ -133,7 +142,7 @@ export class NearbyPage implements OnInit {
setTimeout
(()
=>
{
this
.
loader
=
false
;
this
.
successState
=
false
;
if
(
this
.
type
===
1
)
{
if
(
this
.
authService
.
regState
===
false
)
{
this
.
router
.
navigateByUrl
(
'preference'
,
{
queryParams
:
null
});
}
else
{
this
.
goBack
();
...
...
src/app/preference/preference.page.html
View file @
d99adcd2
<div
class=
"nav_header"
>
<button
class=
"nav_btn nav_back floatLeft"
(
click
)="
goBack
()"
>
<button
class=
"nav_btn nav_back floatLeft"
(
click
)="
goBack
()"
*
ngIf=
"authService.regState"
>
<img
src=
"../assets/Group17_2.png"
/>
</button>
<div
class=
"nav_title floatLeft"
>
...
...
src/app/preference/preference.page.ts
View file @
d99adcd2
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
CategoriesService
}
from
'./../../config/category.service'
;
import
{
ServiceService
}
from
'./../../config/service.service'
;
import
{
AuthService
}
from
'./../../config/auth.service'
;
import
{
Router
,
ActivatedRoute
}
from
'@angular/router'
;
@
Component
({
...
...
@@ -18,7 +19,8 @@ export class PreferencePage implements OnInit {
constructor
(
private
categoriesService
:
CategoriesService
,
private
service
:
ServiceService
,
private
router
:
Router
private
router
:
Router
,
private
authService
:
AuthService
)
{
this
.
successState
=
false
;
this
.
userPrefence
=
[];
...
...
@@ -73,9 +75,11 @@ export class PreferencePage implements OnInit {
this
.
loader
=
false
;
this
.
successState
=
false
;
this
.
service
.
set
(
'type'
,
0
);
if
(
this
.
type
===
1
)
{
if
(
this
.
authService
.
regState
===
false
)
{
this
.
authService
.
regState
=
true
;
this
.
router
.
navigateByUrl
(
'home'
,
{
queryParams
:
null
});
}
else
{
this
.
authService
.
regState
=
true
;
this
.
goBack
();
}
},
3000
);
...
...
src/app/productdetail/productdetail.page.ts
View file @
d99adcd2
...
...
@@ -151,7 +151,7 @@ export class ProductdetailPage implements OnInit {
this
.
cartService
.
buyNow
(
product
).
then
((
data
)
=>
{
if
(
data
===
true
)
{
if
(
type
===
1
)
{
this
.
router
.
navigateByUrl
(
'cart'
);
this
.
router
.
navigateByUrl
(
'cart'
,
{
replaceUrl
:
true
}
);
}
else
{
this
.
service
.
showToast
(
'Added into cart'
,
'top'
,
'my-toast'
,
2000
);
}
...
...
src/app/verification/verification.page.html
View file @
d99adcd2
<div
class=
"nav_header"
>
<button
class=
"nav_btn nav_back floatLeft"
(
click
)="
goBack
()"
>
<button
class=
"nav_btn nav_back floatLeft"
(
click
)="
goBack
()"
*
ngIf=
"authService.regState"
>
<img
src=
"../assets/Group17_2.png"
/>
</button>
<div
class=
"nav_title floatLeft"
>
...
...
@@ -15,14 +15,7 @@
<h6>
+01 {{authService.userPostData.phone}}
</h6>
</div>
<div
class=
"row"
>
<input
class=
""
type=
"number"
placeholder=
"Type OTP"
maxlength=
"4"
#
otp
required
/>
<input
class=
""
type=
"number"
placeholder=
"Type OTP"
maxlength=
"4"
#
otp
required
/>
</div>
<div
class=
"row"
>
<button
class=
"login_btn"
(
click
)="
authService
.
verify
(
otp
.
value
)"
>
...
...
src/config/address.service.ts
View file @
d99adcd2
...
...
@@ -135,7 +135,7 @@ export class AddressService {
.
delete
();
}
public
async
getNearBy
(
centerId
,
userId
)
{
public
async
getNearBy
(
centerId
,
userId
,
distance
)
{
// latitude, longitude, distance, userId
console
.
log
(
centerId
);
if
(
centerId
)
{
...
...
@@ -161,7 +161,6 @@ export class AddressService {
const
lat
=
0.0144927536231884
;
const
lon
=
0.0181818181818182
;
const
distance
=
10
;
const
lowerLat
=
latitude
-
lat
*
distance
;
const
lowerLon
=
longitude
-
lon
*
distance
;
...
...
src/config/auth.service.ts
View file @
d99adcd2
...
...
@@ -51,7 +51,7 @@ export class AuthService {
this
.
router
.
navigateByUrl
(
'home'
,
{
replaceUrl
:
true
});
}
else
{
this
.
regState
=
false
;
this
.
router
.
navigateByUrl
(
'verification'
);
this
.
router
.
navigateByUrl
(
'verification'
,
{
replaceUrl
:
true
}
);
}
}
else
{
console
.
log
(
'here too'
);
...
...
@@ -109,7 +109,7 @@ export class AuthService {
.
update
({
otp
:
''
,
phoneVerified
:
true
});
this
.
service
.
set
(
'type'
,
1
);
this
.
loader
=
false
;
this
.
router
.
navigateByUrl
(
'nearby'
);
this
.
router
.
navigateByUrl
(
'nearby'
,
{
replaceUrl
:
true
}
);
}
else
{
this
.
loader
=
false
;
this
.
service
.
showToast
(
...
...
src/config/cart.service.ts
View file @
d99adcd2
...
...
@@ -60,7 +60,7 @@ export class CartsService {
if
(
this
.
cartCenter
===
''
)
{
this
.
cartCenter
=
product
.
centerId
;
this
.
addressService
.
defaultAddress
(
this
.
custId
);
this
.
addressService
.
getNearBy
(
this
.
cartCenter
,
this
.
custId
);
this
.
addressService
.
getNearBy
(
this
.
cartCenter
,
this
.
custId
,
this
.
service
.
distance
);
}
const
cartRef
:
AngularFirestoreCollection
<
any
>
=
this
.
afs
.
collection
(
'carts'
,
...
...
@@ -156,7 +156,7 @@ export class CartsService {
if
(
this
.
cartCenter
===
''
)
{
this
.
cartCenter
=
res
[
0
].
centerId
;
this
.
addressService
.
defaultAddress
(
this
.
custId
);
this
.
addressService
.
getNearBy
(
this
.
cartCenter
,
this
.
custId
);
this
.
addressService
.
getNearBy
(
this
.
cartCenter
,
this
.
custId
,
this
.
service
.
distance
);
}
res
.
forEach
(
item
=>
{
const
cartItem
:
CartItem
=
{
...
...
src/config/center.service.ts
View file @
d99adcd2
...
...
@@ -5,6 +5,7 @@ import {
AngularFirestoreCollection
}
from
'@angular/fire/firestore'
;
import
{
Centers
,
CenterData
}
from
'./services/center'
;
import
{
ServiceService
}
from
'./service.service'
;
import
*
as
firebase
from
'firebase'
;
@
Injectable
({
...
...
@@ -13,9 +14,10 @@ import * as firebase from 'firebase';
export
class
CenterService
{
centers
:
Centers
[]
=
[];
nearcenters
:
Centers
[]
=
[];
constructor
(
public
afs
:
AngularFirestore
)
{
constructor
(
public
afs
:
AngularFirestore
,
public
service
:
ServiceService
)
{
console
.
log
(
this
.
service
.
distance
);
this
.
centerList
();
this
.
getNearBy
(
10.0159
,
76.3419
,
10
);
this
.
getNearBy
(
10.0159
,
76.3419
,
this
.
service
.
distance
);
}
public
async
centerList
()
{
...
...
@@ -54,6 +56,7 @@ export class CenterService {
}
public
async
getNearBy
(
latitude
,
longitude
,
distance
)
{
console
.
log
(
distance
);
const
This
=
this
;
const
state
=
true
;
...
...
src/config/myorder.service.ts
View file @
d99adcd2
...
...
@@ -233,7 +233,7 @@ export class MyordersService {
const
lat
=
0.0144927536231884
;
const
lon
=
0.0181818181818182
;
const
distance
=
10
;
const
distance
=
this
.
service
.
distance
;
const
lowerLat
=
latitude
-
lat
*
distance
;
const
lowerLon
=
longitude
-
lon
*
distance
;
...
...
src/config/order.service.ts
View file @
d99adcd2
...
...
@@ -163,11 +163,11 @@ export class OrdersService {
const
product
=
cartItem
[
0
];
this
.
custId
=
this
.
custId
.
trim
();
const
orderItem
:
Order
=
{
amount
:
'A$ '
+
otherCharge
.
totalAmt
,
amount
:
'A$ '
+
otherCharge
.
totalAmt
.
toFixed
(
2
)
,
customer
:
firebase
.
firestore
().
doc
(
'/customer/'
+
this
.
custId
),
shopper
:
product
.
shopper
,
deliveryAddress
:
otherCharge
.
custAddress
,
deliveryCharge
:
'A$ '
+
otherCharge
.
deliveryCharge
,
deliveryCharge
:
'A$ '
+
otherCharge
.
deliveryCharge
.
toFixed
(
2
)
,
deliveryLocation
:
otherCharge
.
custAddress
.
latLng
,
bookDate
:
firebase
.
firestore
.
FieldValue
.
serverTimestamp
(),
orderDate
:
Math
.
floor
(
Date
.
now
()
/
1000
),
...
...
@@ -195,9 +195,9 @@ export class OrdersService {
shopperName
:
''
,
product
:
products
,
timeRemain
:
timer
,
discount
:
'A$ '
+
otherCharge
.
discount
,
discount
:
'A$ '
+
otherCharge
.
discount
.
toFixed
(
2
)
,
promoApplied
:
otherCharge
.
discountApplied
,
tax
:
'A$ '
+
otherCharge
.
taxAmount
tax
:
'A$ '
+
otherCharge
.
taxAmount
.
toFixed
(
2
)
};
// console.log(orderItem);
...
...
src/config/service.service.ts
View file @
d99adcd2
import
{
Injectable
}
from
'@angular/core'
;
import
{
Storage
}
from
'@ionic/storage'
;
import
{
ToastController
}
from
'@ionic/angular'
;
import
*
as
firebase
from
'firebase'
;
@
Injectable
({
providedIn
:
'root'
})
export
class
ServiceService
{
state
:
boolean
;
distance
:
any
;
constructor
(
public
storage
:
Storage
,
public
toastController
:
ToastController
)
{
this
.
state
=
true
;
this
.
distance
=
10
;
this
.
storage
.
ready
().
then
(()
=>
{
this
.
get
(
'user'
);
});
this
.
setting
().
then
((
data
)
=>
{
if
(
data
)
{
this
.
distance
=
data
;
}
}).
catch
(
err
=>
{
this
.
distance
=
10
;
});
}
public
set
(
settingName
:
string
,
value
:
any
)
{
...
...
@@ -80,4 +89,21 @@ export class ServiceService {
formatNumber
(
num
:
number
)
{
return
num
.
toString
().
replace
(
/
(\d)(?=(\d{3})
+
(?!\d))
/g
,
'$1,'
)
}
setting
()
{
const
promise
=
new
Promise
(
resolve
=>
{
const
prodRef
=
firebase
.
firestore
()
.
collection
(
'setting'
)
.
doc
(
'basic'
).
onSnapshot
(
doc
=>
{
console
.
log
(
doc
.
data
());
if
(
doc
.
exists
)
{
const
data
=
doc
.
data
();
this
.
distance
=
data
.
distance
;
resolve
(
this
.
distance
);
}
});
});
return
promise
;
}
}
src/config/shopper.service.ts
View file @
d99adcd2
...
...
@@ -5,6 +5,7 @@ import {
AngularFirestoreDocument
,
AngularFirestoreCollection
}
from
'@angular/fire/firestore'
;
import
{
ServiceService
}
from
'./service.service'
;
import
{
Shopper
}
from
'./services/shopper'
;
import
*
as
firebase
from
'firebase'
;
...
...
@@ -15,9 +16,9 @@ export class ShoppersService {
shoppers
:
Shopper
[]
=
[];
activeshoppers
:
Shopper
[]
=
[];
nearshoppers
:
Shopper
[]
=
[];
constructor
(
public
afs
:
AngularFirestore
,
public
afAuth
:
AngularFireAuth
)
{
constructor
(
public
afs
:
AngularFirestore
,
public
afAuth
:
AngularFireAuth
,
public
service
:
ServiceService
)
{
this
.
featuredshopperList
();
this
.
getNearBy
(
10.0159
,
76.3419
,
10
);
this
.
getNearBy
(
-
33.87276
,
151.20534
,
this
.
service
.
distance
);
}
public
async
shopperList
(
centerId
:
any
,
type
:
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