WIP Idea to implement bound map to be equal to selected
This commit is contained in:
@@ -4,9 +4,28 @@ const getLocation = async (req, res) => {
|
||||
const title = "Odaberite lokaciju";
|
||||
const nextStep = req.query.nextStep || "/";
|
||||
|
||||
//Check if location data already exists
|
||||
//If it does then get location is called through edit field query
|
||||
//and map should show already selected location not initial map
|
||||
let selectedLatLngBounds = 0;
|
||||
|
||||
const searchRequest = await currentSearchRequest(req);
|
||||
|
||||
if (!searchRequest || !searchRequest.dataValues) {
|
||||
res.render("notFound", { title: " " });
|
||||
return;
|
||||
}
|
||||
const selectedArea = searchRequest.areaToSearch;
|
||||
const sw = selectedArea.coordinates[0][3];
|
||||
const ne = selectedArea.coordinates[0][1];
|
||||
if (sw[0] && ne[0]) {
|
||||
selectedLatLngBounds = [sw, ne];
|
||||
}
|
||||
|
||||
res.render("location", {
|
||||
nextStep,
|
||||
title
|
||||
title,
|
||||
selectedLatLngBounds
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user