39 lines
708 B
JavaScript
39 lines
708 B
JavaScript
const { currentRERequest } = require('../helpers/url');
|
|
|
|
const getPrice = (req,res) => {
|
|
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 request = await currentRERequest(req);
|
|
|
|
const nextStepPage = req.query.nextStep || 'pregled';
|
|
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
|
|
|
|
request.priceMin = req.body.from;
|
|
request.priceMax = req.body.to;
|
|
await request.save();
|
|
|
|
res.redirect(nextStepUrl);
|
|
};
|
|
|
|
module.exports = {
|
|
getPrice,
|
|
postPrice
|
|
};
|