Commit b799deb5 by Milovan Samardzic

izmenaFrontKonacnav3

parent f143089e
...@@ -115,13 +115,16 @@ public class OglasController ...@@ -115,13 +115,16 @@ public class OglasController
model.addAttribute("loggedUser", loggedUser); model.addAttribute("loggedUser", loggedUser);
List<Oglas> listaOglasa = oRepo.findAll( vrstaOglasaId, lokacijaId, brojSoba, cenaMin, cenaMax, kvadraturaMin,kvadraturaMax, lift, grejanje, namesten, pretraga); List<Oglas> listaOglasa = oRepo.findAll( vrstaOglasaId, lokacijaId, brojSoba, cenaMin, cenaMax, kvadraturaMin,kvadraturaMax, lift, grejanje, namesten, pretraga);
model.addAttribute("oglasi",listaOglasa); model.addAttribute("oglasi",listaOglasa);
List<Float> prosecnaOcenaList = new ArrayList<Float>();
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
for (Oglas o:listaOglasa) { for (Oglas o:listaOglasa) {
list.add(kRepo.findCity(o.getLokacijaId())); list.add(kRepo.findCity(o.getLokacijaId()));
prosecnaOcenaList.add(oRepo.averageOcenaByOglasId(o.getOglasId()));
} }
model.addAttribute("gradovi",list); model.addAttribute("gradovi",list);
model.addAttribute("lokacije", lRepo.findAll()); model.addAttribute("lokacije", lRepo.findAll());
model.addAttribute("slikeOglasa", sRepo.findAllFirstPics(listaOglasa)); model.addAttribute("slikeOglasa", sRepo.findAllFirstPics(listaOglasa));
model.addAttribute("prosecneOcene",prosecnaOcenaList);
return "/lista-oglasa"; return "/lista-oglasa";
} }
......
...@@ -257,4 +257,21 @@ public class OglasRepository ...@@ -257,4 +257,21 @@ public class OglasRepository
} }
return 0; return 0;
} }
public float averageOcenaByOglasId(int oglasId){
CallableStatement stmt=null;
ResultSet rs=null;
try {
String sql = "{call averageOcenaByOglasId(?)}";
stmt = dataBase.connection.prepareCall( sql);
stmt.setInt(1,oglasId);
rs=stmt.executeQuery();
while(rs.next())
{
return(rs.getFloat(1));
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return 0;
}
} }
\ No newline at end of file
...@@ -26,9 +26,9 @@ function showMessage(message) { ...@@ -26,9 +26,9 @@ function showMessage(message) {
let mail = message.split(":")[0]; let mail = message.split(":")[0];
let messageC = message.split(":")[1]; let messageC = message.split(":")[1];
if(mail !== email) if(mail !== email)
document.getElementById("porukaDodaj").innerHTML+= "<div class=\"row w-100 m-0\"><div class=\"col-6\"></div><div class=\"col-6 d-flex justify-content-center align-items-center p-3 w-50 bg-info rounded\">"+messageC+"</div></div>" document.getElementById("porukaDodaj").innerHTML+= "<div class=\"row w-100 m-0\"><div class=\"col-6\"></div><div class=\"col-6 d-flex justify-content-center align-items-center p-3 w-50 bg-info rounded\"><p style='width:100%;word-wrap: break-word;'>"+messageC+"</p></div></div>"
else else
document.getElementById("porukaDodaj").innerHTML+= "<div class=\"row w-100\"><div class=\"\"><div class=\"col-6 d-flex justify-content-center align-items-center p-3 w-50 bg-info rounded\">"+messageC+"</div><div class=\"col-6\"></div></div></div>" document.getElementById("porukaDodaj").innerHTML+= "<div class=\"row w-100\"><div class=\"\"><div class=\"col-6 d-flex justify-content-center align-items-center p-3 w-50 bg-info rounded\"><p style='width:100%;word-wrap: break-word'>"+messageC+"</p></div><div class=\"col-6\"></div></div></div>"
} }
......
...@@ -19,13 +19,30 @@ ...@@ -19,13 +19,30 @@
</head> </head>
<body th:object="${loggedUser}"> <body th:object="${loggedUser}">
<section class="features-icons text-center" style="display: flex;flex: auto;flex-direction: column;height: 100vh">
<header style="height: 19vh;background-color: #f9f9f9;flex-grow: 0;">
<div class="row">
<div class="col-6">
<img class="d-flex rounded-circle m-3" style="width: 120px;height: 120px"
th:src="@{'data:image/png;charset=utf-8;base64,'+${sagovornik.slika}}" alt="Image Description">
</div>
<div class="col-6 d-flex justify-content-end align-items-center">
<div class="col-lg-12">
<h1 class="row" th:text="${sagovornik.ime + ' ' + sagovornik.prezime}"></h1>
<h3 class="row" th:text="${sagovornik.email}"></h3>
</div>
</div>
</div>
</header>
<div class="row m-3" style="height: 70vh;overflow:auto;">
<div class="col-md-12 mb-5" id="porukaDodaj">
</div>
<section class="features-icons text-center"> </div>
<div class="row fixed-bottom" style="margin-top: 10px"> <div class="row fixed-bottom" style="height: 11vh;flex-grow: 0;">
<div class="col-md-12"> <div class="col-md-12">
<form class="form-inline"> <form class="form-inline">
<div class="form-group d-flex justify-content-start align-items-center flex-wrap w-100"> <div class="form-group d-flex justify-content-start align-items-center flex-wrap w-100" style="background: #f9f9f9">
<div class="col-9"> <div class="col-9">
<textarea id="private-message" class="form-control m-2 w-100" rows=3 <textarea id="private-message" class="form-control m-2 w-100" rows=3
placeholder="Unesite poruku ovde..." required></textarea> placeholder="Unesite poruku ovde..." required></textarea>
...@@ -37,11 +54,6 @@ ...@@ -37,11 +54,6 @@
</form> </form>
</div> </div>
</div> </div>
<div class="row m-3">
<div class="col-md-12" id="porukaDodaj" style="overflow: scroll">
</div>
</div>
</section> </section>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
......
...@@ -252,8 +252,9 @@ ...@@ -252,8 +252,9 @@
th:text="${oglasi[i].kvadratura + 'm2'}"></span> th:text="${oglasi[i].kvadratura + 'm2'}"></span>
</div> </div>
<div class="col-lg-12 sectin-title d-flex alignt-items-center p-0"> <div class="col-lg-12 sectin-title d-flex alignt-items-center p-0">
<div class="col-lg-5 d-flex justify-content-start align-items-center"> <div class="col-lg-12 d-flex justify-content-between align-items-center">
<h1 class="pt-2 pb-2 text-nowrap" th:text="${oglasi[i].naslov}"></h1> <h1 class="pt-2 pb-2 text-nowrap" th:text="${oglasi[i].naslov}"></h1>
<h1 class="pt-2 pb-2 text-nowrap" th:text="${prosecneOcene[i] != 0.0 ? 'Prosecna ocena: ' + prosecneOcene[i] : 'Nema ocena'}"></h1>
</div> </div>
</div> </div>
<div class="col-lg-12"> <div class="col-lg-12">
...@@ -283,8 +284,9 @@ ...@@ -283,8 +284,9 @@
th:text="${oglasi[i+1].kvadratura + 'm2'}"></span> th:text="${oglasi[i+1].kvadratura + 'm2'}"></span>
</div> </div>
<div class="col-lg-12 sectin-title d-flex alignt-items-center p-0"> <div class="col-lg-12 sectin-title d-flex alignt-items-center p-0">
<div class="col-lg-5 d-flex justify-content-start align-items-center"> <div class="col-lg-12 d-flex justify-content-between align-items-center">
<h1 class="pt-2 pb-2 text-nowrap" th:text="${oglasi[i+1].naslov}"></h1> <h1 class="pt-2 pb-2 text-nowrap" th:text="${oglasi[i+1].naslov}"></h1>
<h1 class="pt-2 pb-2 text-nowrap" th:text="${prosecneOcene[i+1] != 0.0 ? 'Prosecna ocena: ' + prosecneOcene[i+1] : 'Nema ocena'}"></h1>
</div> </div>
</div> </div>
<div class="col-lg-12"> <div class="col-lg-12">
...@@ -314,8 +316,9 @@ ...@@ -314,8 +316,9 @@
th:text="${oglasi[i+2].kvadratura + 'm2'}"></span> th:text="${oglasi[i+2].kvadratura + 'm2'}"></span>
</div> </div>
<div class="col-lg-12 sectin-title d-flex alignt-items-center p-0"> <div class="col-lg-12 sectin-title d-flex alignt-items-center p-0">
<div class="col-lg-5 d-flex justify-content-start align-items-center"> <div class="col-lg-12 d-flex justify-content-between align-items-center">
<h1 class="pt-2 pb-2 text-nowrap" th:text="${oglasi[i+2].naslov}"></h1> <h1 class="pt-2 pb-2 text-nowrap" th:text="${oglasi[i+2].naslov}"></h1>
<h1 class="pt-2 pb-2 text-nowrap" th:text="${prosecneOcene[i+2] != 0.0 ? 'Prosecna ocena: ' + prosecneOcene[i+2] : 'Nema ocena'}"></h1>
</div> </div>
</div> </div>
<div class="col-lg-12"> <div class="col-lg-12">
......
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
: zahtevi[oglasStat.index].status.toString() == 'ODBIJEN' ? 'border: red 3px solid' : zahtevi[oglasStat.index].status.toString() == 'ODBIJEN' ? 'border: red 3px solid'
: 'border: blue 3px solid'}"> : 'border: blue 3px solid'}">
</div> </div>
<div class="col-lg-3 col-md-12 col-sm-12 col-xs-12"> <div class="col-md-12 col-sm-12 col-xs-12" th:classappend="${zahtevi[oglasStat.index].status.toString() == 'POTVRDJEN' ? 'col-lg-7': 'col-lg-3'}">
<div class="card-body"> <div class="card-body">
<a class="card-title" <a class="card-title"
th:href="@{/lista-oglasa/{oglasId}(oglasId=${oglas.oglasId})}" th:href="@{/lista-oglasa/{oglasId}(oglasId=${oglas.oglasId})}"
...@@ -126,18 +126,18 @@ ...@@ -126,18 +126,18 @@
</h4> </h4>
<h5 class="card-title" <h5 class="card-title"
th:text="${vlasnici[oglasStat.index].getIme() + ' ' + vlasnici[oglasStat.index].getPrezime()}"></h5> th:text="${vlasnici[oglasStat.index].getIme() + ' ' + vlasnici[oglasStat.index].getPrezime()}"></h5>
<p class="card-text" <p class="card-text text-wrap"
th:if="${zahtevi[oglasStat.index].status.toString()=='POTVRDJEN'}"> th:if="${zahtevi[oglasStat.index].status.toString()=='POTVRDJEN'}">
Email:<span th:text="${vlasnici[oglasStat.index].getEmail()}"></span><br> Email:<span th:text="${vlasnici[oglasStat.index].getEmail()}"></span><br>
Telefon:<span th:text="${vlasnici[oglasStat.index].getTelefon()}"></span> Telefon:<span th:text="${vlasnici[oglasStat.index].getTelefon()}"></span>
</p> </p>
<button class="btn btn-dark" th:if="${zahtevi[oglasStat.index].status.toString() == 'POTVRDJEN'}" <button class="btn btn-dark" th:if="${zahtevi[oglasStat.index].status.toString() == 'POTVRDJEN'}"
th:onclick="window.open('/chat?email='+[[${vlasnici[oglasStat.index].email}]],'mywindow','menubar=1,width=650,height=900')"> th:onclick="window.open('/chat?email='+[[${vlasnici[oglasStat.index].email}]],'mywindow','menubar=1,width=800,height=900')">
<i class="fas fa-sms"></i> Chat <i class="fas fa-sms"></i> Chat
</button> </button>
</div> </div>
</div> </div>
<div class="col-lg-7 col-md-7 col-sm-7 col-xs-7 d-flex flex-column justify-content-around align-items-end" <div class="col-md-7 col-sm-7 col-xs-7 d-flex flex-column justify-content-around align-items-end" th:classappend="${zahtevi[oglasStat.index].status.toString() == 'CEKANJE' ? 'col-lg-7' : 'col-lg-3'}"
th:if="${zahtevi[oglasStat.index].status.toString() != 'ZAVRSEN'}"> th:if="${zahtevi[oglasStat.index].status.toString() != 'ZAVRSEN'}">
<h4 th:text="${zahtevi[oglasStat.index].datum + ' ' + zahtevi[oglasStat.index].vreme}" <h4 th:text="${zahtevi[oglasStat.index].datum + ' ' + zahtevi[oglasStat.index].vreme}"
th:if="${zahtevi[oglasStat.index].status.toString() == 'POTVRDJEN'}"></h4> th:if="${zahtevi[oglasStat.index].status.toString() == 'POTVRDJEN'}"></h4>
...@@ -177,16 +177,16 @@ ...@@ -177,16 +177,16 @@
th:for="${'star' + zahtevi[oglasStat.index].zahtevId + '-3'}" title="3 star"></label> th:for="${'star' + zahtevi[oglasStat.index].zahtevId + '-3'}" title="3 star"></label>
<input type="radio" th:id="${'star' + zahtevi[oglasStat.index].zahtevId + '-2'}" name="ocenaRadio" value="2"/><label <input type="radio" th:id="${'star' + zahtevi[oglasStat.index].zahtevId + '-2'}" name="ocenaRadio" value="2"/><label
th:for="${'star' + zahtevi[oglasStat.index].zahtevId + '-2'}" title="2 star"></label> th:for="${'star' + zahtevi[oglasStat.index].zahtevId + '-2'}" title="2 star"></label>
<input type="radio" th:id="${'star' + zahtevi[oglasStat.index].zahtevId + '-1'}" name="ocenaRadio" value="1"/><label <input type="radio" th:id="${'star' + zahtevi[oglasStat.index].zahtevId + '-1'}" name="ocenaRadio" value="1" checked/><label
th:for="${'star' + zahtevi[oglasStat.index].zahtevId + '-1'}" title="1 star"></label> th:for="${'star' + zahtevi[oglasStat.index].zahtevId + '-1'}" title="1 star"></label>
</div> </div>
</div> </div>
<div class="col-lg-3 col-md-12 col-sm-12 col-xs-12 d-flex justify-content-center align-items-center"> <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12 d-flex justify-content-center align-items-center">
<button type="submit" class="btn btn-secondary text-wrap w-100">Komentarisi</button> <button type="submit" class="btn btn-secondary text-wrap w-100">Komentarisi</button>
<button type="button" class="btn btn-secondary text-wrap w-100 ml-1">Završi</button> <button type="button" class="btn btn-secondary text-wrap w-100 ml-1" onclick="document.getElementById('formaZavrsi').submit(); return false;">Završi</button>
</div> </div>
</form> </form>
<form method="get" th:action="@{/profile/moji-zahtevi/sacuvaj-bez-komentara}"> <form method="get" id="formaZavrsi" th:action="@{/profile/moji-zahtevi/sacuvaj-bez-komentara}">
<input type="text" th:value="${zahtevi[oglasStat.index].zahtevId}" <input type="text" th:value="${zahtevi[oglasStat.index].zahtevId}"
name="zahtevId" style="display: none"> name="zahtevId" style="display: none">
</form> </form>
......
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
th:object="${korisnici}" th:object="${korisnici}"
th:if="${(loggedUser!=null)&&(loggedUser.korisnik.korisnikId == oglas.korisnikId)}"> th:if="${(loggedUser!=null)&&(loggedUser.korisnik.korisnikId == oglas.korisnikId)}">
<h1 th:if="${korisnici.size() > 0}" class="mt-2 mb-5">Spisak zahteva za obilazak</h1> <h1 th:if="${korisnici.size() > 0}" class="mt-2 mb-5">Spisak zahteva za obilazak</h1>
<div class="card mb-3 d-flex justify-content-center align-items-center" th:each="korisnik: ${korisnici}" style="background: transparent;width: 100%" th:if="${(!zahtevi[korisnikStat.index].vlasnikKom) || (zahtevi[korisnikStat.index].status.toString() == 'ODBIJEN')}"> <div class="card mb-3 d-flex justify-content-center align-items-center" th:each="korisnik: ${korisnici}" style="background: transparent;width: 100%" th:if="${(!zahtevi[korisnikStat.index].vlasnikKom) && (zahtevi[korisnikStat.index].status.toString() != 'ODBIJEN')}">
<div class="row flex-wrap w-100"> <div class="row flex-wrap w-100">
<div class="col-lg-2 col-md-11 col-sm-11 col-xs-11 d-flex justify-content-around align-items-center"> <div class="col-lg-2 col-md-11 col-sm-11 col-xs-11 d-flex justify-content-around align-items-center">
<img <img
...@@ -317,8 +317,8 @@ ...@@ -317,8 +317,8 @@
Email:<span th:text="${korisnik.getEmail()}"></span><br> Email:<span th:text="${korisnik.getEmail()}"></span><br>
Telefon:<span th:text="${korisnik.getTelefon()}"></span> Telefon:<span th:text="${korisnik.getTelefon()}"></span>
</p> </p>
<button class="btn btn-dark" th:if="${zahtevi[korisnikStat.index].status.toString() == 'POTVRDJEN'}" <button class="btn btn-dark mb-1" th:if="${zahtevi[korisnikStat.index].status.toString() == 'POTVRDJEN'}"
th:onclick="window.open('/chat?email='+[[${korisnik.getEmail()}]],'mywindow','menubar=1,width=650,height=900')"> th:onclick="window.open('/chat?email='+[[${korisnik.getEmail()}]],'mywindow','menubar=1,width=800,height=900')">
<i class="fas fa-sms"></i> Chat <i class="fas fa-sms"></i> Chat
</button> </button>
</div> </div>
...@@ -358,7 +358,7 @@ ...@@ -358,7 +358,7 @@
title="2 star"></label> title="2 star"></label>
<input type="radio" <input type="radio"
th:id="${'star' + zahtevi[korisnikStat.index].zahtevId + '-1'}" th:id="${'star' + zahtevi[korisnikStat.index].zahtevId + '-1'}"
name="ocenaRadio" value="1"/><label name="ocenaRadio" value="1" checked/><label
th:for="${'star' + zahtevi[korisnikStat.index].zahtevId + '-1'}" th:for="${'star' + zahtevi[korisnikStat.index].zahtevId + '-1'}"
title="1 star"></label> title="1 star"></label>
</div> </div>
...@@ -377,7 +377,7 @@ ...@@ -377,7 +377,7 @@
name="oglasId" style="display: none"> name="oglasId" style="display: none">
</form> </form>
</div> </div>
<div class="col-lg-3 col-md-11 col-sm-11 col-xs-11 d-flex flex-column justify-content-around align-items-center" th:if="${zahtevi[korisnikStat.index].status.toString() != 'ZAVRSEN'}"> <div class="col-md-11 col-sm-11 col-xs-11 d-flex flex-column justify-content-around align-items-center" th:classappend="${zahtevi[korisnikStat.index].status.toString() == 'CEKANJE' ? 'col-lg-3' : 'col-lg-5'}" th:if="${zahtevi[korisnikStat.index].status.toString() != 'ZAVRSEN'}">
<p class="card-text"> <p class="card-text">
<span th:text="${zahtevi[korisnikStat.index].datum + ' ' + zahtevi[korisnikStat.index].vreme}"></span> <span th:text="${zahtevi[korisnikStat.index].datum + ' ' + zahtevi[korisnikStat.index].vreme}"></span>
</p> </p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment