Fixed bounding box bug, and removed unecesary params
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
const { currentRERequest } = require('../helpers/url');
|
const { currentRERequest } = require('../helpers/url');
|
||||||
const { getMunicipalitiesForRegion } = require('../helpers/codes');
|
const { getMunicipalitiesForRegion, getMunicipalityName } = require('../helpers/codes');
|
||||||
|
|
||||||
const getMunicipality = async (req, res) => {
|
const getMunicipality = async (req, res) => {
|
||||||
let request = await currentRERequest(req);
|
let request = await currentRERequest(req);
|
||||||
@@ -10,9 +10,8 @@ const getMunicipality = async (req, res) => {
|
|||||||
|
|
||||||
const postMunicipality = async (req, res) => {
|
const postMunicipality = async (req, res) => {
|
||||||
const request = await currentRERequest(req);
|
const request = await currentRERequest(req);
|
||||||
|
|
||||||
const nextStepPage = req.query.nextStep || 'naselje';
|
const nextStepPage = req.query.nextStep || 'naselje';
|
||||||
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}/${req.body.municipalityname}`;
|
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}/${getMunicipalityName(request.region, req.body.municipality)}`;
|
||||||
|
|
||||||
request.municipality = req.body.municipality;
|
request.municipality = req.body.municipality;
|
||||||
await request.save();
|
await request.save();
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ const { currentRERequest } = require('../helpers/url');
|
|||||||
const getNeighborhood = async (req, res) => {
|
const getNeighborhood = async (req, res) => {
|
||||||
const municipality = req.params.municipality
|
const municipality = req.params.municipality
|
||||||
const nextStep = req.query.nextStep || '/';
|
const nextStep = req.query.nextStep || '/';
|
||||||
console.log(municipality);
|
|
||||||
|
|
||||||
res.render('neighborhoodMap', {
|
res.render('neighborhoodMap', {
|
||||||
nextStep,
|
nextStep,
|
||||||
@@ -14,10 +13,10 @@ const getNeighborhood = async (req, res) => {
|
|||||||
|
|
||||||
const postNeighborhood = async (req, res) => {
|
const postNeighborhood = async (req, res) => {
|
||||||
let request = await currentRERequest(req);
|
let request = await currentRERequest(req);
|
||||||
const northWest = [req.body.north, req.body.west];
|
const northWest = [req.body.west, req.body.north];
|
||||||
const northEast = [req.body.north, req.body.east];
|
const northEast = [req.body.east, req.body.north];
|
||||||
const southEast = [req.body.south, req.body.east];
|
const southEast = [req.body.east, req.body.south];
|
||||||
const southWest = [req.body.south, req.body.west];
|
const southWest = [req.body.west, req.body.south];
|
||||||
|
|
||||||
request.bounding_box = {
|
request.bounding_box = {
|
||||||
type: 'Polygon', coordinates: [
|
type: 'Polygon', coordinates: [
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<ul class="collection with-header">
|
<ul class="collection with-header">
|
||||||
<% for(const municipality of municipalities) { %>
|
<% for(const municipality of municipalities) { %>
|
||||||
<li class="collection-item">
|
<li class="collection-item">
|
||||||
<div val="<%= municipality.name %>" id="<%= municipality.id %>" onclick="saveAndSubmit(this.id, municipality.name)"><%= municipality.name %>
|
<div val="<%= municipality.name %>" id="<%= municipality.id %>" onclick="saveAndSubmit(this.id)"><%= municipality.name %>
|
||||||
<a href="#" class="secondary-content">
|
<a href="#" class="secondary-content">
|
||||||
<i class="material-icons">send</i>
|
<i class="material-icons">send</i>
|
||||||
</a>
|
</a>
|
||||||
@@ -17,14 +17,12 @@
|
|||||||
<% } %>
|
<% } %>
|
||||||
</ul>
|
</ul>
|
||||||
<input type="hidden" name="municipality" id="municipality" />
|
<input type="hidden" name="municipality" id="municipality" />
|
||||||
<input type="hidden" name="municipalityname" id="municipalityname" />
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function saveAndSubmit(id, name) {
|
function saveAndSubmit(id, name) {
|
||||||
$("#municipality").val(id);
|
$("#municipality").val(id);
|
||||||
$("#municipalityname").val(name);
|
|
||||||
$("#form-municipality").submit();
|
$("#form-municipality").submit();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user