Geocoding restricttions, added values for range finders, added confirmation email, and .env file
This commit is contained in:
@@ -2,89 +2,124 @@
|
||||
<h2>U kojem naselju tražite nekretninu?</h2>
|
||||
</div>
|
||||
|
||||
<div class="row center-align" >
|
||||
<div class="row center-align">
|
||||
<div id="floating-panel">
|
||||
<input id="address" type="textbox" value="">
|
||||
<input id="submit" type="button" value="Trazi">
|
||||
</div>
|
||||
<div id="map"></div>
|
||||
</div>
|
||||
<form method="POST" id="form-map-output">
|
||||
<div class="row center-align">
|
||||
<div class="col s6 push-s3">
|
||||
<a id="btnsubmit" href="#" class="welcome-center-button waves-effect waves-light btn">
|
||||
Dalje
|
||||
</a>
|
||||
</div>
|
||||
<form method="POST" id="form-map-output">
|
||||
<div class="row center-align">
|
||||
<div class="col s6 push-s3">
|
||||
<a id="btnsubmit" href="#" class="welcome-center-button waves-effect waves-light btn">
|
||||
Dalje
|
||||
</a>
|
||||
</div>
|
||||
<input type="hidden" name="north" id=north />
|
||||
<input type="hidden" name="south" id=south />
|
||||
<input type="hidden" name="east" id=east />
|
||||
<input type="hidden" name="west" id=west />
|
||||
</form>
|
||||
<script>
|
||||
</div>
|
||||
<input type="hidden" name="north" id=north />
|
||||
<input type="hidden" name="south" id=south />
|
||||
<input type="hidden" name="east" id=east />
|
||||
<input type="hidden" name="west" id=west />
|
||||
</form>
|
||||
<script>
|
||||
|
||||
|
||||
var map;
|
||||
var municipality = "<%= municipality%>";
|
||||
var defaultAddress = document.getElementById('address');
|
||||
var map;
|
||||
var municipality = "<%= municipality%>";
|
||||
var defaultAddress = document.getElementById('address');
|
||||
var latLngRestrictions = [];
|
||||
|
||||
var BOSNIA_BOUNDS = {
|
||||
north: 45.70,
|
||||
south: 41.69,
|
||||
west: 15.55,
|
||||
east: 20.77,
|
||||
};
|
||||
var BOSNIA_BOUNDS = {
|
||||
north: 45.70,
|
||||
south: 41.69,
|
||||
west: 15.55,
|
||||
east: 20.77,
|
||||
};
|
||||
|
||||
function initMap() {
|
||||
map = new google.maps.Map(document.getElementById('map'), {
|
||||
center: { lat: -34.397, lng: 150.644 },
|
||||
zoom: 11,
|
||||
restriction: {
|
||||
latLngBounds: BOSNIA_BOUNDS,
|
||||
strictBounds: false,
|
||||
},
|
||||
});
|
||||
var geocoder = new google.maps.Geocoder();
|
||||
function initMap() {
|
||||
map = new google.maps.Map(document.getElementById('map'), {
|
||||
center: { lat: -34.397, lng: 150.644 },
|
||||
zoom: 11,
|
||||
restriction: {
|
||||
latLngBounds: BOSNIA_BOUNDS,
|
||||
strictBounds: false,
|
||||
},
|
||||
});
|
||||
var geocoder = new google.maps.Geocoder();
|
||||
|
||||
document.getElementById('submit').addEventListener('click', function () {
|
||||
geocodeAddress(geocoder, map);
|
||||
});
|
||||
document.getElementById('submit').addEventListener('click', function () {
|
||||
geocodeAddress(geocoder, map, false, latLngRestrictions);
|
||||
});
|
||||
|
||||
function geocodeAddress(geocoder, resultsMap) {
|
||||
var address = document.getElementById('address').value;
|
||||
geocoder.geocode({ 'address': address }, function (results, status) {
|
||||
if (status === 'OK') {
|
||||
resultsMap.setCenter(results[0].geometry.location);
|
||||
var marker = new google.maps.Marker({
|
||||
map: resultsMap,
|
||||
position: results[0].geometry.location
|
||||
});
|
||||
function geocodeAddress(geocoder, resultsMap, isInit, geocoderRestrictions) {
|
||||
var address = document.getElementById('address').value;
|
||||
let geocoderOptions = geocoderRestrictions
|
||||
? { 'address': address, 'bounds': geocoderRestrictions }
|
||||
: { 'address': address }
|
||||
|
||||
geocoder.geocode(geocoderOptions, function (results, status) {
|
||||
if (status === 'OK') {
|
||||
|
||||
var bounds = results[0].geometry.bounds;
|
||||
|
||||
var resultBounds = new google.maps.LatLngBounds(
|
||||
|
||||
results[0].geometry.viewport.getSouthWest(),
|
||||
results[0].geometry.viewport.getNorthEast()
|
||||
);
|
||||
|
||||
// map.fitBounds(resultBounds);
|
||||
resultsMap.setCenter(results[0].geometry.location);
|
||||
|
||||
if (isInit) {
|
||||
|
||||
latLngRestrictions = new google.maps.LatLngBounds(
|
||||
new google.maps.LatLng(bounds.getSouthWest().lat(), bounds.getSouthWest().lng()),
|
||||
new google.maps.LatLng(bounds.getNorthEast().lng(), bounds.getNorthEast().lng()));
|
||||
|
||||
|
||||
let latLngRestrictionsa = {
|
||||
west: bounds.getSouthWest().lng(),
|
||||
east: bounds.getNorthEast().lng(),
|
||||
north: bounds.getNorthEast().lat(),
|
||||
south: bounds.getSouthWest().lat()
|
||||
}
|
||||
map.setOptions({
|
||||
restriction: {
|
||||
latLngBounds: latLngRestrictionsa,
|
||||
strictBounds: false,
|
||||
}
|
||||
})
|
||||
} else {
|
||||
alert('Geocode was not successful for the following reason: ' + status);
|
||||
resultsMap.setZoom(17);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
defaultAddress.value = municipality;
|
||||
geocodeAddress(geocoder, map);
|
||||
|
||||
$(document).ready(() => {
|
||||
$("#btnsubmit").click(() => {
|
||||
var bounds = map.getBounds();
|
||||
|
||||
$("#north").val(map.getBounds().getNorthEast().lat());
|
||||
$("#south").val(map.getBounds().getSouthWest().lat());
|
||||
$("#east").val(map.getBounds().getNorthEast().lng());
|
||||
$("#west").val(map.getBounds().getSouthWest().lng());
|
||||
|
||||
$("#form-map-output").submit();
|
||||
});
|
||||
} else {
|
||||
alert('Geocode was not successful for the following reason: ' + status);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAna8ohfV2HBMcxGk_29vqxU5Z_bDickqg&callback=initMap"
|
||||
async defer></script>
|
||||
|
||||
defaultAddress.value = municipality;
|
||||
geocodeAddress(geocoder, map, true);
|
||||
|
||||
$(document).ready(() => {
|
||||
$("#btnsubmit").click(() => {
|
||||
var bounds = map.getBounds();
|
||||
|
||||
$("#north").val(map.getBounds().getNorthEast().lat());
|
||||
$("#south").val(map.getBounds().getSouthWest().lat());
|
||||
$("#east").val(map.getBounds().getNorthEast().lng());
|
||||
$("#west").val(map.getBounds().getSouthWest().lng());
|
||||
|
||||
$("#form-map-output").submit();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAna8ohfV2HBMcxGk_29vqxU5Z_bDickqg&callback=initMap" async
|
||||
defer></script>
|
||||
</div>
|
||||
@@ -1,56 +1,61 @@
|
||||
<form method="POST" id="form-range">
|
||||
|
||||
<div>
|
||||
<div class="row center-align">
|
||||
<h6>Od</h6>
|
||||
</div>
|
||||
<p class="range-field">
|
||||
<input
|
||||
name="from"
|
||||
id="from"
|
||||
type="range"
|
||||
value="<%= rangeFrom.value %>"
|
||||
min="<%= rangeFrom.min %>"
|
||||
max="<%= rangeFrom.max %>"
|
||||
step="<%= rangeFrom.step %>"/>
|
||||
</p>
|
||||
<div class="row center-align">
|
||||
<h6>Do</h6>
|
||||
</div>
|
||||
<p class="range-field">
|
||||
<input
|
||||
name="to"
|
||||
id="to"
|
||||
type="range"
|
||||
value="<%= rangeTo.value %>"
|
||||
min="<%= rangeTo.min %>"
|
||||
max="<%= rangeTo.max %>"
|
||||
step="<%= rangeTo.step %>"/>
|
||||
</p>
|
||||
<div>
|
||||
<div class="row center-align">
|
||||
<h6>Od</h6>
|
||||
</div>
|
||||
<div class="col s6 push-s3">
|
||||
<a id="btnsubmit" href="#" class="welcome-center-button waves-effect waves-light btn">
|
||||
Dalje
|
||||
</a>
|
||||
<div class="row center-align">
|
||||
<h6 id="from-value"><%= rangeFrom.value %> <%= unit %> </h12>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
$("#btnsubmit").click(() => {
|
||||
var from = $("#from").val();
|
||||
var to = $("#to").val();
|
||||
console.log("From " + from + " " + to);
|
||||
|
||||
if (parseInt(from, 10) >= parseInt(to, 10)) {
|
||||
alert("\"Od\" vrijednost ne smije biti veca od \"Do\" vrijednosti ")
|
||||
return;
|
||||
}
|
||||
|
||||
$("#form-range").submit();
|
||||
});
|
||||
<p class="range-field">
|
||||
<input name="from" id="from" type="range" value="<%= rangeFrom.value %>" min="<%= rangeFrom.min %>"
|
||||
max="<%= rangeFrom.max %>" step="<%= rangeFrom.step %>" />
|
||||
</p>
|
||||
<div class="row center-align">
|
||||
<h6>Do</h6>
|
||||
</div>
|
||||
<div class="row center-align">
|
||||
<h6 id="to-value"><%= rangeTo.value %> <%= unit %></h12>
|
||||
</div>
|
||||
<p class="range-field">
|
||||
<input name="to" id="to" type="range" value="<%= rangeTo.value %>" min="<%= rangeTo.min %>"
|
||||
max="<%= rangeTo.max %>" step="<%= rangeTo.step %>" />
|
||||
</p>
|
||||
</div>
|
||||
<div class="col s6 push-s3">
|
||||
<a id="btnsubmit" href="#" class="welcome-center-button waves-effect waves-light btn">
|
||||
Dalje
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
$("#from").change(function () {
|
||||
$('#from-value').text($("#from").val() + "<%= unit %>");
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
$("#to").change(function () {
|
||||
$('#to-value').text($("#to").val() + "<%= unit %>" );
|
||||
});
|
||||
|
||||
|
||||
$("#btnsubmit").click(() => {
|
||||
var from = $("#from").val();
|
||||
var to = $("#to").val();
|
||||
|
||||
$("#foo").on("click", function () {
|
||||
alert($(this).text());
|
||||
});
|
||||
|
||||
if (parseInt(from, 10) >= parseInt(to, 10)) {
|
||||
alert("\"Od\" vrijednost ne smije biti veca od \"Do\" vrijednosti ")
|
||||
return;
|
||||
}
|
||||
|
||||
$("#form-range").submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
14
app/views/unsubscribe.ejs
Normal file
14
app/views/unsubscribe.ejs
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
<div class="row center-align">
|
||||
<span class="welcome-big-logo">🤙</span>
|
||||
</div>
|
||||
<div class="row center-align">
|
||||
<div>Uspješno ste se odjavili</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s6 push-s3">
|
||||
<a href="<%= nextStep %>" class="welcome-center-button waves-effect waves-light btn">
|
||||
Nova pretraga
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user