Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SkuciSe
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tim 2 - 2022
SkuciSe
Commits
2750e609
Commit
2750e609
authored
Sep 16, 2022
by
Mihailo Sebek
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
e3fda47b
fbc8a1cb
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
58 additions
and
10 deletions
+58
-10
SkuciSe/src/main/java/com/example/SkuciSe/controller/OglasController.java
+9
-2
SkuciSe/src/main/java/com/example/SkuciSe/controller/ZahtevController.java
+16
-1
SkuciSe/src/main/java/com/example/SkuciSe/repository/ZahtevRepository.java
+14
-0
SkuciSe/src/main/resources/static/css/style.css
+9
-1
SkuciSe/src/main/resources/templates/index.html
+3
-3
SkuciSe/src/main/resources/templates/lista-korisnika.html
+2
-2
SkuciSe/src/main/resources/templates/oglas.html
+5
-1
No files found.
SkuciSe/src/main/java/com/example/SkuciSe/controller/OglasController.java
View file @
2750e609
...
...
@@ -94,8 +94,15 @@ public class OglasController
model
.
addAttribute
(
"slike"
,
sRepo
.
findAllById
(
oglasId
));
model
.
addAttribute
(
"grad"
,
kRepo
.
findCity
(
oglas
.
getLokacijaId
()));
model
.
addAttribute
(
"noviZahtev"
,
new
Zahtev
());
if
(
loggedUser
!=
null
&&
oglas
.
getKorisnikId
()
==
loggedUser
.
getKorisnik
().
getKorisnikId
())
model
.
addAttribute
(
"zahtevi"
,
zRepo
.
findAllByOglasId
(
oglasId
));
if
(
loggedUser
!=
null
&&
oglas
.
getKorisnikId
()
==
loggedUser
.
getKorisnik
().
getKorisnikId
())
{
List
<
Zahtev
>
zahtevi
=
zRepo
.
findAllByOglasId
(
oglasId
);
List
<
Korisnik
>
korisnici
=
new
ArrayList
<
Korisnik
>();
for
(
Zahtev
zahtev:
zahtevi
)
korisnici
.
add
(
kRepo
.
findById
(
zahtev
.
getKorisnikId
()));
model
.
addAttribute
(
"zahtevi"
,
zahtevi
);
model
.
addAttribute
(
"korisnici"
,
korisnici
);
}
return
(
"oglas"
);
}
@GetMapping
(
"/profile/moji-oglasi"
)
...
...
SkuciSe/src/main/java/com/example/SkuciSe/controller/ZahtevController.java
View file @
2750e609
...
...
@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
java.util.Date
;
...
...
@@ -30,9 +31,10 @@ public class ZahtevController {
}
@PostMapping
(
"/obradi-zahtev/{id}"
)
public
String
postObradizahtev
(
Model
model
,
@AuthenticationPrincipal
KorisnikDetails
loggedUser
,
@ModelAttribute
Zahtev
noviZahtev
,
@ModelAttribute
(
"datumIVreme"
)
String
datumIVreme
,
@PathVariable
(
"id"
)
int
oglasId
)
public
String
postObradizahtev
(
Model
model
,
@AuthenticationPrincipal
KorisnikDetails
loggedUser
,
@ModelAttribute
Zahtev
noviZahtev
,
@ModelAttribute
(
"datumIVreme"
)
String
datumIVreme
,
@PathVariable
(
"id"
)
int
oglasId
,
RedirectAttributes
redirectAttributes
)
{
zRepo
.
insert
(
loggedUser
.
getKorisnik
().
getKorisnikId
(),
oglasId
,
noviZahtev
,
datumIVreme
);
redirectAttributes
.
addFlashAttribute
(
"zakazan"
,
true
);
return
"redirect:/lista-oglasa/"
+
oglasId
;
}
...
...
@@ -42,4 +44,17 @@ public class ZahtevController {
return
"redirect:/lista-oglasa/"
+
oglasId
;
}
@GetMapping
(
"/oglas-edit/{oglasId}/prihvati-zahtev/{zahtevId}"
)
public
String
getPrihvatiZahtev
(
Model
model
,
@PathVariable
(
"oglasId"
)
int
oglasId
,
@PathVariable
(
"zahtevId"
)
int
zahtevId
)
{
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
)
{
zRepo
.
updateZahtevStatus
(
zahtevId
,
StanjeZahteva
.
ODBIJEN
);
return
(
"redirect:/lista-oglasa/"
+
oglasId
);
}
}
SkuciSe/src/main/java/com/example/SkuciSe/repository/ZahtevRepository.java
View file @
2750e609
...
...
@@ -96,4 +96,18 @@ public class ZahtevRepository {
throw
new
RuntimeException
(
e
);
}
}
public
void
updateZahtevStatus
(
int
zahtevId
,
StanjeZahteva
potvrdjen
)
{
String
sql
=
"{ call updateZahtevStatus(?,?)}"
;
CallableStatement
cs
=
null
;
try
{
cs
=
dataBase
.
connection
.
prepareCall
(
sql
);
cs
.
setInt
(
1
,
zahtevId
);
cs
.
setString
(
2
,
potvrdjen
.
toString
());
cs
.
execute
();
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
SkuciSe/src/main/resources/static/css/style.css
View file @
2750e609
...
...
@@ -326,6 +326,12 @@ p {
border-radius
:
50%
;
object-fit
:
cover
;
}
#slikaProfil1
{
width
:
150px
;
height
:
150px
;
border-radius
:
50%
;
object-fit
:
cover
;
}
.fab.fa-twitter
{
color
:
#8ab7f1
;
...
...
@@ -513,6 +519,7 @@ p {
height
:
100%
;
}
.pozadinaSlika
{
/*background-image:*/
background-image
:
url("https://wallpaperaccess.com/full/1895610.jpg")
;
background-repeat
:
no-repeat
;
background-size
:
cover
;
}
\ No newline at end of file
SkuciSe/src/main/resources/templates/index.html
View file @
2750e609
...
...
@@ -97,7 +97,7 @@
<div
class=
"row justify-content-center w-100"
>
<div
class=
"col d-flex justify-content-center align-items-center"
>
<div
class=
"text-center text-white w-100"
>
<h1
class=
"mb-5"
style=
"color:
black
"
>
Pretrazite oglase
</h1>
<h1
class=
"mb-5"
style=
"color:
white
"
>
Pretrazite oglase
</h1>
<form
class=
"form-subscribe"
method=
"GET"
th:action=
"@{/lista-oglasa}"
>
<div
class=
"row"
>
<div
class=
"col-3"
>
...
...
@@ -109,11 +109,11 @@
</div>
<div
class=
"col-3"
>
<input
type=
"radio"
name=
"vrstaOglasaId"
id=
"radiodugme1"
value=
"1"
>
<label
for=
"radiodugme1"
style=
"color:
black
"
>
Prodaja
</label>
<label
for=
"radiodugme1"
style=
"color:
white
"
>
Prodaja
</label>
</div>
<div
class=
"col-3"
>
<input
type=
"radio"
name=
"vrstaOglasaId"
id=
"radiodugme2"
value=
"2"
>
<label
for=
"radiodugme2"
style=
"color:
black
"
>
Iznajmljivanje
</label>
<label
for=
"radiodugme2"
style=
"color:
white
"
>
Iznajmljivanje
</label>
</div>
<div
class=
"col-3"
>
<button
class=
"btn btn-secondary btn-lg"
id=
"submitButton"
type=
"submit"
>
Pretrazi
...
...
SkuciSe/src/main/resources/templates/lista-korisnika.html
View file @
2750e609
...
...
@@ -104,9 +104,9 @@
<div
class=
"card mb-3"
th:each=
"korisnik: ${korisnici}"
>
<div
class=
"row no-gutters"
>
<div
class=
"col-md-4 d-flex justify-content-center align-items-center"
>
<img
style=
"width: 150px;height: 150px"
<img
th:src=
"@{'data:image/png;charset=utf-8;base64,'+${korisnik.getSlika()}}"
alt=
"slika korisnika"
>
alt=
"slika korisnika"
id=
"slikaProfil1"
>
</div>
<div
class=
"col-md-6"
>
<div
class=
"card-body"
>
...
...
SkuciSe/src/main/resources/templates/oglas.html
View file @
2750e609
...
...
@@ -88,6 +88,10 @@
</nav>
<div
class=
"mt-5 ml-5 mr-0 w-100"
th:object=
"${oglasId}"
>
<div
class=
"alert alert-success d-flex justify-content-between align-items-center"
th:object=
"${zakazan}"
th:if=
"${zakazan == true}"
style=
"width: 96%"
>
<div><strong>
Uspesno!
</strong>
Uspesno ste poslali zahtev za obilazak!
</div>
<button
type=
"button"
class=
"btn-close"
data-dismiss=
"alert"
></button>
</div>
<div
class=
"row mb-5 flex-row"
>
<div
class=
"col-lg-6 col-md-6 col-sm-6"
>
<div
id=
"custCarousel"
class=
"carousel slide"
data-ride=
"carousel"
align=
"center"
>
...
...
@@ -166,7 +170,7 @@
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"row"
th:if=
"${(loggedUser !=null) && (oglas.korisnikId != loggedUser.getKorisnik().korisnikId)}"
>
<button
type=
"button"
class=
"btn btn-primary"
id=
"zahtevDugme"
>
Zakazite obilazak
</button>
<div
class=
"row mt-3"
id =
"izlazDiv"
style=
"display: none;"
>
<form
class=
"d-flex justify-content-center flex-column align-items-end"
th:if=
"${loggedUser != null}"
th:action=
"@{/obradi-zahtev/{id}(id=${oglasId})}"
method=
"POST"
th:object=
"${noviZahtev}"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment