change price slider options for renting option
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const PRICE_SLIDER_OPTIONS = {
|
||||
const PRICE_SLIDER_OPTIONS_SALE = {
|
||||
start: [50000, 85000],
|
||||
range: {
|
||||
min: [0],
|
||||
@@ -8,6 +8,16 @@ const PRICE_SLIDER_OPTIONS = {
|
||||
connect: true
|
||||
};
|
||||
|
||||
const PRICE_SLIDER_OPTIONS_RENT = {
|
||||
start: [300, 500],
|
||||
range: {
|
||||
min: [0],
|
||||
max: [2000]
|
||||
},
|
||||
step: 50,
|
||||
connect: true
|
||||
};
|
||||
|
||||
//This will be used for Flats, Apartments, Houses
|
||||
const HOME_SIZE_SLIDER_OPTIONS = {
|
||||
start: [30, 75],
|
||||
@@ -84,14 +94,16 @@ const AD_CATEGORY = {
|
||||
id: "FLAT",
|
||||
title: "Stan",
|
||||
hasGardenSize: false,
|
||||
priceSliderOptions: PRICE_SLIDER_OPTIONS,
|
||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
||||
},
|
||||
HOUSE: {
|
||||
id: "HOUSE",
|
||||
title: "Kuća",
|
||||
hasGardenSize: true,
|
||||
priceSliderOptions: PRICE_SLIDER_OPTIONS,
|
||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
|
||||
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
|
||||
},
|
||||
@@ -99,35 +111,40 @@ const AD_CATEGORY = {
|
||||
id: "OFFICE",
|
||||
title: "Kancelarija",
|
||||
hasGardenSize: false,
|
||||
priceSliderOptions: PRICE_SLIDER_OPTIONS,
|
||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
||||
},
|
||||
LAND: {
|
||||
id: "LAND",
|
||||
title: "Zemljište",
|
||||
hasGardenSize: false,
|
||||
priceSliderOptions: PRICE_SLIDER_OPTIONS,
|
||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
||||
sizeSliderOptions: LAND_SIZE_SLIDER_OPTIONS
|
||||
},
|
||||
APARTMENT: {
|
||||
id: "APARTMENT",
|
||||
title: "Apartman",
|
||||
hasGardenSize: false,
|
||||
priceSliderOptions: PRICE_SLIDER_OPTIONS,
|
||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
||||
},
|
||||
GARAGE: {
|
||||
id: "GARAGE",
|
||||
title: "Garaža",
|
||||
hasGardenSize: false,
|
||||
priceSliderOptions: GARAGE_PRICE_SLIDER_OPTIONS,
|
||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
||||
sizeSliderOptions: GARAGE_SIZE_SLIDER_OPTIONS
|
||||
},
|
||||
COTTAGE: {
|
||||
id: "COTTAGE",
|
||||
title: "Vikendica",
|
||||
hasGardenSize: true,
|
||||
priceSliderOptions: PRICE_SLIDER_OPTIONS,
|
||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
|
||||
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const { currentSearchRequest } = require("../helpers/url");
|
||||
const { AD_CATEGORY } = require("../common/enums");
|
||||
const { AD_CATEGORY, AD_TYPE } = require("../common/enums");
|
||||
|
||||
const getFilters = async (req, res) => {
|
||||
const searchRequest = await currentSearchRequest(req);
|
||||
@@ -12,6 +12,7 @@ const getFilters = async (req, res) => {
|
||||
const title = "Filteri za pretraživanje";
|
||||
|
||||
const {
|
||||
adType,
|
||||
realEstateType,
|
||||
priceMin,
|
||||
priceMax,
|
||||
@@ -24,11 +25,22 @@ const getFilters = async (req, res) => {
|
||||
|
||||
const {
|
||||
hasGardenSize,
|
||||
priceSliderOptions,
|
||||
priceSliderOptionsSale,
|
||||
priceSliderOptionsRent,
|
||||
sizeSliderOptions,
|
||||
gardenSizeSliderOptions
|
||||
} = category;
|
||||
|
||||
let priceSliderOptions;
|
||||
if (adType === AD_TYPE.AD_TYPE_SALE.stringId) {
|
||||
priceSliderOptions = Object.assign({}, priceSliderOptionsSale);
|
||||
} else if (adType === AD_TYPE.AD_TYPE_RENT.stringId) {
|
||||
priceSliderOptions = Object.assign({}, priceSliderOptionsRent);
|
||||
} else {
|
||||
res.render("notFound", { title: " " });
|
||||
return;
|
||||
}
|
||||
|
||||
if (priceMin || priceMax) {
|
||||
priceSliderOptions.start = [priceMin, priceMax];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user