Merge branch 'confirmation-email' into 'master'
Geocoding restricttions, added values for range finders, added confirmation email, and .env file See merge request saburly/marketalarm/web!14
This commit was merged in pull request #14.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
|
.env
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ const { currentRERequest } = require('../helpers/url');
|
|||||||
const { getRealEstateTypeEnum } = require('../helpers/enums');
|
const { getRealEstateTypeEnum } = require('../helpers/enums');
|
||||||
|
|
||||||
const getGardenSize = (req,res) => {
|
const getGardenSize = (req,res) => {
|
||||||
|
|
||||||
|
const unit = " m2"
|
||||||
const rangeFrom = {
|
const rangeFrom = {
|
||||||
min : 10,
|
min : 10,
|
||||||
max : 3000,
|
max : 3000,
|
||||||
@@ -15,7 +17,8 @@ const getGardenSize = (req,res) => {
|
|||||||
value : 100,
|
value : 100,
|
||||||
step : 10
|
step : 10
|
||||||
}
|
}
|
||||||
res.render('gardenSize', { rangeFrom, rangeTo });
|
|
||||||
|
res.render('gardenSize', { rangeFrom, rangeTo, unit });
|
||||||
};
|
};
|
||||||
|
|
||||||
const postGardenSize = async (req, res) => {
|
const postGardenSize = async (req, res) => {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
const { currentRERequest } = require('../helpers/url');
|
const { currentRERequest } = require('../helpers/url');
|
||||||
|
|
||||||
const getPrice = (req,res) => {
|
const getPrice = (req,res) => {
|
||||||
|
|
||||||
|
const unit = " KM"
|
||||||
const rangeFrom = {
|
const rangeFrom = {
|
||||||
min : 1000,
|
min : 1000,
|
||||||
max : 250000,
|
max : 250000,
|
||||||
@@ -16,7 +18,7 @@ const getPrice = (req,res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
res.render('price', {rangeFrom, rangeTo });
|
res.render('price', {rangeFrom, rangeTo, unit });
|
||||||
};
|
};
|
||||||
|
|
||||||
const postPrice = async (req, res) => {
|
const postPrice = async (req, res) => {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const { currentRERequest } = require('../helpers/url');
|
const { currentRERequest } = require('../helpers/url');
|
||||||
const { isValidEmail } = require('../helpers/email');
|
const { isValidEmail } = require('../helpers/email');
|
||||||
|
const { sendTemplatedEmail} = require('../helpers/awsEmail');
|
||||||
|
|
||||||
const getQuerySubmit = async (req, res) => {
|
const getQuerySubmit = async (req, res) => {
|
||||||
const nextStep = req.query.nextStep;
|
const nextStep = req.query.nextStep;
|
||||||
@@ -38,7 +39,9 @@ const postQuerySubmit = async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request.email = req.body.email;
|
request.email = req.body.email;
|
||||||
|
request.subscribed = true;
|
||||||
await request.save();
|
await request.save();
|
||||||
|
sendTemplatedEmail(req.body.email, request);
|
||||||
res.redirect(nextStep);
|
res.redirect(nextStep);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ const { currentRERequest } = require('../helpers/url');
|
|||||||
const { sizes, getRealEstateTypeEnum } = require('../helpers/enums');
|
const { sizes, getRealEstateTypeEnum } = require('../helpers/enums');
|
||||||
|
|
||||||
const getSize = (req,res) => {
|
const getSize = (req,res) => {
|
||||||
|
|
||||||
|
const unit = " m2"
|
||||||
const rangeFrom = {
|
const rangeFrom = {
|
||||||
min : 10,
|
min : 10,
|
||||||
max : 250,
|
max : 250,
|
||||||
@@ -16,7 +18,7 @@ const getSize = (req,res) => {
|
|||||||
step : 10
|
step : 10
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render('size', { rangeFrom, rangeTo });
|
res.render('size', { rangeFrom, rangeTo, unit });
|
||||||
};
|
};
|
||||||
|
|
||||||
const postSize = async (req, res) => {
|
const postSize = async (req, res) => {
|
||||||
|
|||||||
15
app/controllers/unsubscribe.js
Normal file
15
app/controllers/unsubscribe.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
const { currentRERequest } = require('../helpers/url');
|
||||||
|
|
||||||
|
const getUnsubscribe = async (req, res) => {
|
||||||
|
const request = await currentRERequest(req);
|
||||||
|
request.subscribed = false;
|
||||||
|
await request.save();
|
||||||
|
|
||||||
|
res.render('unsubscribe', { nextStep: '/vrstanekretnine' });
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
getUnsubscribe
|
||||||
|
};
|
||||||
96
app/helpers/awsEmail.js
Normal file
96
app/helpers/awsEmail.js
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
|
||||||
|
const dotenv = require('dotenv');
|
||||||
|
dotenv.config();
|
||||||
|
const { getRealEstateTypeEnum } = require('./enums');
|
||||||
|
const { getRegionName, getMunicipalityName } = require('./codes');
|
||||||
|
const AWS = require('aws-sdk');
|
||||||
|
AWS.config.update({
|
||||||
|
region: process.env.AMAZON_REGION,
|
||||||
|
credentials:
|
||||||
|
{
|
||||||
|
accessKeyId: process.env.AMAZON_ACCES_KEY_ID,
|
||||||
|
secretAccessKey: process.env.AMAZON_SECRET_ACCESS_KEY
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const sendTemplatedEmail = async (email, request) => {
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
Destination: { /* required */
|
||||||
|
CcAddresses: [
|
||||||
|
],
|
||||||
|
ToAddresses: [
|
||||||
|
email
|
||||||
|
]
|
||||||
|
},
|
||||||
|
Message: { /* required */
|
||||||
|
Body: { /* required */
|
||||||
|
Html: {
|
||||||
|
Charset: "UTF-8",
|
||||||
|
Data: getEmailHTML(request)
|
||||||
|
},
|
||||||
|
Text: {
|
||||||
|
Charset: "UTF-8",
|
||||||
|
Data: getEmaiTextVersion(request)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Subject: {
|
||||||
|
Charset: 'UTF-8',
|
||||||
|
Data: `Javimi Potvrda: ${request.realEstateType} ${getRegionName(request.region)}, ${getMunicipalityName(request.region, request.municipality)}`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Source: process.env.SOURCE_EMAIL, /* required */
|
||||||
|
ReplyToAddresses: [
|
||||||
|
process.env.SOURCE_EMAIL,
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const sendEmailPromise = new AWS.SES({ apiVersion: '2010-12-01' }).sendEmail(params).promise();
|
||||||
|
await sendEmailPromise;
|
||||||
|
}
|
||||||
|
|
||||||
|
const getEmailHTML = (realestateRequest) => {
|
||||||
|
const realEstateType = getRealEstateTypeEnum(realestateRequest.realEstateType);
|
||||||
|
const gardenSize = realEstateType.hasGardenSize ? `<div><strong>Kvadratura okućnice: Od ${realestateRequest.gardenSizeMin} do ${realestateRequest.gardenSizeMax} m2 </strong></div>` : ``
|
||||||
|
|
||||||
|
return `<h1> Zdravo,
|
||||||
|
Naručio/la si da ti javimo ako se nekretnina pojavi u oglasima. </h1>
|
||||||
|
<h2> Ovo je tražena nekretnina: </h2>
|
||||||
|
<div>
|
||||||
|
<div> <strong>Tip nekretnine: ${realEstateType.title} </strong></div>
|
||||||
|
<div><strong>Područje: ${getRegionName(realestateRequest.region)} </strong></div>
|
||||||
|
<div><strong>Mjesto: ${getMunicipalityName(realestateRequest.region, realestateRequest.municipality)} </strong></div>
|
||||||
|
<div><strong>Kvadratura nekretnine: Od ${realestateRequest.sizeMin} do ${realestateRequest.sizeMax} m2 </strong></div>
|
||||||
|
${gardenSize}
|
||||||
|
<div><strong>Cijena: ${realestateRequest.priceMin} do ${realestateRequest.priceMax} KM </strong></div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div><strong> Ako želis prestati dobijati obavještenja za ovu pretragu klikni ${process.env.APP_URL}/odjava/${realestateRequest.uniqueId} </strong></div>
|
||||||
|
<div><strong>Ako želiš promijeniti uslove pretrage klikni ${process.env.APP_URL}/pregled/${realestateRequest.uniqueId} </strong></div>
|
||||||
|
<h4> Tvoj,
|
||||||
|
Javimi tim.
|
||||||
|
</h4>`
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const getEmaiTextVersion = (realestateRequest) => {
|
||||||
|
const realEstateType = getRealEstateTypeEnum(realestateRequest.realEstateType);
|
||||||
|
const gardenSize = realEstateType.hasGardenSize ? "Kvadratura okućnice od " + realestateRequest.gardenSizeMin + " do " + realestateRequest.gardenSizeMax : ""
|
||||||
|
|
||||||
|
const text = "Zdravo, \n Naručio/la si da ti javimo ako se nekretnina pojavi u oglasima \n Ovo je tražena nekretnina: \n , Tip nekretnine: "
|
||||||
|
+ realestateRequest.realEstateType + "\n Područje" + getRegionName(realestateRequest.region) + "\n Mjesto " + getMunicipalityName(realestateRequest.region, realestateRequest.municipality)
|
||||||
|
+ "\n Kvadratura nekretnine Od " + realestateRequest.sizeMin + " do " + realestateRequest.sizeMaX +
|
||||||
|
+ gardenSize
|
||||||
|
"\n Cijena od " + realestateRequest.priceMin + " do " + realestateRequest.priceMax +
|
||||||
|
"\n Ako želis prestati dobijati obavještenja za ovu pretragu klikni" + process.env.APP_URL + "/odjava/" + realestateRequest.uniqueId +
|
||||||
|
"\n Ako želiš promijeniti uslove pretrage klikni " + process.env.APP_URL + "/odpregled/" + realestateRequest.uniqueId +
|
||||||
|
"\n Tvoj,\n Javimi tim"
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
sendTemplatedEmail
|
||||||
|
};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
const scrapTheItems = require("./scrapTheItems");
|
const scrapTheItems = require("./scrapTheItems");
|
||||||
const convertToDate = require("./convertToDate");
|
const convertToDate = require("./convertToDate");
|
||||||
const AWS = require('aws-sdk');
|
const AWS = require('aws-sdk');
|
||||||
AWS.config.update({region: 'eu-central-1'});
|
// AWS.config.update({region: 'eu-central-1'});
|
||||||
|
|
||||||
|
|
||||||
async function sendNotification(marketAlert) {
|
async function sendNotification(marketAlert) {
|
||||||
|
|||||||
18
app/migrations/20190531111232-subscribed-boolean.js
Normal file
18
app/migrations/20190531111232-subscribed-boolean.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
up: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.addColumn(
|
||||||
|
'RealEstateRequests',
|
||||||
|
'subscribed',
|
||||||
|
Sequelize.BOOLEAN
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
down: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.removeColumn(
|
||||||
|
'RealEstateRequests',
|
||||||
|
'subscribed'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -18,7 +18,8 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
gardenSizeMax: DataTypes.INTEGER,
|
gardenSizeMax: DataTypes.INTEGER,
|
||||||
priceMin: DataTypes.INTEGER,
|
priceMin: DataTypes.INTEGER,
|
||||||
priceMax: DataTypes.INTEGER,
|
priceMax: DataTypes.INTEGER,
|
||||||
bounding_box: DataTypes.GEOMETRY('POINT', 4326)
|
bounding_box: DataTypes.GEOMETRY('POINT', 4326),
|
||||||
|
subscribed: DataTypes.BOOLEAN
|
||||||
}, {});
|
}, {});
|
||||||
RealEstateRequest.associate = function(models) {
|
RealEstateRequest.associate = function(models) {
|
||||||
// associations can be defined here
|
// associations can be defined here
|
||||||
|
|||||||
@@ -2,89 +2,124 @@
|
|||||||
<h2>U kojem naselju tražite nekretninu?</h2>
|
<h2>U kojem naselju tražite nekretninu?</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row center-align" >
|
<div class="row center-align">
|
||||||
<div id="floating-panel">
|
<div id="floating-panel">
|
||||||
<input id="address" type="textbox" value="">
|
<input id="address" type="textbox" value="">
|
||||||
<input id="submit" type="button" value="Trazi">
|
<input id="submit" type="button" value="Trazi">
|
||||||
</div>
|
</div>
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
</div>
|
</div>
|
||||||
<form method="POST" id="form-map-output">
|
<form method="POST" id="form-map-output">
|
||||||
<div class="row center-align">
|
<div class="row center-align">
|
||||||
<div class="col s6 push-s3">
|
<div class="col s6 push-s3">
|
||||||
<a id="btnsubmit" href="#" class="welcome-center-button waves-effect waves-light btn">
|
<a id="btnsubmit" href="#" class="welcome-center-button waves-effect waves-light btn">
|
||||||
Dalje
|
Dalje
|
||||||
</a>
|
</a>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="north" id=north />
|
</div>
|
||||||
<input type="hidden" name="south" id=south />
|
<input type="hidden" name="north" id=north />
|
||||||
<input type="hidden" name="east" id=east />
|
<input type="hidden" name="south" id=south />
|
||||||
<input type="hidden" name="west" id=west />
|
<input type="hidden" name="east" id=east />
|
||||||
</form>
|
<input type="hidden" name="west" id=west />
|
||||||
<script>
|
</form>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
var map;
|
var map;
|
||||||
var municipality = "<%= municipality%>";
|
var municipality = "<%= municipality%>";
|
||||||
var defaultAddress = document.getElementById('address');
|
var defaultAddress = document.getElementById('address');
|
||||||
|
var latLngRestrictions = [];
|
||||||
|
|
||||||
var BOSNIA_BOUNDS = {
|
var BOSNIA_BOUNDS = {
|
||||||
north: 45.70,
|
north: 45.70,
|
||||||
south: 41.69,
|
south: 41.69,
|
||||||
west: 15.55,
|
west: 15.55,
|
||||||
east: 20.77,
|
east: 20.77,
|
||||||
};
|
};
|
||||||
|
|
||||||
function initMap() {
|
function initMap() {
|
||||||
map = new google.maps.Map(document.getElementById('map'), {
|
map = new google.maps.Map(document.getElementById('map'), {
|
||||||
center: { lat: -34.397, lng: 150.644 },
|
center: { lat: -34.397, lng: 150.644 },
|
||||||
zoom: 11,
|
zoom: 11,
|
||||||
restriction: {
|
restriction: {
|
||||||
latLngBounds: BOSNIA_BOUNDS,
|
latLngBounds: BOSNIA_BOUNDS,
|
||||||
strictBounds: false,
|
strictBounds: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
var geocoder = new google.maps.Geocoder();
|
var geocoder = new google.maps.Geocoder();
|
||||||
|
|
||||||
document.getElementById('submit').addEventListener('click', function () {
|
document.getElementById('submit').addEventListener('click', function () {
|
||||||
geocodeAddress(geocoder, map);
|
geocodeAddress(geocoder, map, false, latLngRestrictions);
|
||||||
});
|
});
|
||||||
|
|
||||||
function geocodeAddress(geocoder, resultsMap) {
|
function geocodeAddress(geocoder, resultsMap, isInit, geocoderRestrictions) {
|
||||||
var address = document.getElementById('address').value;
|
var address = document.getElementById('address').value;
|
||||||
geocoder.geocode({ 'address': address }, function (results, status) {
|
let geocoderOptions = geocoderRestrictions
|
||||||
if (status === 'OK') {
|
? { 'address': address, 'bounds': geocoderRestrictions }
|
||||||
resultsMap.setCenter(results[0].geometry.location);
|
: { 'address': address }
|
||||||
var marker = new google.maps.Marker({
|
|
||||||
map: resultsMap,
|
geocoder.geocode(geocoderOptions, function (results, status) {
|
||||||
position: results[0].geometry.location
|
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 {
|
} else {
|
||||||
alert('Geocode was not successful for the following reason: ' + status);
|
resultsMap.setZoom(17);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultAddress.value = municipality;
|
} else {
|
||||||
geocodeAddress(geocoder, map);
|
alert('Geocode was not successful for the following reason: ' + status);
|
||||||
|
}
|
||||||
$(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"
|
defaultAddress.value = municipality;
|
||||||
async defer></script>
|
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>
|
</div>
|
||||||
@@ -1,56 +1,61 @@
|
|||||||
<form method="POST" id="form-range">
|
<form method="POST" id="form-range">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div class="row center-align">
|
<div class="row center-align">
|
||||||
<h6>Od</h6>
|
<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>
|
||||||
<div class="col s6 push-s3">
|
<div class="row center-align">
|
||||||
<a id="btnsubmit" href="#" class="welcome-center-button waves-effect waves-light btn">
|
<h6 id="from-value"><%= rangeFrom.value %> <%= unit %> </h12>
|
||||||
Dalje
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
<p class="range-field">
|
||||||
|
<input name="from" id="from" type="range" value="<%= rangeFrom.value %>" min="<%= rangeFrom.min %>"
|
||||||
<script>
|
max="<%= rangeFrom.max %>" step="<%= rangeFrom.step %>" />
|
||||||
|
</p>
|
||||||
$(document).ready(() => {
|
<div class="row center-align">
|
||||||
|
<h6>Do</h6>
|
||||||
$("#btnsubmit").click(() => {
|
</div>
|
||||||
var from = $("#from").val();
|
<div class="row center-align">
|
||||||
var to = $("#to").val();
|
<h6 id="to-value"><%= rangeTo.value %> <%= unit %></h12>
|
||||||
console.log("From " + from + " " + to);
|
</div>
|
||||||
|
<p class="range-field">
|
||||||
if (parseInt(from, 10) >= parseInt(to, 10)) {
|
<input name="to" id="to" type="range" value="<%= rangeTo.value %>" min="<%= rangeTo.min %>"
|
||||||
alert("\"Od\" vrijednost ne smije biti veca od \"Do\" vrijednosti ")
|
max="<%= rangeTo.max %>" step="<%= rangeTo.step %>" />
|
||||||
return;
|
</p>
|
||||||
}
|
</div>
|
||||||
|
<div class="col s6 push-s3">
|
||||||
$("#form-range").submit();
|
<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>
|
||||||
5
development.env
Normal file
5
development.env
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
AMAZON_ACCES_KEY_ID=(your-key-here)
|
||||||
|
AMAZON_SECRET_ACCESS_KEY=(your-key-here)
|
||||||
|
AMAZON_REGION=eu-west-1
|
||||||
|
APP_URL=http://localhost:3001
|
||||||
|
SOURCE_EMAIL=info@saburly.com
|
||||||
7
index.js
7
index.js
@@ -1,5 +1,5 @@
|
|||||||
const welcome = require('./app/controllers/welcome').getWelcome;
|
const welcome = require('./app/controllers/welcome').getWelcome;
|
||||||
const { getRealEstateTypes, postRealEstateTypes} = require('./app/controllers/realEstateTypes');
|
const { getRealEstateTypes, postRealEstateTypes } = require('./app/controllers/realEstateTypes');
|
||||||
const { getRegion, postRegion } = require('./app/controllers/regions');
|
const { getRegion, postRegion } = require('./app/controllers/regions');
|
||||||
const { getMunicipality, postMunicipality } = require('./app/controllers/municipalities');
|
const { getMunicipality, postMunicipality } = require('./app/controllers/municipalities');
|
||||||
const { getSize, postSize } = require('./app/controllers/sizes');
|
const { getSize, postSize } = require('./app/controllers/sizes');
|
||||||
@@ -9,6 +9,7 @@ const { getQueryReview, postQueryReview } = require('./app/controllers/queryRevi
|
|||||||
const { getQuerySubmit, postQuerySubmit } = require('./app/controllers/querySubmit');
|
const { getQuerySubmit, postQuerySubmit } = require('./app/controllers/querySubmit');
|
||||||
const { getGoAgain } = require('./app/controllers/goAgain');
|
const { getGoAgain } = require('./app/controllers/goAgain');
|
||||||
const { getNeighborhood, postNeighborhood } = require('./app/controllers/neighborhoodMap');
|
const { getNeighborhood, postNeighborhood } = require('./app/controllers/neighborhoodMap');
|
||||||
|
const { getUnsubscribe } = require('./app/controllers/unsubscribe');
|
||||||
|
|
||||||
let express = require("express");
|
let express = require("express");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
@@ -106,7 +107,7 @@ app.post("/api/payforalert", (req, res) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
tco.checkout.authorize(params, function(error, data) {
|
tco.checkout.authorize(params, function (error, data) {
|
||||||
if (error) {
|
if (error) {
|
||||||
res.send(error.message);
|
res.send(error.message);
|
||||||
} else {
|
} else {
|
||||||
@@ -146,6 +147,8 @@ app.post('/pregled/:request_id', postQueryReview);
|
|||||||
app.get('/posalji/:request_id', getQuerySubmit);
|
app.get('/posalji/:request_id', getQuerySubmit);
|
||||||
app.post('/posalji/:request_id', postQuerySubmit);
|
app.post('/posalji/:request_id', postQuerySubmit);
|
||||||
|
|
||||||
|
app.get('/odjava/:request_id', getUnsubscribe);
|
||||||
|
|
||||||
app.get('/ponovo', getGoAgain);
|
app.get('/ponovo', getGoAgain);
|
||||||
|
|
||||||
app.use('/assets', express.static('./app/public'));
|
app.use('/assets', express.static('./app/public'));
|
||||||
|
|||||||
Reference in New Issue
Block a user