Commit b799deb5 by Milovan Samardzic

izmenaFrontKonacnav3

parent f143089e
......@@ -115,13 +115,16 @@ public class OglasController
model.addAttribute("loggedUser", loggedUser);
List<Oglas> listaOglasa = oRepo.findAll( vrstaOglasaId, lokacijaId, brojSoba, cenaMin, cenaMax, kvadraturaMin,kvadraturaMax, lift, grejanje, namesten, pretraga);
model.addAttribute("oglasi",listaOglasa);
List<Float> prosecnaOcenaList = new ArrayList<Float>();
List<String> list = new ArrayList<String>();
for (Oglas o:listaOglasa) {
list.add(kRepo.findCity(o.getLokacijaId()));
prosecnaOcenaList.add(oRepo.averageOcenaByOglasId(o.getOglasId()));
}
model.addAttribute("gradovi",list);
model.addAttribute("lokacije", lRepo.findAll());
model.addAttribute("slikeOglasa", sRepo.findAllFirstPics(listaOglasa));
model.addAttribute("prosecneOcene",prosecnaOcenaList);
return "/lista-oglasa";
}
......
......@@ -257,4 +257,21 @@ public class OglasRepository
}
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) {
let mail = message.split(":")[0];
let messageC = message.split(":")[1];
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
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 @@
</head>
<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">
<section class="features-icons text-center">
<div class="row fixed-bottom" style="margin-top: 10px">
</div>
</div>
<div class="row fixed-bottom" style="height: 11vh;flex-grow: 0;">
<div class="col-md-12">
<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">
<textarea id="private-message" class="form-control m-2 w-100" rows=3
placeholder="Unesite poruku ovde..." required></textarea>
......@@ -37,11 +54,6 @@
</form>
</div>
</div>
<div class="row m-3">
<div class="col-md-12" id="porukaDodaj" style="overflow: scroll">
</div>
</div>
</section>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
......
......@@ -252,8 +252,9 @@
th:text="${oglasi[i].kvadratura + 'm2'}"></span>
</div>
<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="${prosecneOcene[i] != 0.0 ? 'Prosecna ocena: ' + prosecneOcene[i] : 'Nema ocena'}"></h1>
</div>
</div>
<div class="col-lg-12">
......@@ -283,8 +284,9 @@
th:text="${oglasi[i+1].kvadratura + 'm2'}"></span>
</div>
<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="${prosecneOcene[i+1] != 0.0 ? 'Prosecna ocena: ' + prosecneOcene[i+1] : 'Nema ocena'}"></h1>
</div>
</div>
<div class="col-lg-12">
......@@ -314,8 +316,9 @@
th:text="${oglasi[i+2].kvadratura + 'm2'}"></span>
</div>
<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="${prosecneOcene[i+2] != 0.0 ? 'Prosecna ocena: ' + prosecneOcene[i+2] : 'Nema ocena'}"></h1>
</div>
</div>
<div class="col-lg-12">
......
......@@ -114,7 +114,7 @@
: zahtevi[oglasStat.index].status.toString() == 'ODBIJEN' ? 'border: red 3px solid'
: 'border: blue 3px solid'}">
</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">
<a class="card-title"
th:href="@{/lista-oglasa/{oglasId}(oglasId=${oglas.oglasId})}"
......@@ -126,18 +126,18 @@
</h4>
<h5 class="card-title"
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'}">
Email:<span th:text="${vlasnici[oglasStat.index].getEmail()}"></span><br>
Telefon:<span th:text="${vlasnici[oglasStat.index].getTelefon()}"></span>
</p>
<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
</button>
</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'}">
<h4 th:text="${zahtevi[oglasStat.index].datum + ' ' + zahtevi[oglasStat.index].vreme}"
th:if="${zahtevi[oglasStat.index].status.toString() == 'POTVRDJEN'}"></h4>
......@@ -177,16 +177,16 @@
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
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>
</div>
</div>
<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="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>
</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}"
name="zahtevId" style="display: none">
</form>
......
......@@ -298,7 +298,7 @@
th:object="${korisnici}"
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>
<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="col-lg-2 col-md-11 col-sm-11 col-xs-11 d-flex justify-content-around align-items-center">
<img
......@@ -317,8 +317,8 @@
Email:<span th:text="${korisnik.getEmail()}"></span><br>
Telefon:<span th:text="${korisnik.getTelefon()}"></span>
</p>
<button class="btn btn-dark" th:if="${zahtevi[korisnikStat.index].status.toString() == 'POTVRDJEN'}"
th:onclick="window.open('/chat?email='+[[${korisnik.getEmail()}]],'mywindow','menubar=1,width=650,height=900')">
<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=800,height=900')">
<i class="fas fa-sms"></i> Chat
</button>
</div>
......@@ -358,7 +358,7 @@
title="2 star"></label>
<input type="radio"
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'}"
title="1 star"></label>
</div>
......@@ -377,7 +377,7 @@
name="oglasId" style="display: none">
</form>
</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">
<span th:text="${zahtevi[korisnikStat.index].datum + ' ' + zahtevi[korisnikStat.index].vreme}"></span>
</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