WIP Form submit added.
This commit is contained in:
@@ -2,7 +2,12 @@ const { currentRealEstate } = require("../helpers/url");
|
||||
const { createRealEstate } = require("../helpers/db/realEstate");
|
||||
const { createKiviOriginal } = require("../helpers/db/kiviOriginal");
|
||||
|
||||
const { AD_CATEGORY, AD_TYPE, AD_AGENCY } = require("../common/enums");
|
||||
const {
|
||||
AD_CATEGORY,
|
||||
FURNISHING_TYPE,
|
||||
ACCESS_ROAD_TYPE,
|
||||
HEATING_TYPE
|
||||
} = require("../common/enums");
|
||||
const {
|
||||
BASIC_BOOLEAN_PUBLISH,
|
||||
BASIC_SEGMENT_PUBLISH,
|
||||
@@ -169,6 +174,10 @@ const postPublishInputs = async (req, res) => {
|
||||
return;
|
||||
}
|
||||
|
||||
//const nextStepPage = req.query.nextStep || "pregled";
|
||||
// const nextStepUrl = `/${nextStepPage}/${searchRequest.id}`;
|
||||
const nextStepUrl = "/unsubscribe/";
|
||||
|
||||
const balcony = req.body.balcony === "on";
|
||||
const elevator = req.body.elevator === "on";
|
||||
const newBuilding = req.body.newBuilding === "on";
|
||||
@@ -198,31 +207,32 @@ const postPublishInputs = async (req, res) => {
|
||||
const buildingPermit = req.body.buildingPermit === "on";
|
||||
|
||||
const furnishingType = req.body.furnishingType;
|
||||
if (!FURNISHING_TYPE[furnishingType]) {
|
||||
//VALIDACIJA TAKO POTVRDITI DA JE ISPRAVNA VRIJEDNOST
|
||||
/* if (!FURNISHING_TYPE[furnishingType]) {
|
||||
res.render("notFound", { title: " Greška !" });
|
||||
return;
|
||||
}
|
||||
} */
|
||||
const accessRoadType = req.body.accessRoadType;
|
||||
if (!ACCESS_ROAD_TYPE[accessRoadType]) {
|
||||
/*if (!ACCESS_ROAD_TYPE[accessRoadType]) {
|
||||
res.render("notFound", { title: " Greška !" });
|
||||
return;
|
||||
}
|
||||
} */
|
||||
const heatingType = req.body.heatingType;
|
||||
if (!HEATING_TYPE[heatingType]) {
|
||||
/*if (!HEATING_TYPE[heatingType]) {
|
||||
res.render("notFound", { title: " Greška !" });
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
const price = parseFloat(req.body.price);
|
||||
const area = parseFloat(req.body.area);
|
||||
const gardenSize = parseFloat(req.body.gardenSize);
|
||||
const numberOfRooms = parseInt(req.body.numberOfRooms);
|
||||
const numberOfFloors = parseInt(req.body.numberOfFloors);
|
||||
const floor = parseInt(req.body.floor);
|
||||
const title = req.body.title;
|
||||
const shortDescription = req.body.shortDescription;
|
||||
const streetName = req.body.streetName;
|
||||
const longDescription = req.body.longDescription;
|
||||
const price = parseFloat(req.body.price) || null;
|
||||
const area = parseFloat(req.body.area) || null;
|
||||
const gardenSize = parseFloat(req.body.gardenSize) || null;
|
||||
const numberOfRooms = parseInt(req.body.numberOfRooms) || null;
|
||||
const numberOfFloors = parseInt(req.body.numberOfFloors) || null;
|
||||
const floor = parseInt(req.body.floor) || null;
|
||||
const title = req.body.title || "";
|
||||
const shortDescription = req.body.shortDescription || "";
|
||||
const streetName = req.body.streetName || "";
|
||||
const longDescription = req.body.longDescription || "";
|
||||
|
||||
realEstate.balcony = balcony;
|
||||
realEstate.elevator = elevator;
|
||||
@@ -267,9 +277,10 @@ const postPublishInputs = async (req, res) => {
|
||||
realEstate.streetName = streetName;
|
||||
|
||||
realEstate.longDescription = longDescription;
|
||||
//
|
||||
console.log("postPublishInputs");
|
||||
|
||||
await realEstate.save();
|
||||
|
||||
res.redirect(nextStepUrl);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -122,6 +122,8 @@ const getFilters = async (req, res) => {
|
||||
};
|
||||
|
||||
const postFilters = async (req, res) => {
|
||||
//
|
||||
console.log("postFilters");
|
||||
const searchRequest = await currentSearchRequest(req);
|
||||
|
||||
if (!searchRequest || !searchRequest.dataValues) {
|
||||
|
||||
Reference in New Issue
Block a user