WiP Started input form.
This commit is contained in:
34
app/controllers/publishRealEstate.js
Normal file
34
app/controllers/publishRealEstate.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
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 getPublishInputs = async (req, res) => {
|
||||||
|
const realEstate = await currentRealEstate(req);
|
||||||
|
|
||||||
|
if (!realEstate || !realEstate.dataValues) {
|
||||||
|
res.render("notFound", { title: " " });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const title = "Podaci o nekretnini";
|
||||||
|
|
||||||
|
res.render("publishRealEstate", {
|
||||||
|
title
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const postPublishInputs = async (req, res) => {
|
||||||
|
const realEstate = await currentRealEstate(req);
|
||||||
|
|
||||||
|
if (!realEstate || !realEstate.dataValues) {
|
||||||
|
res.render("notFound", { title: " " });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
getPublishInputs,
|
||||||
|
postPublishInputs
|
||||||
|
};
|
||||||
@@ -53,10 +53,8 @@ const postPublishTypes = async (req, res) => {
|
|||||||
res.render("notFound", { title: " " });
|
res.render("notFound", { title: " " });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Sta je nextStepPage - treba napraviti !!!!
|
|
||||||
/////
|
const nextStepPage = req.query.nextStep || "podacionekretnini";
|
||||||
/////
|
|
||||||
const nextStepPage = req.query.nextStep || "/lokacija";
|
|
||||||
|
|
||||||
let nextStepUrl = "";
|
let nextStepUrl = "";
|
||||||
if (realEstate && realEstate.id) {
|
if (realEstate && realEstate.id) {
|
||||||
@@ -79,7 +77,7 @@ const postPublishTypes = async (req, res) => {
|
|||||||
agencyObjectId: newKiviOriginal.kiviAdId
|
agencyObjectId: newKiviOriginal.kiviAdId
|
||||||
});
|
});
|
||||||
|
|
||||||
//Da li ovaj id ili kivioriginal id
|
//Da li ovaj id ili kivioriginal id ???
|
||||||
nextStepUrl = `/${nextStepPage}/${newRealEstate.id}`;
|
nextStepUrl = `/${nextStepPage}/${newRealEstate.id}`;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ const {
|
|||||||
getPublishTypes,
|
getPublishTypes,
|
||||||
postPublishTypes
|
postPublishTypes
|
||||||
} = require("../controllers/publishRealEstateTypes");
|
} = require("../controllers/publishRealEstateTypes");
|
||||||
|
const {
|
||||||
|
getPublishInputs,
|
||||||
|
postPublishInputs
|
||||||
|
} = require("../controllers/publishRealEstate");
|
||||||
const {
|
const {
|
||||||
getQueryReview,
|
getQueryReview,
|
||||||
postQueryReview
|
postQueryReview
|
||||||
@@ -37,6 +41,9 @@ router.get("/objavinekretninu", getPublishTypes);
|
|||||||
router.post("/objavinekretninu/:realEstateId", postPublishTypes);
|
router.post("/objavinekretninu/:realEstateId", postPublishTypes);
|
||||||
router.post("/objavinekretninu", postPublishTypes);
|
router.post("/objavinekretninu", postPublishTypes);
|
||||||
|
|
||||||
|
router.get("/podacionekretnini/:realEstateId", getPublishInputs);
|
||||||
|
router.post("/podacionekretnini/:realEstateId", postPublishInputs);
|
||||||
|
|
||||||
router.get("/lokacija/:searchRequestId", getLocation);
|
router.get("/lokacija/:searchRequestId", getLocation);
|
||||||
router.post("/lokacija/:searchRequestId", postLocation);
|
router.post("/lokacija/:searchRequestId", postLocation);
|
||||||
|
|
||||||
|
|||||||
4
app/views/publishRealEstate.ejs
Normal file
4
app/views/publishRealEstate.ejs
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<br>
|
||||||
|
<div>
|
||||||
|
Work in progres...
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user