Files
old-web/app/controllers/prices.js

41 lines
792 B
JavaScript
Raw Normal View History

2019-09-05 11:14:54 +02:00
const { currentRERequest } = require("../helpers/url");
2019-05-17 11:32:41 +02:00
2019-09-05 11:14:54 +02:00
const getPrice = (req, res) => {
const title = "Koja Vam okvirna cijena odgovara ?";
2019-09-05 11:14:54 +02:00
const unit = " KM";
const rangeFrom = {
2019-09-05 11:14:54 +02:00
min: 1000,
max: 250000,
value: 0,
step: 1000
};
const rangeTo = {
2019-09-05 11:14:54 +02:00
min: 1000,
max: 250000,
value: 50000,
step: 1000
};
2019-09-05 11:14:54 +02:00
res.render("price", { rangeFrom, rangeTo, unit, title });
2019-05-17 11:32:41 +02:00
};
const postPrice = async (req, res) => {
const request = await currentRERequest(req);
2019-09-05 11:14:54 +02:00
const nextStepPage = req.query.nextStep || "pregled";
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
request.priceMin = req.body.from;
request.priceMax = req.body.to;
2019-05-17 11:32:41 +02:00
await request.save();
res.redirect(nextStepUrl);
2019-05-17 11:32:41 +02:00
};
module.exports = {
getPrice,
postPrice
};