WiP Added input fields.
This commit is contained in:
@@ -8,7 +8,8 @@ const {
|
||||
BASIC_SEGMENT_PUBLISH,
|
||||
ADDITIONAL_BOOLEAN_PUBLISH,
|
||||
ADDITIONAL_SEGMENT_PUBLISH,
|
||||
BASIC_INPUT_PUBLISH
|
||||
BASIC_INPUT_PUBLISH,
|
||||
ADDITIONAL_INPUT_PUBLISH
|
||||
} = require("../common/publishEnums");
|
||||
|
||||
const getPublishInputs = async (req, res) => {
|
||||
@@ -19,7 +20,7 @@ const getPublishInputs = async (req, res) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const title = "Podaci o nekretnini";
|
||||
const pageTitle = "Podaci o nekretnini";
|
||||
|
||||
const {
|
||||
price,
|
||||
@@ -63,7 +64,9 @@ const getPublishInputs = async (req, res) => {
|
||||
buildingPermit,
|
||||
furnishingType,
|
||||
shortDescription,
|
||||
streetName
|
||||
streetName,
|
||||
title,
|
||||
longDescription
|
||||
} = realEstate;
|
||||
const category = AD_CATEGORY[realEstateType] || AD_CATEGORY.FLAT;
|
||||
|
||||
@@ -135,9 +138,14 @@ const getPublishInputs = async (req, res) => {
|
||||
shortDescription,
|
||||
streetName
|
||||
};
|
||||
//Input type textare to be shown on Additional Data
|
||||
const additionalInputInputs = ADDITIONAL_INPUT_PUBLISH.filter(filterInputs);
|
||||
const additionalInputValues = {
|
||||
longDescription
|
||||
};
|
||||
|
||||
res.render("publishRealEstate", {
|
||||
title,
|
||||
title: pageTitle,
|
||||
basicBooleanPublishInputs,
|
||||
basicBooleanPublishValues,
|
||||
additionalBooleanPublishInputs,
|
||||
@@ -147,7 +155,9 @@ const getPublishInputs = async (req, res) => {
|
||||
additionalSegmentSelectInputs,
|
||||
additionalSegmentSelectValues,
|
||||
basicInputInputs,
|
||||
basicInputValues
|
||||
basicInputValues,
|
||||
additionalInputInputs,
|
||||
additionalInputValues
|
||||
});
|
||||
};
|
||||
|
||||
@@ -203,6 +213,17 @@ const postPublishInputs = async (req, res) => {
|
||||
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;
|
||||
|
||||
realEstate.balcony = balcony;
|
||||
realEstate.elevator = elevator;
|
||||
realEstate.newBuilding = newBuilding;
|
||||
@@ -234,6 +255,18 @@ const postPublishInputs = async (req, res) => {
|
||||
realEstate.furnishingType = furnishingType;
|
||||
realEstate.accessRoadType = accessRoadType;
|
||||
realEstate.heatingType = heatingType;
|
||||
|
||||
realEstate.price = price;
|
||||
realEstate.area = area;
|
||||
realEstate.gardenSize = gardenSize;
|
||||
realEstate.numberOfRooms = numberOfRooms;
|
||||
realEstate.numberOfFloors = numberOfFloors;
|
||||
realEstate.floor = floor;
|
||||
realEstate.title = title;
|
||||
realEstate.shortDescription = shortDescription;
|
||||
realEstate.streetName = streetName;
|
||||
|
||||
realEstate.longDescription = longDescription;
|
||||
//
|
||||
console.log("postPublishInputs");
|
||||
await realEstate.save();
|
||||
|
||||
Reference in New Issue
Block a user