Compare commits
7 Commits
edit-bug-f
...
double-ema
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08a94ca4f8 | ||
|
|
a0f2b044b2 | ||
|
|
7db74acad7 | ||
|
|
56865b4670 | ||
|
|
1a8ac3fba4 | ||
|
|
de3c76315e | ||
|
|
e969a8dc8b |
@@ -1,8 +1,21 @@
|
|||||||
const { currentRERequest } = require('../helpers/url');
|
const { currentRERequest } = require('../helpers/url');
|
||||||
const { gardenSizes, getRealEstateTypeEnum } = require('../helpers/enums');
|
const { getRealEstateTypeEnum } = require('../helpers/enums');
|
||||||
|
|
||||||
const getGardenSize = (req,res) => {
|
const getGardenSize = (req,res) => {
|
||||||
res.render('gardenSize', { gardenSizes });
|
const rangeFrom = {
|
||||||
|
min : 10,
|
||||||
|
max : 3000,
|
||||||
|
value : 0,
|
||||||
|
step : 10
|
||||||
|
}
|
||||||
|
|
||||||
|
const rangeTo = {
|
||||||
|
min : 10,
|
||||||
|
max : 3000,
|
||||||
|
value : 100,
|
||||||
|
step : 10
|
||||||
|
}
|
||||||
|
res.render('gardenSize', { rangeFrom, rangeTo });
|
||||||
};
|
};
|
||||||
|
|
||||||
const postGardenSize = async (req, res) => {
|
const postGardenSize = async (req, res) => {
|
||||||
@@ -13,7 +26,8 @@ const postGardenSize = async (req, res) => {
|
|||||||
|
|
||||||
const realEstateType = getRealEstateTypeEnum(request.realEstateType);
|
const realEstateType = getRealEstateTypeEnum(request.realEstateType);
|
||||||
if (realEstateType && realEstateType.hasGardenSize) {
|
if (realEstateType && realEstateType.hasGardenSize) {
|
||||||
request.gardenSize = req.body.gardensize;
|
request.gardenSizeMin = req.body.from;
|
||||||
|
request.gardenSizeMax = req.body.to;
|
||||||
await request.save();
|
await request.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,22 @@
|
|||||||
const { currentRERequest } = require('../helpers/url');
|
const { currentRERequest } = require('../helpers/url');
|
||||||
const { prices } = require('../helpers/enums');
|
|
||||||
|
|
||||||
const getPrice = (req,res) => {
|
const getPrice = (req,res) => {
|
||||||
res.render('price', { prices });
|
const rangeFrom = {
|
||||||
|
min : 1000,
|
||||||
|
max : 250000,
|
||||||
|
value : 0,
|
||||||
|
step : 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
const rangeTo = {
|
||||||
|
min : 1000,
|
||||||
|
max : 250000,
|
||||||
|
value : 50000,
|
||||||
|
step : 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
res.render('price', {rangeFrom, rangeTo });
|
||||||
};
|
};
|
||||||
|
|
||||||
const postPrice = async (req, res) => {
|
const postPrice = async (req, res) => {
|
||||||
@@ -11,7 +25,8 @@ const postPrice = async (req, res) => {
|
|||||||
const nextStepPage = req.query.nextStep || 'pregled';
|
const nextStepPage = req.query.nextStep || 'pregled';
|
||||||
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
|
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
|
||||||
|
|
||||||
request.price = req.body.price;
|
request.priceMin = req.body.from;
|
||||||
|
request.priceMax = req.body.to;
|
||||||
await request.save();
|
await request.save();
|
||||||
|
|
||||||
res.redirect(nextStepUrl);
|
res.redirect(nextStepUrl);
|
||||||
|
|||||||
@@ -10,7 +10,16 @@ const getQueryReview = async (req,res) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { realEstateType, region, municipality, size, gardenSize, price } = request.dataValues;
|
const {
|
||||||
|
realEstateType,
|
||||||
|
region,
|
||||||
|
municipality,
|
||||||
|
sizeMin,
|
||||||
|
sizeMax,
|
||||||
|
gardenSizeMin,
|
||||||
|
gardenSizeMax,
|
||||||
|
priceMin,
|
||||||
|
priceMax } = request.dataValues;
|
||||||
|
|
||||||
const realEstateTypeObject = getRealEstateTypeEnum(realEstateType);
|
const realEstateTypeObject = getRealEstateTypeEnum(realEstateType);
|
||||||
const enableGardenSizeEdit = realEstateTypeObject ? realEstateTypeObject.hasGardenSize : false;
|
const enableGardenSizeEdit = realEstateTypeObject ? realEstateTypeObject.hasGardenSize : false;
|
||||||
@@ -18,9 +27,9 @@ const getQueryReview = async (req,res) => {
|
|||||||
const realEstateTypeTitle = realEstateType ? getEnumTypeTitle(realEstateTypes, realEstateType) : null;
|
const realEstateTypeTitle = realEstateType ? getEnumTypeTitle(realEstateTypes, realEstateType) : null;
|
||||||
const regionName = region ? getRegionName(region) : null;
|
const regionName = region ? getRegionName(region) : null;
|
||||||
const municipalityName = (region && municipality) ? getMunicipalityName(region, municipality) : null;
|
const municipalityName = (region && municipality) ? getMunicipalityName(region, municipality) : null;
|
||||||
const sizeTitle = size ? getEnumTypeTitle(sizes, size) : null;
|
const sizeTitle = sizeMin ? sizeMin + "-" + sizeMax + " m2" : null;
|
||||||
const gardenSizeTitle = gardenSize ? getEnumTypeTitle(gardenSizes, gardenSize) : null;
|
const gardenSizeTitle = gardenSizeMin ? gardenSizeMin + "-" + gardenSizeMax + " m2" : null;
|
||||||
const priceTitle = price ? getEnumTypeTitle(prices, price) : null;
|
const priceTitle = priceMin ? priceMin + "-" + priceMax + " KM" : null;
|
||||||
|
|
||||||
const uniqueId = request.dataValues.uniqueId ? request.dataValues.uniqueId : '';
|
const uniqueId = request.dataValues.uniqueId ? request.dataValues.uniqueId : '';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const { currentRERequest } = require('../helpers/url');
|
const { currentRERequest } = require('../helpers/url');
|
||||||
const { isValidEmail } = require('../helpers/email');
|
const { isValidEmail } = require('../helpers/email');
|
||||||
|
|
||||||
const getQuerySubmit = async (req,res) => {
|
const getQuerySubmit = async (req, res) => {
|
||||||
const nextStep = req.query.nextStep;
|
const nextStep = req.query.nextStep;
|
||||||
const error = req.query.error;
|
const error = req.query.error;
|
||||||
|
|
||||||
@@ -16,14 +16,30 @@ const postQuerySubmit = async (req, res) => {
|
|||||||
const nextStep = req.query.nextStep || '/ponovo';
|
const nextStep = req.query.nextStep || '/ponovo';
|
||||||
|
|
||||||
const emailInput = req.body.email;
|
const emailInput = req.body.email;
|
||||||
|
const emailConfirmInput = req.body.confirm;
|
||||||
|
let error = "Greška ! Unesite validan email";
|
||||||
|
|
||||||
if (isValidEmail(emailInput)){
|
if (!isValidEmail(emailInput) || !isValidEmail(emailConfirmInput)) {
|
||||||
request.email = req.body.email;
|
|
||||||
await request.save();
|
error = "Greška ! Unesite validan email";
|
||||||
res.redirect(nextStep);
|
res.render('querySubmit', {
|
||||||
} else {
|
error
|
||||||
res.redirect('?error=1');
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (emailInput !== emailConfirmInput) {
|
||||||
|
|
||||||
|
error = "Greška ! Unešeni emailovi nisu isti";
|
||||||
|
res.render('querySubmit', {
|
||||||
|
error
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
request.email = req.body.email;
|
||||||
|
await request.save();
|
||||||
|
res.redirect(nextStep);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
@@ -2,7 +2,21 @@ 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) => {
|
||||||
res.render('size', { sizes });
|
const rangeFrom = {
|
||||||
|
min : 10,
|
||||||
|
max : 250,
|
||||||
|
value : 0,
|
||||||
|
step : 10
|
||||||
|
}
|
||||||
|
|
||||||
|
const rangeTo = {
|
||||||
|
min : 10,
|
||||||
|
max : 250,
|
||||||
|
value : 50,
|
||||||
|
step : 10
|
||||||
|
}
|
||||||
|
|
||||||
|
res.render('size', { rangeFrom, rangeTo });
|
||||||
};
|
};
|
||||||
|
|
||||||
const postSize = async (req, res) => {
|
const postSize = async (req, res) => {
|
||||||
@@ -13,8 +27,8 @@ const postSize = async (req, res) => {
|
|||||||
const nextStep = realEstateType && realEstateType.hasGardenSize ? 'okucnica' : 'cijena';
|
const nextStep = realEstateType && realEstateType.hasGardenSize ? 'okucnica' : 'cijena';
|
||||||
const nextStepPage = req.query.nextStep || nextStep;
|
const nextStepPage = req.query.nextStep || nextStep;
|
||||||
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
|
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
|
||||||
|
request.sizeMin = req.body.from;
|
||||||
request.size = req.body.size;
|
request.sizeMax = req.body.to;
|
||||||
await request.save();
|
await request.save();
|
||||||
|
|
||||||
res.redirect(nextStepUrl);
|
res.redirect(nextStepUrl);
|
||||||
|
|||||||
27
app/migrations/20190529093410-slider-fields.js
Normal file
27
app/migrations/20190529093410-slider-fields.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
module.exports = {
|
||||||
|
up: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.sequelize.transaction((t) => {
|
||||||
|
return Promise.all([
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'sizeRange', {
|
||||||
|
type: Sequelize.STRING
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'gardenSizeRange', {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'priceRange', {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
}, { transaction: t })
|
||||||
|
])
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
down: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.sequelize.transaction((t) => {
|
||||||
|
return Promise.all([
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'sizeRange', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'gardenSizeRange', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'priceRange', { transaction: t })
|
||||||
|
])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
63
app/migrations/20190530101945-range-fields.js
Normal file
63
app/migrations/20190530101945-range-fields.js
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
module.exports = {
|
||||||
|
up: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.sequelize.transaction((t) => {
|
||||||
|
return Promise.all([
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'sizeRange', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'gardenSizeRange', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'priceRange', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'size', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'gardenSize', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'price', { transaction: t }),
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'gardenSizeMin', {
|
||||||
|
type: Sequelize.INTEGER,
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'gardenSizeMax', {
|
||||||
|
type: Sequelize.INTEGER,
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'sizeMin', {
|
||||||
|
type: Sequelize.INTEGER
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'sizeMax', {
|
||||||
|
type: Sequelize.INTEGER,
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'priceMin', {
|
||||||
|
type: Sequelize.INTEGER,
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'priceMax', {
|
||||||
|
type: Sequelize.INTEGER
|
||||||
|
}, { transaction: t })
|
||||||
|
])
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
down: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.sequelize.transaction((t) => {
|
||||||
|
return Promise.all([
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'gardenSizeMin', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'gardenSizeMax', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'sizeMin', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'sizeMax', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'priceMin', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('RealEstateRequests', 'priceMin', { transaction: t }),
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'priceMax', {
|
||||||
|
type: Sequelize.STRING
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'gardenSizeRange', {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'priceRange', {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'size', {
|
||||||
|
type: Sequelize.STRING
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'gardenSize', {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('RealEstateRequests', 'price', {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
}, { transaction: t })
|
||||||
|
])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -12,9 +12,12 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
email: DataTypes.STRING,
|
email: DataTypes.STRING,
|
||||||
region: DataTypes.STRING,
|
region: DataTypes.STRING,
|
||||||
municipality: DataTypes.STRING,
|
municipality: DataTypes.STRING,
|
||||||
size: DataTypes.STRING,
|
sizeMin: DataTypes.INTEGER,
|
||||||
gardenSize: DataTypes.STRING,
|
sizeMax: DataTypes.INTEGER,
|
||||||
price: DataTypes.STRING,
|
gardenSizeMin: DataTypes.INTEGER,
|
||||||
|
gardenSizeMax: DataTypes.INTEGER,
|
||||||
|
priceMin: DataTypes.INTEGER,
|
||||||
|
priceMax: DataTypes.INTEGER,
|
||||||
bounding_box: DataTypes.GEOMETRY('POINT', 4326)
|
bounding_box: DataTypes.GEOMETRY('POINT', 4326)
|
||||||
}, {});
|
}, {});
|
||||||
RealEstateRequest.associate = function(models) {
|
RealEstateRequest.associate = function(models) {
|
||||||
|
|||||||
@@ -3,27 +3,4 @@
|
|||||||
<h2>Koliko okućnice tražite ?</h2>
|
<h2>Koliko okućnice tražite ?</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form method="POST" id="form-gardensize">
|
<% include partials/range %>
|
||||||
<div class="row center-align">
|
|
||||||
<ul class="collection with-header">
|
|
||||||
<% for(const gardenSize of gardenSizes) { %>
|
|
||||||
<li class="collection-item" >
|
|
||||||
<div id="<%= gardenSize.id %>" onclick="saveAndSubmit(this.id)"><%= gardenSize.title %>
|
|
||||||
<a href="#" class="secondary-content">
|
|
||||||
<i class="material-icons">send</i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<% } %>
|
|
||||||
</ul>
|
|
||||||
<input type="hidden" name="gardensize" id="gardensize" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function saveAndSubmit(id) {
|
|
||||||
$("#gardensize").val(id);
|
|
||||||
$("#form-gardensize").submit();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|||||||
@@ -73,10 +73,10 @@
|
|||||||
$("#btnsubmit").click(() => {
|
$("#btnsubmit").click(() => {
|
||||||
var bounds = map.getBounds();
|
var bounds = map.getBounds();
|
||||||
|
|
||||||
$("#north").val(bounds.na.l);
|
$("#north").val(map.getBounds().getNorthEast().lat());
|
||||||
$("#south").val(bounds.na.j);
|
$("#south").val(map.getBounds().getSouthWest().lat());
|
||||||
$("#east").val(bounds.ia.l);
|
$("#east").val(map.getBounds().getNorthEast().lng());
|
||||||
$("#west").val(bounds.ia.j);
|
$("#west").val(map.getBounds().getSouthWest().lng());
|
||||||
|
|
||||||
$("#form-map-output").submit();
|
$("#form-map-output").submit();
|
||||||
});
|
});
|
||||||
|
|||||||
56
app/views/partials/range.ejs
Normal file
56
app/views/partials/range.ejs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<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="col s6 push-s3">
|
||||||
|
<a id="btnsubmit" href="#" class="welcome-center-button waves-effect waves-light btn">
|
||||||
|
Dalje
|
||||||
|
</a>
|
||||||
|
</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();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -3,27 +3,4 @@
|
|||||||
<h2>Koja Vam okvirna cijena odgovara ?</h2>
|
<h2>Koja Vam okvirna cijena odgovara ?</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form method="POST" id="form-price">
|
<% include partials/range %>
|
||||||
<div class="row center-align">
|
|
||||||
<ul class="collection with-header">
|
|
||||||
<% for(const price of prices) { %>
|
|
||||||
<li class="collection-item" >
|
|
||||||
<div id="<%= price.id %>" onclick="saveAndSubmit(this.id)"><%= price.title %>
|
|
||||||
<a href="#" class="secondary-content">
|
|
||||||
<i class="material-icons">send</i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<% } %>
|
|
||||||
</ul>
|
|
||||||
<input type="hidden" name="price" id="price" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function saveAndSubmit(id) {
|
|
||||||
$("#price").val(id);
|
|
||||||
$("#form-price").submit();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,13 +9,25 @@
|
|||||||
<input id="email" name="email" type="email" placeholder="vas.email@mail.com" required size="250" />
|
<input id="email" name="email" type="email" placeholder="vas.email@mail.com" required size="250" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% if (error) {%>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s6 push-s3">
|
<div class="col s6 push-s3">
|
||||||
<h6 style="color: red">Greška ! Unesite ispravan email</h6>
|
<h6 id="error-lable-email" style="color: red"><%= error %> </h6>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<%}%>
|
</div>
|
||||||
|
|
||||||
|
<div class="row center-align">
|
||||||
|
<div class="col s6 push-s3">
|
||||||
|
<input id="confirm" name="confirm" type="email" placeholder="potvrdite.email@mail.com" required size="250" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s6 push-s3">
|
||||||
|
<h6 id="error-lable-email-confirm" style="color: red"></h6>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s6 push-s3">
|
<div class="col s6 push-s3">
|
||||||
<a id="submit" href="#" class="welcome-center-button waves-effect waves-light btn">
|
<a id="submit" href="#" class="welcome-center-button waves-effect waves-light btn">
|
||||||
@@ -31,13 +43,26 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready( () => {
|
$(document).ready(() => {
|
||||||
$("#submit").click( () => {
|
$("#submit").click(() => {
|
||||||
const emailField = document.getElementById('email');
|
const emailField = document.getElementById('email');
|
||||||
if (emailField.validity.valid){
|
const emailConfirmField = document.getElementById('confirm');
|
||||||
$("#form-submitquery").submit();
|
const errorMessage = "Greška ! Unedite validan email";
|
||||||
}
|
$("#error-lable-email").text("");
|
||||||
});
|
$("#error-lable-email-confirm").text("");
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
if (!emailField.validity.valid) {
|
||||||
|
$("#error-lable-email").text(errorMessage);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!emailConfirmField.validity.valid) {
|
||||||
|
$("#error-lable-email-confirm").text(errorMessage);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#form-submitquery").submit();
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -1,29 +1,6 @@
|
|||||||
<!--suppress HtmlUnknownAnchorTarget -->
|
<!--suppress HtmlUnknownAnchorTarget -->
|
||||||
<div class="row center-align">
|
<div class="row center-align">
|
||||||
<h2>Do koliko kvadrata tražite nekretninu ?</h2>
|
<h2>Od koliko kvadrata tražite nekretninu ?</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form method="POST" id="form-size">
|
<% include partials/range %>
|
||||||
<div class="row center-align">
|
|
||||||
<ul class="collection with-header">
|
|
||||||
<% for(const size of sizes) { %>
|
|
||||||
<li class="collection-item">
|
|
||||||
<div id="<%= size.id %>" onclick="saveAndSubmit(this.id)"><%= size.title %>
|
|
||||||
<a href="#" class="secondary-content">
|
|
||||||
<i class="material-icons">send</i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<% } %>
|
|
||||||
</ul>
|
|
||||||
<input type="hidden" name="size" id="size" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function saveAndSubmit(id) {
|
|
||||||
$("#size").val(id);
|
|
||||||
$("#form-size").submit();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user