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],
|
start: [50000, 85000],
|
||||||
range: {
|
range: {
|
||||||
min: [0],
|
min: [0],
|
||||||
@@ -8,6 +8,16 @@ const PRICE_SLIDER_OPTIONS = {
|
|||||||
connect: true
|
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
|
//This will be used for Flats, Apartments, Houses
|
||||||
const HOME_SIZE_SLIDER_OPTIONS = {
|
const HOME_SIZE_SLIDER_OPTIONS = {
|
||||||
start: [30, 75],
|
start: [30, 75],
|
||||||
@@ -84,14 +94,16 @@ const AD_CATEGORY = {
|
|||||||
id: "FLAT",
|
id: "FLAT",
|
||||||
title: "Stan",
|
title: "Stan",
|
||||||
hasGardenSize: false,
|
hasGardenSize: false,
|
||||||
priceSliderOptions: PRICE_SLIDER_OPTIONS,
|
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
||||||
|
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
HOUSE: {
|
HOUSE: {
|
||||||
id: "HOUSE",
|
id: "HOUSE",
|
||||||
title: "Kuća",
|
title: "Kuća",
|
||||||
hasGardenSize: true,
|
hasGardenSize: true,
|
||||||
priceSliderOptions: PRICE_SLIDER_OPTIONS,
|
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
||||||
|
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
|
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
|
||||||
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
|
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
@@ -99,35 +111,40 @@ const AD_CATEGORY = {
|
|||||||
id: "OFFICE",
|
id: "OFFICE",
|
||||||
title: "Kancelarija",
|
title: "Kancelarija",
|
||||||
hasGardenSize: false,
|
hasGardenSize: false,
|
||||||
priceSliderOptions: PRICE_SLIDER_OPTIONS,
|
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
||||||
|
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
LAND: {
|
LAND: {
|
||||||
id: "LAND",
|
id: "LAND",
|
||||||
title: "Zemljište",
|
title: "Zemljište",
|
||||||
hasGardenSize: false,
|
hasGardenSize: false,
|
||||||
priceSliderOptions: PRICE_SLIDER_OPTIONS,
|
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
||||||
|
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: LAND_SIZE_SLIDER_OPTIONS
|
sizeSliderOptions: LAND_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
APARTMENT: {
|
APARTMENT: {
|
||||||
id: "APARTMENT",
|
id: "APARTMENT",
|
||||||
title: "Apartman",
|
title: "Apartman",
|
||||||
hasGardenSize: false,
|
hasGardenSize: false,
|
||||||
priceSliderOptions: PRICE_SLIDER_OPTIONS,
|
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
||||||
|
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
GARAGE: {
|
GARAGE: {
|
||||||
id: "GARAGE",
|
id: "GARAGE",
|
||||||
title: "Garaža",
|
title: "Garaža",
|
||||||
hasGardenSize: false,
|
hasGardenSize: false,
|
||||||
priceSliderOptions: GARAGE_PRICE_SLIDER_OPTIONS,
|
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
||||||
|
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: GARAGE_SIZE_SLIDER_OPTIONS
|
sizeSliderOptions: GARAGE_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
COTTAGE: {
|
COTTAGE: {
|
||||||
id: "COTTAGE",
|
id: "COTTAGE",
|
||||||
title: "Vikendica",
|
title: "Vikendica",
|
||||||
hasGardenSize: true,
|
hasGardenSize: true,
|
||||||
priceSliderOptions: PRICE_SLIDER_OPTIONS,
|
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
||||||
|
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
|
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
|
||||||
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
|
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const { currentSearchRequest } = require("../helpers/url");
|
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 getFilters = async (req, res) => {
|
||||||
const searchRequest = await currentSearchRequest(req);
|
const searchRequest = await currentSearchRequest(req);
|
||||||
@@ -12,6 +12,7 @@ const getFilters = async (req, res) => {
|
|||||||
const title = "Filteri za pretraživanje";
|
const title = "Filteri za pretraživanje";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
adType,
|
||||||
realEstateType,
|
realEstateType,
|
||||||
priceMin,
|
priceMin,
|
||||||
priceMax,
|
priceMax,
|
||||||
@@ -24,11 +25,22 @@ const getFilters = async (req, res) => {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
hasGardenSize,
|
hasGardenSize,
|
||||||
priceSliderOptions,
|
priceSliderOptionsSale,
|
||||||
|
priceSliderOptionsRent,
|
||||||
sizeSliderOptions,
|
sizeSliderOptions,
|
||||||
gardenSizeSliderOptions
|
gardenSizeSliderOptions
|
||||||
} = category;
|
} = 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) {
|
if (priceMin || priceMax) {
|
||||||
priceSliderOptions.start = [priceMin, priceMax];
|
priceSliderOptions.start = [priceMin, priceMax];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user