Compare commits
32 Commits
email_to_a
...
rename
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27fa721627 | ||
|
|
9fdfce49ed | ||
|
|
59723410b6 | ||
|
|
51ed3551c7 | ||
|
|
58177a8cce | ||
|
|
864b917b4f | ||
|
|
a2f6f033bf | ||
|
|
64f2cb82a8 | ||
|
|
17492eb52c | ||
|
|
298c901759 | ||
|
|
c534c1ee34 | ||
|
|
2380c85122 | ||
|
|
0f7e9f9285 | ||
|
|
dee4df9bd8 | ||
|
|
4248e6304a | ||
|
|
9fd9fe8b82 | ||
|
|
467d551857 | ||
|
|
28f95b9c05 | ||
|
|
9aba66c273 | ||
|
|
d03e85a0dc | ||
|
|
9d49e72bb4 | ||
|
|
efe2dd66a3 | ||
|
|
5f2fee504a | ||
|
|
add905c793 | ||
|
|
5b25068009 | ||
|
|
262f71164c | ||
|
|
a6fdf259a0 | ||
|
|
da241c8200 | ||
|
|
8c7f26b099 | ||
|
|
0d7c154958 | ||
|
|
2ceb6805ce | ||
|
|
d240fcbcda |
48
Dockerfile
Normal file
48
Dockerfile
Normal file
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# example Dockerfile for https://docs.docker.com/engine/examples/postgresql_service/
|
||||
#
|
||||
|
||||
FROM ubuntu:16.04
|
||||
|
||||
# Add the PostgreSQL PGP key to verify their Debian packages.
|
||||
# It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
||||
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
|
||||
|
||||
# Add PostgreSQL's repository. It contains the most recent stable release
|
||||
# of PostgreSQL, ``9.3``.
|
||||
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
|
||||
|
||||
# Install ``python-software-properties``, ``software-properties-common`` and PostgreSQL 9.3
|
||||
# There are some warnings (in red) that show up during the build. You can hide
|
||||
# them by prefixing each apt-get statement with DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update && apt-get install -y python-software-properties software-properties-common postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3
|
||||
|
||||
# Note: The official Debian and Ubuntu images automatically ``apt-get clean``
|
||||
# after each ``apt-get``
|
||||
|
||||
# Run the rest of the commands as the ``postgres`` user created by the ``postgres-9.3`` package when it was ``apt-get installed``
|
||||
USER postgres
|
||||
|
||||
# Create a PostgreSQL role named ``docker`` with ``docker`` as the password and
|
||||
# then create a database `docker` owned by the ``docker`` role.
|
||||
# Note: here we use ``&&\`` to run commands one after the other - the ``\``
|
||||
# allows the RUN command to span multiple lines.
|
||||
RUN /etc/init.d/postgresql start &&\
|
||||
psql --command "CREATE USER docker WITH SUPERUSER PASSWORD 'docker';" &&\
|
||||
createdb -O docker marketalerts
|
||||
|
||||
# Adjust PostgreSQL configuration so that remote connections to the
|
||||
# database are possible.
|
||||
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf
|
||||
|
||||
# And add ``listen_addresses`` to ``/etc/postgresql/9.3/main/postgresql.conf``
|
||||
RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf
|
||||
|
||||
# Expose the PostgreSQL port
|
||||
EXPOSE 5432
|
||||
|
||||
# Add VOLUMEs to allow backup of config, logs and databases
|
||||
VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]
|
||||
|
||||
# Set the default command to run when starting the container
|
||||
CMD ["/usr/lib/postgresql/9.3/bin/postgres", "-D", "/var/lib/postgresql/9.3/main", "-c", "config_file=/etc/postgresql/9.3/main/postgresql.conf"]
|
||||
15
README.md
15
README.md
@@ -1,4 +1,17 @@
|
||||
# web
|
||||
|
||||
|
||||
The purpose of this project is to build a web application that enables subscribing to notifications when new products are published on various ad based marketplaces. The MVP will be only based on OLX.ba
|
||||
The purpose of this project is to build a web application that enables subscribing to notifications when new products are published on various ad based marketplaces. The MVP will be only based on OLX.ba
|
||||
|
||||
Create postgres docker image
|
||||
docker build -t marketalerts .
|
||||
|
||||
Run postgres image with:
|
||||
docker run --name pg_test -d -p 5432:5432 marketalerts
|
||||
|
||||
Run migrations in app folder
|
||||
npx sequelize db:migrate
|
||||
|
||||
Run app with:
|
||||
$ npm install
|
||||
$ npm start
|
||||
|
||||
15
app/config/config.json
Normal file
15
app/config/config.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"development": {
|
||||
"username": "docker",
|
||||
"password": "docker",
|
||||
"database": "marketalerts",
|
||||
"port": "5432",
|
||||
"dialect": "postgres"
|
||||
},
|
||||
"test": {
|
||||
"use_env_variable": "JAWSDB_URL"
|
||||
},
|
||||
"production": {
|
||||
"use_env_variable": "JAWSDB_URL"
|
||||
}
|
||||
}
|
||||
27
app/controllers/city.js
Normal file
27
app/controllers/city.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const db = require('../models/index');
|
||||
const { currentRERequest } = require('../helpers/url');
|
||||
const { regions } = require('../helpers/codes');
|
||||
|
||||
const cities = regions();
|
||||
|
||||
|
||||
const getCity = (req,res) => {
|
||||
const nextStep = req.query.nextStep || '/';
|
||||
res.render('city', {
|
||||
nextStep,
|
||||
cities
|
||||
});
|
||||
}
|
||||
|
||||
const postCity = async (req, res) => {
|
||||
const request = await currentRERequest(req);
|
||||
const nextStep = req.query.nextStep || `/mjesto/${request.uniqueId}`;
|
||||
request.city = req.body.city;
|
||||
await request.save();
|
||||
res.redirect(nextStep)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getCity,
|
||||
postCity
|
||||
};
|
||||
25
app/controllers/neighborhoods.js
Normal file
25
app/controllers/neighborhoods.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const db = require('../models/index');
|
||||
const { currentRERequest } = require('../helpers/url');
|
||||
const { places } = require('../helpers/codes');
|
||||
|
||||
const getNeighborhood = async (req,res) => {
|
||||
let request = await currentRERequest(req);
|
||||
const neighborhoods = places(request.city);
|
||||
const nextStep = req.query.nextStep || '/';
|
||||
res.render('neighborhood', {
|
||||
nextStep,
|
||||
neighborhoods
|
||||
});
|
||||
}
|
||||
|
||||
const postgNeighborhood = async (req, res) => {
|
||||
let request = await currentRERequest(req);
|
||||
request.neighborhood = req.body.neighborhood;
|
||||
await request.save();
|
||||
res.send("Result is " + JSON.stringify(request));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getNeighborhood,
|
||||
postgNeighborhood
|
||||
};
|
||||
34
app/controllers/real_estate_types.js
Normal file
34
app/controllers/real_estate_types.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const db = require('../models/index');
|
||||
|
||||
const realEstateTypes = [
|
||||
{ ime: "Kuća", id: "kuca" },
|
||||
{ ime: "Stan", id: "stan" },
|
||||
{ ime: "Vikendica", id: "vikendica" }
|
||||
];
|
||||
|
||||
|
||||
const getRealEstateTypes = (req,res) => {
|
||||
const nextStep = req.query.nextStep;
|
||||
res.render('real_estate_type', {
|
||||
nextStep,
|
||||
realEstateTypes: realEstateTypes
|
||||
});
|
||||
}
|
||||
|
||||
const postRealEstateTypes = (req, res) => {
|
||||
let nextStep = req.query.nextStep;
|
||||
db.RealEstateRequest.create({
|
||||
realEstateType: req.body.realestatetype
|
||||
}).then( (result) => {
|
||||
nextStep = nextStep || `/grad/${result.uniqueId}`;
|
||||
res.redirect(nextStep);
|
||||
}).catch( (e) => {
|
||||
res.send(e);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getRealEstateTypes,
|
||||
postRealEstateTypes
|
||||
};
|
||||
7
app/controllers/welcome.js
Normal file
7
app/controllers/welcome.js
Normal file
@@ -0,0 +1,7 @@
|
||||
const getWelcome = (req,res) => {
|
||||
res.render('welcome', { nextStep: '/vrstanekretnine' } );
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getWelcome
|
||||
};
|
||||
893
app/helpers/codes.js
Normal file
893
app/helpers/codes.js
Normal file
@@ -0,0 +1,893 @@
|
||||
|
||||
|
||||
const geographies = [
|
||||
{
|
||||
"ime":" Sarajevo",
|
||||
"id":"sarajevo",
|
||||
"olxid": "9",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Hadžići",
|
||||
"id":"hadii",
|
||||
"olxid":"3817"
|
||||
},
|
||||
{
|
||||
"ime":"Ilidža",
|
||||
"id":"ilida",
|
||||
"olxid":"3879"
|
||||
},
|
||||
{
|
||||
"ime":"Ilijaš",
|
||||
"id":"ilija",
|
||||
"olxid":"3892"
|
||||
},
|
||||
{
|
||||
"ime":"Sarajevo - Centar",
|
||||
"id":"sarajevocentar",
|
||||
"olxid":"3812"
|
||||
},
|
||||
{
|
||||
"ime":"Sarajevo-Novi Grad",
|
||||
"id":"sarajevonovigrad",
|
||||
"olxid":"3969"
|
||||
},
|
||||
{
|
||||
"ime":"Sarajevo-Novo Sarajevo",
|
||||
"id":"sarajevonovosarajevo",
|
||||
"olxid":"5896"
|
||||
},
|
||||
{
|
||||
"ime":"Sarajevo-Stari Grad",
|
||||
"id":"sarajevostarigrad",
|
||||
"olxid":"4048"
|
||||
},
|
||||
{
|
||||
"ime":"Trnovo",
|
||||
"id":"trnovo",
|
||||
"olxid":"4063"
|
||||
},
|
||||
{
|
||||
"ime":"Vogošća",
|
||||
"id":"vogoa",
|
||||
"olxid":"4126"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ime":" Unsko-sanski",
|
||||
"id":"unskosanski",
|
||||
"olxid": "9",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Bihać",
|
||||
"id":"biha",
|
||||
"olxid":"75"
|
||||
},
|
||||
{
|
||||
"ime":"Bosanska Krupa",
|
||||
"id":"bosanskakrupa",
|
||||
"olxid":"373"
|
||||
},
|
||||
{
|
||||
"ime":"Bosanski Petrovac",
|
||||
"id":"bosanskipetrovac",
|
||||
"olxid":"504"
|
||||
},
|
||||
{
|
||||
"ime":"Bužim",
|
||||
"id":"buim",
|
||||
"olxid":"374"
|
||||
},
|
||||
{
|
||||
"ime":"Cazin",
|
||||
"id":"cazin",
|
||||
"olxid":"857"
|
||||
},
|
||||
{
|
||||
"ime":"Ključ",
|
||||
"id":"klju",
|
||||
"olxid":"2362"
|
||||
},
|
||||
{
|
||||
"ime":"Sanski Most",
|
||||
"id":"sanskimost",
|
||||
"olxid":"3738"
|
||||
},
|
||||
{
|
||||
"ime":"Velika Kladuša",
|
||||
"id":"velikakladua",
|
||||
"olxid":"5122"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ime":" Posavski",
|
||||
"id":"posavski",
|
||||
"olxid": "15",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Domaljevac",
|
||||
"id":"domaljevac",
|
||||
"olxid":"6144"
|
||||
},
|
||||
{
|
||||
"ime":"Odžak",
|
||||
"id":"odak",
|
||||
"olxid":"424"
|
||||
},
|
||||
{
|
||||
"ime":"Orašje",
|
||||
"id":"oraje",
|
||||
"olxid":"3252"
|
||||
},
|
||||
{
|
||||
"ime":"Šamac",
|
||||
"id":"amac",
|
||||
"olxid":"540"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ime":" Tuzlanski",
|
||||
"id":"tuzlanski",
|
||||
"olxid": "15",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Banovići",
|
||||
"id":"banovii",
|
||||
"olxid":"2"
|
||||
},
|
||||
{
|
||||
"ime":"Doboj-Istok",
|
||||
"id":"dobojistok",
|
||||
"olxid":"1090"
|
||||
},
|
||||
{
|
||||
"ime":"Gradačac",
|
||||
"id":"gradaac",
|
||||
"olxid":"1854"
|
||||
},
|
||||
{
|
||||
"ime":"Gračanica",
|
||||
"id":"graanica",
|
||||
"olxid":"1826"
|
||||
},
|
||||
{
|
||||
"ime":"Kalesija",
|
||||
"id":"kalesija",
|
||||
"olxid":"2129"
|
||||
},
|
||||
{
|
||||
"ime":"Kladanj",
|
||||
"id":"kladanj",
|
||||
"olxid":"2319"
|
||||
},
|
||||
{
|
||||
"ime":"Lukavac",
|
||||
"id":"lukavac",
|
||||
"olxid":"2840"
|
||||
},
|
||||
{
|
||||
"ime":"Sapna",
|
||||
"id":"sapna",
|
||||
"olxid":"5699"
|
||||
},
|
||||
{
|
||||
"ime":"Srebrenik",
|
||||
"id":"srebrenik",
|
||||
"olxid":"4391"
|
||||
},
|
||||
{
|
||||
"ime":"Teočak",
|
||||
"id":"teoak",
|
||||
"olxid":"5010"
|
||||
},
|
||||
{
|
||||
"ime":"Tuzla",
|
||||
"id":"tuzla",
|
||||
"olxid":"4944"
|
||||
},
|
||||
{
|
||||
"ime":"Čelić",
|
||||
"id":"eli",
|
||||
"olxid":"2801"
|
||||
},
|
||||
{
|
||||
"ime":"Živinice",
|
||||
"id":"ivinice",
|
||||
"olxid":"5774"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ime":" Zeničko-dobojski",
|
||||
"id":"zenickodobojski",
|
||||
"olxid": "15",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Breza",
|
||||
"id":"breza",
|
||||
"olxid":"704"
|
||||
},
|
||||
{
|
||||
"ime":"Doboj-Jug",
|
||||
"id":"dobojjug",
|
||||
"olxid":"1122"
|
||||
},
|
||||
{
|
||||
"ime":"Kakanj",
|
||||
"id":"kakanj",
|
||||
"olxid":"2022"
|
||||
},
|
||||
{
|
||||
"ime":"Maglaj",
|
||||
"id":"maglaj",
|
||||
"olxid":"2941"
|
||||
},
|
||||
{
|
||||
"ime":"Olovo",
|
||||
"id":"olovo",
|
||||
"olxid":"1925"
|
||||
},
|
||||
{
|
||||
"ime":"Tešanj",
|
||||
"id":"teanj",
|
||||
"olxid":"4594"
|
||||
},
|
||||
{
|
||||
"ime":"Usora",
|
||||
"id":"usora",
|
||||
"olxid":"1087"
|
||||
},
|
||||
{
|
||||
"ime":"Vareš",
|
||||
"id":"vare",
|
||||
"olxid":"5037"
|
||||
},
|
||||
{
|
||||
"ime":"Visoko",
|
||||
"id":"visoko",
|
||||
"olxid":"5171"
|
||||
},
|
||||
{
|
||||
"ime":"Zavidovići",
|
||||
"id":"zavidovii",
|
||||
"olxid":"5548"
|
||||
},
|
||||
{
|
||||
"ime":"Zenica",
|
||||
"id":"zenica",
|
||||
"olxid":"4571"
|
||||
},
|
||||
{
|
||||
"ime":"Žepče",
|
||||
"id":"epe",
|
||||
"olxid":"2940"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ime":" Bosansko-podrinjski",
|
||||
"id":"bosanskopodrinjski",
|
||||
"olxid": "15",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Foča",
|
||||
"id":"foa",
|
||||
"olxid":"1289"
|
||||
},
|
||||
{
|
||||
"ime":"Goražde",
|
||||
"id":"gorade",
|
||||
"olxid":"1588"
|
||||
},
|
||||
{
|
||||
"ime":"Pale",
|
||||
"id":"pale",
|
||||
"olxid":"3546"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ime":" Srednjobosanski",
|
||||
"id":"srednjobosanski",
|
||||
"olxid": "6",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Bugojno",
|
||||
"id":"bugojno",
|
||||
"olxid":"732"
|
||||
},
|
||||
{
|
||||
"ime":"Busovača",
|
||||
"id":"busovaa",
|
||||
"olxid":"810"
|
||||
},
|
||||
{
|
||||
"ime":"Dobretići",
|
||||
"id":"dobretii",
|
||||
"olxid":"4151"
|
||||
},
|
||||
{
|
||||
"ime":"Donji Vakuf",
|
||||
"id":"donjivakuf",
|
||||
"olxid":"1160"
|
||||
},
|
||||
{
|
||||
"ime":"Fojnica",
|
||||
"id":"fojnica",
|
||||
"olxid":"1407"
|
||||
},
|
||||
{
|
||||
"ime":"Gornji Vakuf - Uskoplje",
|
||||
"id":"gornjivakufuskoplje",
|
||||
"olxid":"1775"
|
||||
},
|
||||
{
|
||||
"ime":"Jajce",
|
||||
"id":"jajce",
|
||||
"olxid":"1960"
|
||||
},
|
||||
{
|
||||
"ime":"Kiseljak",
|
||||
"id":"kiseljak",
|
||||
"olxid":"2237"
|
||||
},
|
||||
{
|
||||
"ime":"Kreševo",
|
||||
"id":"kreevo",
|
||||
"olxid":"2608"
|
||||
},
|
||||
{
|
||||
"ime":"Novi Travnik",
|
||||
"id":"novitravnik",
|
||||
"olxid":"3477"
|
||||
},
|
||||
{
|
||||
"ime":"Travnik",
|
||||
"id":"travnik",
|
||||
"olxid":"4678"
|
||||
},
|
||||
{
|
||||
"ime":"Vitez",
|
||||
"id":"vitez",
|
||||
"olxid":"5422"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ime":" Hercegovačko-neretvanski",
|
||||
"id":"hercegovackoneretvanski",
|
||||
"olxid": "7",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Grad Mostar",
|
||||
"id":"gradmostar",
|
||||
"olxid":"3017"
|
||||
},
|
||||
{
|
||||
"ime":"Jablanica",
|
||||
"id":"jablanica",
|
||||
"olxid":"1930"
|
||||
},
|
||||
{
|
||||
"ime":"Konjic",
|
||||
"id":"konjic",
|
||||
"olxid":"2169"
|
||||
},
|
||||
{
|
||||
"ime":"Neum",
|
||||
"id":"neum",
|
||||
"olxid":"3111"
|
||||
},
|
||||
{
|
||||
"ime":"Prozor",
|
||||
"id":"prozor",
|
||||
"olxid":"3421"
|
||||
},
|
||||
{
|
||||
"ime":"Ravno",
|
||||
"id":"ravno",
|
||||
"olxid":"4769"
|
||||
},
|
||||
{
|
||||
"ime":"Stolac",
|
||||
"id":"stolac",
|
||||
"olxid":"4439"
|
||||
},
|
||||
{
|
||||
"ime":"Čapljina",
|
||||
"id":"apljina",
|
||||
"olxid":"947"
|
||||
},
|
||||
{
|
||||
"ime":"Čitluk",
|
||||
"id":"itluk",
|
||||
"olxid":"1009"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ime":" Zapadno-hercegovački",
|
||||
"id":"zapadnohercegovacki",
|
||||
"olxid": "8",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Grude",
|
||||
"id":"grude",
|
||||
"olxid":"1892"
|
||||
},
|
||||
{
|
||||
"ime":"Ljubuški",
|
||||
"id":"ljubuki",
|
||||
"olxid":"2905"
|
||||
},
|
||||
{
|
||||
"ime":"Posušje",
|
||||
"id":"posuje",
|
||||
"olxid":"3268"
|
||||
},
|
||||
{
|
||||
"ime":"Široki Brijeg",
|
||||
"id":"irokibrijeg",
|
||||
"olxid":"2708"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ime":" Livanjski",
|
||||
"id":"livanjski",
|
||||
"olxid": "10",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Bosansko Grahovo",
|
||||
"id":"bosanskograhovo",
|
||||
"olxid":"560"
|
||||
},
|
||||
{
|
||||
"ime":"Drvar",
|
||||
"id":"drvar",
|
||||
"olxid":"4640"
|
||||
},
|
||||
{
|
||||
"ime":"Glamoč",
|
||||
"id":"glamo",
|
||||
"olxid":"1533"
|
||||
},
|
||||
{
|
||||
"ime":"Kupres",
|
||||
"id":"kupres",
|
||||
"olxid":"2635"
|
||||
},
|
||||
{
|
||||
"ime":"Livno",
|
||||
"id":"livno",
|
||||
"olxid":"2741"
|
||||
},
|
||||
{
|
||||
"ime":"Tomislavgrad",
|
||||
"id":"tomislavgrad",
|
||||
"olxid":"1228"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ime":" Banjalučka",
|
||||
"id":"banjalučka",
|
||||
"olxid": "14",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Banja Luka",
|
||||
"id":"banjaluka",
|
||||
"olxid":"21"
|
||||
},
|
||||
{
|
||||
"ime":"Gradiška",
|
||||
"id":"gradika",
|
||||
"olxid":"305"
|
||||
},
|
||||
{
|
||||
"ime":"Istočni Drvar",
|
||||
"id":"istonidrvar",
|
||||
"olxid":"4662"
|
||||
},
|
||||
{
|
||||
"ime":"Jezero",
|
||||
"id":"jezero",
|
||||
"olxid":"1965"
|
||||
},
|
||||
{
|
||||
"ime":"Kneževo",
|
||||
"id":"kneevo",
|
||||
"olxid":"4147"
|
||||
},
|
||||
{
|
||||
"ime":"Kostajnica",
|
||||
"id":"kostajnica",
|
||||
"olxid":"6142"
|
||||
},
|
||||
{
|
||||
"ime":"Kotor Varoš",
|
||||
"id":"kotorvaro",
|
||||
"olxid":"2574"
|
||||
},
|
||||
{
|
||||
"ime":"Kozarska Dubica",
|
||||
"id":"kozarskadubica",
|
||||
"olxid":"244"
|
||||
},
|
||||
{
|
||||
"ime":"Krupa na uni",
|
||||
"id":"krupanauni",
|
||||
"olxid":"382"
|
||||
},
|
||||
{
|
||||
"ime":"Kupres ",
|
||||
"id":"kupres",
|
||||
"olxid":"2654"
|
||||
},
|
||||
{
|
||||
"ime":"Laktaši",
|
||||
"id":"laktai",
|
||||
"olxid":"2671"
|
||||
},
|
||||
{
|
||||
"ime":"Mrkonjić Grad",
|
||||
"id":"mrkonjigrad",
|
||||
"olxid":"3073"
|
||||
},
|
||||
{
|
||||
"ime":"Novi Grad",
|
||||
"id":"novigrad",
|
||||
"olxid":"444"
|
||||
},
|
||||
{
|
||||
"ime":"Oštra Luka",
|
||||
"id":"otraluka",
|
||||
"olxid":"3737"
|
||||
},
|
||||
{
|
||||
"ime":"Petrovac",
|
||||
"id":"petrovac",
|
||||
"olxid":"515"
|
||||
},
|
||||
{
|
||||
"ime":"Prijedor",
|
||||
"id":"prijedor",
|
||||
"olxid":"3287"
|
||||
},
|
||||
{
|
||||
"ime":"Prnjavor",
|
||||
"id":"prnjavor",
|
||||
"olxid":"3358"
|
||||
},
|
||||
{
|
||||
"ime":"Ribnik",
|
||||
"id":"ribnik",
|
||||
"olxid":"2365"
|
||||
},
|
||||
{
|
||||
"ime":"Srbac",
|
||||
"id":"srbac",
|
||||
"olxid":"4271"
|
||||
},
|
||||
{
|
||||
"ime":"Čelinac",
|
||||
"id":"elinac",
|
||||
"olxid":"979"
|
||||
},
|
||||
{
|
||||
"ime":"Šipovo",
|
||||
"id":"ipovo",
|
||||
"olxid":"4509"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ime":" Dobojsko-Bijeljinska",
|
||||
"id":"dobojskobijeljinska",
|
||||
"olxid": "15",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Bijeljina",
|
||||
"id":"bijeljina",
|
||||
"olxid":"123"
|
||||
},
|
||||
{
|
||||
"ime":"Bosanski Brod",
|
||||
"id":"bosanskibrod",
|
||||
"olxid":"421"
|
||||
},
|
||||
{
|
||||
"ime":"Derventa",
|
||||
"id":"derventa",
|
||||
"olxid":"1030"
|
||||
},
|
||||
{
|
||||
"ime":"Doboj",
|
||||
"id":"doboj",
|
||||
"olxid":"1088"
|
||||
},
|
||||
{
|
||||
"ime":"Donji Žabar",
|
||||
"id":"donjiabar",
|
||||
"olxid":"3254"
|
||||
},
|
||||
{
|
||||
"ime":"Lopare",
|
||||
"id":"lopare",
|
||||
"olxid":"2800"
|
||||
},
|
||||
{
|
||||
"ime":"Lukavac",
|
||||
"id":"lukavac",
|
||||
"olxid":"6029"
|
||||
},
|
||||
{
|
||||
"ime":"Modriča",
|
||||
"id":"modria",
|
||||
"olxid":"2996"
|
||||
},
|
||||
{
|
||||
"ime":"Pelagićevo",
|
||||
"id":"pelagievo",
|
||||
"olxid":"1856"
|
||||
},
|
||||
{
|
||||
"ime":"Petrovo",
|
||||
"id":"petrovo",
|
||||
"olxid":"1827"
|
||||
},
|
||||
{
|
||||
"ime":"Stanari",
|
||||
"id":"stanari",
|
||||
"olxid":"1148"
|
||||
},
|
||||
{
|
||||
"ime":"Teslić",
|
||||
"id":"tesli",
|
||||
"olxid":"4549"
|
||||
},
|
||||
{
|
||||
"ime":"Tešanj",
|
||||
"id":"teanj",
|
||||
"olxid":"4636"
|
||||
},
|
||||
{
|
||||
"ime":"Travnik",
|
||||
"id":"travnik",
|
||||
"olxid":"4692"
|
||||
},
|
||||
{
|
||||
"ime":"Tuzla",
|
||||
"id":"tuzla",
|
||||
"olxid":"4966"
|
||||
},
|
||||
{
|
||||
"ime":"Ugljevik",
|
||||
"id":"ugljevik",
|
||||
"olxid":"5009"
|
||||
},
|
||||
{
|
||||
"ime":"Vukosavlje",
|
||||
"id":"vukosavlje",
|
||||
"olxid":"3197"
|
||||
},
|
||||
{
|
||||
"ime":"Šamac",
|
||||
"id":"amac",
|
||||
"olxid":"539"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ime":" Sarajevsko-Zvornička",
|
||||
"id":"sarajevskozvornicka",
|
||||
"olxid": "16",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Bratunac",
|
||||
"id":"bratunac",
|
||||
"olxid":"595"
|
||||
},
|
||||
{
|
||||
"ime":"Han Pijesak",
|
||||
"id":"hanpijesak",
|
||||
"olxid":"1904"
|
||||
},
|
||||
{
|
||||
"ime":"Ilijaš",
|
||||
"id":"ilija",
|
||||
"olxid":"3947"
|
||||
},
|
||||
{
|
||||
"ime":"Istočni Stari Grad",
|
||||
"id":"istonistarigrad",
|
||||
"olxid":"4049"
|
||||
},
|
||||
{
|
||||
"ime":"Kasindo",
|
||||
"id":"kasindo",
|
||||
"olxid":"3880"
|
||||
},
|
||||
{
|
||||
"ime":"Kladanj",
|
||||
"id":"kladanj",
|
||||
"olxid":"2325"
|
||||
},
|
||||
{
|
||||
"ime":"Lukavica",
|
||||
"id":"lukavica",
|
||||
"olxid":"3971"
|
||||
},
|
||||
{
|
||||
"ime":"Milići",
|
||||
"id":"milii",
|
||||
"olxid":"6143"
|
||||
},
|
||||
{
|
||||
"ime":"Olovo",
|
||||
"id":"olovo",
|
||||
"olxid":"3221"
|
||||
},
|
||||
{
|
||||
"ime":"Osmaci",
|
||||
"id":"osmaci",
|
||||
"olxid":"2128"
|
||||
},
|
||||
{
|
||||
"ime":"Pale",
|
||||
"id":"pale",
|
||||
"olxid":"3978"
|
||||
},
|
||||
{
|
||||
"ime":"Rogatica",
|
||||
"id":"rogatica",
|
||||
"olxid":"3529"
|
||||
},
|
||||
{
|
||||
"ime":"Rudo",
|
||||
"id":"rudo",
|
||||
"olxid":"3648"
|
||||
},
|
||||
{
|
||||
"ime":"Sarajevo-Novi Grad",
|
||||
"id":"sarajevonovigrad",
|
||||
"olxid":"6069"
|
||||
},
|
||||
{
|
||||
"ime":"Sokolac",
|
||||
"id":"sokolac",
|
||||
"olxid":"4183"
|
||||
},
|
||||
{
|
||||
"ime":"Srebrenica",
|
||||
"id":"srebrenica",
|
||||
"olxid":"4310"
|
||||
},
|
||||
{
|
||||
"ime":"Trnovo",
|
||||
"id":"trnovo",
|
||||
"olxid":"4067"
|
||||
},
|
||||
{
|
||||
"ime":"Ustiprača",
|
||||
"id":"ustipraa",
|
||||
"olxid":"1593"
|
||||
},
|
||||
{
|
||||
"ime":"Višegrad",
|
||||
"id":"viegrad",
|
||||
"olxid":"5259"
|
||||
},
|
||||
{
|
||||
"ime":"Vlasenica",
|
||||
"id":"vlasenica",
|
||||
"olxid":"5456"
|
||||
},
|
||||
{
|
||||
"ime":"Zvornik",
|
||||
"id":"zvornik",
|
||||
"olxid":"5684"
|
||||
},
|
||||
{
|
||||
"ime":"Šekovići",
|
||||
"id":"ekovii",
|
||||
"olxid":"4475"
|
||||
},
|
||||
{
|
||||
"ime":"Žepa",
|
||||
"id":"epa",
|
||||
"olxid":"1906"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ime":" Trebinjsko-Fočanska",
|
||||
"id":"trebinjskofocanska",
|
||||
"olxid": "17",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Berkovići",
|
||||
"id":"berkovii",
|
||||
"olxid":"4441"
|
||||
},
|
||||
{
|
||||
"ime":"Bileća",
|
||||
"id":"bilea",
|
||||
"olxid":"183"
|
||||
},
|
||||
{
|
||||
"ime":"Foča",
|
||||
"id":"foa",
|
||||
"olxid":"1287"
|
||||
},
|
||||
{
|
||||
"ime":"Gacko",
|
||||
"id":"gacko",
|
||||
"olxid":"1462"
|
||||
},
|
||||
{
|
||||
"ime":"Istočni Mostar",
|
||||
"id":"istonimostar",
|
||||
"olxid":"3038"
|
||||
},
|
||||
{
|
||||
"ime":"Kalinovik",
|
||||
"id":"kalinovik",
|
||||
"olxid":"2164"
|
||||
},
|
||||
{
|
||||
"ime":"Ljubinje",
|
||||
"id":"ljubinje",
|
||||
"olxid":"2884"
|
||||
},
|
||||
{
|
||||
"ime":"Nevesinje",
|
||||
"id":"nevesinje",
|
||||
"olxid":"3138"
|
||||
},
|
||||
{
|
||||
"ime":"Trebinje",
|
||||
"id":"trebinje",
|
||||
"olxid":"4766"
|
||||
},
|
||||
{
|
||||
"ime":"Čajniče",
|
||||
"id":"ajnie",
|
||||
"olxid":"911"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ime":"Distrikt Brčko",
|
||||
"id":"distriktbrcko",
|
||||
"olxid": "12",
|
||||
"mjesta":[
|
||||
{
|
||||
"ime":"Brčko",
|
||||
"id":"brko",
|
||||
"olxid":"12"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
const regions = () => {
|
||||
return geographies.map( (g) => ({ ime: g.ime, id: g.id, olxid: g.olxid }) );
|
||||
}
|
||||
|
||||
const places = (regionId) => {
|
||||
for (geo of geographies) {
|
||||
if(geo.id === regionId) {
|
||||
return geo.mjesta;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
regions,
|
||||
places
|
||||
}
|
||||
13
app/helpers/url.js
Normal file
13
app/helpers/url.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const db = require('../models/index');
|
||||
|
||||
const currentRERequest = async (req) => {
|
||||
const uniqueId = req.params['request_id'];
|
||||
if(!uniqueId) return null;
|
||||
|
||||
const request = await db.RealEstateRequest.findOne({ where: {uniqueId} });
|
||||
return request;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
currentRERequest
|
||||
}
|
||||
34
app/migrations/20190417035319-create-market-alert.js
Normal file
34
app/migrations/20190417035319-create-market-alert.js
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
return queryInterface.createTable('MarketAlerts', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
type: Sequelize.INTEGER
|
||||
},
|
||||
olxUrl: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
lastDate: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
email: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
createdAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
},
|
||||
updatedAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
}
|
||||
});
|
||||
},
|
||||
down: (queryInterface, Sequelize) => {
|
||||
return queryInterface.dropTable('MarketAlerts');
|
||||
}
|
||||
};
|
||||
34
app/migrations/20190417035707-create-real-estate-request.js
Normal file
34
app/migrations/20190417035707-create-real-estate-request.js
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
return queryInterface.createTable('RealEstateRequests', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
type: Sequelize.INTEGER
|
||||
},
|
||||
uniqueId: {
|
||||
type: Sequelize.UUID
|
||||
},
|
||||
realEstateType: {
|
||||
type: Sequelize.ENUM,
|
||||
values: ['kuca','stan','vikendica','plac','poslovni_prostor','apartman','garaza']
|
||||
},
|
||||
email: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
createdAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
},
|
||||
updatedAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
}
|
||||
});
|
||||
},
|
||||
down: (queryInterface, Sequelize) => {
|
||||
return queryInterface.dropTable('RealEstateRequests');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
return queryInterface.addColumn(
|
||||
'RealEstateRequests',
|
||||
'city',
|
||||
Sequelize.STRING
|
||||
);
|
||||
},
|
||||
|
||||
down: (queryInterface, Sequelize) => {
|
||||
return queryInterface.removeColumn(
|
||||
'RealEstateRequests',
|
||||
'city'
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
return queryInterface.addColumn(
|
||||
'RealEstateRequests',
|
||||
'place',
|
||||
Sequelize.STRING
|
||||
);
|
||||
},
|
||||
|
||||
down: (queryInterface, Sequelize) => {
|
||||
return queryInterface.removeColumn(
|
||||
'RealEstateRequests',
|
||||
'place'
|
||||
);
|
||||
}
|
||||
};
|
||||
37
app/models/index.js
Normal file
37
app/models/index.js
Normal file
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const Sequelize = require('sequelize');
|
||||
const basename = path.basename(__filename);
|
||||
const env = process.env.NODE_ENV || 'development';
|
||||
const config = require(__dirname + '/../config/config.json')[env];
|
||||
const db = {};
|
||||
|
||||
let sequelize;
|
||||
if (config.use_env_variable) {
|
||||
sequelize = new Sequelize(process.env[config.use_env_variable], config);
|
||||
} else {
|
||||
sequelize = new Sequelize(config.database, config.username, config.password, config);
|
||||
}
|
||||
|
||||
fs
|
||||
.readdirSync(__dirname)
|
||||
.filter(file => {
|
||||
return (file.indexOf('.') !== 0) && (file !== basename) && (file.slice(-3) === '.js');
|
||||
})
|
||||
.forEach(file => {
|
||||
const model = sequelize['import'](path.join(__dirname, file));
|
||||
db[model.name] = model;
|
||||
});
|
||||
|
||||
Object.keys(db).forEach(modelName => {
|
||||
if (db[modelName].associate) {
|
||||
db[modelName].associate(db);
|
||||
}
|
||||
});
|
||||
|
||||
db.sequelize = sequelize;
|
||||
db.Sequelize = Sequelize;
|
||||
|
||||
module.exports = db;
|
||||
15
app/models/marketalert.js
Normal file
15
app/models/marketalert.js
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
const MarketAlert = sequelize.define('MarketAlert', {
|
||||
olxUrl: DataTypes.STRING,
|
||||
lastDate: DataTypes.STRING,
|
||||
email: {
|
||||
type: DataTypes.STRING,
|
||||
allowNul: false
|
||||
}
|
||||
}, {});
|
||||
MarketAlert.associate = function(models) {
|
||||
// associations can be defined here
|
||||
};
|
||||
return MarketAlert;
|
||||
};
|
||||
21
app/models/realestaterequest.js
Normal file
21
app/models/realestaterequest.js
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
const RealEstateRequest = sequelize.define('RealEstateRequest', {
|
||||
uniqueId: {
|
||||
type: DataTypes.UUID,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
allowNull: false
|
||||
},
|
||||
realEstateType: {
|
||||
type: DataTypes.ENUM,
|
||||
values: ['kuca','stan','vikendica','plac','poslovni_prostor','apartman','garaza']
|
||||
},
|
||||
email: DataTypes.STRING,
|
||||
city: DataTypes.STRING,
|
||||
place: DataTypes.STRING,
|
||||
}, {});
|
||||
RealEstateRequest.associate = function(models) {
|
||||
// associations can be defined here
|
||||
};
|
||||
return RealEstateRequest;
|
||||
};
|
||||
BIN
app/public/images/logo.png
Normal file
BIN
app/public/images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
11
app/public/main.css
Normal file
11
app/public/main.css
Normal file
@@ -0,0 +1,11 @@
|
||||
.welcome-center-button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.welcome-big-logo {
|
||||
font-size: 200pt;
|
||||
background-image: url(./images/logo.png);
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
31
app/views/city.ejs
Normal file
31
app/views/city.ejs
Normal file
@@ -0,0 +1,31 @@
|
||||
<div class="row center-align">
|
||||
<h2>U kojoj regiji tražite nekretninu?</h2>
|
||||
</div>
|
||||
|
||||
<form method="POST" id="form-city">
|
||||
<div class="row center-align">
|
||||
<ul class="collection with-header">
|
||||
<% for(const city of cities) { %>
|
||||
<li class="collection-item" >
|
||||
<div id="<%= city.id %>" ><%= city.ime %>
|
||||
<a href="#!" class="secondary-content">
|
||||
<i class="material-icons">send</i>
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<% } %>
|
||||
</ul>
|
||||
<input type="hidden" name="city" id="city" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(document).ready( () => {
|
||||
$(".collection-item").click( (e) => {
|
||||
const clickedId = $(e.target).attr("id");
|
||||
$("#city").val(clickedId);
|
||||
$("#form-city").submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
17
app/views/layout.ejs
Normal file
17
app/views/layout.ejs
Normal file
@@ -0,0 +1,17 @@
|
||||
<!doctype>
|
||||
<html>
|
||||
<head>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="stylesheet" href="/assets/main.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<%-body%>
|
||||
</div>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
31
app/views/neighborhood.ejs
Normal file
31
app/views/neighborhood.ejs
Normal file
@@ -0,0 +1,31 @@
|
||||
<div class="row center-align">
|
||||
<h2>U kojem mjestu tražite nekretninu?</h2>
|
||||
</div>
|
||||
|
||||
<form method="POST" id="form-neighborhood">
|
||||
<div class="row center-align">
|
||||
<ul class="collection with-header">
|
||||
<% for(const neighborhood of neighborhoods) { %>
|
||||
<li class="collection-item" >
|
||||
<div id="<%= neighborhood.id %>" ><%= neighborhood.ime %>
|
||||
<a href="#!" class="secondary-content">
|
||||
<i class="material-icons">send</i>
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<% } %>
|
||||
</ul>
|
||||
<input type="hidden" name="neighborhood" id="neighborhoods" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(document).ready( () => {
|
||||
$(".collection-item").click( (e) => {
|
||||
const clickedId = $(e.target).attr("id");
|
||||
$("#neighborhood").val(clickedId);
|
||||
$("#form-neighborhood").submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
35
app/views/real_estate_type.ejs
Normal file
35
app/views/real_estate_type.ejs
Normal file
@@ -0,0 +1,35 @@
|
||||
<div class="row center-align">
|
||||
<h2>Koju nekretninu tražite?</h2>
|
||||
</div>
|
||||
|
||||
<form method="POST" id="form-real-estate-type">
|
||||
<div class="row center-align">
|
||||
<ul class="collection with-header">
|
||||
<% for(const realEstatetype of realEstateTypes) { %>
|
||||
<li class="collection-item" >
|
||||
<div id="<%= realEstatetype.id %>" ><%= realEstatetype.ime %>
|
||||
<a href="#!" class="secondary-content">
|
||||
<i class="material-icons">send</i>
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<% } %>
|
||||
</ul>
|
||||
<input type="hidden" name="realestatetype" id="realestatetype" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(document).ready( () => {
|
||||
$(".collection-item").click( (e) => {
|
||||
const clickedId = $(e.target).attr("id");
|
||||
$("#realestatetype").val(clickedId);
|
||||
$("#form-real-estate-type").submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
17
app/views/welcome.ejs
Normal file
17
app/views/welcome.ejs
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
<!-- -->
|
||||
<div class="row center-align">
|
||||
<span class="welcome-big-logo">🤙</span>
|
||||
</div>
|
||||
<div class="row center-align">
|
||||
<div>Sve nekretnine dostupne u oglasima.</div>
|
||||
<div> Na vaš email. </div>
|
||||
<div> BESPLATNO </div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s6 push-s3">
|
||||
<a href="<%= nextStep %>" class="welcome-center-button waves-effect waves-light btn">
|
||||
Javi mi
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
19
backend/.env
19
backend/.env
@@ -1,19 +0,0 @@
|
||||
AWS_ENVIRONMENT=development
|
||||
AWS_ACCESS_KEY_ID=your_key
|
||||
AWS_SECRET_ACCESS_KEY=your_secret
|
||||
AWS_PROFILE=
|
||||
AWS_SESSION_TOKEN=
|
||||
AWS_ROLE_ARN=your_amazon_role
|
||||
AWS_REGION=us-east-1
|
||||
AWS_FUNCTION_NAME=
|
||||
AWS_HANDLER=index.handler
|
||||
AWS_MEMORY_SIZE=128
|
||||
AWS_TIMEOUT=3
|
||||
AWS_DESCRIPTION=
|
||||
AWS_RUNTIME=nodejs6.10
|
||||
AWS_VPC_SUBNETS=
|
||||
AWS_VPC_SECURITY_GROUPS=
|
||||
AWS_TRACING_CONFIG=
|
||||
AWS_LOGS_RETENTION_IN_DAYS=
|
||||
EXCLUDE_GLOBS="event.json"
|
||||
PACKAGE_DIRECTORY=build
|
||||
1
backend/.gitignore
vendored
1
backend/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
node_modules/
|
||||
@@ -1,17 +0,0 @@
|
||||
const Sequelize = require("sequelize");
|
||||
const sequelize = require("./db.js");
|
||||
const MarketAlert = sequelize.define("market_alert", {
|
||||
id: {
|
||||
type: Sequelize.INTEGER,
|
||||
autoIncrement: true,
|
||||
primaryKey: true
|
||||
},
|
||||
olx_url: Sequelize.STRING,
|
||||
last_date: Sequelize.STRING,
|
||||
email: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: false
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = MarketAlert;
|
||||
@@ -1,4 +0,0 @@
|
||||
# How to deploy automatically:
|
||||
|
||||
1. set up aws cli with aws configure
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{}
|
||||
@@ -1,4 +0,0 @@
|
||||
const Sequelize = require("sequelize");
|
||||
const sequelize = new Sequelize(process.env.JAWSDB_URL);
|
||||
|
||||
module.exports = sequelize;
|
||||
@@ -1 +0,0 @@
|
||||
SECRET_VARIABLE=mysecretval
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"key": "value",
|
||||
"key2": "value2",
|
||||
"other_key": "other_value"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
{
|
||||
"EventSourceMappings": [
|
||||
{
|
||||
"EventSourceArn": "your event source arn",
|
||||
"StartingPosition": "LATEST",
|
||||
"BatchSize": 100,
|
||||
"Enabled": true
|
||||
}
|
||||
],
|
||||
"ScheduleEvents": [
|
||||
{
|
||||
"ScheduleName": "node-lambda-test-schedule",
|
||||
"ScheduleState": "ENABLED",
|
||||
"ScheduleExpression": "rate(1 hour)",
|
||||
"Input":
|
||||
{
|
||||
"key1": "value",
|
||||
"key2": "value"
|
||||
}
|
||||
}
|
||||
],
|
||||
"S3Events": [{
|
||||
"Bucket": "BUCKET_NAME",
|
||||
"Events": [
|
||||
"s3:ObjectCreated:*"
|
||||
],
|
||||
"Filter": {
|
||||
"Key": {
|
||||
"FilterRules": [{
|
||||
"Name": "prefix",
|
||||
"Value": "STRING_VALUE"
|
||||
}]
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
23
frontend-react/.gitignore
vendored
23
frontend-react/.gitignore
vendored
@@ -1,23 +0,0 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
@@ -1,68 +0,0 @@
|
||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `npm start`
|
||||
|
||||
Runs the app in the development mode.<br>
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
||||
|
||||
The page will reload if you make edits.<br>
|
||||
You will also see any lint errors in the console.
|
||||
|
||||
### `npm test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.<br>
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `npm run build`
|
||||
|
||||
Builds the app for production to the `build` folder.<br>
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.<br>
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `npm run eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
||||
|
||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
||||
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
|
||||
|
||||
### `npm run build` fails to minify
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
|
||||
17025
frontend-react/package-lock.json
generated
17025
frontend-react/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,38 +0,0 @@
|
||||
{
|
||||
"name": "frontend-react",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@material-ui/core": "^3.9.0",
|
||||
"@material-ui/icons": "^3.0.2",
|
||||
"axios": "^0.18.0",
|
||||
"history": "^4.7.2",
|
||||
"prettier": "^1.15.3",
|
||||
"rc-slider": "^8.6.4",
|
||||
"react": "^16.7.0",
|
||||
"react-dom": "^16.7.0",
|
||||
"react-redux": "^6.0.0",
|
||||
"react-router-dom": "^4.3.1",
|
||||
"react-scripts": "^2.1.5",
|
||||
"react-select": "^2.2.0",
|
||||
"redux": "^4.0.1",
|
||||
"redux-devtools-extension": "^2.13.7",
|
||||
"redux-logger": "^3.0.6"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "NODE_PATH=src/ react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"proxy": "http://localhost:5000/",
|
||||
"browserslist": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not ie <= 11",
|
||||
"not op_mini all"
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB |
@@ -1,52 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, shrink-to-fit=no"
|
||||
/>
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is added to the
|
||||
homescreen on Android. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Roboto+Slab:400,700|Material+Icons"
|
||||
/>
|
||||
<link rel="stylesheet" href="./style.css" />
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="https://www.2checkout.com/checkout/api/2co.min.js"
|
||||
></script>
|
||||
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
html {
|
||||
font-family: Roboto, sans-serif;
|
||||
-ms-text-size-adjust: 100%;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
* {
|
||||
font-family: Roboto, serif;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
.radio-style {
|
||||
color: #e91e63 !important;
|
||||
}
|
||||
|
||||
.checkbox-style {
|
||||
color: #e91e63 !important;
|
||||
}
|
||||
.label-style {
|
||||
color: white;
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
import { drawerWidth, transition } from "./globalStyle";
|
||||
|
||||
const appStyle = theme => ({
|
||||
wrapper: {
|
||||
top: "0",
|
||||
display: "grid",
|
||||
minHeight: "750px",
|
||||
"grid-template-columns": `${drawerWidth}px 1fr`,
|
||||
"grid-template-areas": `"sidebar content"`,
|
||||
[theme.breakpoints.down("sm")]: {
|
||||
"grid-template-areas": `"sidebar" "content"`,
|
||||
"grid-template-columns": "1fr",
|
||||
"grid-template-rows": "auto 1fr"
|
||||
}
|
||||
},
|
||||
mainPanel: {
|
||||
...transition,
|
||||
overflowScrolling: "touch",
|
||||
"grid-area": "content",
|
||||
zIndex: "1",
|
||||
backgroundColor: "#272727",
|
||||
backgroundImage: "linear-gradient(180deg,#272727, #21525f)"
|
||||
},
|
||||
itemsCountTitle: {
|
||||
textAlign: 'center',
|
||||
color: 'white'
|
||||
}
|
||||
});
|
||||
|
||||
export default appStyle;
|
||||
@@ -1,42 +0,0 @@
|
||||
const drawerWidth = 360;
|
||||
|
||||
const transition = {
|
||||
transition: "all 0.33s cubic-bezier(0.685, 0.0473, 0.346, 1)"
|
||||
};
|
||||
|
||||
const boxShadow = {
|
||||
boxShadow:
|
||||
"0 10px 30px -12px rgba(0, 0, 0, 0.42), 0 4px 25px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.2)"
|
||||
};
|
||||
|
||||
const defaultFont = {
|
||||
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
||||
fontWeight: "300",
|
||||
lineHeight: "1.5em"
|
||||
};
|
||||
|
||||
const primaryColor = "#e91e63";
|
||||
|
||||
const primaryBoxShadow = {
|
||||
boxShadow:
|
||||
"0 4px 20px 0px rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(233, 30, 99, 0.4)"
|
||||
};
|
||||
|
||||
const defaultBoxShadow = {
|
||||
border: "0",
|
||||
borderRadius: "3px",
|
||||
boxShadow:
|
||||
"0 10px 20px -12px rgba(0, 0, 0, 0.42), 0 3px 20px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.2)",
|
||||
padding: "10px 0",
|
||||
transition: "all 150ms ease 0s"
|
||||
};
|
||||
|
||||
export {
|
||||
drawerWidth,
|
||||
transition,
|
||||
boxShadow,
|
||||
defaultFont,
|
||||
primaryColor,
|
||||
primaryBoxShadow,
|
||||
defaultBoxShadow
|
||||
};
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 272 KiB |
@@ -1,115 +0,0 @@
|
||||
const modalStyle = {
|
||||
modal: {
|
||||
borderRadius: "6px",
|
||||
backgroundColor: "#010000"
|
||||
},
|
||||
modalHeader: {
|
||||
borderBottom: "none",
|
||||
paddingTop: "24px",
|
||||
paddingRight: "24px",
|
||||
paddingBottom: "0",
|
||||
paddingLeft: "24px",
|
||||
minHeight: "16.43px",
|
||||
color: "white"
|
||||
},
|
||||
modalTitle: {
|
||||
margin: "0",
|
||||
lineHeight: "1.42857143"
|
||||
},
|
||||
modalCloseButton: {
|
||||
color: "white",
|
||||
marginTop: "-12px",
|
||||
WebkitAppearance: "none",
|
||||
padding: "0",
|
||||
cursor: "pointer",
|
||||
background: "0 0",
|
||||
border: "0",
|
||||
fontSize: "inherit",
|
||||
opacity: ".9",
|
||||
textShadow: "none",
|
||||
fontWeight: "700",
|
||||
lineHeight: "1",
|
||||
float: "right"
|
||||
},
|
||||
modalClose: {
|
||||
width: "16px",
|
||||
height: "16px"
|
||||
},
|
||||
modalBody: {
|
||||
paddingTop: "24px",
|
||||
paddingRight: "24px",
|
||||
paddingBottom: "16px",
|
||||
paddingLeft: "24px",
|
||||
position: "relative"
|
||||
},
|
||||
modalFooter: {
|
||||
padding: "15px",
|
||||
textAlign: "right",
|
||||
paddingTop: "0",
|
||||
margin: "0"
|
||||
},
|
||||
modalFooterCenter: {
|
||||
marginLeft: "auto",
|
||||
marginRight: "auto"
|
||||
},
|
||||
whiteText: {
|
||||
color: "white"
|
||||
},
|
||||
inputStyle: {
|
||||
color: "white",
|
||||
"&:after": {
|
||||
borderBottom: "1px solid #e91e63"
|
||||
}
|
||||
},
|
||||
saveButton: {
|
||||
backgroundColor: "#e91e63 !important",
|
||||
color: "white !important"
|
||||
},
|
||||
closeButton: {
|
||||
backgroundColor: "white",
|
||||
color: "#e91e63"
|
||||
},
|
||||
checkBoxStyle: {
|
||||
color: "#e91e63 !important"
|
||||
},
|
||||
tooltip: {
|
||||
padding: "10px 15px",
|
||||
minWidth: "130px",
|
||||
color: "#e91e63",
|
||||
lineHeight: "1.7em",
|
||||
background: "white",
|
||||
border: "none",
|
||||
borderRadius: "3px",
|
||||
boxShadow:
|
||||
"0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2)",
|
||||
maxWidth: "200px",
|
||||
textAlign: "center",
|
||||
fontFamily: '"Helvetica Neue",Helvetica,Arial,sans-serif',
|
||||
fontSize: "0.875em",
|
||||
fontStyle: "normal",
|
||||
fontWeight: "400",
|
||||
textShadow: "none",
|
||||
textTransform: "none",
|
||||
letterSpacing: "normal",
|
||||
wordBreak: "normal",
|
||||
wordSpacing: "normal",
|
||||
wordWrap: "normal",
|
||||
whiteSpace: "normal",
|
||||
lineBreak: "auto",
|
||||
zIndex: 5000
|
||||
},
|
||||
buttonStyle: {
|
||||
width: "150px",
|
||||
margin: "0 auto",
|
||||
position: "relative",
|
||||
borderRadius: "8px",
|
||||
display: "block",
|
||||
padding: "10px 10px",
|
||||
textAlign: "center",
|
||||
marginBottom: "20px",
|
||||
color: "white",
|
||||
backgroundColor: "#e91e63",
|
||||
border: "1px solid #e91e63"
|
||||
}
|
||||
};
|
||||
export default modalStyle;
|
||||
@@ -1,28 +0,0 @@
|
||||
.rc-slider-handle {
|
||||
border: solid 2px #e91e63 !important;
|
||||
}
|
||||
.rc-slider-handle:hover {
|
||||
border: solid 2px #e91e63 !important;
|
||||
}
|
||||
.rc-slider-rail {
|
||||
background-color: #e91e63 !important;
|
||||
width: 20px;
|
||||
}
|
||||
.rc-slider-track {
|
||||
background-color: grey !important;
|
||||
}
|
||||
.input-style:after {
|
||||
border-bottom: 1px solid #e91e63 !important;
|
||||
}
|
||||
.input-style {
|
||||
color: white !important;
|
||||
width: 80% !important;
|
||||
margin: 0 auto !important;
|
||||
position: relative !important;
|
||||
display: block !important;
|
||||
margin: 10px auto !important;
|
||||
}
|
||||
.rc-slider {
|
||||
width: 80% !important;
|
||||
margin: 0 auto !important;
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
import {
|
||||
boxShadow,
|
||||
defaultFont,
|
||||
primaryColor,
|
||||
primaryBoxShadow
|
||||
} from "./globalStyle";
|
||||
|
||||
const sidebarStyle = theme => ({
|
||||
drawerPaper: {
|
||||
border: "none",
|
||||
position: "relative",
|
||||
"overflow-y": "auto",
|
||||
"overflow-x": "none",
|
||||
zIndex: "1",
|
||||
...boxShadow,
|
||||
"grid-area": "sidebar",
|
||||
[theme.breakpoints.down("sm")]: {
|
||||
position: "relative"
|
||||
}
|
||||
},
|
||||
logo: {
|
||||
position: "relative",
|
||||
padding: "15px 15px",
|
||||
zIndex: "4",
|
||||
"&:after": {
|
||||
content: '""',
|
||||
position: "absolute",
|
||||
bottom: "0",
|
||||
|
||||
height: "1px",
|
||||
right: "15px",
|
||||
width: "calc(100% - 30px)",
|
||||
backgroundColor: "rgba(180, 180, 180, 0.3)"
|
||||
}
|
||||
},
|
||||
logoLink: {
|
||||
...defaultFont,
|
||||
textTransform: "uppercase",
|
||||
padding: "5px 0",
|
||||
display: "block",
|
||||
fontSize: "18px",
|
||||
textAlign: "left",
|
||||
fontWeight: "400",
|
||||
lineHeight: "30px",
|
||||
textDecoration: "none",
|
||||
backgroundColor: "transparent",
|
||||
"&,&:hover": {
|
||||
color: "#FFFFFF"
|
||||
}
|
||||
},
|
||||
logoImage: {
|
||||
width: "30px",
|
||||
display: "inline-block",
|
||||
maxHeight: "30px",
|
||||
marginLeft: "10px",
|
||||
marginRight: "15px"
|
||||
},
|
||||
img: {
|
||||
width: "35px",
|
||||
top: "22px",
|
||||
position: "absolute",
|
||||
verticalAlign: "middle",
|
||||
border: "0"
|
||||
},
|
||||
background: {
|
||||
position: "absolute",
|
||||
zIndex: "1",
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
display: "block",
|
||||
top: "0",
|
||||
left: "0",
|
||||
backgroundSize: "cover",
|
||||
backgroundPosition: "center center",
|
||||
"&:after": {
|
||||
position: "absolute",
|
||||
zIndex: "3",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
content: '""',
|
||||
display: "block",
|
||||
background: "#000",
|
||||
opacity: ".8"
|
||||
}
|
||||
},
|
||||
list: {
|
||||
marginTop: "20px",
|
||||
paddingLeft: "0",
|
||||
paddingTop: "0",
|
||||
paddingBottom: "0",
|
||||
marginBottom: "0",
|
||||
listStyle: "none",
|
||||
position: "unset"
|
||||
},
|
||||
item: {
|
||||
position: "relative",
|
||||
display: "block",
|
||||
textDecoration: "none",
|
||||
"&:hover,&:focus,&:visited,&": {
|
||||
color: "#FFFFFF"
|
||||
}
|
||||
},
|
||||
itemLink: {
|
||||
width: "auto",
|
||||
transition: "all 300ms linear",
|
||||
margin: "10px 15px 0",
|
||||
borderRadius: "3px",
|
||||
position: "relative",
|
||||
display: "block",
|
||||
padding: "10px 15px",
|
||||
backgroundColor: "transparent",
|
||||
...defaultFont
|
||||
},
|
||||
itemIcon: {
|
||||
width: "24px",
|
||||
height: "30px",
|
||||
fontSize: "24px",
|
||||
lineHeight: "30px",
|
||||
float: "left",
|
||||
marginRight: "15px",
|
||||
textAlign: "center",
|
||||
verticalAlign: "middle",
|
||||
color: "rgba(255, 255, 255, 0.8)"
|
||||
},
|
||||
itemText: {
|
||||
...defaultFont,
|
||||
margin: "0",
|
||||
lineHeight: "30px",
|
||||
fontSize: "14px",
|
||||
color: "#FFFFFF"
|
||||
},
|
||||
whiteFont: {
|
||||
color: "#FFFFFF"
|
||||
},
|
||||
|
||||
sidebarWrapper: {
|
||||
width: "360px",
|
||||
position: "relative",
|
||||
overflow: "auto",
|
||||
zIndex: "4",
|
||||
overflowScrolling: "touch"
|
||||
},
|
||||
whiteText: {
|
||||
zIndex: "5000",
|
||||
color: "white"
|
||||
},
|
||||
collapsedItemStyle: {
|
||||
zIndex: "5000",
|
||||
color: "white",
|
||||
"&:hover": {
|
||||
backgroundColor: primaryColor,
|
||||
color: "#FFFFFF",
|
||||
...primaryBoxShadow
|
||||
},
|
||||
cursor: "pointer"
|
||||
},
|
||||
collapse: {
|
||||
width: "80%",
|
||||
margin: "0 auto"
|
||||
},
|
||||
checkedItem: {
|
||||
backgroundColor: primaryColor,
|
||||
color: "#FFFFFF",
|
||||
...primaryBoxShadow
|
||||
},
|
||||
subOptionIndent: {
|
||||
paddingLeft: "20px"
|
||||
}
|
||||
});
|
||||
|
||||
export default sidebarStyle;
|
||||
@@ -1,104 +0,0 @@
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
import { connect } from "react-redux";
|
||||
import { ITEMS_CHANGED, USER_DATA_CHANGED } from "../constants/actionTypes";
|
||||
import { areObjectEqual } from "../utils/helpers";
|
||||
import { createOlxLink } from "../utils/createOlxLink";
|
||||
import axios from "axios";
|
||||
|
||||
import image from "../assets/img/sidebar-1.jpg";
|
||||
import logo from "../assets/img/reactlogo.png";
|
||||
|
||||
import Sidebar from "../components/Sidebar.js";
|
||||
import ItemsContainer from "./items/itemscontainer/ItemsContainer";
|
||||
import NotificationModal from "./NotificationModal";
|
||||
|
||||
import dashboardStyle from "../assets/dashboardStyle.js";
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
category: state.category,
|
||||
options: state.options,
|
||||
subcategory: state.subcategory,
|
||||
items: state.items,
|
||||
userdata: state.userdata
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
onItemsChanged: items => dispatch({ type: ITEMS_CHANGED, items }),
|
||||
onUserDataChange: change => dispatch({ type: USER_DATA_CHANGED, ...change })
|
||||
});
|
||||
|
||||
let lastUpdateTime = null;
|
||||
let interval = null;
|
||||
class App extends React.Component {
|
||||
componentDidMount() {
|
||||
interval = setInterval(() => {
|
||||
if (lastUpdateTime && Date.now() - lastUpdateTime > 2000) {
|
||||
const {
|
||||
category,
|
||||
options,
|
||||
subcategory,
|
||||
onItemsChanged,
|
||||
onUserDataChange
|
||||
} = this.props;
|
||||
let url = createOlxLink(category, subcategory, options);
|
||||
url = encodeURI(url);
|
||||
onUserDataChange({ info: "olx_url", value: url });
|
||||
if (url) {
|
||||
axios
|
||||
.get(`/items/${url}`)
|
||||
.then(response => {
|
||||
onItemsChanged(response.data.items);
|
||||
onUserDataChange({
|
||||
info: "last_date",
|
||||
value: response.data.last_date
|
||||
});
|
||||
})
|
||||
.catch(error => console.log(error));
|
||||
}
|
||||
lastUpdateTime = null;
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
clearInterval(interval);
|
||||
}
|
||||
componentWillReceiveProps(newProps) {
|
||||
const { subcategory, category, options } = this.props;
|
||||
if (
|
||||
newProps.subcategory !== subcategory ||
|
||||
newProps.category !== category ||
|
||||
!areObjectEqual(newProps.options, options)
|
||||
) {
|
||||
lastUpdateTime = Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { items, classes } = this.props;
|
||||
|
||||
return (
|
||||
<div className={classes.wrapper}>
|
||||
<Sidebar logoText={"Market Alarm"} logo={logo} image={image} />
|
||||
<div className={classes.mainPanel}>
|
||||
{items.length && <h3 className={classes.itemsCountTitle}>Pronađeno {items.length} nekretnina. Napravite notifikaciju i primite vise detalja na vas emailu adresu.</h3>}
|
||||
{items.length ? <NotificationModal /> : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
App.propTypes = {
|
||||
classes: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default withStyles(dashboardStyle)(
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(App)
|
||||
);
|
||||
@@ -1,211 +0,0 @@
|
||||
import React from "react";
|
||||
import Dialog from "@material-ui/core/Dialog";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import Slide from "@material-ui/core/Slide";
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
import { notificationmodalwrapper } from "../utils/notificationmodalwrapper";
|
||||
import modalStyle from "../assets/modalStyle.js";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import Close from "@material-ui/icons/Close";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import axios from "axios";
|
||||
|
||||
function Transition(props) {
|
||||
return <Slide direction="down" {...props} />;
|
||||
}
|
||||
|
||||
let token = "";
|
||||
class NotificationModal extends React.Component {
|
||||
componentDidMount() {
|
||||
console.log("load sandbox");
|
||||
window.TCO.loadPubKey("sandbox");
|
||||
}
|
||||
handleOpen = () => {
|
||||
this.props.onModalOpen();
|
||||
};
|
||||
handleClose = () => {
|
||||
this.props.onModalClose();
|
||||
};
|
||||
|
||||
checkEmail = email =>
|
||||
/^(([^<>()[\]\\.,;:\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,}))$/.test(
|
||||
email
|
||||
);
|
||||
|
||||
handleEmail = e => {
|
||||
this.props.onUserDataChange({ info: "email", value: e.target.value });
|
||||
this.props.onUserDataChange({
|
||||
info: "validEmail",
|
||||
value: this.checkEmail(e.target.value)
|
||||
});
|
||||
};
|
||||
|
||||
handleInput = (e, infoName) => {
|
||||
this.props.onUserDataChange({ info: infoName, value: e.target.value });
|
||||
};
|
||||
|
||||
isChecked = optionName => Boolean(this.props.userdata[optionName]);
|
||||
|
||||
optionChange = optionName => {
|
||||
const { userdata } = this.props;
|
||||
this.props.onUserDataChange({
|
||||
info: optionName,
|
||||
value: !userdata[optionName]
|
||||
});
|
||||
};
|
||||
|
||||
successCallback = data => {
|
||||
//token = data.response.token.token;
|
||||
const {
|
||||
userdata: { email, last_date, olx_url }
|
||||
} = this.props;
|
||||
|
||||
axios
|
||||
.post("/marketalerts", {
|
||||
email,
|
||||
last_date,
|
||||
olx_url
|
||||
})
|
||||
.then(response => {
|
||||
this.handleClose();
|
||||
alert("Market Alert Created");
|
||||
})
|
||||
.catch(error => console.log(error));
|
||||
};
|
||||
|
||||
errorCallback = data => {
|
||||
if (data.errorCode === 200) {
|
||||
this.tokenRequest();
|
||||
} else {
|
||||
alert(data.errorMsg);
|
||||
}
|
||||
};
|
||||
|
||||
tokenRequest = () => {
|
||||
const {
|
||||
userdata: { ccNo, expYear, expMonth, cvv }
|
||||
} = this.props;
|
||||
const sellerId = "901402692";
|
||||
const publishableKey = "93546B8D-B726-4376-A6DF-F698FD8893CA";
|
||||
var args = {
|
||||
sellerId,
|
||||
publishableKey,
|
||||
ccNo,
|
||||
cvv,
|
||||
expMonth,
|
||||
expYear
|
||||
};
|
||||
window.TCO.requestToken(this.successCallback, this.errorCallback, args);
|
||||
};
|
||||
|
||||
handleSaveMarketAlert = () => {
|
||||
this.successCallback();
|
||||
//this.tokenRequest();
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
modal,
|
||||
classes,
|
||||
userdata: { validEmail }
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<button className={classes.buttonStyle} onClick={this.handleOpen}>
|
||||
Napravi notifikaciju
|
||||
</button>
|
||||
<Dialog
|
||||
classes={{
|
||||
root: classes.center,
|
||||
paper: classes.modal
|
||||
}}
|
||||
open={modal}
|
||||
TransitionComponent={Transition}
|
||||
keepMounted
|
||||
onClose={() => this.handleClose()}
|
||||
aria-labelledby="classic-modal-slide-title"
|
||||
aria-describedby="classic-modal-slide-description"
|
||||
>
|
||||
<DialogTitle
|
||||
id="classic-modal-slide-title"
|
||||
disableTypography
|
||||
className={classes.modalHeader}
|
||||
>
|
||||
<IconButton
|
||||
className={classes.modalCloseButton}
|
||||
key="close"
|
||||
aria-label="Close"
|
||||
color="inherit"
|
||||
onClick={() => this.handleClose()}
|
||||
>
|
||||
<Close className={classes.modalClose} />
|
||||
</IconButton>
|
||||
<h4 className={classes.modalTitle}>Save Market Alert</h4>
|
||||
</DialogTitle>
|
||||
<DialogContent
|
||||
id="classic-modal-slide-description"
|
||||
className={classes.modalBody}
|
||||
>
|
||||
<div>
|
||||
<Input
|
||||
className={classes.inputStyle}
|
||||
placeholder="Email"
|
||||
inputProps={{
|
||||
"aria-label": "Email"
|
||||
}}
|
||||
type="email"
|
||||
onChange={this.handleEmail}
|
||||
/>
|
||||
<Input
|
||||
className={classes.inputStyle}
|
||||
type="hidden"
|
||||
value={token}
|
||||
/>
|
||||
</div>
|
||||
</DialogContent>
|
||||
<DialogActions className={classes.modalFooter}>
|
||||
{validEmail ? (
|
||||
<Button
|
||||
onClick={this.handleSaveMarketAlert}
|
||||
className={classes.saveButton}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
) : (
|
||||
<Tooltip
|
||||
title="Provide a valid email"
|
||||
placement="top"
|
||||
classes={{ tooltip: classes.tooltip }}
|
||||
>
|
||||
<div>
|
||||
<Button disabled className={classes.saveButton}>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
<Button
|
||||
className={classes.closeButton}
|
||||
onClick={() => this.handleClose()}
|
||||
>
|
||||
Close
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default withStyles(modalStyle)(
|
||||
notificationmodalwrapper(NotificationModal)
|
||||
);
|
||||
@@ -1,116 +0,0 @@
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
import List from "@material-ui/core/List";
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import ListItemIcon from "@material-ui/core/ListItemIcon";
|
||||
import ListItemText from "@material-ui/core/ListItemText";
|
||||
import Dashboard from "@material-ui/icons/Dashboard";
|
||||
import ExpandLess from "@material-ui/icons/ExpandLess";
|
||||
import ExpandMore from "@material-ui/icons/ExpandMore";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import StarBorder from "@material-ui/icons/StarBorder";
|
||||
|
||||
import sidebarStyle from "../assets/sidebarStyle.js";
|
||||
import CollapseWrapperStyled from "../components/widgets/CollapseWrapperStyled";
|
||||
import DeepCategoryWrapper from "./widgets/DeepCategoryWrapper";
|
||||
import { hoc } from "../utils/helpers";
|
||||
|
||||
import * as Nekretnine from "./categories/Nekretnine";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { CATEGORY_SELECT } from "../constants/actionTypes";
|
||||
|
||||
const options = [
|
||||
{ value: "Nekretnine", label: "Nekretnine" }
|
||||
];
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
category: state.category
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
onCategoryChanged: option => dispatch({ type: CATEGORY_SELECT, option })
|
||||
});
|
||||
|
||||
class Sidebar extends React.Component {
|
||||
handleCategoryChange = selectedOption => {
|
||||
this.props.onCategoryChanged(selectedOption);
|
||||
};
|
||||
render() {
|
||||
const { classes, logo, image, logoText, category } = this.props;
|
||||
|
||||
return (
|
||||
<div className={classes.drawerPaper}>
|
||||
<div className={classes.logo}>
|
||||
<a href="https://www.creative-tim.com" className={classes.logoLink}>
|
||||
<div className={classes.logoImage}>
|
||||
<img src={logo} alt="logo" className={classes.img} />
|
||||
</div>
|
||||
{logoText}
|
||||
</a>
|
||||
</div>
|
||||
<div className={classes.sidebarWrapper}>
|
||||
<List role="menu">
|
||||
<Collapse in={true} timeout="auto" unmountOnExit>
|
||||
<List disablePadding>
|
||||
{options.map(({ label, value }, index) => (
|
||||
<ListItem
|
||||
onClick={() => this.handleCategoryChange({ label, value })}
|
||||
className={
|
||||
classes.nested +
|
||||
" " +
|
||||
classes.collapsedItemStyle +
|
||||
" " +
|
||||
(category && category.value === value
|
||||
? classes.checkedItem
|
||||
: "")
|
||||
}
|
||||
key={index}
|
||||
>
|
||||
<ListItemIcon className={classes.whiteText}>
|
||||
<StarBorder />
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
className={classes.whiteText}
|
||||
primary={label}
|
||||
disableTypography={true}
|
||||
/>
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
</Collapse>
|
||||
|
||||
{hoc(category && category.value, {
|
||||
Nekretnine: (
|
||||
<CollapseWrapperStyled componentName="Podkategorija">
|
||||
<DeepCategoryWrapper {...Nekretnine.properties} />
|
||||
</CollapseWrapperStyled>
|
||||
)
|
||||
})}
|
||||
</List>
|
||||
</div>
|
||||
{image !== undefined ? (
|
||||
<div
|
||||
className={classes.background}
|
||||
style={{ backgroundImage: "url(" + image + ")" }}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Sidebar.propTypes = {
|
||||
classes: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default withStyles(sidebarStyle)(
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(Sidebar)
|
||||
);
|
||||
@@ -1,17 +0,0 @@
|
||||
import React from "react";
|
||||
|
||||
import Stanovi from "../subcategories/nekretnine/Stanovi";
|
||||
import Kuce from "../subcategories/nekretnine/Kuce";
|
||||
|
||||
const options = [{ value: 23, label: "Stanovi" }, { value: 24, label: "Kuce" }];
|
||||
const depth = 0;
|
||||
const childrenComponents = {
|
||||
23: <Stanovi />,
|
||||
24: <Kuce />
|
||||
};
|
||||
|
||||
export const properties = {
|
||||
options,
|
||||
depth,
|
||||
childrenComponents
|
||||
};
|
||||
@@ -1,234 +0,0 @@
|
||||
// Kanton/Regija
|
||||
export const lokacijaOptions = {
|
||||
choices: [
|
||||
{ value: "9", label: "Sarajevo" },
|
||||
{ value: "2", label: "Posavski" }
|
||||
],
|
||||
value: "kanton",
|
||||
optionName: "kanton"
|
||||
};
|
||||
|
||||
// Grad
|
||||
export const gradoviOptions = {
|
||||
parentOptionName: "kanton",
|
||||
checkboxOptions: {
|
||||
"9": {
|
||||
elements: [
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Ilidza",
|
||||
optionName: "grad-ilidza",
|
||||
value: "3879"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Sarajevo-Centar",
|
||||
optionName: "grad-centar",
|
||||
value: "3812"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Hadzici",
|
||||
optionName: "grad-hadzici",
|
||||
value: "3817"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Ilijas",
|
||||
optionName: "grad-ilijas",
|
||||
value: "3892"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Sarajevo-Novi Grad",
|
||||
optionName: "grad-novigrad",
|
||||
value: "3969"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Sarajevo-Novo Sarajevo",
|
||||
optionName: "grad-novosarajevo",
|
||||
value: "5896"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Cijena
|
||||
export const cijenaRangeOptions = {
|
||||
min: 0,
|
||||
max: 100000,
|
||||
defaultValues: [0, 100000],
|
||||
step: 100,
|
||||
optionNames: ["od", "do"]
|
||||
};
|
||||
|
||||
// Stanje
|
||||
export const stanjeElements = [
|
||||
{
|
||||
type: "radio",
|
||||
value: 0,
|
||||
name: "Sve",
|
||||
optionName: "stanje"
|
||||
},
|
||||
{
|
||||
type: "radio",
|
||||
value: 1,
|
||||
name: "Novo",
|
||||
optionName: "stanje"
|
||||
},
|
||||
{
|
||||
type: "radio",
|
||||
value: 2,
|
||||
name: "Koristeno",
|
||||
optionName: "stanje"
|
||||
}
|
||||
];
|
||||
|
||||
// Vrsta Artikla
|
||||
export const vrstaElements = [
|
||||
{
|
||||
value: "",
|
||||
name: "Sve",
|
||||
type: "radio",
|
||||
optionName: "vrsta"
|
||||
},
|
||||
{
|
||||
value: "samoprodaja",
|
||||
name: "Prodaja",
|
||||
type: "radio",
|
||||
optionName: "vrsta"
|
||||
},
|
||||
{
|
||||
value: "samoizdavanje",
|
||||
name: "Iznajmljivanje",
|
||||
type: "radio",
|
||||
optionName: "vrsta"
|
||||
},
|
||||
{
|
||||
value: "samopotraznja",
|
||||
name: "Potražnja",
|
||||
type: "radio",
|
||||
optionName: "vrsta"
|
||||
}
|
||||
];
|
||||
|
||||
// Kvadrata
|
||||
export const velicinaRangeOptions = {
|
||||
min: 0,
|
||||
max: 1000,
|
||||
defaultValues: [0, new Date().getFullYear()],
|
||||
step: 1,
|
||||
optionNames: ["kvadrata_min", "kvadrata_max"]
|
||||
};
|
||||
|
||||
// Dodatno za kucu
|
||||
export const kucaElements = [
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Uknjizeno",
|
||||
optionName: "uknjizeno-zk_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Namjesteno",
|
||||
optionName: "namjestena_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Nedavno adaptirano",
|
||||
optionName: "nedavno-adaptirana_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Garaza",
|
||||
optionName: "gara-a_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Balkon",
|
||||
optionName: "balkon_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Voda",
|
||||
optionName: "voda_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Plin",
|
||||
optionName: "plin_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Bazen",
|
||||
optionName: "bazen_checkbox",
|
||||
value: "on"
|
||||
}
|
||||
];
|
||||
|
||||
// Dodatno za stan
|
||||
export const stanElements = [
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Novogradnja",
|
||||
optionName: "novogradnja_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Namjesten",
|
||||
optionName: "namjesten_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Nedavno adaptiran",
|
||||
optionName: "nedavno-adaptiran_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Uknjizeno",
|
||||
optionName: "uknjizeno-zk_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Lift",
|
||||
optionName: "lift_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Balkon",
|
||||
optionName: "balkon_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Parking",
|
||||
optionName: "parking_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Plin",
|
||||
optionName: "plin_checkbox",
|
||||
value: "on"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "kablovska",
|
||||
optionName: "kablovska-tv_checkbox",
|
||||
value: "on"
|
||||
}
|
||||
];
|
||||
@@ -1,72 +0,0 @@
|
||||
import React from "react";
|
||||
import * as Filters from "./AllFiltersDefined";
|
||||
import CheckboxAndRadioWrapper from "../../widgets/CheckboxAndRadioWrapper";
|
||||
import SelectDisplayCheckboxWrapper from "../../widgets/SelectDisplayCheckboxWrapper";
|
||||
import RangeWrapper from "../../widgets/RangeWrapper";
|
||||
import DropDownWrapper from "../../widgets/DropDownWrapper";
|
||||
|
||||
const Kanton = (
|
||||
<DropDownWrapper componentName="Lokacija" {...Filters.lokacijaOptions} />
|
||||
);
|
||||
|
||||
const Grad = (
|
||||
<SelectDisplayCheckboxWrapper
|
||||
componentName="Grad"
|
||||
{...Filters.gradoviOptions}
|
||||
/>
|
||||
);
|
||||
|
||||
const Cijena = (
|
||||
<RangeWrapper
|
||||
componentName="Cijena"
|
||||
{...Filters.cijenaRangeOptions}
|
||||
optionName="cijena"
|
||||
/>
|
||||
);
|
||||
|
||||
const Stanje = (
|
||||
<CheckboxAndRadioWrapper
|
||||
componentName="Stanje"
|
||||
elements={Filters.stanjeElements}
|
||||
/>
|
||||
);
|
||||
|
||||
const Vrsta = (
|
||||
<CheckboxAndRadioWrapper
|
||||
componentName="Vrsta"
|
||||
elements={Filters.vrstaElements}
|
||||
/>
|
||||
);
|
||||
|
||||
const Kvadratura = (
|
||||
<RangeWrapper
|
||||
componentName="Velicina"
|
||||
{...Filters.velicinaRangeOptions}
|
||||
optionName="velicina"
|
||||
/>
|
||||
);
|
||||
|
||||
const DodatnoZaStan = (
|
||||
<CheckboxAndRadioWrapper
|
||||
componentName="dodatno-za-stan"
|
||||
elements={Filters.stanElements}
|
||||
/>
|
||||
);
|
||||
|
||||
const DodatnoZaKucu = (
|
||||
<CheckboxAndRadioWrapper
|
||||
componentName="dodatno-za-kucu"
|
||||
elements={Filters.kucaElements}
|
||||
/>
|
||||
);
|
||||
|
||||
export {
|
||||
Kanton,
|
||||
Grad,
|
||||
Cijena,
|
||||
Stanje,
|
||||
Vrsta,
|
||||
Kvadratura,
|
||||
DodatnoZaStan,
|
||||
DodatnoZaKucu
|
||||
};
|
||||
@@ -1,188 +0,0 @@
|
||||
// Proizvodac
|
||||
export const proizvodacOptions = {
|
||||
choices: [{ value: "1900", label: "Audi" }, { value: "9000", label: "Ford" }],
|
||||
value: "v_b",
|
||||
optionName: "v_b"
|
||||
};
|
||||
|
||||
// Kanton/Regija
|
||||
export const lokacijaOptions = {
|
||||
choices: [
|
||||
{ value: "9", label: "Sarajevo" },
|
||||
{ value: "2", label: "Posavski" }
|
||||
],
|
||||
value: "kanton",
|
||||
optionName: "kanton"
|
||||
};
|
||||
|
||||
// Grad
|
||||
export const gradoviOptions = {
|
||||
parentOptionName: "kanton",
|
||||
checkboxOptions: {
|
||||
"9": {
|
||||
elements: [
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Ilidza",
|
||||
optionName: "grad-ilidza",
|
||||
value: "3879"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Sarajevo-Centar",
|
||||
optionName: "grad-centar",
|
||||
value: "3812"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Hadzici",
|
||||
optionName: "grad-hadzici",
|
||||
value: "3817"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Ilijas",
|
||||
optionName: "grad-ilijas",
|
||||
value: "3892"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Sarajevo-Novi Grad",
|
||||
optionName: "grad-novigrad",
|
||||
value: "3969"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Sarajevo-Novo Sarajevo",
|
||||
optionName: "grad-novosarajevo",
|
||||
value: "5896"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Cijena
|
||||
export const cijenaRangeOptions = {
|
||||
min: 0,
|
||||
max: 100000,
|
||||
defaultValues: [0, 100000],
|
||||
step: 100,
|
||||
optionNames: ["od", "do"]
|
||||
};
|
||||
|
||||
// Stanje
|
||||
export const stanjeElements = [
|
||||
{
|
||||
type: "radio",
|
||||
value: "",
|
||||
name: "Nova i polovna vozila",
|
||||
optionName: "stanje"
|
||||
},
|
||||
{
|
||||
type: "radio",
|
||||
value: 1,
|
||||
name: "Nova",
|
||||
optionName: "stanje"
|
||||
},
|
||||
{
|
||||
type: "radio",
|
||||
value: 2,
|
||||
name: "Polovna vozila",
|
||||
optionName: "stanje"
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "Udarena vozila",
|
||||
optionName: "udaren_checkbox",
|
||||
value: "on"
|
||||
}
|
||||
];
|
||||
|
||||
// Vrsta Artikla
|
||||
export const vrstaElements = [
|
||||
{
|
||||
value: "",
|
||||
name: "Sve",
|
||||
type: "radio",
|
||||
optionName: "vrsta"
|
||||
},
|
||||
{
|
||||
value: "samoprodaja",
|
||||
name: "Prodaja",
|
||||
type: "radio",
|
||||
optionName: "vrsta"
|
||||
},
|
||||
{
|
||||
value: "samoizdavanje",
|
||||
name: "Iznajmljivanje",
|
||||
type: "radio",
|
||||
optionName: "vrsta"
|
||||
},
|
||||
{
|
||||
value: "samopotraznja",
|
||||
name: "Potražnja",
|
||||
type: "radio",
|
||||
optionName: "vrsta"
|
||||
}
|
||||
];
|
||||
|
||||
// Godiste
|
||||
export const godisteRangeOptions = {
|
||||
min: 1960,
|
||||
max: new Date().getFullYear(),
|
||||
defaultValues: [1960, new Date().getFullYear()],
|
||||
step: 1,
|
||||
optionNames: ["godiste_min", "godiste_max"]
|
||||
};
|
||||
|
||||
// Kilometraza
|
||||
export const kilometrazaOptions = {
|
||||
kilometraMin: {
|
||||
choices: [{ value: 5000, label: "5000" }, { value: 10000, label: "10000" }],
|
||||
value: "kilometra-a_min",
|
||||
optionName: "kilometra-a_min"
|
||||
},
|
||||
kilometraMax: {
|
||||
choices: [
|
||||
{ value: 15000, label: "15000" },
|
||||
{ value: 200000, label: "200000" }
|
||||
],
|
||||
value: "kilometra-a_max",
|
||||
optionName: "kilometra-a_max"
|
||||
}
|
||||
};
|
||||
|
||||
// Gorivo
|
||||
export const gorivoElements = [
|
||||
{
|
||||
name: "Dizel",
|
||||
optionName: "gorivo_select_dizel",
|
||||
type: "checkbox",
|
||||
value: "Dizel"
|
||||
},
|
||||
{
|
||||
name: "Benzin",
|
||||
optionName: "gorivo_select_benzin",
|
||||
type: "checkbox",
|
||||
value: "Benzin"
|
||||
},
|
||||
{
|
||||
name: "Plin",
|
||||
optionName: "gorivo_select_plin",
|
||||
type: "checkbox",
|
||||
value: "Plin"
|
||||
},
|
||||
{
|
||||
name: "Hibrid",
|
||||
optionName: "gorivo_select_hibrid",
|
||||
type: "checkbox",
|
||||
value: "Hibrid"
|
||||
},
|
||||
{
|
||||
name: "Elektro",
|
||||
optionName: "gorivo_select_elektro",
|
||||
type: "checkbox",
|
||||
value: "Elektro"
|
||||
}
|
||||
];
|
||||
@@ -1,81 +0,0 @@
|
||||
import React from "react";
|
||||
import * as Filters from "./AllFiltersDefined";
|
||||
import CheckboxAndRadioWrapper from "components/widgets/CheckboxAndRadioWrapper";
|
||||
import SelectDisplayCheckboxWrapper from "components/widgets/SelectDisplayCheckboxWrapper";
|
||||
import RangeWrapper from "components/widgets/RangeWrapper";
|
||||
import DropDownWrapper from "components/widgets/DropDownWrapper";
|
||||
|
||||
const Proizvodac = (
|
||||
<DropDownWrapper componentName="Proizvodac" {...Filters.proizvodacOptions} />
|
||||
);
|
||||
|
||||
const Kanton = (
|
||||
<DropDownWrapper componentName="Lokacija" {...Filters.lokacijaOptions} />
|
||||
);
|
||||
|
||||
const Grad = (
|
||||
<SelectDisplayCheckboxWrapper
|
||||
componentName="Grad"
|
||||
{...Filters.gradoviOptions}
|
||||
/>
|
||||
);
|
||||
|
||||
const Cijena = (
|
||||
<RangeWrapper
|
||||
componentName="Cijena"
|
||||
{...Filters.cijenaRangeOptions}
|
||||
optionName="cijena"
|
||||
/>
|
||||
);
|
||||
|
||||
const Stanje = (
|
||||
<CheckboxAndRadioWrapper
|
||||
componentName="Stanje"
|
||||
elements={Filters.stanjeElements}
|
||||
/>
|
||||
);
|
||||
|
||||
const Vrsta = (
|
||||
<CheckboxAndRadioWrapper
|
||||
componentName="Vrsta"
|
||||
elements={Filters.vrstaElements}
|
||||
/>
|
||||
);
|
||||
|
||||
const Godiste = (
|
||||
<RangeWrapper componentName="Godiste" {...Filters.godisteRangeOptions} />
|
||||
);
|
||||
|
||||
const KilometraMin = (
|
||||
<DropDownWrapper
|
||||
componentName="Min kilometraza"
|
||||
{...Filters.kilometrazaOptions.kilometraMin}
|
||||
/>
|
||||
);
|
||||
|
||||
const KilometraMax = (
|
||||
<DropDownWrapper
|
||||
componentName="Max kilometraza"
|
||||
{...Filters.kilometrazaOptions.kilometraMax}
|
||||
/>
|
||||
);
|
||||
|
||||
const Gorivo = (
|
||||
<CheckboxAndRadioWrapper
|
||||
componentName="Gorivo"
|
||||
elements={Filters.gorivoElements}
|
||||
/>
|
||||
);
|
||||
|
||||
export {
|
||||
Proizvodac,
|
||||
Kanton,
|
||||
Grad,
|
||||
Cijena,
|
||||
Stanje,
|
||||
Vrsta,
|
||||
Godiste,
|
||||
KilometraMin,
|
||||
KilometraMax,
|
||||
Gorivo
|
||||
};
|
||||
@@ -1,40 +0,0 @@
|
||||
.item {
|
||||
display: grid;
|
||||
border: solid #ffc600 1px;
|
||||
border-radius: 5px;
|
||||
max-width: 200px;
|
||||
min-height: 150px;
|
||||
grid-template-areas:
|
||||
"image"
|
||||
"title";
|
||||
margin: 3%;
|
||||
background-color: #272727;
|
||||
justify-items: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.item > a > img {
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
min-height: 100px !important;
|
||||
min-width: 150px !important;
|
||||
grid-area: image;
|
||||
}
|
||||
.item > a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.basic-info {
|
||||
grid-area: title;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.basic-info > h3 {
|
||||
font-size: 90%;
|
||||
margin: 5%;
|
||||
margin-bottom: 0px;
|
||||
color: #ffc600;
|
||||
padding-bottom: 10px;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import React, { Component } from "react";
|
||||
import "./ItemCard.css";
|
||||
|
||||
class ItemCard extends Component {
|
||||
render() {
|
||||
const { url, price, image } = this.props;
|
||||
return (
|
||||
<div className="item">
|
||||
<a href={url}>
|
||||
<img alt={image} src={image} />
|
||||
<div className="basic-info">
|
||||
<h3>{price}</h3>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ItemCard;
|
||||
@@ -1,8 +0,0 @@
|
||||
.items-list {
|
||||
margin: 5%;
|
||||
margin-top: 8%;
|
||||
display: grid;
|
||||
grid-gap: 5px;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
justify-items: center;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import React, { Component } from "react";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import ItemCard from "../itemcard/ItemCard";
|
||||
import "./ItemsContainer.css";
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
items: state.items
|
||||
};
|
||||
};
|
||||
|
||||
class ItemContainer extends Component {
|
||||
renderItems() {
|
||||
let items = this.props.items;
|
||||
return items.map((item, index) => {
|
||||
return <ItemCard {...item} key={index} />;
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div className="items-list">{this.renderItems()}</div>;
|
||||
}
|
||||
}
|
||||
export default connect(mapStateToProps)(ItemContainer);
|
||||
@@ -1,23 +0,0 @@
|
||||
import { WrapAll } from "../../widgets/CollapseWrapperAll";
|
||||
import {
|
||||
Kanton,
|
||||
Grad,
|
||||
Cijena,
|
||||
Stanje,
|
||||
Vrsta,
|
||||
Kvadratura,
|
||||
DodatnoZaKucu
|
||||
} from "../../filters/NekretnineFilter/index";
|
||||
|
||||
const KuceFilters = [
|
||||
Kanton,
|
||||
Grad,
|
||||
Cijena,
|
||||
Stanje,
|
||||
Vrsta,
|
||||
Kvadratura,
|
||||
DodatnoZaKucu
|
||||
];
|
||||
const Kuce = () => WrapAll(KuceFilters);
|
||||
|
||||
export default Kuce;
|
||||
@@ -1,23 +0,0 @@
|
||||
import { WrapAll } from "../../widgets/CollapseWrapperAll";
|
||||
import {
|
||||
Kanton,
|
||||
Grad,
|
||||
Cijena,
|
||||
Stanje,
|
||||
Vrsta,
|
||||
Kvadratura,
|
||||
DodatnoZaStan
|
||||
} from "../../filters/NekretnineFilter/index";
|
||||
|
||||
const StanFilters = [
|
||||
Kanton,
|
||||
Grad,
|
||||
Cijena,
|
||||
Stanje,
|
||||
Vrsta,
|
||||
Kvadratura,
|
||||
DodatnoZaStan
|
||||
];
|
||||
const Stanovi = () => WrapAll(StanFilters);
|
||||
|
||||
export default Stanovi;
|
||||
@@ -1,27 +0,0 @@
|
||||
import { WrapAll } from "components/widgets/CollapseWrapperAll";
|
||||
import {
|
||||
Kanton,
|
||||
Grad,
|
||||
Cijena,
|
||||
Stanje,
|
||||
Vrsta,
|
||||
Godiste,
|
||||
KilometraMin,
|
||||
KilometraMax,
|
||||
Gorivo
|
||||
} from "components/filters/VozilaFilter/index";
|
||||
|
||||
const MotocikliFilters = [
|
||||
Kanton,
|
||||
Grad,
|
||||
Cijena,
|
||||
Stanje,
|
||||
Vrsta,
|
||||
Godiste,
|
||||
KilometraMin,
|
||||
KilometraMax,
|
||||
Gorivo
|
||||
];
|
||||
const Motocikli = () => WrapAll(MotocikliFilters);
|
||||
|
||||
export default Motocikli;
|
||||
@@ -1,57 +0,0 @@
|
||||
import React from "react";
|
||||
import { optionchangewrapper } from "../../utils/optionchangewrapper";
|
||||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import "../../assets/checkboxAndRadioStyle.css";
|
||||
|
||||
class CheckboxAndRadioWrapper extends React.Component {
|
||||
optionChange = (option, optionName, type) => {
|
||||
const optionTypePicker = {
|
||||
radio: option.target.value,
|
||||
checkbox: option.target.checked ? option.target.value : false
|
||||
};
|
||||
const { onOptionChanged } = this.props;
|
||||
onOptionChanged({
|
||||
optionName,
|
||||
optionValue: optionTypePicker[type]
|
||||
});
|
||||
};
|
||||
isChecked = (type, value, optionName) => {
|
||||
const { options } = this.props;
|
||||
return options.hasOwnProperty(optionName) && type === "checkbox"
|
||||
? options[optionName]
|
||||
: options[optionName] === String(value);
|
||||
};
|
||||
renderElements = (elements, componentName) => {
|
||||
return elements.map(({ type, value, name, optionName } = {}) => (
|
||||
<label key={name + type}>
|
||||
{type === "radio" ? (
|
||||
<Radio
|
||||
className="radio-style"
|
||||
name={type === "radio" ? `${componentName}-radio` : ""}
|
||||
type={type}
|
||||
value={value}
|
||||
checked={this.isChecked(type, value, optionName)}
|
||||
onChange={option => this.optionChange(option, optionName, type)}
|
||||
/>
|
||||
) : (
|
||||
<Checkbox
|
||||
className="checkbox-style"
|
||||
type={type}
|
||||
value={value}
|
||||
checked={this.isChecked(type, value, optionName)}
|
||||
onChange={option => this.optionChange(option, optionName, type)}
|
||||
/>
|
||||
)}
|
||||
<span className="label-style">{name}</span>
|
||||
<br />
|
||||
</label>
|
||||
));
|
||||
};
|
||||
|
||||
render() {
|
||||
const { elements, componentName } = this.props;
|
||||
return <div>{this.renderElements(elements, componentName)}</div>;
|
||||
}
|
||||
}
|
||||
export default optionchangewrapper(CheckboxAndRadioWrapper);
|
||||
@@ -1,13 +0,0 @@
|
||||
import React from "react";
|
||||
import CollapseWrapperStyled from "./CollapseWrapperStyled";
|
||||
|
||||
export const WrapAll = components => {
|
||||
return components.map(comp => (
|
||||
<CollapseWrapperStyled
|
||||
key={comp.props.componentName}
|
||||
componentName={comp.props.componentName}
|
||||
>
|
||||
{comp}
|
||||
</CollapseWrapperStyled>
|
||||
));
|
||||
};
|
||||
@@ -1,71 +0,0 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { OPTION_EXPAND_CHANGE } from "../../constants/actionTypes";
|
||||
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
import sidebarStyle from "../../assets/sidebarStyle.js";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import ListItemIcon from "@material-ui/core/ListItemIcon";
|
||||
import ListItemText from "@material-ui/core/ListItemText";
|
||||
import ExpandLess from "@material-ui/icons/ExpandLess";
|
||||
import ExpandMore from "@material-ui/icons/ExpandMore";
|
||||
import Dashboard from "@material-ui/icons/Dashboard";
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
uiexpand: state.uiexpand
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
onUIExpandChanged: uiExpandOption =>
|
||||
dispatch({ type: OPTION_EXPAND_CHANGE, ...uiExpandOption })
|
||||
});
|
||||
|
||||
class CollapseWrapperStyled extends React.Component {
|
||||
handleClick = componentName => {
|
||||
this.props.onUIExpandChanged({
|
||||
controlName: componentName,
|
||||
value: !this.props.uiexpand[componentName]
|
||||
});
|
||||
};
|
||||
|
||||
isopen = componentName => this.props.uiexpand[componentName];
|
||||
render() {
|
||||
let { classes, componentName } = this.props;
|
||||
return (
|
||||
<div>
|
||||
<ListItem
|
||||
className={classes.whiteText}
|
||||
onClick={() => this.handleClick(componentName)}
|
||||
>
|
||||
<ListItemIcon className={classes.whiteText}>
|
||||
<Dashboard />
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
className={classes.whiteText}
|
||||
inset
|
||||
primary={componentName}
|
||||
disableTypography={true}
|
||||
/>
|
||||
{this.isopen(componentName) ? <ExpandLess /> : <ExpandMore />}
|
||||
</ListItem>
|
||||
<Collapse
|
||||
className={classes.subOptionIndent}
|
||||
in={this.isopen(componentName)}
|
||||
timeout="auto"
|
||||
unmountOnExit
|
||||
>
|
||||
{this.props.children}
|
||||
</Collapse>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
export default withStyles(sidebarStyle)(
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(CollapseWrapperStyled)
|
||||
);
|
||||
@@ -1,61 +0,0 @@
|
||||
import React from "react";
|
||||
import { subcategorywrapper } from "../../utils/subcategorywrapper";
|
||||
import { hoc } from "../../utils/helpers";
|
||||
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
import sidebarStyle from "../../assets/sidebarStyle.js";
|
||||
import List from "@material-ui/core/List";
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import ListItemIcon from "@material-ui/core/ListItemIcon";
|
||||
import ListItemText from "@material-ui/core/ListItemText";
|
||||
import StarBorder from "@material-ui/icons/StarBorder";
|
||||
|
||||
class DeepCategoryWrapper extends React.Component {
|
||||
handleOptionChange = selectedOption => {
|
||||
const { depth, onSubCategoryChanged } = this.props;
|
||||
onSubCategoryChanged({ selectedOption, depth });
|
||||
};
|
||||
|
||||
render() {
|
||||
const { options, depth, childrenComponents, classes } = this.props;
|
||||
const {
|
||||
subcategory: { [depth]: deepSubCategory }
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<List disablePadding>
|
||||
{options.map(({ label, value }, index) => (
|
||||
<ListItem
|
||||
onClick={() => this.handleOptionChange({ label, value })}
|
||||
className={
|
||||
classes.nested +
|
||||
" " +
|
||||
classes.collapsedItemStyle +
|
||||
" " +
|
||||
(deepSubCategory && deepSubCategory.value === value
|
||||
? classes.checkedItem
|
||||
: "")
|
||||
}
|
||||
key={index}
|
||||
>
|
||||
<ListItemIcon className={classes.whiteText}>
|
||||
<StarBorder />
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
className={classes.whiteText}
|
||||
primary={label}
|
||||
disableTypography={true}
|
||||
/>
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
|
||||
{hoc(deepSubCategory && deepSubCategory.value, childrenComponents)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
export default withStyles(sidebarStyle)(
|
||||
subcategorywrapper(DeepCategoryWrapper)
|
||||
);
|
||||
@@ -1,54 +0,0 @@
|
||||
import React from "react";
|
||||
import { optionchangewrapper } from "../../utils/optionchangewrapper";
|
||||
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
import List from "@material-ui/core/List";
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import ListItemIcon from "@material-ui/core/ListItemIcon";
|
||||
import ListItemText from "@material-ui/core/ListItemText";
|
||||
import sidebarStyle from "../../assets/sidebarStyle.js";
|
||||
import StarBorder from "@material-ui/icons/StarBorder";
|
||||
|
||||
class DropdownWrapper extends React.Component {
|
||||
handleOptionChange = selectedOption => {
|
||||
const { onOptionChanged, optionName } = this.props;
|
||||
onOptionChanged({
|
||||
optionName,
|
||||
optionValue: selectedOption
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
let { value, options, choices, classes } = this.props;
|
||||
let optionName = value;
|
||||
return (
|
||||
<List disablePadding>
|
||||
{choices.map(({ label, value }, index) => (
|
||||
<ListItem
|
||||
onClick={() => this.handleOptionChange({ label, value })}
|
||||
className={
|
||||
classes.nested +
|
||||
" " +
|
||||
classes.collapsedItemStyle +
|
||||
" " +
|
||||
(options[optionName] && options[optionName].value === value
|
||||
? classes.checkedItem
|
||||
: "")
|
||||
}
|
||||
key={index}
|
||||
>
|
||||
<ListItemIcon className={classes.whiteText}>
|
||||
<StarBorder />
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
className={classes.whiteText}
|
||||
primary={label}
|
||||
disableTypography={true}
|
||||
/>
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
);
|
||||
}
|
||||
}
|
||||
export default withStyles(sidebarStyle)(optionchangewrapper(DropdownWrapper));
|
||||
@@ -1,70 +0,0 @@
|
||||
import React from "react";
|
||||
import { Range } from "rc-slider";
|
||||
import { optionchangewrapper } from "../../utils/optionchangewrapper";
|
||||
import "../../assets/rangeStyle.css";
|
||||
import "rc-slider/assets/index.css";
|
||||
import Input from "@material-ui/core/Input";
|
||||
|
||||
class RangeWrapper extends React.Component {
|
||||
sendAction = (optionName, optionValue) => {
|
||||
this.props.onOptionChanged({
|
||||
optionName,
|
||||
optionValue
|
||||
});
|
||||
};
|
||||
handleRangeChange = ([min, max] = this.props.defaultValues) => {
|
||||
this.inputMin.value = min;
|
||||
this.inputMax.value = max;
|
||||
const { optionNames } = this.props;
|
||||
const optionValues = [min, max];
|
||||
optionNames.forEach((optionName, index) =>
|
||||
this.sendAction(optionName, optionValues[index])
|
||||
);
|
||||
};
|
||||
|
||||
handleInputChange = () => {
|
||||
const { optionNames } = this.props;
|
||||
const optionValues = [this.inputMin.value, this.inputMax.value];
|
||||
optionNames.forEach((optionName, index) =>
|
||||
this.sendAction(optionName, optionValues[index])
|
||||
);
|
||||
};
|
||||
|
||||
render() {
|
||||
const { step, defaultValues, min, max } = this.props;
|
||||
return (
|
||||
<div>
|
||||
<Range
|
||||
min={min}
|
||||
max={max}
|
||||
defaultValue={defaultValues}
|
||||
step={step}
|
||||
onAfterChange={this.handleRangeChange}
|
||||
/>
|
||||
<Input
|
||||
placeholder="Min"
|
||||
className="input-style"
|
||||
inputProps={{
|
||||
"aria-label": "Min"
|
||||
}}
|
||||
inputRef={node => {
|
||||
this.inputMin = node;
|
||||
}}
|
||||
onChange={this.handleInputChange}
|
||||
/>
|
||||
<Input
|
||||
placeholder="Max"
|
||||
className="input-style"
|
||||
inputProps={{
|
||||
"aria-label": "Max"
|
||||
}}
|
||||
inputRef={node => {
|
||||
this.inputMax = node;
|
||||
}}
|
||||
onChange={this.handleInputChange}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
export default optionchangewrapper(RangeWrapper);
|
||||
@@ -1,21 +0,0 @@
|
||||
import React from "react";
|
||||
import CheckboxAndRadioWrapper from "../../components/widgets/CheckboxAndRadioWrapper";
|
||||
import { optionchangewrapper } from "../../utils/optionchangewrapper";
|
||||
|
||||
class SelectDisplayCheckboxWrapper extends React.Component {
|
||||
render() {
|
||||
const { options, checkboxOptions, parentOptionName } = this.props;
|
||||
let elements =
|
||||
options[parentOptionName] &&
|
||||
checkboxOptions[options[parentOptionName].value].elements;
|
||||
return elements ? (
|
||||
<div>
|
||||
<CheckboxAndRadioWrapper
|
||||
componentName={`${parentOptionName}-child`}
|
||||
elements={elements}
|
||||
/>
|
||||
</div>
|
||||
) : null;
|
||||
}
|
||||
}
|
||||
export default optionchangewrapper(SelectDisplayCheckboxWrapper);
|
||||
@@ -1,25 +0,0 @@
|
||||
import React from "react";
|
||||
import Select from "react-select";
|
||||
import { optionchangewrapper } from "utils/optionchangewrapper";
|
||||
|
||||
class SelectWrapper extends React.Component {
|
||||
handleOptionChange = selectedOption => {
|
||||
const { onOptionChanged, optionName } = this.props;
|
||||
onOptionChanged({
|
||||
optionName,
|
||||
optionValue: selectedOption
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
let { value, options, choices } = this.props;
|
||||
return (
|
||||
<Select
|
||||
value={options[value]}
|
||||
onChange={this.handleOptionChange}
|
||||
options={choices}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
export default optionchangewrapper(SelectWrapper);
|
||||
@@ -1,8 +0,0 @@
|
||||
export const CATEGORY_SELECT = "CATEGORY_SELECT";
|
||||
export const SUBCATEGORY_SELECT = "SUBCATEGORY_SELECT";
|
||||
export const OPTION_CHANGE = "OPTION_CHANGE";
|
||||
export const ITEMS_CHANGED = "ITEMS_CHANGED";
|
||||
export const MODAL_CLOSE = "MODAL_CLOSE";
|
||||
export const MODAL_OPEN = " MODAL_OPEN";
|
||||
export const USER_DATA_CHANGED = "USER_DATA_CHANGED";
|
||||
export const OPTION_EXPAND_CHANGE = "OPTION_EXPAND_CHANGE";
|
||||
@@ -1,15 +0,0 @@
|
||||
import ReactDOM from "react-dom";
|
||||
import { Provider } from "react-redux";
|
||||
import React from "react";
|
||||
import { store } from "./store";
|
||||
|
||||
import App from "./components/App";
|
||||
import CssBaseline from "@material-ui/core/CssBaseline";
|
||||
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
<CssBaseline />
|
||||
<App />
|
||||
</Provider>,
|
||||
document.getElementById("root")
|
||||
);
|
||||
@@ -1,18 +0,0 @@
|
||||
import category from "./reducers/category";
|
||||
import subcategory from "./reducers/subcategory";
|
||||
import options from "./reducers/options";
|
||||
import items from "./reducers/items";
|
||||
import modal from "./reducers/modal";
|
||||
import userdata from "./reducers/userdata";
|
||||
import uiexpand from "./reducers/uiexpand";
|
||||
import { combineReducers } from "redux";
|
||||
|
||||
export default combineReducers({
|
||||
category,
|
||||
subcategory,
|
||||
options,
|
||||
items,
|
||||
modal,
|
||||
userdata,
|
||||
uiexpand
|
||||
});
|
||||
@@ -1,10 +0,0 @@
|
||||
import { CATEGORY_SELECT } from "../constants/actionTypes";
|
||||
|
||||
export default (state = null, action) => {
|
||||
switch (action.type) {
|
||||
case CATEGORY_SELECT:
|
||||
return action.option;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
import {
|
||||
ITEMS_CHANGED,
|
||||
SUBCATEGORY_SELECT,
|
||||
CATEGORY_SELECT,
|
||||
OPTION_CHANGE
|
||||
} from "../constants/actionTypes";
|
||||
|
||||
export default (state = [], action) => {
|
||||
switch (action.type) {
|
||||
case ITEMS_CHANGED:
|
||||
return action.items;
|
||||
case CATEGORY_SELECT:
|
||||
case SUBCATEGORY_SELECT:
|
||||
case OPTION_CHANGE:
|
||||
return [];
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
import { MODAL_CLOSE, MODAL_OPEN } from "../constants/actionTypes";
|
||||
|
||||
export default (state = false, action) => {
|
||||
switch (action.type) {
|
||||
case MODAL_CLOSE:
|
||||
return false;
|
||||
case MODAL_OPEN:
|
||||
return true;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -1,18 +0,0 @@
|
||||
import {
|
||||
SUBCATEGORY_SELECT,
|
||||
CATEGORY_SELECT,
|
||||
OPTION_CHANGE
|
||||
} from "../constants/actionTypes";
|
||||
|
||||
export default (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case OPTION_CHANGE:
|
||||
return { ...state, [action.optionName]: action.optionValue };
|
||||
case SUBCATEGORY_SELECT:
|
||||
return {};
|
||||
case CATEGORY_SELECT:
|
||||
return {};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
import { SUBCATEGORY_SELECT, CATEGORY_SELECT } from "../constants/actionTypes";
|
||||
|
||||
export default (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case SUBCATEGORY_SELECT:
|
||||
return { ...state, [action.option.depth]: action.option.selectedOption };
|
||||
case CATEGORY_SELECT:
|
||||
return {};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -1,18 +0,0 @@
|
||||
import {
|
||||
OPTION_EXPAND_CHANGE,
|
||||
CATEGORY_SELECT,
|
||||
SUBCATEGORY_SELECT
|
||||
} from "../constants/actionTypes";
|
||||
|
||||
export default (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case OPTION_EXPAND_CHANGE:
|
||||
return { ...state, [action.controlName]: action.value };
|
||||
case CATEGORY_SELECT:
|
||||
return {};
|
||||
case SUBCATEGORY_SELECT:
|
||||
return { Podkategorija: state["Podkategorija"] };
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -1,10 +0,0 @@
|
||||
import { USER_DATA_CHANGED } from "../constants/actionTypes";
|
||||
|
||||
export default (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case USER_DATA_CHANGED:
|
||||
return { ...state, [action.info]: action.value };
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -1,135 +0,0 @@
|
||||
// This optional code is used to register a service worker.
|
||||
// register() is not called by default.
|
||||
|
||||
// This lets the app load faster on subsequent visits in production, and gives
|
||||
// it offline capabilities. However, it also means that developers (and users)
|
||||
// will only see deployed updates on subsequent visits to a page, after all the
|
||||
// existing tabs open on the page have been closed, since previously cached
|
||||
// resources are updated in the background.
|
||||
|
||||
// To learn more about the benefits of this model and instructions on how to
|
||||
// opt-in, read http://bit.ly/CRA-PWA
|
||||
|
||||
const isLocalhost = Boolean(
|
||||
window.location.hostname === 'localhost' ||
|
||||
// [::1] is the IPv6 localhost address.
|
||||
window.location.hostname === '[::1]' ||
|
||||
// 127.0.0.1/8 is considered localhost for IPv4.
|
||||
window.location.hostname.match(
|
||||
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||
)
|
||||
);
|
||||
|
||||
export function register(config) {
|
||||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
||||
// The URL constructor is available in all browsers that support SW.
|
||||
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
|
||||
if (publicUrl.origin !== window.location.origin) {
|
||||
// Our service worker won't work if PUBLIC_URL is on a different origin
|
||||
// from what our page is served on. This might happen if a CDN is used to
|
||||
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
|
||||
return;
|
||||
}
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
|
||||
|
||||
if (isLocalhost) {
|
||||
// This is running on localhost. Let's check if a service worker still exists or not.
|
||||
checkValidServiceWorker(swUrl, config);
|
||||
|
||||
// Add some additional logging to localhost, pointing developers to the
|
||||
// service worker/PWA documentation.
|
||||
navigator.serviceWorker.ready.then(() => {
|
||||
console.log(
|
||||
'This web app is being served cache-first by a service ' +
|
||||
'worker. To learn more, visit http://bit.ly/CRA-PWA'
|
||||
);
|
||||
});
|
||||
} else {
|
||||
// Is not localhost. Just register service worker
|
||||
registerValidSW(swUrl, config);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function registerValidSW(swUrl, config) {
|
||||
navigator.serviceWorker
|
||||
.register(swUrl)
|
||||
.then(registration => {
|
||||
registration.onupdatefound = () => {
|
||||
const installingWorker = registration.installing;
|
||||
if (installingWorker == null) {
|
||||
return;
|
||||
}
|
||||
installingWorker.onstatechange = () => {
|
||||
if (installingWorker.state === 'installed') {
|
||||
if (navigator.serviceWorker.controller) {
|
||||
// At this point, the updated precached content has been fetched,
|
||||
// but the previous service worker will still serve the older
|
||||
// content until all client tabs are closed.
|
||||
console.log(
|
||||
'New content is available and will be used when all ' +
|
||||
'tabs for this page are closed. See http://bit.ly/CRA-PWA.'
|
||||
);
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onUpdate) {
|
||||
config.onUpdate(registration);
|
||||
}
|
||||
} else {
|
||||
// At this point, everything has been precached.
|
||||
// It's the perfect time to display a
|
||||
// "Content is cached for offline use." message.
|
||||
console.log('Content is cached for offline use.');
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onSuccess) {
|
||||
config.onSuccess(registration);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error during service worker registration:', error);
|
||||
});
|
||||
}
|
||||
|
||||
function checkValidServiceWorker(swUrl, config) {
|
||||
// Check if the service worker can be found. If it can't reload the page.
|
||||
fetch(swUrl)
|
||||
.then(response => {
|
||||
// Ensure service worker exists, and that we really are getting a JS file.
|
||||
const contentType = response.headers.get('content-type');
|
||||
if (
|
||||
response.status === 404 ||
|
||||
(contentType != null && contentType.indexOf('javascript') === -1)
|
||||
) {
|
||||
// No service worker found. Probably a different app. Reload the page.
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.unregister().then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// Service worker found. Proceed as normal.
|
||||
registerValidSW(swUrl, config);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
console.log(
|
||||
'No internet connection found. App is running in offline mode.'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export function unregister() {
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.unregister();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import { applyMiddleware, createStore } from "redux";
|
||||
import { createLogger } from "redux-logger";
|
||||
import { composeWithDevTools } from "redux-devtools-extension/developmentOnly";
|
||||
import reducer from "./reducer";
|
||||
|
||||
const getMiddleware = () => {
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
return applyMiddleware(createLogger());
|
||||
}
|
||||
};
|
||||
export const store = createStore(reducer, composeWithDevTools(getMiddleware()));
|
||||
@@ -1,38 +0,0 @@
|
||||
const isObject = obj => obj === Object(obj);
|
||||
const mapOptionsToLink = options => {
|
||||
const multipleOptions = ["grad"];
|
||||
return Object.entries(options)
|
||||
.filter(([optionName, optionValue]) => optionValue !== false)
|
||||
.map(([optionName, optionValue]) =>
|
||||
isObject(options[optionName])
|
||||
? [optionName, options[optionName].value]
|
||||
: [optionName, optionValue]
|
||||
)
|
||||
.map(
|
||||
([optionName, optionValue]) =>
|
||||
!console.log(optionName, optionValue) && [optionName, optionValue]
|
||||
)
|
||||
.reduce((acc, [optionName, optionValue]) => {
|
||||
console.log(optionName, typeof optionName);
|
||||
if (multipleOptions.some(option => ~optionName.indexOf(option))) {
|
||||
const whatOption = multipleOptions.filter(
|
||||
option => ~optionName.indexOf(option)
|
||||
)[0];
|
||||
return acc + `${whatOption}[]=${optionValue}&`;
|
||||
}
|
||||
return acc + `${optionName}=${optionValue}&`;
|
||||
}, "");
|
||||
};
|
||||
|
||||
export const createOlxLink = (category, subcategory, options) => {
|
||||
const categoryChoice =
|
||||
(Boolean(Object.keys(subcategory).length) &&
|
||||
subcategory[
|
||||
Object.keys(subcategory).reduce((max, key) => (max < key ? key : max))
|
||||
]) ||
|
||||
category;
|
||||
|
||||
return categoryChoice
|
||||
? `kategorija=${categoryChoice.value}&${mapOptionsToLink(options)}`
|
||||
: "";
|
||||
};
|
||||
@@ -1,11 +0,0 @@
|
||||
export const hoc = (option, componentList) => componentList[option];
|
||||
export const areObjectEqual = function checkEquality(objectA, objectB) {
|
||||
return (
|
||||
Object.keys(objectA).length === Object.keys(objectB).length &&
|
||||
Object.keys(objectA).every(property =>
|
||||
objectA[property] === Object(objectA[property])
|
||||
? checkEquality(objectA[property], objectB[property])
|
||||
: objectA[property] === objectB[property]
|
||||
)
|
||||
);
|
||||
};
|
||||
@@ -1,25 +0,0 @@
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
MODAL_CLOSE,
|
||||
MODAL_OPEN,
|
||||
USER_DATA_CHANGED
|
||||
} from "../constants/actionTypes";
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
modal: state.modal,
|
||||
userdata: state.userdata
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
onModalOpen: () => dispatch({ type: MODAL_OPEN }),
|
||||
onModalClose: () => dispatch({ type: MODAL_CLOSE }),
|
||||
onUserDataChange: change => dispatch({ type: USER_DATA_CHANGED, ...change })
|
||||
});
|
||||
|
||||
export const notificationmodalwrapper = component =>
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(component);
|
||||
@@ -1,18 +0,0 @@
|
||||
import { connect } from "react-redux";
|
||||
import { OPTION_CHANGE } from "../constants/actionTypes";
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
options: state.options
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
onOptionChanged: option => dispatch({ type: OPTION_CHANGE, ...option })
|
||||
});
|
||||
|
||||
export const optionchangewrapper = component =>
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(component);
|
||||
@@ -1,19 +0,0 @@
|
||||
import { connect } from "react-redux";
|
||||
import { SUBCATEGORY_SELECT } from "../constants/actionTypes";
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
subcategory: state.subcategory
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
onSubCategoryChanged: option =>
|
||||
dispatch({ type: SUBCATEGORY_SELECT, option })
|
||||
});
|
||||
|
||||
export const subcategorywrapper = component =>
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(component);
|
||||
48
index.js
48
index.js
@@ -1,11 +1,17 @@
|
||||
const welcome = require('./app/controllers/welcome').getWelcome;
|
||||
const { getRealEstateTypes, postRealEstateTypes} = require('./app/controllers/real_estate_types');
|
||||
const { getCity, postCity } = require('./app/controllers/city');
|
||||
const { getNeighborhood, postgNeighborhood } = require('./app/controllers/neighborhoods');
|
||||
|
||||
let express = require("express");
|
||||
const path = require("path");
|
||||
const bodyParser = require("body-parser");
|
||||
const MarketAlert = require("./backend/MarketAlert");
|
||||
const sendNotification = require("./backend/utils/sendnotification");
|
||||
const scrapTheItems = require("./backend/utils/scraptheitems");
|
||||
const sequelize = require("./backend/db.js");
|
||||
const MarketAlert = require("./app/models/marketalert");
|
||||
const sendNotification = require("./app/lib/sendnotification");
|
||||
const scrapTheItems = require("./app/lib/scraptheitems");
|
||||
const sequelize = require("./app/models/index").sequelize;
|
||||
const Twocheckout = require("2checkout-node");
|
||||
const layout = require('express-layout');
|
||||
|
||||
const app = express();
|
||||
app.use(bodyParser.json());
|
||||
@@ -13,7 +19,14 @@ app.use(bodyParser.urlencoded({ extended: true }));
|
||||
|
||||
const port = process.env.PORT || 5000;
|
||||
|
||||
app.get("/sendnotifications", async function(req, res) {
|
||||
app.set('views', path.join(__dirname, '/app/views'));
|
||||
app.set('view engine', 'ejs');
|
||||
app.use(layout());
|
||||
|
||||
const compression = require('compression');
|
||||
app.use(compression());
|
||||
|
||||
app.get("/api/sendnotifications", async function(req, res) {
|
||||
let marketAlerts = await MarketAlert.findAll();
|
||||
|
||||
let lastDateUpdate = await Promise.all(
|
||||
@@ -34,7 +47,7 @@ app.get("/sendnotifications", async function(req, res) {
|
||||
);
|
||||
});
|
||||
|
||||
app.get("/items/:url", async (req, res) => {
|
||||
app.get("/api/items/:url", async (req, res) => {
|
||||
let url =
|
||||
"https://www.olx.ba/pretraga?" +
|
||||
req.params.url +
|
||||
@@ -46,7 +59,7 @@ app.get("/items/:url", async (req, res) => {
|
||||
});
|
||||
});
|
||||
|
||||
app.post("/marketalerts", function(req, res) {
|
||||
app.post("/api/marketalerts", function(req, res) {
|
||||
const { email, last_date, olx_url } = req.body;
|
||||
console.log(email, last_date, olx_url);
|
||||
sequelize.sync().then(() => {
|
||||
@@ -62,7 +75,7 @@ app.post("/marketalerts", function(req, res) {
|
||||
});
|
||||
});
|
||||
|
||||
app.post("/payforalert", function(request, response) {
|
||||
app.post("/api/payforalert", function(request, response) {
|
||||
let tco = new Twocheckout({
|
||||
sellerId: "901402692",
|
||||
privateKey: "A28DCE5F-9292-405C-8161-F84D8BB83AFC",
|
||||
@@ -95,11 +108,20 @@ app.post("/payforalert", function(request, response) {
|
||||
});
|
||||
});
|
||||
|
||||
app.use(express.static(path.join(__dirname, 'frontend-react/build')));
|
||||
app.get('/', welcome);
|
||||
app.get('/vrstanekretnine/:request_id', getRealEstateTypes);
|
||||
app.get('/vrstanekretnine', getRealEstateTypes);
|
||||
|
||||
// Anything that doesn't match the above, send back index.html
|
||||
app.get('*', (req, res) => {
|
||||
res.sendFile(path.join(__dirname + '/frontend-react/build/index.html'))
|
||||
})
|
||||
app.post('/vrstanekretnine/:request_id', postRealEstateTypes);
|
||||
app.post('/vrstanekretnine', postRealEstateTypes);
|
||||
|
||||
app.get('/grad/:request_id', getCity);
|
||||
app.post('/grad/:request_id', postCity);
|
||||
|
||||
app.get('/mjesto/:request_id', getNeighborhood);
|
||||
app.post('/mjesto/:request_id', postgNeighborhood);
|
||||
|
||||
|
||||
app.use('/assets', express.static('./app/public'))
|
||||
|
||||
app.listen(port, () => console.log(`Example app listening on port ${port}!`));
|
||||
|
||||
974
package-lock.json
generated
974
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@@ -5,8 +5,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node ./index.js",
|
||||
"heroku-postbuild": "cd frontend-react && npm install && npm run build"
|
||||
"start": "node ./index.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -22,9 +21,16 @@
|
||||
"@sendgrid/mail": "^6.3.1",
|
||||
"aws-sdk": "^2.422.0",
|
||||
"cheerio": "^1.0.0-rc.2",
|
||||
"compression": "^1.7.4",
|
||||
"dotenv": "^7.0.0",
|
||||
"ejs": "^2.6.1",
|
||||
"express": "^4.16.4",
|
||||
"mysql2": "^1.6.4",
|
||||
"express-ejs-layouts": "^2.5.0",
|
||||
"express-layout": "^0.1.0",
|
||||
"node-fetch": "^2.3.0",
|
||||
"sequelize": "^4.42.0"
|
||||
"pg": "^7.10.0",
|
||||
"react-step-wizard": "^5.1.0",
|
||||
"sequelize": "^4.43.2",
|
||||
"sequelize-cli": "^5.4.0"
|
||||
}
|
||||
}
|
||||
|
||||
389
tools/kantoni.html
Normal file
389
tools/kantoni.html
Normal file
@@ -0,0 +1,389 @@
|
||||
<!DOCTYPE>
|
||||
<html>
|
||||
<head>
|
||||
<script src="https://code.jquery.com/jquery-3.4.0.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<select name="kanton" id="kanton" class="drop-select" onchange="pronadji_gradove()">
|
||||
<option value="">Iz svih lokacija</option>
|
||||
|
||||
<option value="" disabled="">Federacija BiH</option>
|
||||
<option value="9"> Sarajevo</option>
|
||||
<option value="3"> Tuzlanski</option>
|
||||
<option value="4"> Zeničko-Dobojski</option>
|
||||
<option value="1"> Unsko-Sanski</option>
|
||||
<option value="2"> Posavski</option>
|
||||
<option value="5"> Bosansko-podrinjski</option>
|
||||
<option value="6"> Srednjobosanski</option>
|
||||
<option value="7"> Hercegovačko-Neretvanski</option>
|
||||
<option value="8"> Zapadno-Hercegovački</option>
|
||||
<option value="10"> Livanjski</option>
|
||||
|
||||
<option value="" disabled="">Republika Srpska</option>
|
||||
<option value="14"> Banjalučka</option>
|
||||
<option value="15"> Dobojsko-Bijeljinska</option>
|
||||
<option value="16"> Sarajevsko-Zvornička</option>
|
||||
<option value="17"> Trebinjsko-Fočanska</option>
|
||||
|
||||
<option value="12">Disktrikt Brčko</option>
|
||||
</select>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="unskosanski" id="unskosanski" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="75">Bihać</option>
|
||||
<option value="373">Bosanska Krupa</option>
|
||||
<option value="504">Bosanski Petrovac</option>
|
||||
<option value="374">Bužim</option>
|
||||
<option value="857">Cazin</option>
|
||||
<option value="2362">Ključ</option>
|
||||
<option value="3738">Sanski Most</option>
|
||||
<option value="5122">Velika Kladuša</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="posavski" id="posavski" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="6144">Domaljevac</option>
|
||||
<option value="424">Odžak</option>
|
||||
<option value="3252">Orašje</option>
|
||||
<option value="540">Šamac</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="tuzlanski" id="tuzlanski" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="2">Banovići</option>
|
||||
<option value="1090">Doboj-Istok</option>
|
||||
<option value="1854">Gradačac</option>
|
||||
<option value="1826">Gračanica</option>
|
||||
<option value="2129">Kalesija</option>
|
||||
<option value="2319">Kladanj</option>
|
||||
<option value="2840">Lukavac</option>
|
||||
<option value="5699">Sapna</option>
|
||||
<option value="4391">Srebrenik</option>
|
||||
<option value="5010">Teočak</option>
|
||||
<option value="4944">Tuzla</option>
|
||||
<option value="2801">Čelić</option>
|
||||
<option value="5774">Živinice</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="zenickodobojski" id="zenickodobojski" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="704">Breza</option>
|
||||
<option value="1122">Doboj-Jug</option>
|
||||
<option value="2022">Kakanj</option>
|
||||
<option value="2941">Maglaj</option>
|
||||
<option value="1925">Olovo</option>
|
||||
<option value="4594">Tešanj</option>
|
||||
<option value="1087">Usora</option>
|
||||
<option value="5037">Vareš</option>
|
||||
<option value="5171">Visoko</option>
|
||||
<option value="5548">Zavidovići</option>
|
||||
<option value="4571">Zenica</option>
|
||||
<option value="2940">Žepče</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="" id="bosanskopodrinjski" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="1289">Foča</option>
|
||||
<option value="1588">Goražde</option>
|
||||
<option value="3546">Pale</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="" id="srednjobosanski" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="732">Bugojno</option>
|
||||
<option value="810">Busovača</option>
|
||||
<option value="4151">Dobretići</option>
|
||||
<option value="1160">Donji Vakuf</option>
|
||||
<option value="1407">Fojnica</option>
|
||||
<option value="1775">Gornji Vakuf - Uskoplje</option>
|
||||
<option value="1960">Jajce</option>
|
||||
<option value="2237">Kiseljak</option>
|
||||
<option value="2608">Kreševo</option>
|
||||
<option value="3477">Novi Travnik</option>
|
||||
<option value="4678">Travnik</option>
|
||||
<option value="5422">Vitez</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="" id="hercegovackoneretvanski" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="3017">Grad Mostar</option>
|
||||
<option value="1930">Jablanica</option>
|
||||
<option value="2169">Konjic</option>
|
||||
<option value="3111">Neum</option>
|
||||
<option value="3421">Prozor</option>
|
||||
<option value="4769">Ravno</option>
|
||||
<option value="4439">Stolac</option>
|
||||
<option value="947">Čapljina</option>
|
||||
<option value="1009">Čitluk</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="" id="zapadnohercegovacki" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="1892">Grude</option>
|
||||
<option value="2905">Ljubuški</option>
|
||||
<option value="3268">Posušje</option>
|
||||
<option value="2708">Široki Brijeg</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="" id="sarajevo" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="3817">Hadžići</option>
|
||||
<option value="3879">Ilidža</option>
|
||||
<option value="3892">Ilijaš</option>
|
||||
<option value="3812">Sarajevo - Centar</option>
|
||||
<option value="3969">Sarajevo-Novi Grad</option>
|
||||
<option value="5896">Sarajevo-Novo Sarajevo</option>
|
||||
<option value="4048">Sarajevo-Stari Grad</option>
|
||||
<option value="4063">Trnovo</option>
|
||||
<option value="4126">Vogošća</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="" id="livanjski" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="560">Bosansko Grahovo</option>
|
||||
<option value="4640">Drvar</option>
|
||||
<option value="1533">Glamoč</option>
|
||||
<option value="2635">Kupres</option>
|
||||
<option value="2741">Livno</option>
|
||||
<option value="1228">Tomislavgrad</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="" id="grad11" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="645">distriktbrcko</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="" id="banjalučka" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="21">Banja Luka</option>
|
||||
<option value="305">Gradiška</option>
|
||||
<option value="4662">Istočni Drvar</option>
|
||||
<option value="1965">Jezero</option>
|
||||
<option value="4147">Kneževo</option>
|
||||
<option value="6142">Kostajnica</option>
|
||||
<option value="2574">Kotor Varoš</option>
|
||||
<option value="244">Kozarska Dubica</option>
|
||||
<option value="382">Krupa na uni</option>
|
||||
<option value="2654">Kupres </option>
|
||||
<option value="2671">Laktaši</option>
|
||||
<option value="3073">Mrkonjić Grad</option>
|
||||
<option value="444">Novi Grad</option>
|
||||
<option value="3737">Oštra Luka</option>
|
||||
<option value="515">Petrovac</option>
|
||||
<option value="3287">Prijedor</option>
|
||||
<option value="3358">Prnjavor</option>
|
||||
<option value="2365">Ribnik</option>
|
||||
<option value="4271">Srbac</option>
|
||||
<option value="979">Čelinac</option>
|
||||
<option value="4509">Šipovo</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="" id="dobojskobijeljinska" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="123">Bijeljina</option>
|
||||
<option value="421">Bosanski Brod</option>
|
||||
<option value="1030">Derventa</option>
|
||||
<option value="1088">Doboj</option>
|
||||
<option value="3254">Donji Žabar</option>
|
||||
<option value="2800">Lopare</option>
|
||||
<option value="6029">Lukavac</option>
|
||||
<option value="2996">Modriča</option>
|
||||
<option value="1856">Pelagićevo</option>
|
||||
<option value="1827">Petrovo</option>
|
||||
<option value="1148">Stanari</option>
|
||||
<option value="4549">Teslić</option>
|
||||
<option value="4636">Tešanj</option>
|
||||
<option value="4692">Travnik</option>
|
||||
<option value="4966">Tuzla</option>
|
||||
<option value="5009">Ugljevik</option>
|
||||
<option value="3197">Vukosavlje</option>
|
||||
<option value="539">Šamac</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="" id="sarajevskozvornicka" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="595">Bratunac</option>
|
||||
<option value="1904">Han Pijesak</option>
|
||||
<option value="3947">Ilijaš</option>
|
||||
<option value="4049">Istočni Stari Grad</option>
|
||||
<option value="3880">Kasindo</option>
|
||||
<option value="2325">Kladanj</option>
|
||||
<option value="3971">Lukavica</option>
|
||||
<option value="6143">Milići</option>
|
||||
<option value="3221">Olovo</option>
|
||||
<option value="2128">Osmaci</option>
|
||||
<option value="3978">Pale</option>
|
||||
<option value="3529">Rogatica</option>
|
||||
<option value="3648">Rudo</option>
|
||||
<option value="6069">Sarajevo-Novi Grad</option>
|
||||
<option value="4183">Sokolac</option>
|
||||
<option value="4310">Srebrenica</option>
|
||||
<option value="4067">Trnovo</option>
|
||||
<option value="1593">Ustiprača</option>
|
||||
<option value="5259">Višegrad</option>
|
||||
<option value="5456">Vlasenica</option>
|
||||
<option value="5684">Zvornik</option>
|
||||
<option value="4475">Šekovići</option>
|
||||
<option value="1906">Žepa</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="height:40px;">
|
||||
|
||||
<span class="drop-container" style="width: 168px;">
|
||||
<span class="drop-label">Mjesto</span><span class="drop-arrow"></span>
|
||||
<select name="" id="trebinjskofocanska" class="drop-select" onchange="stavi_grad()">
|
||||
<option value="0">Mjesto</option>
|
||||
<option value="4441">Berkovići</option>
|
||||
<option value="183">Bileća</option>
|
||||
<option value="1287">Foča</option>
|
||||
<option value="1462">Gacko</option>
|
||||
<option value="3038">Istočni Mostar</option>
|
||||
<option value="2164">Kalinovik</option>
|
||||
<option value="2884">Ljubinje</option>
|
||||
<option value="3138">Nevesinje</option>
|
||||
<option value="4766">Trebinje</option>
|
||||
<option value="911">Čajniče</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
const stavi_grad = () => {};
|
||||
const gradovi = [
|
||||
{"ime":" Sarajevo","id":"sarajevo"},
|
||||
{"ime":" Unsko-sanski","id":"unskosanski"},
|
||||
{"ime":" Posavski","id":"posavski"},
|
||||
{"ime":" Tuzlanski","id":"tuzlanski"},
|
||||
{"ime":" Zeničko-dobojski","id":"zenickodobojski"},
|
||||
{"ime":" Bosansko-podrinjski","id":"bosanskopodrinjski"},
|
||||
{"ime":" Srednjobosanski","id":"srednjobosanski"},
|
||||
{"ime":" Hercegovačko-neretvanski","id":"hercegovackoneretvanski"},
|
||||
{"ime":" Zapadno-hercegovački","id":"zapadnohercegovacki"},
|
||||
{"ime":" Livanjski","id":"livanjski"},
|
||||
{"ime":" Banjalučka","id":"banjalučka"},
|
||||
{"ime":" Dobojsko-Bijeljinska","id":"dobojskobijeljinska"},
|
||||
{"ime":" Sarajevsko-Zvornička","id":"sarajevskozvornicka"},
|
||||
{"ime":" Trebinjsko-Fočanska","id":"trebinjskofocanska"},
|
||||
{"ime":"Distrikt Brčko","id":"distriktbrcko"},
|
||||
];
|
||||
|
||||
for (let grad of gradovi) {
|
||||
const mjesta = [];
|
||||
$('#' + grad.id).children().each( function() {
|
||||
const mjesto = $(this).text();
|
||||
mjesta.push( {
|
||||
ime: mjesto,
|
||||
id: mjesto.toLowerCase().replace(/[^a-z]/g,''),
|
||||
olxid: $(this).val()
|
||||
});
|
||||
});
|
||||
grad.mjesta = mjesta;
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(gradovi));
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user