Added google maps step
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const { currentRERequest } = require('../helpers/url');
|
||||
const { getMunicipalitiesForRegion } = require('../helpers/codes');
|
||||
|
||||
const getMunicipality = async (req,res) => {
|
||||
const getMunicipality = async (req, res) => {
|
||||
let request = await currentRERequest(req);
|
||||
const municipalities = getMunicipalitiesForRegion(request.region);
|
||||
|
||||
@@ -11,8 +11,8 @@ const getMunicipality = async (req,res) => {
|
||||
const postMunicipality = async (req, res) => {
|
||||
const request = await currentRERequest(req);
|
||||
|
||||
const nextStepPage = req.query.nextStep || 'povrsina';
|
||||
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
|
||||
const nextStepPage = req.query.nextStep || 'naselje';
|
||||
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}/${req.body.municipalityname}`;
|
||||
|
||||
request.municipality = req.body.municipality;
|
||||
await request.save();
|
||||
|
||||
36
app/controllers/neighborhoodMap.js
Normal file
36
app/controllers/neighborhoodMap.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const { currentRERequest } = require('../helpers/url');
|
||||
|
||||
const getNeighborhood = async (req, res) => {
|
||||
const municipality = req.params.municipality
|
||||
const nextStep = req.query.nextStep || '/';
|
||||
console.log(municipality);
|
||||
|
||||
res.render('neighborhoodMap', {
|
||||
nextStep,
|
||||
municipality
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
const postNeighborhood = async (req, res) => {
|
||||
let request = await currentRERequest(req);
|
||||
const northWest = [req.body.north, req.body.west];
|
||||
const northEast = [req.body.north, req.body.east];
|
||||
const southEast = [req.body.south, req.body.east];
|
||||
const southWest = [req.body.south, req.body.west];
|
||||
|
||||
request.bounding_box = {
|
||||
type: 'Polygon', coordinates: [
|
||||
[northWest, northEast, southEast,
|
||||
southWest, northWest]
|
||||
]
|
||||
};
|
||||
await request.save();
|
||||
const nextStep = req.query.nextStep || `/povrsina/${request.uniqueId}`;
|
||||
res.redirect(nextStep);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getNeighborhood,
|
||||
postNeighborhood
|
||||
};
|
||||
Reference in New Issue
Block a user