Merge branch 'improve-clickable-items' into 'master'

Improve clickable items

See merge request saburly/marketalarm/web!45
This commit was merged in pull request #45.
This commit is contained in:
Bilal Catic
2019-10-15 19:38:47 +00:00
7 changed files with 37 additions and 14 deletions

View File

@@ -86,7 +86,8 @@ const AD_CATEGORY = {
title: "Vikendica",
hasGardenSize: true,
priceSliderOptions: PRICE_SLIDER_OPTIONS,
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
}
};

View File

@@ -13,6 +13,11 @@ const getLocation = async (req, res) => {
const postLocation = async (req, res) => {
let searchRequest = await currentSearchRequest(req);
if (!searchRequest || !searchRequest.dataValues) {
res.render("notFound", { title: " " });
return;
}
const northWest = [req.body.west, req.body.north];
const northEast = [req.body.east, req.body.north];
const southEast = [req.body.east, req.body.south];

View File

@@ -37,7 +37,7 @@ const getQueryReviewData = searchRequest => {
{
id: "realEstateType",
title: realEstateTypeTitle,
url: `/vrstanekretnine/${id}?nextStep=pregled`
url: `/vrstanekretnine/${id}?nextStep=filteri`
},
{
id: "location",
@@ -66,7 +66,8 @@ const getQueryReview = async (req, res) => {
const searchRequest = await currentSearchRequest(req);
if (!searchRequest || !searchRequest.dataValues) {
return null;
res.render("notFound", { title: " " });
return;
}
const title = "Da li je ovo to što ste tražili ?";

View File

@@ -3,6 +3,12 @@ const { AD_CATEGORY } = require("../common/enums");
const getFilters = async (req, res) => {
const searchRequest = await currentSearchRequest(req);
if (!searchRequest || !searchRequest.dataValues) {
res.render("notFound", { title: " " });
return;
}
const title = "Filteri za pretraživanje";
const {
@@ -47,6 +53,11 @@ const getFilters = async (req, res) => {
const postFilters = async (req, res) => {
const searchRequest = await currentSearchRequest(req);
if (!searchRequest || !searchRequest.dataValues) {
res.render("notFound", { title: " " });
return;
}
const nextStepPage = req.query.nextStep || "pregled";
const nextStepUrl = `/${nextStepPage}/${searchRequest.id}`;

View File

@@ -4,7 +4,11 @@ const sequelize = require("sequelize");
const Op = sequelize.Op;
const getSearchRequest = async searchRequestId => {
return await db.SearchRequest.findByPk(searchRequestId);
try {
return await db.SearchRequest.findByPk(searchRequestId);
} catch (error) {
return null;
}
};
const createSearchRequest = async (searchRequestFields = {}) => {

View File

@@ -5,7 +5,7 @@
<li class="collection-item" >
<div id="<%= stepData.id %>" ><%= stepData.title || '-' %>
<a href="<%= stepData.url %>" class="kivi-color secondary-content">
<i class="material-icons">edit</i>
<i class="waves-effect material-icons">edit</i>
</a>
</div>
</li>

View File

@@ -1,16 +1,17 @@
<form method="POST" id="form-real-estate-type">
<div class="row center-align">
<ul class="collection with-header">
<div class="collection">
<% for(const realEstateType of realEstateTypes) { %>
<li class="collection-item">
<div id="<%= realEstateType.id %>" onclick="saveAndSubmit(this.id)"><%= realEstateType.title %>
<a href="#" class="kivi-color secondary-content">
<i class="material-icons">send</i>
</a>
</div>
</li>
<a href="#" class="waves-effect collection-item"
id="<%= realEstateType.id %>"
onclick="saveAndSubmit(this.id)"
>
<%= realEstateType.title %>
</a>
<% } %>
</ul>
</div>
<input type="hidden" name="realEstateType" id="realEstateType" />
</div>
</form>