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: " " });
|
||||
return;
|
||||
}
|
||||
// Sta je nextStepPage - treba napraviti !!!!
|
||||
/////
|
||||
/////
|
||||
const nextStepPage = req.query.nextStep || "/lokacija";
|
||||
|
||||
const nextStepPage = req.query.nextStep || "podacionekretnini";
|
||||
|
||||
let nextStepUrl = "";
|
||||
if (realEstate && realEstate.id) {
|
||||
@@ -79,7 +77,7 @@ const postPublishTypes = async (req, res) => {
|
||||
agencyObjectId: newKiviOriginal.kiviAdId
|
||||
});
|
||||
|
||||
//Da li ovaj id ili kivioriginal id
|
||||
//Da li ovaj id ili kivioriginal id ???
|
||||
nextStepUrl = `/${nextStepPage}/${newRealEstate.id}`;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
@@ -11,6 +11,10 @@ const {
|
||||
getPublishTypes,
|
||||
postPublishTypes
|
||||
} = require("../controllers/publishRealEstateTypes");
|
||||
const {
|
||||
getPublishInputs,
|
||||
postPublishInputs
|
||||
} = require("../controllers/publishRealEstate");
|
||||
const {
|
||||
getQueryReview,
|
||||
postQueryReview
|
||||
@@ -37,6 +41,9 @@ router.get("/objavinekretninu", getPublishTypes);
|
||||
router.post("/objavinekretninu/:realEstateId", postPublishTypes);
|
||||
router.post("/objavinekretninu", postPublishTypes);
|
||||
|
||||
router.get("/podacionekretnini/:realEstateId", getPublishInputs);
|
||||
router.post("/podacionekretnini/:realEstateId", postPublishInputs);
|
||||
|
||||
router.get("/lokacija/:searchRequestId", getLocation);
|
||||
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