Commit 5d8aa8df by Bogdan Andjelkovic

poruke: uradjeni linkovi za dm, uradjen window, jos ostao stil windowa

parent 0c2cd067
......@@ -14,7 +14,7 @@ public class WSService {
this.messagingTemplate = messagingTemplate;
}
public void notifyUser(final String mail, final Message message) {
ResponseMessage responseMessage = new ResponseMessage( message.getFrom() + " " + message.getMessageContent());
ResponseMessage responseMessage = new ResponseMessage( message.getFrom() + ": " + message.getMessageContent());
messagingTemplate.convertAndSendToUser(mail, "/topic/private-messages", responseMessage);
}
}
\ No newline at end of file
......@@ -82,8 +82,12 @@ public class AppController
return "portfolio";
}
@GetMapping("/chat")
public String getChat(Model model,@AuthenticationPrincipal KorisnikDetails loggedUser){
public String getChat(Model model,@AuthenticationPrincipal KorisnikDetails loggedUser, @RequestParam("email") String email)
{
if( loggedUser == null)
return "redirect:/moji-zahtevi";
model.addAttribute("loggedUser",loggedUser);
model.addAttribute("sagovornik",kRepo.findByEmail( email));
return "chat";
}
}
......@@ -2,10 +2,12 @@ package com.example.SkuciSe.controller;
import com.example.SkuciSe.configuration.AktivanZahtevPostoji;
import com.example.SkuciSe.model.komentar.Komentar;
import com.example.SkuciSe.model.korisnik.Korisnik;
import com.example.SkuciSe.model.korisnik.KorisnikDetails;
import com.example.SkuciSe.model.oglas.Oglas;
import com.example.SkuciSe.model.zahtev.StanjeZahteva;
import com.example.SkuciSe.model.zahtev.Zahtev;
import com.example.SkuciSe.repository.KorisnikRepository;
import com.example.SkuciSe.repository.OglasRepository;
import com.example.SkuciSe.repository.SlikeRepository;
import com.example.SkuciSe.repository.ZahtevRepository;
......@@ -30,21 +32,27 @@ public class ZahtevController {
ZahtevRepository zRepo;
@Autowired
OglasRepository oRepo;
@Autowired
SlikeRepository sRepo;
@Autowired
KorisnikRepository kRepo;
@GetMapping("/profile/moji-zahtevi")
public String getMojiZahtevi(Model model, @AuthenticationPrincipal KorisnikDetails loggedUser)
{
List<Zahtev> mojiZahtevi = zRepo.findAllByKorisnikId( loggedUser.getKorisnik().getKorisnikId());
List<Oglas> mojiOglasi = new ArrayList<Oglas>();
List<Korisnik> vlasnici = new ArrayList<Korisnik>();
for( Zahtev zahtev: mojiZahtevi)
{
mojiOglasi.add(oRepo.findById(zahtev.getOglasId()));
Oglas oglas = oRepo.findById(zahtev.getOglasId());
mojiOglasi.add( oglas);
vlasnici.add( kRepo.findById( oglas.getKorisnikId()));
}
model.addAttribute("loggedUser", loggedUser);
model.addAttribute("zahtevi", mojiZahtevi);
model.addAttribute("oglasi", mojiOglasi);
model.addAttribute("vlasnici", vlasnici);
model.addAttribute("slike",sRepo.findAllFirstPics(mojiOglasi));
return "moji-zahtevi";
}
......@@ -73,6 +81,7 @@ public class ZahtevController {
zRepo.updateZahtevStatus( zahtevId, StanjeZahteva.POTVRDJEN);
return ("redirect:/lista-oglasa/" + oglasId);
}
@GetMapping("/oglas-edit/{oglasId}/odbi-zahtev/{zahtevId}")
public String getOdbiZahtev( Model model, @PathVariable("oglasId") int oglasId, @PathVariable("zahtevId") int zahtevId)
{
......
var stompClient = null;
var email = new URLSearchParams( window.location.search).get("email");
console.log( "To: " + email);
$(document).ready(function() {
console.log("Index page is ready");
connect();
......@@ -25,5 +28,6 @@ function showMessage(message) {
function sendPrivateMessage() {
console.log("sending private message");
stompClient.send("/ws/private-message", {}, JSON.stringify({ 'from':"", 'to':$("#to").val(), 'messageContent': $("#private-message").val()}));
stompClient.send("/ws/private-message", {}, JSON.stringify({ 'from':"", 'to':email/*$("#to").val()*/, 'messageContent': $("#private-message").val()}));
$("#private-message").val("");
}
\ No newline at end of file
......@@ -114,8 +114,6 @@
<div class="form-group">
<label for="private-message">Private Message</label>
<input type="text" id="private-message" class="form-control" placeholder="Enter your message here...">
<label for="private-message">To</label>
<input type="text" id="to" class="form-control" placeholder="Enter your message here...">
</div>
<button id="send-private" class="btn btn-default" type="button">Send Private Message</button>
</form>
......@@ -137,40 +135,6 @@
</div>
</section>
<div class="container-fluid pb-0 mb-0 justify-content-center text-light ">
<footer>
<div class="row my-5 justify-content-center py-5">
<div class="col-11">
<div class="row ">
<div class="col-xl-8 col-md-4 col-sm-4 col-12 my-auto mx-auto a"><h3
class="text-muted mb-md-0 mb-5 bold-text">SkuciSe</h3></div>
<div class="col-xl-2 col-md-4 col-sm-4 col-12"><h6 class="mb-3 mb-lg-4 bold-text "><b>MENI </b><i class="fa-solid fa-bars"></i></h6>
<ul class="list-unstyled">
<li><a href="/index" style="text-decoration: none;color:#627482;" onmouseover="this.style.color='#989c9e'" onMouseOut="this.style.color='#627482'">Pocetna</a></li>
<li><a href="/onama" style="text-decoration: none;color:#627482;" onmouseover="this.style.color='#989c9e'" onMouseOut="this.style.color='#627482'">O nama</a></li>
<li><a href="/portfolio" style="text-decoration: none;color:#627482;" onmouseover="this.style.color='#989c9e'" onMouseOut="this.style.color='#627482'">Portfolio</a></li>
</ul>
</div>
<div class="col-xl-2 col-md-4 col-sm-4 col-12"><h6
class="mb-3 mb-lg-4 text-muted bold-text mt-sm-0 mt-5"><b>ADRESA </b><i class="fa-solid fa-map-pin"></i></h6>
<p><a href="http://maps.google.com/maps?daddr=Radoja Domanovića 12 Kragujevac&amp;" style="text-decoration: none;color:#627482;" onmouseover="this.style.color='#989c9e'" onMouseOut="this.style.color='#627482'">Radoja Domanovića 12 Kragujevac 34000</a></p>
</div>
<div class="row ">
<div class="col-xl-8 col-md-4 col-sm-4 col-auto my-md-0 mt-5 order-sm-1 order-3 align-self-end"><p
class="social text-muted mb-0 pb-0 bold-text"><span class="mx-2"><i class="fa fa-facebook"
aria-hidden="true"></i></span>
<span class="mx-2"><i class="fa fa-linkedin-square" aria-hidden="true"></i></span> <span
class="mx-2"><i class="fa fa-twitter" aria-hidden="true"></i></span> <span class="mx-2"><i
class="fa fa-instagram" aria-hidden="true"></i></span></p><small class="rights"><span>&#174;</span>
SkuciSe. Sva prava zadrzana.</small></div>
<div class="col-xl-2 col-md-4 col-sm-4 col-auto order-1 align-self-end "><h6
class="mt-55 mt-2 text-muted bold-text"><b>Korisnicki centar </b><i class="fa-solid fa-phone"></i></h6><small> <span><i
class="fa fa-envelope" aria-hidden="true"></i></span><a href="mailto:someone@yoursite.com" style="text-decoration: none;color:#627482;" onmouseover="this.style.color='#989c9e'" onMouseOut="this.style.color='#627482'"> skucise@gmail.com</a> </small></div>
</div>
</div>
</div></div>
</footer>
</div>
<!-- JavaScript Bundle with Popper -->
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
......
......@@ -160,7 +160,7 @@
</form>
</div>
<div class="col-5 d-flex align-items-center flex-row justify-content-center">
<form method="get" th:action="@{/profile/moji-zahtevi/sacuvaj-komentar}">
<form method="get" th:action="@{/profile/moji-zahtevi/sacuvaj-komentar}" th:if="${zahtevi[oglasStat.count - 1].status.toString() == 'POTVRDJEN'}">
<div class="col-4 h-100">
<div class="w-100 h-100 d-flex justify-content-center align-items-center">
<input type="text" name="komentar"/>
......@@ -188,6 +188,10 @@
</div>
</form>
</form>
<div>
<p th:text="'Vlasnik: ' + ${vlasnici[oglasStat.count - 1].ime}"></p>
<a th:href="'/chat?email='+${vlasnici[oglasStat.count - 1].email}" target="_blank" onclick="window.open(this.href,'mywindow','menubar=1,resizable=0,width=500,height=900')">Posaljite poruku</a>
</div>
</div>
</div>
</div>
......
......@@ -280,6 +280,8 @@
Email:<span th:text="${korisnik.getEmail()}"></span><br>
Telefon:<span th:text="${korisnik.getTelefon()}"></span>
</p>
<a th:href="'/chat?email='+${korisnik.email}" target="_blank" onclick="window.open(this.href,'mywindow','menubar=1,resizable=0,width=500,height=900')">Posaljite poruku</a>
</div>
</div>
<div class="col-md-3 d-flex flex-column justify-content-around align-items-center">
......
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