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
8f326880
Commit
8f326880
authored
Mar 09, 2020
by
Adarsh K
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes
parent
4ba5e826
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
3 deletions
+26
-3
nearby.page.ts
src/app/nearby/nearby.page.ts
+2
-0
address.service.ts
src/config/address.service.ts
+23
-3
address.ts
src/config/services/address.ts
+1
-0
No files found.
src/app/nearby/nearby.page.ts
View file @
8f326880
...
...
@@ -120,12 +120,14 @@ export class NearbyPage implements OnInit {
mapReady
(
map
)
{
map
.
addListener
(
'dragend'
,
()
=>
{
console
.
log
(
this
.
newCenterLat
,
this
.
newCenterLng
);
this
.
getAddress
(
this
.
newCenterLat
,
this
.
newCenterLng
);
});
}
centerChange
(
e
)
{
console
.
log
(
e
);
this
.
newCenterLat
=
e
.
lat
;
this
.
newCenterLng
=
e
.
lng
;
this
.
getAddress
(
this
.
newCenterLat
,
this
.
newCenterLng
);
}
goToPage
(
path
,
data
=
null
)
{
...
...
src/config/address.service.ts
View file @
8f326880
...
...
@@ -42,7 +42,8 @@ export class AddressService {
defaultVal
:
item
.
defaultVal
,
building
:
item
.
building
,
landmark
:
item
.
landmark
,
addressId
:
item
.
addressId
addressId
:
item
.
addressId
,
nearest
:
false
};
this
.
addressList
.
push
(
address
);
});
...
...
@@ -72,7 +73,8 @@ export class AddressService {
defaultVal
:
item
.
defaultVal
,
building
:
item
.
building
,
landmark
:
item
.
landmark
,
addressId
:
item
.
addressId
addressId
:
item
.
addressId
,
nearest
:
false
};
this
.
defaultAdd
=
address
;
console
.
log
(
this
.
defaultAdd
);
...
...
@@ -203,7 +205,8 @@ export class AddressService {
defaultVal
:
item
.
defaultVal
,
building
:
item
.
building
,
landmark
:
item
.
landmark
,
addressId
:
item
.
addressId
addressId
:
item
.
addressId
,
nearest
:
true
};
this
.
nearestList
.
push
(
address
);
});
...
...
@@ -212,6 +215,23 @@ export class AddressService {
}
else
{
// alert('No Orders Found');
}
if
(
this
.
addressList
.
length
>
0
&&
this
.
nearestList
.
length
>
0
)
{
this
.
addressList
.
forEach
((
address
)
=>
{
const
index
=
this
.
nearestList
.
findIndex
(
x
=>
x
.
addressId
===
address
.
addressId
);
if
(
index
>=
0
)
{
address
.
nearest
=
true
;
}
});
}
console
.
log
(
this
.
addressList
);
this
.
addressList
=
this
.
addressList
.
sort
((
a
:
any
,
b
:
any
)
=>
{
return
b
.
nearest
-
a
.
nearest
;
});
console
.
log
(
this
.
addressList
);
});
}
else
{
console
.
log
(
'No such document!'
);
...
...
src/config/services/address.ts
View file @
8f326880
...
...
@@ -22,4 +22,5 @@ export interface AddressList {
building
:
string
;
latLng
:
any
;
landmark
:
string
;
nearest
:
boolean
;
}
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