Compare commits
24 Commits
block-next
...
replace-fr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a77730cc5f | ||
|
|
90db3025b5 | ||
|
|
8a95409606 | ||
|
|
c2ffc906ea | ||
|
|
43747eb942 | ||
|
|
d07d0a3453 | ||
|
|
c87a1fc8a8 | ||
|
|
91cda0ff0f | ||
|
|
310448dcb8 | ||
|
|
8ea44f5fc7 | ||
|
|
4d5571b1d8 | ||
|
|
2be013de1f | ||
|
|
23e319da5e | ||
|
|
a120dfc4a3 | ||
|
|
5b2961d992 | ||
|
|
b6bc67e442 | ||
|
|
46dbe40891 | ||
|
|
7cc9550031 | ||
|
|
1117592f4c | ||
|
|
a0449f7ffd | ||
|
|
e3e0ddd508 | ||
|
|
2e3ddbac95 | ||
|
|
5433a71859 | ||
|
|
6aff0d221b |
@@ -174,10 +174,24 @@ const CRAWLER_AD_TYPE = {
|
|||||||
ONLY_REQUEST: 4
|
ONLY_REQUEST: 4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const EMAIL_FREQUENCY = {
|
||||||
|
ASAP: {
|
||||||
|
id: 1,
|
||||||
|
stringId: "ASAP",
|
||||||
|
title: "Odmah"
|
||||||
|
},
|
||||||
|
DAILY: {
|
||||||
|
id: 2,
|
||||||
|
stringId: "DAILY",
|
||||||
|
title: "Jednom dnevno"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
AD_TYPE,
|
AD_TYPE,
|
||||||
AD_CATEGORY,
|
AD_CATEGORY,
|
||||||
AD_STATUS,
|
AD_STATUS,
|
||||||
AD_AGENCY,
|
AD_AGENCY,
|
||||||
CRAWLER_AD_TYPE
|
CRAWLER_AD_TYPE,
|
||||||
|
EMAIL_FREQUENCY
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ const { isValidEmail } = require("../helpers/email");
|
|||||||
const {
|
const {
|
||||||
notifyForNewSearchRequest
|
notifyForNewSearchRequest
|
||||||
} = require("../services/notificationService");
|
} = require("../services/notificationService");
|
||||||
const { AD_CATEGORY, AD_TYPE } = require("../common/enums");
|
const { AD_CATEGORY, AD_TYPE, EMAIL_FREQUENCY } = require("../common/enums");
|
||||||
|
|
||||||
const getQueryReviewData = searchRequest => {
|
const getQueryReviewTableData = searchRequest => {
|
||||||
const {
|
const {
|
||||||
id,
|
id,
|
||||||
adType,
|
adType,
|
||||||
@@ -87,15 +87,26 @@ const getQueryReview = async (req, res) => {
|
|||||||
const title = "Da li je ovo to što ste tražili ?";
|
const title = "Da li je ovo to što ste tražili ?";
|
||||||
const nextStep = req.query.nextStep;
|
const nextStep = req.query.nextStep;
|
||||||
const error = req.query.error;
|
const error = req.query.error;
|
||||||
const queryReviewData = getQueryReviewData(searchRequest);
|
const queryReviewTableData = getQueryReviewTableData(searchRequest);
|
||||||
const email = searchRequest.email;
|
const email = searchRequest.email;
|
||||||
|
let selectedEmailFrequency;
|
||||||
|
switch (searchRequest.emailFrequency) {
|
||||||
|
case EMAIL_FREQUENCY.ASAP.stringId:
|
||||||
|
selectedEmailFrequency = EMAIL_FREQUENCY.ASAP.id;
|
||||||
|
break;
|
||||||
|
case EMAIL_FREQUENCY.DAILY.stringId:
|
||||||
|
selectedEmailFrequency = EMAIL_FREQUENCY.DAILY.id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
res.render("queryReview", {
|
res.render("queryReview", {
|
||||||
nextStep,
|
nextStep,
|
||||||
queryReviewData,
|
queryReviewTableData,
|
||||||
title,
|
title,
|
||||||
email,
|
email,
|
||||||
error
|
selectedEmailFrequency,
|
||||||
|
error,
|
||||||
|
EMAIL_FREQUENCY
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -107,17 +118,26 @@ const postQueryReview = async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const nextStep = req.query.nextStep || "/ponovo";
|
const nextStep = req.query.nextStep || "/ponovo";
|
||||||
|
const emailFrequency =
|
||||||
|
parseInt(req.body.emailFrequency) || EMAIL_FREQUENCY.ASAP.id;
|
||||||
const emailInput = req.body.email;
|
const emailInput = req.body.email;
|
||||||
const emailConfirmInput = req.body.confirmEmail;
|
const emailConfirmInput = req.body.confirmEmail;
|
||||||
const title = "Da li je ovo to što ste tražili ?";
|
const title = "Da li je ovo to što ste tražili ?";
|
||||||
const queryReviewData = getQueryReviewData(searchRequest);
|
const queryReviewTableData = getQueryReviewTableData(searchRequest);
|
||||||
|
|
||||||
|
let emailFrequencyStringId = EMAIL_FREQUENCY.ASAP.stringId;
|
||||||
|
if (emailFrequency === EMAIL_FREQUENCY.DAILY.id) {
|
||||||
|
emailFrequencyStringId = EMAIL_FREQUENCY.DAILY.stringId;
|
||||||
|
}
|
||||||
|
|
||||||
|
searchRequest.emailFrequency = emailFrequencyStringId;
|
||||||
|
|
||||||
if (emailInput !== emailConfirmInput) {
|
if (emailInput !== emailConfirmInput) {
|
||||||
const error = "Greška ! Unešeni emailovi nisu isti";
|
const error = "Greška ! Unešeni emailovi nisu isti";
|
||||||
res.render("queryReview", {
|
res.render("queryReview", {
|
||||||
error,
|
error,
|
||||||
title,
|
title,
|
||||||
queryReviewData,
|
queryReviewTableData,
|
||||||
email: ""
|
email: ""
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@@ -128,7 +148,7 @@ const postQueryReview = async (req, res) => {
|
|||||||
res.render("queryReview", {
|
res.render("queryReview", {
|
||||||
error,
|
error,
|
||||||
title,
|
title,
|
||||||
queryReviewData,
|
queryReviewTableData,
|
||||||
email: ""
|
email: ""
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@@ -147,7 +167,7 @@ const postQueryReview = async (req, res) => {
|
|||||||
res.render("queryReview", {
|
res.render("queryReview", {
|
||||||
error,
|
error,
|
||||||
title,
|
title,
|
||||||
queryReviewData,
|
queryReviewTableData,
|
||||||
email: ""
|
email: ""
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@@ -164,7 +184,7 @@ const postQueryReview = async (req, res) => {
|
|||||||
res.render("queryReview", {
|
res.render("queryReview", {
|
||||||
error,
|
error,
|
||||||
title,
|
title,
|
||||||
queryReviewData,
|
queryReviewTableData,
|
||||||
email: ""
|
email: ""
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ const getUnsubscribe = async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
searchRequest.subscribed = false;
|
searchRequest.subscribed = false;
|
||||||
|
searchRequest.deletedEmail = searchRequest.email;
|
||||||
|
searchRequest.email = "";
|
||||||
await searchRequest.save();
|
await searchRequest.save();
|
||||||
|
|
||||||
res.render("unsubscribe", { nextStep: "/vrstanekretnine", title });
|
res.render("unsubscribe", { nextStep: "/vrstanekretnine", title });
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ class OlxCrawler {
|
|||||||
case "Izdavanje":
|
case "Izdavanje":
|
||||||
return AD_TYPE.AD_TYPE_RENT.stringId;
|
return AD_TYPE.AD_TYPE_RENT.stringId;
|
||||||
case "Potražnja":
|
case "Potražnja":
|
||||||
return AD_TYPE.AD_TYPE_RENT.stringId;
|
return AD_TYPE.AD_TYPE_REQUEST.stringId;
|
||||||
default:
|
default:
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ class RentalCrawler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async scrapeAd(url) {
|
async scrapeAd(url) {
|
||||||
console.log("[RENTAL] Scraping : ", url);
|
// console.log("[RENTAL] Scraping : ", url);
|
||||||
try {
|
try {
|
||||||
const adPageSource = await fetch(url);
|
const adPageSource = await fetch(url);
|
||||||
const body = await adPageSource.text();
|
const body = await adPageSource.text();
|
||||||
|
|||||||
@@ -24,6 +24,23 @@ const findRealEstatesForSearchRequest = async searchRequestId => {
|
|||||||
return matchingRealEstates;
|
return matchingRealEstates;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const findNotNotifiedMatches = async () => {
|
||||||
|
const query = {
|
||||||
|
notified: false
|
||||||
|
};
|
||||||
|
|
||||||
|
const searchRequestsModel = { model: db.SearchRequest, as: "searchRequests" };
|
||||||
|
const realEstateModel = { model: db.RealEstate, as: "realEstates" };
|
||||||
|
const include = [searchRequestsModel, realEstateModel];
|
||||||
|
|
||||||
|
const matchingRecords = await db.SearchRequestMatch.findAll({
|
||||||
|
where: query,
|
||||||
|
include
|
||||||
|
});
|
||||||
|
|
||||||
|
return matchingRecords;
|
||||||
|
};
|
||||||
|
|
||||||
const addMatches = async matchingRecords => {
|
const addMatches = async matchingRecords => {
|
||||||
return await db.SearchRequestMatch.bulkCreate(matchingRecords, {
|
return await db.SearchRequestMatch.bulkCreate(matchingRecords, {
|
||||||
ignoreDuplicates: true
|
ignoreDuplicates: true
|
||||||
@@ -32,5 +49,6 @@ const addMatches = async matchingRecords => {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
findRealEstatesForSearchRequest,
|
findRealEstatesForSearchRequest,
|
||||||
addMatches
|
addMatches,
|
||||||
|
findNotNotifiedMatches
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,7 +20,11 @@ const generateRealEstateLinks = realEstates => {
|
|||||||
return realEstateLinks;
|
return realEstateLinks;
|
||||||
};
|
};
|
||||||
|
|
||||||
const generateNotificationEmail = (realEstates, searchRequestId) => {
|
const generateNotificationEmail = (
|
||||||
|
realEstates,
|
||||||
|
searchRequestId,
|
||||||
|
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)
|
||||||
@@ -30,9 +34,20 @@ const generateNotificationEmail = (realEstates, searchRequestId) => {
|
|||||||
const realEstateLinks = generateRealEstateLinks(realEstatesToShow);
|
const realEstateLinks = generateRealEstateLinks(realEstatesToShow);
|
||||||
const moreRealEstates = `<div>Kompletan spisak nekretnina 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 =
|
||||||
|
realEstates.length > 1
|
||||||
|
? "Pronašli smo nekretnine koje odgovaraju Vašoj pretrazi"
|
||||||
|
: "Pronašli smo nekretninu koja odgovara Vašoj pretrazi";
|
||||||
|
|
||||||
|
const dailyMessageBody =
|
||||||
|
realEstates.length > 1
|
||||||
|
? "U posljednja 24h objavljene su sljedeće nekretnine koje odgovaraju uslovima Vaše pretrage"
|
||||||
|
: "U posljednja 24h objavljena je sljedeća nekretnina koja odgovara uslovima Vaše pretrage";
|
||||||
|
|
||||||
|
const messageBody = dailyNotification ? dailyMessageBody : asapMessageBody;
|
||||||
|
|
||||||
return `<h3>Zdravo</h3>
|
return `<h3>Zdravo</h3>
|
||||||
<h4>Pronašli smo nekretnine koje odgovaraju Vašoj pretrazi</h4>
|
<h4>${messageBody}</h4>
|
||||||
<div>
|
<div>
|
||||||
${realEstateLinks}
|
${realEstateLinks}
|
||||||
<div/>
|
<div/>
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
"use strict";
|
||||||
|
const { EMAIL_FREQUENCY } = require("../common/enums");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
up: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.addColumn("SearchRequests", "emailFrequency", {
|
||||||
|
type: Sequelize.TEXT,
|
||||||
|
defaultValue: EMAIL_FREQUENCY.ASAP.stringId
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
down: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.removeColumn("SearchRequests", "emailFrequency");
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
up: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.addColumn("SearchRequests", "deletedEmail", {
|
||||||
|
type: Sequelize.TEXT
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
down: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.removeColumn("SearchRequests", "deletedEmail");
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { AD_TYPE } = require("../common/enums");
|
const { AD_TYPE, EMAIL_FREQUENCY } = require("../common/enums");
|
||||||
|
|
||||||
module.exports = (sequelize, DataTypes) => {
|
module.exports = (sequelize, DataTypes) => {
|
||||||
const SearchRequest = sequelize.define("SearchRequest", {
|
const SearchRequest = sequelize.define("SearchRequest", {
|
||||||
@@ -61,6 +61,14 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
type: DataTypes.BOOLEAN,
|
type: DataTypes.BOOLEAN,
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
allowNull: false
|
allowNull: false
|
||||||
|
},
|
||||||
|
emailFrequency: {
|
||||||
|
type: DataTypes.TEXT,
|
||||||
|
defaultValue: EMAIL_FREQUENCY.ASAP.stringId,
|
||||||
|
allowNull: false
|
||||||
|
},
|
||||||
|
deletedEmail: {
|
||||||
|
type: DataTypes.TEXT
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
SearchRequestMatch.associate = models => {
|
SearchRequestMatch.associate = models => {
|
||||||
|
SearchRequestMatch.hasMany(models.SearchRequest, {
|
||||||
|
foreignKey: "id",
|
||||||
|
sourceKey: "searchRequestId",
|
||||||
|
targetKey: "id",
|
||||||
|
as: "searchRequests"
|
||||||
|
});
|
||||||
SearchRequestMatch.hasMany(models.RealEstate, {
|
SearchRequestMatch.hasMany(models.RealEstate, {
|
||||||
foreignKey: "id",
|
foreignKey: "id",
|
||||||
as: "realEstates"
|
as: "realEstates"
|
||||||
|
|||||||
8
app/npmScripts/npmDailyNotify.js
Normal file
8
app/npmScripts/npmDailyNotify.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
"use strict";
|
||||||
|
const {
|
||||||
|
notifyRequestsWithDailyOption
|
||||||
|
} = require("../services/notificationService");
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
await notifyRequestsWithDailyOption();
|
||||||
|
})();
|
||||||
@@ -1,14 +1,18 @@
|
|||||||
.ui-segment {
|
.segmented {
|
||||||
color: #02adba;
|
color: #02adba;
|
||||||
border: 1px solid #02adba;
|
border: 1px solid #02adba;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
.ui-segment span.option.active {
|
.segmented label {
|
||||||
|
color: #02adba;
|
||||||
|
}
|
||||||
|
.segmented input:checked + .label {
|
||||||
background-color: #02adba;
|
background-color: #02adba;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
.ui-segment span.option {
|
[type="radio"]:not(:checked) + span,
|
||||||
|
[type="radio"]:checked + span {
|
||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
@@ -21,9 +25,14 @@
|
|||||||
border-right: 1px solid #02adba;
|
border-right: 1px solid #02adba;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-segment span.option:last-child {
|
.segmented :last-child .label {
|
||||||
border-right: none;
|
border-right: none;
|
||||||
}
|
}
|
||||||
.segment-select {
|
.segmented input {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.label:before,
|
||||||
|
span.label:after {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ const {
|
|||||||
generateNewSearchRequestEmail,
|
generateNewSearchRequestEmail,
|
||||||
generateEmailSubject
|
generateEmailSubject
|
||||||
} = require("../helpers/emailContentGenerator");
|
} = require("../helpers/emailContentGenerator");
|
||||||
|
const { findNotNotifiedMatches } = require("../helpers/db/searchRequestMatch");
|
||||||
const { sendEmail } = require("../services/emailService");
|
const { sendEmail } = require("../services/emailService");
|
||||||
|
|
||||||
const notifyForNewRealEstates = async newRealEstates => {
|
const notifyForNewRealEstates = async newRealEstates => {
|
||||||
@@ -29,34 +30,87 @@ const notifyForNewSearchRequest = async searchRequest => {
|
|||||||
await sendEmail(email, "Kivi - novi zahtjev za pretragu", emailContent);
|
await sendEmail(email, "Kivi - novi zahtjev za pretragu", emailContent);
|
||||||
};
|
};
|
||||||
|
|
||||||
const notifyMatches = async matches => {
|
const notifyMatches = async (matches, dailyNotification = false) => {
|
||||||
const searchRequestsToNotify = Object.keys(matches);
|
const searchRequestsToNotify = Object.keys(matches);
|
||||||
|
|
||||||
const asyncSendEmailActions = [];
|
const asyncSendEmailActions = [];
|
||||||
for (const id of searchRequestsToNotify) {
|
for (const id of searchRequestsToNotify) {
|
||||||
const { searchRequest } = matches[id];
|
const { searchRequest, notifyNow } = matches[id];
|
||||||
const { email } = searchRequest;
|
const { email, subscribed } = searchRequest;
|
||||||
const allMatchingRealEstates = matches[id].realEstates || [];
|
if (notifyNow && subscribed) {
|
||||||
if (allMatchingRealEstates.length > 0) {
|
const allMatchingRealEstates = matches[id].realEstates || [];
|
||||||
const emailContent = generateNotificationEmail(
|
if (allMatchingRealEstates.length > 0) {
|
||||||
allMatchingRealEstates,
|
const emailContent = generateNotificationEmail(
|
||||||
id
|
allMatchingRealEstates,
|
||||||
);
|
id,
|
||||||
const emailSubject = generateEmailSubject(
|
dailyNotification
|
||||||
allMatchingRealEstates.length,
|
);
|
||||||
allMatchingRealEstates[0].title
|
const emailSubject = generateEmailSubject(
|
||||||
);
|
allMatchingRealEstates.length,
|
||||||
|
allMatchingRealEstates[0].title
|
||||||
|
);
|
||||||
|
|
||||||
const sendEmailPromise = sendEmail(email, emailSubject, emailContent);
|
const sendEmailPromise = sendEmail(email, emailSubject, emailContent);
|
||||||
asyncSendEmailActions.push(sendEmailPromise);
|
asyncSendEmailActions.push(sendEmailPromise);
|
||||||
sendEmailPromise.catch(err => console.log("[Email Sending Failed]", err));
|
sendEmailPromise.catch(err =>
|
||||||
|
console.log("[Email Sending Failed]", err)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(asyncSendEmailActions);
|
await Promise.all(asyncSendEmailActions);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const notifyRequestsWithDailyOption = async () => {
|
||||||
|
const notNotifiedSearchRequestMatches = await findNotNotifiedMatches();
|
||||||
|
|
||||||
|
const matches = {};
|
||||||
|
|
||||||
|
for (const searchRequestMatch of notNotifiedSearchRequestMatches) {
|
||||||
|
const { searchRequests, realEstates } = searchRequestMatch;
|
||||||
|
|
||||||
|
if (!Array.isArray(searchRequests) || searchRequests.length !== 1) {
|
||||||
|
// Something is wrong with this match
|
||||||
|
// (search request not found for specified search request id)
|
||||||
|
// OR
|
||||||
|
// there are multiple search requests with the same ID (this should never be the case !
|
||||||
|
// TODO: Maybe if association is defined better, this will be automatically only one object instead of array
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Array.isArray(realEstates) || realEstates.length !== 1) {
|
||||||
|
// Something is wrong with this match
|
||||||
|
// (real estate not found for specified real estate id)
|
||||||
|
// OR
|
||||||
|
// there are multiple real estates with the same ID (this should never be the case !
|
||||||
|
// TODO: Maybe if association is defined better, this will be automatically only one object instead of array
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const searchRequest = searchRequests[0];
|
||||||
|
const realEstate = realEstates[0];
|
||||||
|
const searchRequestId = searchRequest.id;
|
||||||
|
|
||||||
|
if (!matches[searchRequestId]) {
|
||||||
|
matches[searchRequestId] = {
|
||||||
|
searchRequest,
|
||||||
|
realEstates: [],
|
||||||
|
notifyNow: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
matches[searchRequestId].realEstates.push(realEstate);
|
||||||
|
|
||||||
|
searchRequestMatch.notified = true;
|
||||||
|
searchRequestMatch.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
await notifyMatches(matches, true);
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
notifyForNewRealEstates,
|
notifyForNewRealEstates,
|
||||||
notifyForNewSearchRequest
|
notifyForNewSearchRequest,
|
||||||
|
notifyRequestsWithDailyOption
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ const {
|
|||||||
const { findRealEstatesForSearchRequest } = require("../helpers/db/realEstate");
|
const { findRealEstatesForSearchRequest } = require("../helpers/db/realEstate");
|
||||||
const { addMatches } = require("../helpers/db/searchRequestMatch");
|
const { addMatches } = require("../helpers/db/searchRequestMatch");
|
||||||
const { MAX_REAL_ESTATES_IN_FIRST_EMAIL } = require("../config/appConfig");
|
const { MAX_REAL_ESTATES_IN_FIRST_EMAIL } = require("../config/appConfig");
|
||||||
|
const { EMAIL_FREQUENCY } = require("../common/enums");
|
||||||
|
|
||||||
const matchRealEstates = async realEstates => {
|
const matchRealEstates = async realEstates => {
|
||||||
if (Array.isArray(realEstates)) {
|
if (Array.isArray(realEstates)) {
|
||||||
@@ -18,18 +19,19 @@ const matchRealEstates = async realEstates => {
|
|||||||
|
|
||||||
searchRequestsPromise.then(searchRequests => {
|
searchRequestsPromise.then(searchRequests => {
|
||||||
for (const searchRequest of searchRequests) {
|
for (const searchRequest of searchRequests) {
|
||||||
const { id } = searchRequest;
|
const { id, emailFrequency } = searchRequest;
|
||||||
if (!matches[id]) {
|
if (!matches[id]) {
|
||||||
matches[id] = {
|
matches[id] = {
|
||||||
searchRequest,
|
searchRequest,
|
||||||
realEstates: []
|
realEstates: [],
|
||||||
|
notifyNow: emailFrequency === EMAIL_FREQUENCY.ASAP.stringId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
matches[id].realEstates.push(realEstate);
|
matches[id].realEstates.push(realEstate);
|
||||||
matchingRecords.push({
|
matchingRecords.push({
|
||||||
searchRequestId: searchRequest.id,
|
searchRequestId: searchRequest.id,
|
||||||
realEstateId: realEstate.id,
|
realEstateId: realEstate.id,
|
||||||
notified: false
|
notified: emailFrequency === EMAIL_FREQUENCY.ASAP.stringId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -62,7 +64,7 @@ const matchSearchRequest = async searchRequest => {
|
|||||||
matchingRecords.push({
|
matchingRecords.push({
|
||||||
searchRequestId,
|
searchRequestId,
|
||||||
realEstateId: realEstate.id,
|
realEstateId: realEstate.id,
|
||||||
notified: false
|
notified: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
function locateMe() {
|
function locateMe() {
|
||||||
if (navigator.geolocation) {
|
if (navigator.geolocation) {
|
||||||
|
|
||||||
const onLocationSuccess = (position) => {
|
function onLocationSuccess (position) {
|
||||||
const coordinates = position && position.coords ? position.coords : null;
|
const coordinates = position && position.coords ? position.coords : null;
|
||||||
if (coordinates){
|
if (coordinates){
|
||||||
const longitude = coordinates.longitude || null;
|
const longitude = coordinates.longitude || null;
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
map.setZoom(16);
|
map.setZoom(16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
navigator.geolocation.getCurrentPosition(onLocationSuccess);
|
navigator.geolocation.getCurrentPosition(onLocationSuccess);
|
||||||
}
|
}
|
||||||
@@ -162,8 +162,8 @@
|
|||||||
input.attachEvent = addEventListenerWrapper
|
input.attachEvent = addEventListenerWrapper
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(function() {
|
||||||
$("#submit").click(() => {
|
$("#submit").click(function() {
|
||||||
const mapBounds = map.getBounds();
|
const mapBounds = map.getBounds();
|
||||||
|
|
||||||
$("#north").val(mapBounds.getNorthEast().lat());
|
$("#north").val(mapBounds.getNorthEast().lat());
|
||||||
@@ -178,4 +178,4 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAna8ohfV2HBMcxGk_29vqxU5Z_bDickqg&language=bs&libraries=places&callback=initMap" async
|
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAna8ohfV2HBMcxGk_29vqxU5Z_bDickqg&language=bs&libraries=places&callback=initMap" async
|
||||||
defer></script>
|
defer></script>
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
<form method="POST" id="form-range">
|
|
||||||
|
|
||||||
<div class="row center-align no-ui-slider centered-element-small" id="slider"></div>
|
|
||||||
|
|
||||||
<div class="col s6 push-s3 centered-element-small">
|
|
||||||
<a id="btnsubmit" href="#" class="next-center-button waves-effect waves-light btn">
|
|
||||||
Dalje
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input type="hidden" name="from" id="from" />
|
|
||||||
<input type="hidden" name="to" id="to" />
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
$(document).ready(() => {
|
|
||||||
|
|
||||||
var slider = document.getElementById('slider');
|
|
||||||
|
|
||||||
const unitFormat = wNumb({
|
|
||||||
decimals: 3,
|
|
||||||
thousand: '.',
|
|
||||||
suffix: '<%= unit %>'
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
noUiSlider.create(slider, {
|
|
||||||
start: [<%= rangeFrom.value %>, <%= rangeTo.value %>],
|
|
||||||
connect: true,
|
|
||||||
tooltips: true,
|
|
||||||
step: <%= rangeFrom.step %>,
|
|
||||||
range: {
|
|
||||||
'min': <%= rangeFrom.min %>,
|
|
||||||
'max': <%= rangeTo.max %>
|
|
||||||
},
|
|
||||||
format: unitFormat
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$("#btnsubmit").click(() => {
|
|
||||||
const sliderValues = slider.noUiSlider.get();
|
|
||||||
|
|
||||||
$("#from").val(unitFormat.from(sliderValues[0]));
|
|
||||||
$("#to").val(unitFormat.from(sliderValues[1]));
|
|
||||||
|
|
||||||
$("#form-range").submit();
|
|
||||||
// });
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
|
<br><br>
|
||||||
<form method="POST" id="form-queryreview">
|
<form method="POST" id="form-queryreview">
|
||||||
<div class="row center-align">
|
<div class="row center-align">
|
||||||
<ul class="collection with-header">
|
<ul class="collection with-header">
|
||||||
<% for(const stepData of queryReviewData) { %>
|
<% for(const stepData of queryReviewTableData) { %>
|
||||||
<li class="collection-item" >
|
<li class="collection-item" >
|
||||||
<div id="<%= stepData.id %>" ><%= stepData.title || '-' %>
|
<div id="<%= stepData.id %>" ><%= stepData.title || '-' %>
|
||||||
<a href="<%= stepData.url %>" class="kivi-color secondary-content">
|
<a href="<%= stepData.url %>" class="kivi-color secondary-content">
|
||||||
@@ -12,6 +13,26 @@
|
|||||||
<% } %>
|
<% } %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row center-align">
|
||||||
|
<h6>Slanje obavještenja</h6>
|
||||||
|
<span class="segmented">
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="emailFrequency" value="<%= EMAIL_FREQUENCY.ASAP.id %>"
|
||||||
|
<% if (selectedEmailFrequency === EMAIL_FREQUENCY.ASAP.id) { %>
|
||||||
|
checked
|
||||||
|
<% } %>>
|
||||||
|
<span class="label"><%= EMAIL_FREQUENCY.ASAP.title %></span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="emailFrequency" value="<%= EMAIL_FREQUENCY.DAILY.id %>"
|
||||||
|
<% if (selectedEmailFrequency === EMAIL_FREQUENCY.DAILY.id) { %>
|
||||||
|
checked
|
||||||
|
<% } %>>
|
||||||
|
<span class="label"><%= EMAIL_FREQUENCY.DAILY.title %></span>
|
||||||
|
</label>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<div class="row center-align">
|
<div class="row center-align">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input id="email" name="email" type="email" placeholder="vas.email@mail.com" <% if (email) { %>value="<%= email %>" <% } %> required size="250" />
|
<input id="email" name="email" type="email" placeholder="vas.email@mail.com" <% if (email) { %>value="<%= email %>" <% } %> required size="250" />
|
||||||
@@ -46,8 +67,9 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready( () => {
|
|
||||||
$("#submit").click( () => {
|
$(document).ready(function() {
|
||||||
|
$("#submit").click(function() {
|
||||||
const simpleEmailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
const simpleEmailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||||
const email = $("#email").val();
|
const email = $("#email").val();
|
||||||
const confirmEmail = $("#confirmEmail").val();
|
const confirmEmail = $("#confirmEmail").val();
|
||||||
@@ -61,7 +83,7 @@
|
|||||||
$("#submit").attr("disabled", true);
|
$("#submit").attr("disabled", true);
|
||||||
$("#form-queryreview").submit();
|
$("#form-queryreview").submit();
|
||||||
}else{
|
}else{
|
||||||
$("#error-label-email").text("Greška ! Unešeni emailovi nisu isti");
|
$("#error-label-email").text("Greška ! Unešeni email nije validan");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -66,19 +66,19 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(() => {
|
$(document).ready(function() {
|
||||||
const priceSliderOptions = {...<%- priceSliderOptions %>};
|
const priceSliderOptions = <%- priceSliderOptions %>;
|
||||||
const sizeSliderOptions = {...<%- sizeSliderOptions %>};
|
const sizeSliderOptions = <%- sizeSliderOptions %>;
|
||||||
const priceStep = priceSliderOptions.step;
|
const priceStep = priceSliderOptions.step;
|
||||||
const sizeStep = sizeSliderOptions.step;
|
const sizeStep = sizeSliderOptions.step;
|
||||||
delete priceSliderOptions.step;
|
delete priceSliderOptions.step;
|
||||||
delete sizeSliderOptions.step;
|
delete sizeSliderOptions.step;
|
||||||
|
|
||||||
const updatePriceInputs = (values, handle, unencoded) => {
|
function updatePriceInputs(values, handle, unencoded) {
|
||||||
$("#priceMin").val(Math.round(unencoded[0]/priceStep)*priceStep);
|
$("#priceMin").val(Math.round(unencoded[0]/priceStep)*priceStep);
|
||||||
$("#priceMax").val(Math.round(unencoded[1]/priceStep)*priceStep);
|
$("#priceMax").val(Math.round(unencoded[1]/priceStep)*priceStep);
|
||||||
}
|
}
|
||||||
const updateSizeInputs = (values, handle, unencoded) => {
|
function updateSizeInputs(values, handle, unencoded) {
|
||||||
$("#sizeMin").val(Math.round(unencoded[0]/sizeStep)*sizeStep);
|
$("#sizeMin").val(Math.round(unencoded[0]/sizeStep)*sizeStep);
|
||||||
$("#sizeMax").val(Math.round(unencoded[1]/sizeStep)*sizeStep);
|
$("#sizeMax").val(Math.round(unencoded[1]/sizeStep)*sizeStep);
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
priceSliderObject.on('slide', updatePriceInputs);
|
priceSliderObject.on('slide', updatePriceInputs);
|
||||||
sizeSliderObject.on('slide', updateSizeInputs);
|
sizeSliderObject.on('slide', updateSizeInputs);
|
||||||
|
|
||||||
const priceMinChangeHandler = (element) => {
|
function priceMinChangeHandler(element) {
|
||||||
if (element && element.currentTarget && element.currentTarget.value){
|
if (element && element.currentTarget && element.currentTarget.value){
|
||||||
const currentValues = priceSliderObject.get();
|
const currentValues = priceSliderObject.get();
|
||||||
const newValue = element.currentTarget.value;
|
const newValue = element.currentTarget.value;
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
$("#priceMin").val(Math.round(priceSliderObject.get()[0]));
|
$("#priceMin").val(Math.round(priceSliderObject.get()[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const priceMaxChangeHandler = (element) => {
|
function priceMaxChangeHandler(element) {
|
||||||
if (element && element.currentTarget && element.currentTarget.value){
|
if (element && element.currentTarget && element.currentTarget.value){
|
||||||
const newValue = element.currentTarget.value;
|
const newValue = element.currentTarget.value;
|
||||||
priceSliderObject.set([null, newValue]);
|
priceSliderObject.set([null, newValue]);
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
$("#priceMin").change(priceMinChangeHandler);
|
$("#priceMin").change(priceMinChangeHandler);
|
||||||
$("#priceMax").change(priceMaxChangeHandler);
|
$("#priceMax").change(priceMaxChangeHandler);
|
||||||
|
|
||||||
const sizeMinChangeHandler = (element) => {
|
function sizeMinChangeHandler(element) {
|
||||||
if (element && element.currentTarget && element.currentTarget.value){
|
if (element && element.currentTarget && element.currentTarget.value){
|
||||||
const currentValues = sizeSliderObject.get();
|
const currentValues = sizeSliderObject.get();
|
||||||
const newValue = element.currentTarget.value;
|
const newValue = element.currentTarget.value;
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
$("#sizeMin").val(Math.round(sizeSliderObject.get()[0]));
|
$("#sizeMin").val(Math.round(sizeSliderObject.get()[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const sizeMaxChangeHandler = (element) => {
|
function sizeMaxChangeHandler(element) {
|
||||||
if (element && element.currentTarget && element.currentTarget.value){
|
if (element && element.currentTarget && element.currentTarget.value){
|
||||||
const newValue = element.currentTarget.value;
|
const newValue = element.currentTarget.value;
|
||||||
sizeSliderObject.set([null, newValue]);
|
sizeSliderObject.set([null, newValue]);
|
||||||
@@ -135,11 +135,11 @@
|
|||||||
$("#sizeMax").change(sizeMaxChangeHandler);
|
$("#sizeMax").change(sizeMaxChangeHandler);
|
||||||
|
|
||||||
<% if(hasGardenSize) { %>
|
<% if(hasGardenSize) { %>
|
||||||
const gardenSizeSliderOptions = {...<%- gardenSizeSliderOptions %>};
|
const gardenSizeSliderOptions = <%- gardenSizeSliderOptions %>;
|
||||||
const gardenSizeStep = gardenSizeSliderOptions.step;
|
const gardenSizeStep = gardenSizeSliderOptions.step;
|
||||||
delete gardenSizeSliderOptions.step;
|
delete gardenSizeSliderOptions.step;
|
||||||
|
|
||||||
const updateGardenSizeInputs = (values, handle, unencoded) => {
|
function updateGardenSizeInputs(values, handle, unencoded) {
|
||||||
$("#gardenSizeMin").val(Math.round(unencoded[0]/gardenSizeStep)*gardenSizeStep);
|
$("#gardenSizeMin").val(Math.round(unencoded[0]/gardenSizeStep)*gardenSizeStep);
|
||||||
$("#gardenSizeMax").val(Math.round(unencoded[1]/gardenSizeStep)*gardenSizeStep);
|
$("#gardenSizeMax").val(Math.round(unencoded[1]/gardenSizeStep)*gardenSizeStep);
|
||||||
}
|
}
|
||||||
@@ -147,7 +147,7 @@
|
|||||||
const gardenSizeSlider = document.getElementById("gardenSizeFilter");
|
const gardenSizeSlider = document.getElementById("gardenSizeFilter");
|
||||||
const gardenSizeSliderObject = noUiSlider.create(gardenSizeSlider, gardenSizeSliderOptions);
|
const gardenSizeSliderObject = noUiSlider.create(gardenSizeSlider, gardenSizeSliderOptions);
|
||||||
gardenSizeSliderObject.on('slide', updateGardenSizeInputs);
|
gardenSizeSliderObject.on('slide', updateGardenSizeInputs);
|
||||||
const gardenSizeMinChangeHandler = (element) => {
|
function gardenSizeMinChangeHandler(element) {
|
||||||
if (element && element.currentTarget && element.currentTarget.value){
|
if (element && element.currentTarget && element.currentTarget.value){
|
||||||
const currentValues = gardenSizeSliderObject.get();
|
const currentValues = gardenSizeSliderObject.get();
|
||||||
const newValue = element.currentTarget.value;
|
const newValue = element.currentTarget.value;
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
$("#gardenSizeMin").val(Math.round(gardenSizeSliderObject.get()[0]));
|
$("#gardenSizeMin").val(Math.round(gardenSizeSliderObject.get()[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const gardenSizeMaxChangeHandler = (element) => {
|
function gardenSizeMaxChangeHandler(element) {
|
||||||
if (element && element.currentTarget && element.currentTarget.value){
|
if (element && element.currentTarget && element.currentTarget.value){
|
||||||
const newValue = element.currentTarget.value;
|
const newValue = element.currentTarget.value;
|
||||||
gardenSizeSliderObject.set([null, newValue]);
|
gardenSizeSliderObject.set([null, newValue]);
|
||||||
@@ -169,7 +169,7 @@
|
|||||||
$("#gardenSizeMax").change("step", gardenSizeMaxChangeHandler);
|
$("#gardenSizeMax").change("step", gardenSizeMaxChangeHandler);
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
$("#submit").click(() => {
|
$("#submit").click(function() {
|
||||||
const priceFilterValues = priceSlider.noUiSlider.get();
|
const priceFilterValues = priceSlider.noUiSlider.get();
|
||||||
$("#priceFilterMin").val(priceFilterValues[0]);
|
$("#priceFilterMin").val(priceFilterValues[0]);
|
||||||
$("#priceFilterMax").val(priceFilterValues[1]);
|
$("#priceFilterMax").val(priceFilterValues[1]);
|
||||||
|
|||||||
@@ -3,18 +3,23 @@
|
|||||||
<div class="center-align">
|
<div class="center-align">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<select class="segment-select" id="adType" name="adType">
|
<span class="segmented">
|
||||||
<option value="<%= AD_TYPE.AD_TYPE_SALE.id %>"
|
<label>
|
||||||
<% if (selectedAdType === AD_TYPE.AD_TYPE_SALE.id) { %>
|
<input type="radio" name="adType" value="<%= AD_TYPE.AD_TYPE_SALE.id %>"
|
||||||
selected="selected"
|
<% if (selectedAdType === AD_TYPE.AD_TYPE_SALE.id) { %>
|
||||||
<% } %>
|
checked
|
||||||
><%= AD_TYPE.AD_TYPE_SALE.title %></option>
|
<% } %>>
|
||||||
<option value="<%= AD_TYPE.AD_TYPE_RENT.id %>"
|
<span class="label"><%= AD_TYPE.AD_TYPE_SALE.title %></span>
|
||||||
<% if (selectedAdType === AD_TYPE.AD_TYPE_RENT.id) { %>
|
</label>
|
||||||
selected="selected"
|
|
||||||
<% } %>
|
<label>
|
||||||
><%= AD_TYPE.AD_TYPE_RENT.title %></option>
|
<input type="radio" name="adType" value="<%= AD_TYPE.AD_TYPE_RENT.id %>"
|
||||||
</select>
|
<% if (selectedAdType === AD_TYPE.AD_TYPE_RENT.id) { %>
|
||||||
|
checked
|
||||||
|
<% } %>>
|
||||||
|
<span class="label"><%= AD_TYPE.AD_TYPE_RENT.title %></span>
|
||||||
|
</label>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@@ -37,45 +42,6 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
(function($) {
|
|
||||||
$.fn.extend({
|
|
||||||
Segment: function() {
|
|
||||||
$(this).each(function() {
|
|
||||||
const self = $(this);
|
|
||||||
const onchange = self.attr('onchange');
|
|
||||||
const wrapper = $("<div>", { class: "ui-segment" });
|
|
||||||
$(this)
|
|
||||||
.find("option")
|
|
||||||
.each(function() {
|
|
||||||
const option = $("<span>", {
|
|
||||||
class: "option",
|
|
||||||
onclick: onchange,
|
|
||||||
text: $(this).text(),
|
|
||||||
value: $(this).val(),
|
|
||||||
});
|
|
||||||
if ($(this).is(":selected")) {
|
|
||||||
option.addClass("active");
|
|
||||||
}
|
|
||||||
wrapper.append(option);
|
|
||||||
});
|
|
||||||
|
|
||||||
wrapper.find("span.option").click(function (){
|
|
||||||
wrapper.find("span.option").removeClass("active");
|
|
||||||
$(this).addClass("active");
|
|
||||||
self.val($(this).attr('value'));
|
|
||||||
});
|
|
||||||
|
|
||||||
$(this).after(wrapper);
|
|
||||||
$(this).hide();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})(jQuery);
|
|
||||||
|
|
||||||
$(document).ready(() => {
|
|
||||||
$(".segment-select").Segment();
|
|
||||||
});
|
|
||||||
|
|
||||||
function saveAndSubmit(id) {
|
function saveAndSubmit(id) {
|
||||||
$("#realEstateType").val(id);
|
$("#realEstateType").val(id);
|
||||||
$("#realEstateTypeSelection > a").attr("onclick", "");
|
$("#realEstateTypeSelection > a").attr("onclick", "");
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
</h6>
|
</h6>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
window.onload = () => {
|
window.onload = function() {
|
||||||
document.getElementById('realEstateUrl').click();
|
document.getElementById('realEstateUrl').click();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ OLX_CRAWLER_AD_TYPE=enum name of what type of ads should be crawled, check commo
|
|||||||
OLX_CRAWLER_AD_CATEGORIES=comma separated list of enum names of categories to be included, check common/enums.js file for valid values
|
OLX_CRAWLER_AD_CATEGORIES=comma separated list of enum names of categories to be included, check common/enums.js file for valid values
|
||||||
OLX_IGNORED_USERNAMES=comma separated list of usernames to ignore
|
OLX_IGNORED_USERNAMES=comma separated list of usernames to ignore
|
||||||
OLX_DELAY_BETWEEN_PAGES=time in miliseconds to wait before indexing next page
|
OLX_DELAY_BETWEEN_PAGES=time in miliseconds to wait before indexing next page
|
||||||
|
OLX_FORCE_CRAWL=Non-zero value will force crawler to crawl all pages without stopping when known real estate is found
|
||||||
#==RENTAL==
|
#==RENTAL==
|
||||||
RENTAL_MAX_PAGES=Restrict crawler to this number of pages
|
RENTAL_MAX_PAGES=Restrict crawler to this number of pages
|
||||||
RENTAL_MAX_RESULTS_PER_PAGE=Only this number or less results from one page will be scraped and saved
|
RENTAL_MAX_RESULTS_PER_PAGE=Only this number or less results from one page will be scraped and saved
|
||||||
@@ -38,6 +39,7 @@ RENTAL_CRAWLER_AD_TYPE=enum name of what type of ads should be crawled, check co
|
|||||||
RENTAL_CRAWLER_AD_CATEGORIES=comma separated list of enum names of categories to be included, check common/enums.js file for valid values
|
RENTAL_CRAWLER_AD_CATEGORIES=comma separated list of enum names of categories to be included, check common/enums.js file for valid values
|
||||||
RENTAL_IGNORED_USERNAMES=!!! This is not used for rental crawler !!!
|
RENTAL_IGNORED_USERNAMES=!!! This is not used for rental crawler !!!
|
||||||
RENTAL_DELAY_BETWEEN_PAGES=time in miliseconds to wait before indexing next page
|
RENTAL_DELAY_BETWEEN_PAGES=time in miliseconds to wait before indexing next page
|
||||||
|
RENTAL_FORCE_CRAWL=Non-zero value will force crawler to crawl all pages without stopping when known real estate is found
|
||||||
#==PROSTOR==
|
#==PROSTOR==
|
||||||
PROSTOR_MAX_PAGES=!!! This is not used for prostor crawler !!!
|
PROSTOR_MAX_PAGES=!!! This is not used for prostor crawler !!!
|
||||||
PROSTOR_MAX_RESULTS_PER_PAGE=For Prostor crawler, this represents MAX RESULTS in total
|
PROSTOR_MAX_RESULTS_PER_PAGE=For Prostor crawler, this represents MAX RESULTS in total
|
||||||
@@ -45,6 +47,7 @@ PROSTOR_CRAWLER_AD_TYPE=enum name of what type of ads should be crawled, check c
|
|||||||
PROSTOR_CRAWLER_AD_CATEGORIES=comma separated list of enum names of categories to be included, check common/enums.js file for valid values
|
PROSTOR_CRAWLER_AD_CATEGORIES=comma separated list of enum names of categories to be included, check common/enums.js file for valid values
|
||||||
PROSTOR_IGNORED_USERNAMES=!!! This is not used for prostor crawler !!!
|
PROSTOR_IGNORED_USERNAMES=!!! This is not used for prostor crawler !!!
|
||||||
PROSTOR_DELAY_BETWEEN_PAGES=!!! This is not used for prostor crawler !!!
|
PROSTOR_DELAY_BETWEEN_PAGES=!!! This is not used for prostor crawler !!!
|
||||||
|
PROSTOR_FORCE_CRAWL=Non-zero value will force crawler to crawl all pages without stopping when known real estate is found
|
||||||
#==AKTIDO==
|
#==AKTIDO==
|
||||||
AKTIDO_MAX_PAGES=Restrict crawler to this number of pages
|
AKTIDO_MAX_PAGES=Restrict crawler to this number of pages
|
||||||
AKTIDO_MAX_RESULTS_PER_PAGE=Only this number or less results from one page will be scraped and saved
|
AKTIDO_MAX_RESULTS_PER_PAGE=Only this number or less results from one page will be scraped and saved
|
||||||
@@ -52,3 +55,4 @@ AKTIDO_CRAWLER_AD_TYPE=enum name of what type of ads should be crawled, check co
|
|||||||
AKTIDO_CRAWLER_AD_CATEGORIES=comma separated list of enum names of categories to be included, check common/enums.js file for valid values
|
AKTIDO_CRAWLER_AD_CATEGORIES=comma separated list of enum names of categories to be included, check common/enums.js file for valid values
|
||||||
AKTIDO_IGNORED_USERNAMES=!!! This is not used for aktido crawler !!!
|
AKTIDO_IGNORED_USERNAMES=!!! This is not used for aktido crawler !!!
|
||||||
AKTIDO_DELAY_BETWEEN_PAGES=time in miliseconds to wait before indexing next page
|
AKTIDO_DELAY_BETWEEN_PAGES=time in miliseconds to wait before indexing next page
|
||||||
|
AKTIDO_FORCE_CRAWL=Non-zero value will force crawler to crawl all pages without stopping when known real estate is found
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"docker-start": "docker start pg_marketalerts",
|
"docker-start": "docker start pg_marketalerts",
|
||||||
"docker-stop": "docker stop pg_marketalerts",
|
"docker-stop": "docker stop pg_marketalerts",
|
||||||
"crawl": "cd app/crawler && node npmCrawl.js",
|
"crawl": "cd app/crawler && node npmCrawl.js",
|
||||||
|
"daily-notify": "cd app/npmScripts && node npmDailyNotify.js",
|
||||||
"test-search": "cd test && node searchTest.js",
|
"test-search": "cd test && node searchTest.js",
|
||||||
"test-olx-scraper": "cd test && node olxScrapeTest.js"
|
"test-olx-scraper": "cd test && node olxScrapeTest.js"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user