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
f52f760c
Commit
f52f760c
authored
Sep 20, 2022
by
Milovan Samardzic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
frontIzmenaResponzivnost
parent
baac01a4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
62 deletions
+55
-62
SkuciSe/src/main/java/com/example/SkuciSe/controller/OglasController.java
+1
-1
SkuciSe/src/main/java/com/example/SkuciSe/controller/ProfileController.java
+6
-1
SkuciSe/src/main/resources/static/css/oglasiStyle.css
+6
-2
SkuciSe/src/main/resources/static/js/main.js
+0
-5
SkuciSe/src/main/resources/templates/korisnik.html
+30
-28
SkuciSe/src/main/resources/templates/moji-zahtevi.html
+12
-25
SkuciSe/src/main/resources/templates/oglas.html
+0
-0
No files found.
SkuciSe/src/main/java/com/example/SkuciSe/controller/OglasController.java
View file @
f52f760c
...
@@ -156,7 +156,7 @@ public class OglasController
...
@@ -156,7 +156,7 @@ public class OglasController
@PostMapping
(
"/obrisi-oglas/{oglasId}"
)
@PostMapping
(
"/obrisi-oglas/{oglasId}"
)
public
String
postObrisiOglas
(
@AuthenticationPrincipal
KorisnikDetails
loggedUser
,
@PathVariable
(
"oglasId"
)
int
oglasId
)
public
String
postObrisiOglas
(
@AuthenticationPrincipal
KorisnikDetails
loggedUser
,
@PathVariable
(
"oglasId"
)
int
oglasId
)
{
{
if
(
loggedUser
!=
null
&&
(
loggedUser
.
getKorisnik
().
getTipId
()==
1
||
oRepo
.
findById
(
oglasId
).
getKorisnikId
()==
loggedUser
.
getKorisnik
().
getKorisnikId
()))
{
if
(
loggedUser
!=
null
&&
(
loggedUser
.
getKorisnik
().
getTipId
()==
2
||
oRepo
.
findById
(
oglasId
).
getKorisnikId
()==
loggedUser
.
getKorisnik
().
getKorisnikId
()))
{
oRepo
.
deleteOglas
(
oglasId
);
oRepo
.
deleteOglas
(
oglasId
);
}
}
return
"redirect:/lista-oglasa"
;
return
"redirect:/lista-oglasa"
;
...
...
SkuciSe/src/main/java/com/example/SkuciSe/controller/ProfileController.java
View file @
f52f760c
...
@@ -14,13 +14,18 @@ import org.springframework.web.bind.annotation.*;
...
@@ -14,13 +14,18 @@ import org.springframework.web.bind.annotation.*;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Base64
;
import
java.util.Base64
;
import
java.util.List
;
import
java.util.List
;
@Controller
@Controller
public
class
ProfileController
public
class
ProfileController
{
{
public
static
float
round
(
double
d
,
int
decimalPlace
)
{
return
BigDecimal
.
valueOf
(
d
).
setScale
(
decimalPlace
,
BigDecimal
.
ROUND_HALF_UP
).
floatValue
();
}
@Autowired
@Autowired
KorisnikRepository
kRepo
;
KorisnikRepository
kRepo
;
...
@@ -110,7 +115,7 @@ public class ProfileController
...
@@ -110,7 +115,7 @@ public class ProfileController
}
}
model
.
addAttribute
(
"komentari"
,
komentari
);
model
.
addAttribute
(
"komentari"
,
komentari
);
model
.
addAttribute
(
"korisniciKomentari"
,
korisniciKomentari
);
model
.
addAttribute
(
"korisniciKomentari"
,
korisniciKomentari
);
model
.
addAttribute
(
"avgOcena"
,
komRepo
.
averageOcenaByKorisnikId
(
korisnikId
));
model
.
addAttribute
(
"avgOcena"
,
round
(
komRepo
.
averageOcenaByKorisnikId
(
korisnikId
),
2
));
model
.
addAttribute
(
"countOglas"
,
oRepo
.
countOglasByKorisnikId
(
korisnikId
));
model
.
addAttribute
(
"countOglas"
,
oRepo
.
countOglasByKorisnikId
(
korisnikId
));
return
"korisnik"
;
return
"korisnik"
;
}
}
...
...
SkuciSe/src/main/resources/static/css/oglasiStyle.css
View file @
f52f760c
...
@@ -354,4 +354,8 @@ h3{
...
@@ -354,4 +354,8 @@ h3{
{
color
:
#ffca08
;
}
/* Set yellow color when star checked */
{
color
:
#ffca08
;
}
/* Set yellow color when star checked */
.starrating
>
input
:hover
~
label
.starrating
>
input
:hover
~
label
{
color
:
#ffca08
;
}
/* Set yellow color when star hover */
{
color
:
#ffca08
;
}
/* St yellow color when star hover */
\ No newline at end of file
.w-40
{
width
:
40%
;
}
\ No newline at end of file
SkuciSe/src/main/resources/static/js/main.js
View file @
f52f760c
...
@@ -114,13 +114,9 @@ $(document).ready(function() {
...
@@ -114,13 +114,9 @@ $(document).ready(function() {
function
prikaziOglase
(){
function
prikaziOglase
(){
document
.
getElementById
(
"div-oglasi"
).
style
.
display
=
"block"
;
document
.
getElementById
(
"div-oglasi"
).
style
.
display
=
"block"
;
document
.
getElementById
(
"div-ocene"
).
style
.
display
=
"none"
;
document
.
getElementById
(
"div-ocene"
).
style
.
display
=
"none"
;
document
.
getElementById
(
"dugme-oglasi"
).
style
=
"text-decoration:none; border-bottom: 3px solid grey; width:100px; text-align:center;padding-bottom:5px;"
;
document
.
getElementById
(
"dugme-ocene"
).
style
=
""
;
}
}
function
prikaziOcene
(){
function
prikaziOcene
(){
document
.
getElementById
(
"div-oglasi"
).
style
.
display
=
"none"
;
document
.
getElementById
(
"div-oglasi"
).
style
.
display
=
"none"
;
document
.
getElementById
(
"div-ocene"
).
style
.
display
=
"block"
;
document
.
getElementById
(
"div-ocene"
).
style
.
display
=
"block"
;
document
.
getElementById
(
"dugme-ocene"
).
style
=
"text-decoration:none; border-bottom: 3px solid grey; width:100px; text-align:center;padding-bottom:5px;"
;
document
.
getElementById
(
"dugme-oglasi"
).
style
=
""
;
}
}
\ No newline at end of file
SkuciSe/src/main/resources/templates/korisnik.html
View file @
f52f760c
...
@@ -99,29 +99,27 @@
...
@@ -99,29 +99,27 @@
method=
"GET"
th:action=
"@{/lista-oglasa}"
id=
"filter"
>
method=
"GET"
th:action=
"@{/lista-oglasa}"
id=
"filter"
>
<div
class=
"row w-100"
>
<div
class=
"row w-100"
>
<div
class=
"col-3"
>
<div
class=
"col-3"
>
<div
class=
"card mt-2"
style=
"min-width: 130px"
th:object=
"${korisnik}"
>
<div
class=
"card mt-2 justify-content-center align-items-center d-flex mt-5"
style=
"min-width: 130px"
th:object=
"${korisnik}"
>
<article
class=
"card-group-item"
>
<div
class=
"profilepic"
>
<div
class=
"profilepic"
>
<img
class=
"photo profilepic__image"
id=
"slikaProfil"
<img
class=
"photo profilepic__image"
id=
"slikaProfil"
style=
"width: 120px;height:100px;border-radius:50%"
style=
"width: 100px;height:100px;border-radius:50%"
th:src=
"@{'data:image/png;charset=utf-8;base64,'+${korisnik.getSlika()}}"
th:src=
"@{'data:image/png;charset=utf-8;base64,'+${korisnik.getSlika()}}"
alt=
"slika korisnika"
>
alt=
"slika korisnika"
>
</div>
</div>
<div
class=
"filter-content"
>
<div
class=
"filter-content"
>
<p
class=
"fw-bold h4 mt-3 text-center"
><span
th:text=
"${korisnik.ime + ' ' + korisnik.prezime}"
></span></p>
<p
class=
"fw-bold h4 mt-3"
><span
th:text=
"${korisnik.ime + ' ' + korisnik.prezime}"
></span></p>
<p
class=
"text-center"
th:object=
"${avgOcena}"
th:text=
"${'Prosecna ocena korisnika: ' + avgOcena}"
></p>
<p
th:object=
"${avgOcena}"
th:text=
"${'Prosecna ocena korisnika: ' + avgOcena}"
></p>
<p
class=
"text-center"
th:object=
"${countOglas}"
th:text=
"${'Broj aktivnih oglasa: ' + countOglas}"
></p>
<p
th:object=
"${countOglas}"
th:text=
"${'Broj aktivnih oglasa: ' + countOglas}"
></p>
</div>
</div>
</article>
</div>
</div>
</div>
</div>
<div
class=
"col-9"
th:object=
"${slikeOglasa}"
>
<div
class=
"col-9"
th:object=
"${slikeOglasa}"
>
<div
class=
"row w-100 box "
style=
"/*! border: 1px solid red; */"
>
<div
class=
"row w-100 box "
>
<div
class=
"col d-flex justify-content-center"
>
<div
class=
"col d-flex justify-content-center"
>
<h4
id=
"dugme-oglasi"
class=
"link-secondary"
style=
"
text-decoration:none; border-bottom: 3px solid grey; width:100px; text-align:center;padding-bottom:5px
;"
onclick=
"prikaziOglase()"
>
Oglasi
</h4>
<h4
id=
"dugme-oglasi"
class=
"link-secondary"
style=
"
width:100px; text-align:center;padding-bottom:5px;cursor: pointer
;"
onclick=
"prikaziOglase()"
>
Oglasi
</h4>
</div>
</div>
<div
class=
"col d-flex justify-content-center"
>
<div
class=
"col d-flex justify-content-center"
>
<h4
id=
"dugme-ocene"
class=
"link-secondary"
style=
"
text-decoration: none
"
onclick=
"prikaziOcene()"
>
Ocene
</h4>
<h4
id=
"dugme-ocene"
class=
"link-secondary"
style=
"
cursor: pointer;
"
onclick=
"prikaziOcene()"
>
Ocene
</h4>
</div>
</div>
</div>
</div>
<div
id=
"div-oglasi"
>
<div
id=
"div-oglasi"
>
...
@@ -237,17 +235,21 @@
...
@@ -237,17 +235,21 @@
<p
th:text=
"${komentar.komentar}"
></p>
<p
th:text=
"${komentar.komentar}"
></p>
<div
class=
"starrating risingstar d-flex justify-content-end flex-row-reverse"
>
<div
class=
"starrating risingstar d-flex justify-content-end flex-row-reverse"
>
<img
src
th:onload=
"postaviZvezdice([[${komentar.ocena}]])"
>
<input
type=
"radio"
th:id=
"${'star' + komentar.komentarVlasnikId + '-5'}"
th:name=
"${'ocenaRadio' + komentar.komentarVlasnikId + '-5'}"
value=
"5"
<input
type=
"radio"
id=
"star5"
name=
"ocenaRadio"
value=
"5"
th:checked=
"${komentar.ocena == 5}"
disabled
/><label
th:checked=
"${komentar.ocena == 5}"
disabled
/><label
for=
"star5"
title=
"5 star"
style=
"pointer-events:none"
></label>
th:for=
"${'star' + komentar.komentarVlasnikId + '-5'}"
title=
"5 star"
style=
"pointer-events:none"
></label>
<input
type=
"radio"
id=
"star4"
name=
"ocenaRadio"
value=
"4"
th:checked=
"${komentar.ocena == 4}"
disabled
/><label
<input
type=
"radio"
th:id=
"${'star' + komentar.komentarVlasnikId + '-4'}"
th:name=
"${'ocenaRadio' + komentar.komentarVlasnikId + '-5'}"
value=
"4"
for=
"star4"
title=
"4 star"
style=
"pointer-events:none"
></label>
th:checked=
"${komentar.ocena == 4}"
disabled
/><label
<input
type=
"radio"
id=
"star3"
name=
"ocenaRadio"
value=
"3"
th:checked=
"${komentar.ocena == 3}"
disabled
/><label
th:for=
"${'star' + komentar.komentarVlasnikId + '-4'}"
title=
"4 star"
style=
"pointer-events:none"
></label>
for=
"star3"
title=
"3 star"
style=
"pointer-events:none"
></label>
<input
type=
"radio"
th:id=
"${'star' + komentar.komentarVlasnikId + '-3'}"
th:name=
"${'ocenaRadio' + komentar.komentarVlasnikId + '-5'}"
value=
"3"
<input
type=
"radio"
id=
"star2"
name=
"ocenaRadio"
value=
"2"
th:checked=
"${komentar.ocena == 2}"
disabled
/><label
th:checked=
"${komentar.ocena == 3}"
disabled
/><label
for=
"star2"
title=
"2 star"
style=
"pointer-events:none"
></label>
th:for=
"${'star' + komentar.komentarVlasnikId + '-3'}"
title=
"3 star"
style=
"pointer-events:none"
></label>
<input
type=
"radio"
id=
"star1"
name=
"ocenaRadio"
value=
"1"
th:checked=
"${komentar.ocena == 1}"
disabled
/><label
<input
type=
"radio"
th:id=
"${'star' + komentar.komentarVlasnikId + '-2'}"
th:name=
"${'ocenaRadio' + komentar.komentarVlasnikId + '-5'}"
value=
"2"
for=
"star1"
title=
"1 star"
style=
"pointer-events:none"
></label>
th:checked=
"${komentar.ocena == 2}"
disabled
/><label
th:for=
"${'star' + komentar.komentarVlasnikId + '-2'}"
title=
"2 star"
style=
"pointer-events:none"
></label>
<input
type=
"radio"
th:id=
"${'star' + komentar.komentarVlasnikId + '-1'}"
th:name=
"${'ocenaRadio' + komentar.komentarVlasnikId + '-5'}"
value=
"1"
th:checked=
"${komentar.ocena == 1}"
disabled
/><label
th:for=
"${'star' + komentar.komentarVlasnikId + '-1'}"
title=
"1 star"
style=
"pointer-events:none"
></label>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
SkuciSe/src/main/resources/templates/moji-zahtevi.html
View file @
f52f760c
...
@@ -102,30 +102,17 @@
...
@@ -102,30 +102,17 @@
<h2
th:if=
"${oglasi.size() == 0}"
class=
"text-center"
>
Jos niste poslali nijedan zahtev!
</h2>
<h2
th:if=
"${oglasi.size() == 0}"
class=
"text-center"
>
Jos niste poslali nijedan zahtev!
</h2>
<div
class=
"card mb-3"
th:each=
"oglas: ${oglasi}"
style=
"background: transparent"
th:if=
"${!zahtevi[oglasStat.index].korisnikKom}"
>
<div
class=
"card mb-3"
th:each=
"oglas: ${oglasi}"
style=
"background: transparent"
th:if=
"${!zahtevi[oglasStat.index].korisnikKom}"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-lg-2 col-md-
3 col-sm-2 col-xs-
2 d-flex justify-content-center align-items-center"
>
<div
class=
"col-lg-2 col-md-
12 col-sm-12 col-xs-1
2 d-flex justify-content-center align-items-center"
>
<img
<img
th:if=
"${zahtevi[oglasStat.index].status.toString() == 'POTVRDJEN'}
"
style=
"width: 120px;height: 120px;border-radius: 50%;object-fit: cover;
"
th:src=
"@{'data:image/png;charset=utf-8;base64,'+${
slike[oglasStat.index].slikaCode
}}"
th:src=
"@{'data:image/png;charset=utf-8;base64,'+${
vlasnici[oglasStat.index].getSlika()
}}"
alt=
"slika korisnika"
alt=
"slika korisnika"
style=
"width: 150px;height: 150px;border-radius: 50%;object-fit: cover; border: green 3px solid"
>
th:styleappend=
"${zahtevi[oglasStat.index].status.toString() == 'POTVRDJEN' ? 'border: green 3px solid'
<img
: zahtevi[oglasStat.index].status.toString() == 'CEKANJE' ? 'border: yellow 3px solid'
th:if=
"${zahtevi[oglasStat.index].status.toString() == 'CEKANJE'}"
: zahtevi[oglasStat.index].status.toString() == 'ODBIJEN' ? 'border: red 3px solid'
th:src=
"@{'data:image/png;charset=utf-8;base64,'+${slike[oglasStat.index].slikaCode}}"
: 'border: blue 3px solid'}"
>
alt=
"slika korisnika"
style=
"width: 150px;height: 150px;border-radius: 50%;object-fit: cover; border: yellow 3px solid"
>
<img
th:if=
"${zahtevi[oglasStat.index].status.toString() == 'ZAVRSEN'}"
th:src=
"@{'data:image/png;charset=utf-8;base64,'+${slike[oglasStat.index].slikaCode}}"
alt=
"slika korisnika"
style=
"width: 150px;height: 150px;border-radius: 50%;object-fit: cover; border: blue 3px solid"
class=
"w-sm-50"
>
<img
th:if=
"${zahtevi[oglasStat.index].status.toString() == 'ODBIJEN'}"
th:src=
"@{'data:image/png;charset=utf-8;base64,'+${slike[oglasStat.index].slikaCode}}"
alt=
"slika korisnika"
style=
"width: 150px;height: 150px;border-radius: 50%;object-fit: cover; border: red 3px solid"
>
</div>
</div>
<div
class=
"col-lg-3 col-md-
4 col-sm-2 col-xs-3
"
>
<div
class=
"col-lg-3 col-md-
12 col-sm-12 col-xs-12
"
>
<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})}"
...
@@ -159,7 +146,7 @@
...
@@ -159,7 +146,7 @@
</button>
</button>
</form>
</form>
</div>
</div>
<div
class=
"col-lg-7 col-md-
5 col-sm-7 col-xs-7
d-flex align-items-center flex-row justify-content-center"
th:if=
"${(zahtevi[oglasStat.index].status.toString() == 'ZAVRSEN')}"
>
<div
class=
"col-lg-7 col-md-
12 col-sm-12 col-xs-12
d-flex align-items-center flex-row justify-content-center"
th:if=
"${(zahtevi[oglasStat.index].status.toString() == 'ZAVRSEN')}"
>
<form
method=
"get"
class=
"row w-100 h-100 flex-wrap flex-row"
<form
method=
"get"
class=
"row w-100 h-100 flex-wrap flex-row"
th:action=
"@{/profile/moji-zahtevi/sacuvaj-komentar}"
th:action=
"@{/profile/moji-zahtevi/sacuvaj-komentar}"
th:if=
"${zahtevi[oglasStat.index].status.toString() == 'ZAVRSEN'}"
>
th:if=
"${zahtevi[oglasStat.index].status.toString() == 'ZAVRSEN'}"
>
...
@@ -186,14 +173,14 @@
...
@@ -186,14 +173,14 @@
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-3 col-sm-3 col-xs-3 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 h-md-50"
>
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>
</div>
</div>
</form>
</form>
<form
method=
"get"
th:action=
"@{/profile/moji-zahtevi/sacuvaj-bez-komentara}"
>
<form
method=
"get"
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"
>
<button
class=
"btn btn-primary"
type=
"submit"
>
Završi
</button>
</form>
</form>
</div>
</div>
</div>
</div>
...
...
SkuciSe/src/main/resources/templates/oglas.html
View file @
f52f760c
This diff is collapsed.
Click to expand it.
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