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
e5a9da76
Commit
e5a9da76
authored
Mar 16, 2020
by
Adarsh K
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'adarsh' into 'master'
Adarsh See merge request
!101
parents
c11d67ac
4e83b7aa
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
65 additions
and
37 deletions
+65
-37
home.module.ts
src/app/home/home.module.ts
+3
-3
trackorder.module.ts
src/app/trackorder/trackorder.module.ts
+2
-2
wishlist.page.ts
src/app/wishlist/wishlist.page.ts
+22
-16
address.service.ts
src/config/address.service.ts
+28
-8
cart.service.ts
src/config/cart.service.ts
+5
-5
wish.service.ts
src/config/wish.service.ts
+4
-2
index.html
src/index.html
+1
-1
No files found.
src/app/home/home.module.ts
View file @
e5a9da76
...
@@ -27,11 +27,11 @@ const routes: Routes = [
...
@@ -27,11 +27,11 @@ const routes: Routes = [
IonicModule
,
IonicModule
,
AgmDirectionModule
,
AgmDirectionModule
,
AgmCoreModule
.
forRoot
({
AgmCoreModule
.
forRoot
({
apiKey
:
'AIzaSyBn
CzDk6ec1OJFcW5FYgxP3LWVHMNumGDM
'
apiKey
:
'AIzaSyBn
6hOlr6YHcZAmbptlsmbhvH5iQllWflE
'
}),
}),
RouterModule
.
forChild
(
routes
)
RouterModule
.
forChild
(
routes
)
],
],
declarations
:
[
HomePage
]
declarations
:
[
HomePage
]
})
})
export
class
HomePageModule
{
}
export
class
HomePageModule
{
}
// AIzaSyBn6hOlr6YHcZAmbptlsmbhvH5iQllWflE
// //AIzaSyBnCzDk6ec1OJFcW5FYgxP3LWVHMNumGDM
\ No newline at end of file
\ No newline at end of file
src/app/trackorder/trackorder.module.ts
View file @
e5a9da76
...
@@ -24,10 +24,10 @@ const routes: Routes = [
...
@@ -24,10 +24,10 @@ const routes: Routes = [
IonicModule
,
IonicModule
,
AgmDirectionModule
,
AgmDirectionModule
,
AgmCoreModule
.
forRoot
({
AgmCoreModule
.
forRoot
({
apiKey
:
'AIzaSyBn
6hOlr6YHcZAmbptlsmbhvH5iQllWflE
'
apiKey
:
'AIzaSyBn
CzDk6ec1OJFcW5FYgxP3LWVHMNumGDM
'
}),
}),
RouterModule
.
forChild
(
routes
)
RouterModule
.
forChild
(
routes
)
],
],
declarations
:
[
TrackorderPage
]
declarations
:
[
TrackorderPage
]
})
})
export
class
TrackorderPageModule
{}
export
class
TrackorderPageModule
{
}
src/app/wishlist/wishlist.page.ts
View file @
e5a9da76
...
@@ -76,22 +76,28 @@ export class WishlistPage implements OnInit {
...
@@ -76,22 +76,28 @@ export class WishlistPage implements OnInit {
this
.
wishService
this
.
wishService
.
addToCart
(
this
.
custId
,
this
.
wishService
.
whishItem
)
.
addToCart
(
this
.
custId
,
this
.
wishService
.
whishItem
)
.
then
(
data
=>
{
.
then
(
data
=>
{
this
.
wishService
console
.
log
(
data
);
.
clearWish
(
this
.
custId
)
if
(
data
===
false
)
{
.
then
(
datas
=>
{
this
.
loader
=
false
;
this
.
loader
=
false
;
this
.
service
.
showToast
(
'You have items from another Shopping Centre'
,
'top'
,
'my-error'
,
2000
);
this
.
service
.
showToast
(
'Added to cart'
,
'top'
,
'my-toast'
,
2000
);
}
else
{
this
.
router
.
navigateByUrl
(
'cart'
,
{
replaceUrl
:
true
,
queryParams
:
data
});
this
.
wishService
})
.
clearWish
(
this
.
custId
)
.
catch
(
err
=>
{
.
then
(
datas
=>
{
this
.
loader
=
false
;
this
.
loader
=
false
;
this
.
service
.
showToast
(
this
.
service
.
showToast
(
'Added to cart'
,
'top'
,
'my-toast'
,
2000
);
'Something went wrong'
,
this
.
router
.
navigateByUrl
(
'cart'
,
{
replaceUrl
:
true
,
queryParams
:
data
});
'top'
,
})
'my-error'
,
.
catch
(
err
=>
{
1000
this
.
loader
=
false
;
);
this
.
service
.
showToast
(
});
'Something went wrong'
,
'top'
,
'my-error'
,
1000
);
});
}
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
this
.
loader
=
false
;
this
.
loader
=
false
;
...
...
src/config/address.service.ts
View file @
e5a9da76
...
@@ -21,6 +21,13 @@ export class AddressService {
...
@@ -21,6 +21,13 @@ export class AddressService {
addressState
:
number
;
addressState
:
number
;
constructor
(
public
afs
:
AngularFirestore
,
public
subject
:
SubjectService
)
{
constructor
(
public
afs
:
AngularFirestore
,
public
subject
:
SubjectService
)
{
this
.
addressState
=
0
;
this
.
addressState
=
0
;
this
.
subject
.
getUserData
().
subscribe
(
userData
=>
{
if
(
userData
)
{
console
.
log
(
'address reinitialized'
);
const
userDatas
=
JSON
.
parse
(
userData
);
this
.
addList
(
userDatas
.
uid
);
}
});
}
}
public
async
addList
(
userId
:
string
)
{
public
async
addList
(
userId
:
string
)
{
...
@@ -146,8 +153,11 @@ export class AddressService {
...
@@ -146,8 +153,11 @@ export class AddressService {
}
}
public
async
getNearBy
(
centerId
,
userId
,
distance
)
{
public
async
getNearBy
(
centerId
,
userId
,
distance
)
{
// latitude, longitude, distance, userId
// latitude, longitude, distance, userId
console
.
log
(
centerId
,
userId
,
distance
);
console
.
log
(
centerId
,
userId
,
distance
);
this
.
custAddress
=
undefined
;
if
(
centerId
)
{
if
(
centerId
)
{
this
.
afs
.
collection
(
'centers'
).
doc
(
centerId
).
ref
.
get
().
then
((
doc
)
=>
{
this
.
afs
.
collection
(
'centers'
).
doc
(
centerId
).
ref
.
get
().
then
((
doc
)
=>
{
if
(
doc
.
exists
)
{
if
(
doc
.
exists
)
{
...
@@ -221,15 +231,24 @@ export class AddressService {
...
@@ -221,15 +231,24 @@ export class AddressService {
// alert('No Orders Found');
// alert('No Orders Found');
}
}
if
(
this
.
addressList
.
length
>
0
&&
this
.
nearestList
.
length
>
0
)
{
if
(
this
.
addressList
.
length
>
0
)
{
this
.
addressList
.
forEach
((
address
)
=>
{
if
(
this
.
nearestList
.
length
>
0
)
{
const
index
=
this
.
nearestList
.
findIndex
(
x
=>
x
.
addressId
===
address
.
addressId
);
this
.
addressList
.
forEach
((
address
)
=>
{
if
(
index
>=
0
)
{
const
index
=
this
.
nearestList
.
findIndex
(
x
=>
x
.
addressId
===
address
.
addressId
);
address
.
nearest
=
true
;
if
(
index
>=
0
)
{
}
address
.
nearest
=
true
;
});
}
});
}
else
{
this
.
addressList
.
forEach
((
address
)
=>
{
address
.
nearest
=
false
;
});
}
console
.
log
(
this
.
addressList
);
}
}
console
.
log
(
this
.
addressList
);
this
.
addressList
=
this
.
addressList
.
sort
((
a
:
any
,
b
:
any
)
=>
{
this
.
addressList
=
this
.
addressList
.
sort
((
a
:
any
,
b
:
any
)
=>
{
return
b
.
nearest
-
a
.
nearest
;
return
b
.
nearest
-
a
.
nearest
;
...
@@ -246,6 +265,7 @@ export class AddressService {
...
@@ -246,6 +265,7 @@ export class AddressService {
}
}
setAddress
()
{
setAddress
()
{
this
.
custAddress
=
undefined
;
console
.
log
(
this
.
nearestList
);
console
.
log
(
this
.
nearestList
);
if
(
this
.
nearestList
.
length
>
0
)
{
if
(
this
.
nearestList
.
length
>
0
)
{
this
.
custAddress
=
this
.
nearestList
.
find
(
this
.
custAddress
=
this
.
nearestList
.
find
(
...
...
src/config/cart.service.ts
View file @
e5a9da76
...
@@ -153,11 +153,11 @@ export class CartsService {
...
@@ -153,11 +153,11 @@ export class CartsService {
const
res
=
value
;
const
res
=
value
;
this
.
cartTotal
=
0
;
this
.
cartTotal
=
0
;
if
(
res
.
length
>
0
)
{
if
(
res
.
length
>
0
)
{
if
(
this
.
cartCenter
===
''
)
{
//
if (this.cartCenter === '') {
this
.
cartCenter
=
res
[
0
].
centerId
;
this
.
cartCenter
=
res
[
0
].
centerId
;
this
.
addressService
.
defaultAddress
(
this
.
custId
);
// }
this
.
addressService
.
getNearBy
(
this
.
cartCenter
,
this
.
custId
,
this
.
service
.
distance
);
this
.
addressService
.
defaultAddress
(
this
.
custId
);
}
this
.
addressService
.
getNearBy
(
this
.
cartCenter
,
this
.
custId
,
this
.
service
.
distance
);
res
.
forEach
(
item
=>
{
res
.
forEach
(
item
=>
{
const
cartItem
:
CartItem
=
{
const
cartItem
:
CartItem
=
{
cartId
:
item
.
cartId
,
cartId
:
item
.
cartId
,
...
...
src/config/wish.service.ts
View file @
e5a9da76
...
@@ -120,11 +120,13 @@ export class WishService {
...
@@ -120,11 +120,13 @@ export class WishService {
}
}
addToCart
(
custId
,
items
)
{
addToCart
(
custId
,
items
)
{
console
.
log
(
items
);
const
promise
=
new
Promise
(
resolve
=>
{
const
promise
=
new
Promise
(
resolve
=>
{
items
.
forEach
(
item
=>
{
items
.
forEach
(
item
=>
{
this
.
cartService
.
buyNow
(
item
);
this
.
cartService
.
buyNow
(
item
).
then
(
res
=>
{
resolve
(
res
);
});
});
});
resolve
(
true
);
});
});
return
promise
;
return
promise
;
}
}
...
...
src/index.html
View file @
e5a9da76
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
<body>
<body>
<script
<script
src=
"https://maps.googleapis.com/maps/api/js?key=AIzaSyBn
6hOlr6YHcZAmbptlsmbhvH5iQllWflE
&libraries=geometry"
></script>
src=
"https://maps.googleapis.com/maps/api/js?key=AIzaSyBn
CzDk6ec1OJFcW5FYgxP3LWVHMNumGDM
&libraries=geometry"
></script>
<app-root></app-root>
<app-root></app-root>
</body>
</body>
...
...
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