Compare commits
1 Commits
results-li
...
sliders-fo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6725355a0 |
@@ -7,7 +7,42 @@ const PRICE_SLIDER_OPTIONS_SALE = {
|
|||||||
step: 1000,
|
step: 1000,
|
||||||
connect: true
|
connect: true
|
||||||
};
|
};
|
||||||
|
const FLAT_PRICE_SLIDER_OPTIONS_SALE = {
|
||||||
|
start: [50000, 150000],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [800000]
|
||||||
|
},
|
||||||
|
step: 5000,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
|
const HOUSE_PRICE_SLIDER_OPTIONS_SALE = {
|
||||||
|
start: [50000, 150000],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [1500000]
|
||||||
|
},
|
||||||
|
step: 10000,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
|
const OFFICE_PRICE_SLIDER_OPTIONS_SALE = {
|
||||||
|
start: [15000, 50000],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [2000000]
|
||||||
|
},
|
||||||
|
step: 2000,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
|
const LAND_PRICE_SLIDER_OPTIONS_SALE = {
|
||||||
|
start: [40000, 80000],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [2000000]
|
||||||
|
},
|
||||||
|
step: 10000,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
const PRICE_SLIDER_OPTIONS_RENT = {
|
const PRICE_SLIDER_OPTIONS_RENT = {
|
||||||
start: [300, 500],
|
start: [300, 500],
|
||||||
range: {
|
range: {
|
||||||
@@ -17,18 +52,62 @@ const PRICE_SLIDER_OPTIONS_RENT = {
|
|||||||
step: 50,
|
step: 50,
|
||||||
connect: true
|
connect: true
|
||||||
};
|
};
|
||||||
|
const FLAT_PRICE_SLIDER_OPTIONS_RENT = {
|
||||||
|
start: [300, 600],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [4000]
|
||||||
|
},
|
||||||
|
step: 100,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
|
const HOUSE_PRICE_SLIDER_OPTIONS_RENT = {
|
||||||
|
start: [500, 1000],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [10000]
|
||||||
|
},
|
||||||
|
step: 100,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
|
const OFFICE_PRICE_SLIDER_OPTIONS_RENT = {
|
||||||
|
start: [200, 1000],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [20000]
|
||||||
|
},
|
||||||
|
step: 100,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
|
const LAND_PRICE_SLIDER_OPTIONS_RENT = {
|
||||||
|
start: [500, 1000],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [20000]
|
||||||
|
},
|
||||||
|
step: 100,
|
||||||
|
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],
|
||||||
range: {
|
range: {
|
||||||
min: [0],
|
min: [0],
|
||||||
max: [400]
|
max: [500]
|
||||||
},
|
},
|
||||||
step: 5,
|
step: 5,
|
||||||
connect: true
|
connect: true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const OFFICE_SIZE_SLIDER_OPTIONS = {
|
||||||
|
start: [30, 150],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [1200]
|
||||||
|
},
|
||||||
|
step: 10,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
const GARDEN_SIZE_SLIDER_OPTIONS = {
|
const GARDEN_SIZE_SLIDER_OPTIONS = {
|
||||||
start: [100, 1000],
|
start: [100, 1000],
|
||||||
range: {
|
range: {
|
||||||
@@ -111,8 +190,8 @@ const AD_CATEGORY = {
|
|||||||
hasNumberOfRoom: true,
|
hasNumberOfRoom: true,
|
||||||
hasNumberOfFloors: false,
|
hasNumberOfFloors: false,
|
||||||
hasFloorProp: true,
|
hasFloorProp: true,
|
||||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
priceSliderOptionsSale: FLAT_PRICE_SLIDER_OPTIONS_SALE,
|
||||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
priceSliderOptionsRent: FLAT_PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
HOUSE: {
|
HOUSE: {
|
||||||
@@ -126,8 +205,8 @@ const AD_CATEGORY = {
|
|||||||
hasNumberOfRoom: true,
|
hasNumberOfRoom: true,
|
||||||
hasNumberOfFloors: true,
|
hasNumberOfFloors: true,
|
||||||
hasFloorProp: false,
|
hasFloorProp: false,
|
||||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
priceSliderOptionsSale: HOUSE_PRICE_SLIDER_OPTIONS_SALE,
|
||||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
priceSliderOptionsRent: HOUSE_PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
|
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
|
||||||
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
|
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
@@ -142,9 +221,9 @@ const AD_CATEGORY = {
|
|||||||
hasNumberOfRoom: true,
|
hasNumberOfRoom: true,
|
||||||
hasNumberOfFloors: false,
|
hasNumberOfFloors: false,
|
||||||
hasFloorProp: true,
|
hasFloorProp: true,
|
||||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
priceSliderOptionsSale: OFFICE_PRICE_SLIDER_OPTIONS_SALE,
|
||||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
priceSliderOptionsRent: OFFICE_PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
sizeSliderOptions: OFFICE_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
LAND: {
|
LAND: {
|
||||||
id: "LAND",
|
id: "LAND",
|
||||||
@@ -157,8 +236,8 @@ const AD_CATEGORY = {
|
|||||||
hasNumberOfRoom: false,
|
hasNumberOfRoom: false,
|
||||||
hasNumberOfFloors: false,
|
hasNumberOfFloors: false,
|
||||||
hasFloorProp: false,
|
hasFloorProp: false,
|
||||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
priceSliderOptionsSale: LAND_PRICE_SLIDER_OPTIONS_SALE,
|
||||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
priceSliderOptionsRent: LAND_PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: LAND_SIZE_SLIDER_OPTIONS
|
sizeSliderOptions: LAND_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
APARTMENT: {
|
APARTMENT: {
|
||||||
@@ -172,8 +251,8 @@ const AD_CATEGORY = {
|
|||||||
hasNumberOfRoom: true,
|
hasNumberOfRoom: true,
|
||||||
hasNumberOfFloors: false,
|
hasNumberOfFloors: false,
|
||||||
hasFloorProp: true,
|
hasFloorProp: true,
|
||||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
priceSliderOptionsSale: FLAT_PRICE_SLIDER_OPTIONS_SALE,
|
||||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
priceSliderOptionsRent: FLAT_PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
GARAGE: {
|
GARAGE: {
|
||||||
@@ -202,8 +281,8 @@ const AD_CATEGORY = {
|
|||||||
hasNumberOfRoom: true,
|
hasNumberOfRoom: true,
|
||||||
hasNumberOfFloors: true,
|
hasNumberOfFloors: true,
|
||||||
hasFloorProp: false,
|
hasFloorProp: false,
|
||||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
priceSliderOptionsSale: HOUSE_PRICE_SLIDER_OPTIONS_SALE,
|
||||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
priceSliderOptionsRent: HOUSE_PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
|
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
|
||||||
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
|
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,19 +23,16 @@ const generateRealEstateLinks = realEstates => {
|
|||||||
const generateNotificationEmail = (
|
const generateNotificationEmail = (
|
||||||
realEstates,
|
realEstates,
|
||||||
searchRequestId,
|
searchRequestId,
|
||||||
noAllRealEstates,
|
|
||||||
dailyNotification = false
|
dailyNotification = false
|
||||||
) => {
|
) => {
|
||||||
const truncateList = realEstates.length > MAX_REAL_ESTATES_IN_EMAIL;
|
const truncateList = realEstates.length > MAX_REAL_ESTATES_IN_EMAIL;
|
||||||
|
|
||||||
const realEstatesToShow = truncateList
|
const realEstatesToShow = truncateList
|
||||||
? realEstates.slice(0, MAX_REAL_ESTATES_IN_EMAIL)
|
? realEstates.slice(0, MAX_REAL_ESTATES_IN_EMAIL)
|
||||||
: realEstates;
|
: realEstates;
|
||||||
|
|
||||||
const allRealEstatesLink = `${APP_URL}/nekretnine/${searchRequestId}`;
|
const allRealEstatesLink = `${APP_URL}/nekretnine/${searchRequestId}`;
|
||||||
|
|
||||||
const realEstateLinks = generateRealEstateLinks(realEstatesToShow);
|
const realEstateLinks = generateRealEstateLinks(realEstatesToShow);
|
||||||
const moreRealEstates = `<div>Kompletan spisak nekretnina (${noAllRealEstates}) možete pogledati na <a href="${allRealEstatesLink}">listi nekretnina</a><div>`;
|
const moreRealEstates = `<div>Kompletan spisak nekretnina možete pogledati na <a href="${allRealEstatesLink}">listi nekretnina</a><div>`;
|
||||||
const emailFooter = generateEmailFooter(searchRequestId);
|
const emailFooter = generateEmailFooter(searchRequestId);
|
||||||
const asapMessageBody =
|
const asapMessageBody =
|
||||||
realEstates.length > 1
|
realEstates.length > 1
|
||||||
@@ -73,7 +70,6 @@ const generateNewSearchRequestEmail = (searchRequest, matchingRealEstates) => {
|
|||||||
} = searchRequest;
|
} = searchRequest;
|
||||||
|
|
||||||
const realEstateLinks = generateRealEstateLinks(matchingRealEstates);
|
const realEstateLinks = generateRealEstateLinks(matchingRealEstates);
|
||||||
|
|
||||||
const instantRealEstatesText = `<br/>
|
const instantRealEstatesText = `<br/>
|
||||||
<div>
|
<div>
|
||||||
U međuvremenu pogledajte neke od nedavno objavljenih nekretnina koje odgovaraju Vašim uslovima pretrage :<br/>
|
U međuvremenu pogledajte neke od nedavno objavljenih nekretnina koje odgovaraju Vašim uslovima pretrage :<br/>
|
||||||
|
|||||||
@@ -154,7 +154,3 @@ h3 {
|
|||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.estates-link {
|
|
||||||
color: rgba(0, 0, 0, 0.87);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ const {
|
|||||||
generateNewSearchRequestEmail,
|
generateNewSearchRequestEmail,
|
||||||
generateEmailSubject
|
generateEmailSubject
|
||||||
} = require("../helpers/emailContentGenerator");
|
} = require("../helpers/emailContentGenerator");
|
||||||
const {
|
const { findNotNotifiedMatches } = require("../helpers/db/searchRequestMatch");
|
||||||
findNotNotifiedMatches,
|
|
||||||
findRealEstatesForSearchRequest
|
|
||||||
} = require("../helpers/db/searchRequestMatch");
|
|
||||||
const { sendEmail } = require("../services/emailService");
|
const { sendEmail } = require("../services/emailService");
|
||||||
|
|
||||||
const notifyForNewRealEstates = async newRealEstates => {
|
const notifyForNewRealEstates = async newRealEstates => {
|
||||||
@@ -42,18 +39,10 @@ const notifyMatches = async (matches, dailyNotification = false) => {
|
|||||||
const { email, subscribed } = searchRequest;
|
const { email, subscribed } = searchRequest;
|
||||||
if (notifyNow && subscribed) {
|
if (notifyNow && subscribed) {
|
||||||
const allMatchingRealEstates = matches[id].realEstates || [];
|
const allMatchingRealEstates = matches[id].realEstates || [];
|
||||||
|
|
||||||
//Variable allMatchingRealEstates are real estates that are "new" on the market
|
|
||||||
//the ones that we notify user in this moment, not all that already exists in db
|
|
||||||
//New variable allRealEstates are all real estates that exists in db for search req
|
|
||||||
const allRealEstates = await findRealEstatesForSearchRequest(id);
|
|
||||||
const noAllRealEstates = allRealEstates.length;
|
|
||||||
|
|
||||||
if (allMatchingRealEstates.length > 0) {
|
if (allMatchingRealEstates.length > 0) {
|
||||||
const emailContent = generateNotificationEmail(
|
const emailContent = generateNotificationEmail(
|
||||||
allMatchingRealEstates,
|
allMatchingRealEstates,
|
||||||
id,
|
id,
|
||||||
noAllRealEstates,
|
|
||||||
dailyNotification
|
dailyNotification
|
||||||
);
|
);
|
||||||
const emailSubject = generateEmailSubject(
|
const emailSubject = generateEmailSubject(
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
<div class="row center-align">
|
<div class="row center-align">
|
||||||
<ul class="collection with-header">
|
<ul class="collection with-header">
|
||||||
<% for(const realEstate of realEstates) { %>
|
<% for(const realEstate of realEstates) { %>
|
||||||
<li class="collection-item">
|
<li class="collection-item">
|
||||||
<div>
|
<div><%= realEstate.title %>
|
||||||
<a href="<%= realEstate.url %>" class="estates-link">
|
<a href="<%= realEstate.url %>" class="kivi-color secondary-content">
|
||||||
<%= realEstate.title %>
|
|
||||||
<div class="kivi-color secondary-content">
|
|
||||||
<i class="material-icons">send</i>
|
<i class="material-icons">send</i>
|
||||||
</div>
|
</a>
|
||||||
</a>
|
</div>
|
||||||
</div>
|
</li>
|
||||||
</li>
|
<% } %>
|
||||||
<% } %>
|
</ul>
|
||||||
</ul>
|
</div>
|
||||||
</div>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user