WiP Added input fields.
This commit is contained in:
@@ -8,7 +8,8 @@ const {
|
|||||||
BASIC_SEGMENT_PUBLISH,
|
BASIC_SEGMENT_PUBLISH,
|
||||||
ADDITIONAL_BOOLEAN_PUBLISH,
|
ADDITIONAL_BOOLEAN_PUBLISH,
|
||||||
ADDITIONAL_SEGMENT_PUBLISH,
|
ADDITIONAL_SEGMENT_PUBLISH,
|
||||||
BASIC_INPUT_PUBLISH
|
BASIC_INPUT_PUBLISH,
|
||||||
|
ADDITIONAL_INPUT_PUBLISH
|
||||||
} = require("../common/publishEnums");
|
} = require("../common/publishEnums");
|
||||||
|
|
||||||
const getPublishInputs = async (req, res) => {
|
const getPublishInputs = async (req, res) => {
|
||||||
@@ -19,7 +20,7 @@ const getPublishInputs = async (req, res) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const title = "Podaci o nekretnini";
|
const pageTitle = "Podaci o nekretnini";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
price,
|
price,
|
||||||
@@ -63,7 +64,9 @@ const getPublishInputs = async (req, res) => {
|
|||||||
buildingPermit,
|
buildingPermit,
|
||||||
furnishingType,
|
furnishingType,
|
||||||
shortDescription,
|
shortDescription,
|
||||||
streetName
|
streetName,
|
||||||
|
title,
|
||||||
|
longDescription
|
||||||
} = realEstate;
|
} = realEstate;
|
||||||
const category = AD_CATEGORY[realEstateType] || AD_CATEGORY.FLAT;
|
const category = AD_CATEGORY[realEstateType] || AD_CATEGORY.FLAT;
|
||||||
|
|
||||||
@@ -135,9 +138,14 @@ const getPublishInputs = async (req, res) => {
|
|||||||
shortDescription,
|
shortDescription,
|
||||||
streetName
|
streetName
|
||||||
};
|
};
|
||||||
|
//Input type textare to be shown on Additional Data
|
||||||
|
const additionalInputInputs = ADDITIONAL_INPUT_PUBLISH.filter(filterInputs);
|
||||||
|
const additionalInputValues = {
|
||||||
|
longDescription
|
||||||
|
};
|
||||||
|
|
||||||
res.render("publishRealEstate", {
|
res.render("publishRealEstate", {
|
||||||
title,
|
title: pageTitle,
|
||||||
basicBooleanPublishInputs,
|
basicBooleanPublishInputs,
|
||||||
basicBooleanPublishValues,
|
basicBooleanPublishValues,
|
||||||
additionalBooleanPublishInputs,
|
additionalBooleanPublishInputs,
|
||||||
@@ -147,7 +155,9 @@ const getPublishInputs = async (req, res) => {
|
|||||||
additionalSegmentSelectInputs,
|
additionalSegmentSelectInputs,
|
||||||
additionalSegmentSelectValues,
|
additionalSegmentSelectValues,
|
||||||
basicInputInputs,
|
basicInputInputs,
|
||||||
basicInputValues
|
basicInputValues,
|
||||||
|
additionalInputInputs,
|
||||||
|
additionalInputValues
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -203,6 +213,17 @@ const postPublishInputs = async (req, res) => {
|
|||||||
return;
|
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.balcony = balcony;
|
||||||
realEstate.elevator = elevator;
|
realEstate.elevator = elevator;
|
||||||
realEstate.newBuilding = newBuilding;
|
realEstate.newBuilding = newBuilding;
|
||||||
@@ -234,6 +255,18 @@ const postPublishInputs = async (req, res) => {
|
|||||||
realEstate.furnishingType = furnishingType;
|
realEstate.furnishingType = furnishingType;
|
||||||
realEstate.accessRoadType = accessRoadType;
|
realEstate.accessRoadType = accessRoadType;
|
||||||
realEstate.heatingType = heatingType;
|
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");
|
console.log("postPublishInputs");
|
||||||
await realEstate.save();
|
await realEstate.save();
|
||||||
|
|||||||
@@ -1,3 +1,19 @@
|
|||||||
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<% for (const input of additionalInputInputs){ %>
|
||||||
|
<div class="input-field col s3 m4 l5">
|
||||||
|
<textarea
|
||||||
|
id="<%= input.dbField %>"
|
||||||
|
form="publishForm"
|
||||||
|
name="<%= input.dbField %>"
|
||||||
|
cols="80" rows="15"
|
||||||
|
value="<%= additionalInputValues[input.dbField] !== undefined ? additionalInputValues[input.dbField] : ""%>"
|
||||||
|
></textarea>
|
||||||
|
<label for="<%= input.dbField %>"><%= input.title %></label>
|
||||||
|
</div>
|
||||||
|
<% } %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<% for (const input of additionalBooleanPublishInputs){ %>
|
<% for (const input of additionalBooleanPublishInputs){ %>
|
||||||
|
|||||||
Reference in New Issue
Block a user