Added map to kivi ad preview.
This commit is contained in:
@@ -55,5 +55,4 @@ module.exports = {
|
||||
STAGING,
|
||||
CHECK_UP_DAYS,
|
||||
PROSTOR_LOGIN
|
||||
|
||||
};
|
||||
|
||||
@@ -134,9 +134,7 @@ const getViewRealEstate = async (req, res) => {
|
||||
...BASIC_SEGMENT_PUBLISH,
|
||||
...ADDITIONAL_SEGMENT_PUBLISH
|
||||
];
|
||||
//
|
||||
console.log("ALL BOOLEAN FIELDS:", ALL_BOOLEAN_FIELDS);
|
||||
console.log("All boolean values", allBooleanValues);
|
||||
|
||||
//On view add page we will show only values that are not - null, or "", or undefined
|
||||
const forShowing = value => {
|
||||
return value !== false && value !== null && value !== "";
|
||||
@@ -153,15 +151,15 @@ const getViewRealEstate = async (req, res) => {
|
||||
return forShowing(allSegmentSelectedValues[object.dbField]);
|
||||
});
|
||||
|
||||
//console.log("booleanFields", booleanFields);
|
||||
|
||||
res.render("viewRealEstate", {
|
||||
title: pageTitle,
|
||||
booleanFields,
|
||||
inputFields,
|
||||
allInputValues,
|
||||
segmentFields,
|
||||
allSegmentSelectedValues
|
||||
allSegmentSelectedValues,
|
||||
locationLat,
|
||||
locationLong
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -169,3 +169,15 @@ h3 {
|
||||
left: auto;
|
||||
right: auto;
|
||||
}
|
||||
|
||||
.dont-break-out {
|
||||
overflow-wrap: break-word;
|
||||
word-wrap: break-word;
|
||||
-ms-word-break: break-all;
|
||||
word-break: break-all;
|
||||
word-break: break-word;
|
||||
-ms-hyphens: auto;
|
||||
-moz-hyphens: auto;
|
||||
-webkit-hyphens: auto;
|
||||
hyphens: auto;
|
||||
}
|
||||
|
||||
@@ -198,9 +198,7 @@
|
||||
} */
|
||||
|
||||
if (!hasErrors) {
|
||||
//
|
||||
alert("Pokusavam submit formu!");
|
||||
|
||||
|
||||
$("#publishForm").submit();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
<br>
|
||||
<div class="row">
|
||||
<% for (const field of booleanFields){ %>
|
||||
<p>
|
||||
<span><%= field.title %></span>
|
||||
|
||||
</p>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="row col s12">
|
||||
<% for (const field of inputFields){ %>
|
||||
<p>
|
||||
<span><%= field.title %></span>
|
||||
<span><%= allInputValues[field.dbField] %></span>
|
||||
<span class="col s4"><%= field.title %></span>
|
||||
<span class="col s8 distinguished dont-break-out"><%= allInputValues[field.dbField] %></span>
|
||||
</p>
|
||||
<br>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
@@ -22,12 +13,81 @@
|
||||
<div class="row">
|
||||
<% for (const field of segmentFields){ %>
|
||||
<p>
|
||||
<span><%= field.title %></span>
|
||||
<span class="col s4"><%= field.title.replace(/>/g,'') %></span>
|
||||
<% for (const segmentObject of field.values) { %>
|
||||
<% if (allSegmentSelectedValues[field.dbField] === segmentObject.id) { %>
|
||||
<span><%= segmentObject.title %></span>
|
||||
<% } %>>
|
||||
<span class="col s8 distinguished"><%= segmentObject.title.replace(/>/g,'') %></span>
|
||||
<% } %>
|
||||
<% } %>
|
||||
</p>
|
||||
<br>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row col s12">
|
||||
<% for (const field of booleanFields){ %>
|
||||
<p class="col s4">
|
||||
<span>✓</span>
|
||||
<span><%= field.title %></span>
|
||||
|
||||
</p>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
<div class="row center-align ">
|
||||
<div class="distinguished">
|
||||
<span>Lokacija nekretnine</span>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div class="col s12">
|
||||
<div id="map"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let map;
|
||||
|
||||
function initMap() {
|
||||
const BOSNIA_BOUNDS = {
|
||||
north: 45.7,
|
||||
south: 41.69,
|
||||
west: 15.55,
|
||||
east: 20.77
|
||||
};
|
||||
const ESTATE_COORDINATES = {
|
||||
lat: <%= locationLat %>,
|
||||
lng: <%= locationLong %>
|
||||
};
|
||||
|
||||
const mapElement = document.getElementById("map");
|
||||
const restrictMapPanningToBosniaOnly = {
|
||||
latLngBounds: BOSNIA_BOUNDS,
|
||||
strictBounds: true
|
||||
};
|
||||
const initialMapParams = {
|
||||
center: ESTATE_COORDINATES,
|
||||
zoom: 13,
|
||||
restriction: restrictMapPanningToBosniaOnly,
|
||||
mapTypeControl: false,
|
||||
panControl: false,
|
||||
zoomControl: true,
|
||||
streetViewControl: false
|
||||
};
|
||||
map = new google.maps.Map(mapElement, initialMapParams);
|
||||
|
||||
marker = new google.maps.Marker({
|
||||
position: ESTATE_COORDINATES,
|
||||
map: map,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<script
|
||||
src="https://maps.googleapis.com/maps/api/js?key=<%= process.env.API_MAP_KEY %>&language=bs&libraries=places&callback=initMap"
|
||||
async
|
||||
defer
|
||||
></script>
|
||||
Reference in New Issue
Block a user