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
2bbbc39c
Commit
2bbbc39c
authored
Sep 09, 2022
by
Bogdan Andjelkovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lista-oglasa/id dodat back i oglas.html
parent
75b884d2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
185 additions
and
7 deletions
+185
-7
SkuciSe/src/main/java/com/example/SkuciSe/controller/OglasController.java
+10
-4
SkuciSe/src/main/java/com/example/SkuciSe/repository/OglasRepository.java
+19
-0
SkuciSe/src/main/resources/templates/lista-oglasa.html
+3
-3
SkuciSe/src/main/resources/templates/oglas.html
+153
-0
No files found.
SkuciSe/src/main/java/com/example/SkuciSe/controller/OglasController.java
View file @
2bbbc39c
...
@@ -10,10 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -10,10 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.security.core.annotation.AuthenticationPrincipal
;
import
org.springframework.security.core.annotation.AuthenticationPrincipal
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -64,4 +61,13 @@ public class OglasController
...
@@ -64,4 +61,13 @@ public class OglasController
model
.
addAttribute
(
"gradovi"
,
list
);
model
.
addAttribute
(
"gradovi"
,
list
);
return
"/lista-oglasa"
;
return
"/lista-oglasa"
;
}
}
@GetMapping
(
"/lista-oglasa/{oglasId}"
)
public
String
getOglas
(
Model
model
,
@PathVariable
(
"oglasId"
)
int
oglasId
,
@AuthenticationPrincipal
KorisnikDetails
loggedUser
)
{
System
.
out
.
println
(
oglasId
);
model
.
addAttribute
(
"loggedUser"
,
loggedUser
);
model
.
addAttribute
(
"oglas"
,
oRepo
.
findById
(
oglasId
));
return
(
"oglas"
);
}
}
}
SkuciSe/src/main/java/com/example/SkuciSe/repository/OglasRepository.java
View file @
2bbbc39c
...
@@ -77,4 +77,22 @@ public class OglasRepository
...
@@ -77,4 +77,22 @@ public class OglasRepository
}
}
return
(
list
);
return
(
list
);
}
}
public
Oglas
findById
(
int
oglasId
)
{
String
sql
=
"select * from oglas where oglasid = "
+
oglasId
;
ResultSet
rs
=
null
;
try
{
rs
=
dataBase
.
statement
.
executeQuery
(
sql
);
while
(
rs
.
next
())
{
Oglas
oglas
=
new
Oglas
(
rs
.
getInt
(
"oglasId"
),
rs
.
getInt
(
"korisnikId"
),
rs
.
getString
(
"naslov"
),
rs
.
getString
(
"opis"
),
rs
.
getInt
(
"lokacijaId"
),
rs
.
getDouble
(
"cena"
),
rs
.
getInt
(
"vrstaOglasaId"
),
rs
.
getDouble
(
"kvadratura"
),
rs
.
getInt
(
"brojSoba"
),
rs
.
getBoolean
(
"namesten"
),
rs
.
getBoolean
(
"grejanje"
),
rs
.
getBoolean
(
"lift"
),
rs
.
getString
(
"lokacija"
));
System
.
out
.
println
(
oglas
.
toString
());
return
oglas
;
}
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
(
null
);
}
}
}
\ No newline at end of file
SkuciSe/src/main/resources/templates/lista-oglasa.html
View file @
2bbbc39c
...
@@ -123,7 +123,7 @@
...
@@ -123,7 +123,7 @@
<div
class=
"col-lg-12 pb-2"
>
<div
class=
"col-lg-12 pb-2"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-lg-6"
>
<div
class=
"col-lg-6"
>
<a
href=
"#
"
class=
"btn btn-danger btn-block btn-sm"
>
Book Now
</a>
<a
th:href=
"@{/lista-oglasa/{oglasid}(oglasid=${oglasi[i].getOglasId()})}
"
class=
"btn btn-danger btn-block btn-sm"
>
Book Now
</a>
</div>
</div>
<div
class=
"col-lg-6"
>
<div
class=
"col-lg-6"
>
<a
href=
"#"
class=
"btn btn-info btn-block btn-sm"
>
Apply For Rent
</a>
<a
href=
"#"
class=
"btn btn-info btn-block btn-sm"
>
Apply For Rent
</a>
...
@@ -165,7 +165,7 @@
...
@@ -165,7 +165,7 @@
<div
class=
"col-lg-12 pb-2"
>
<div
class=
"col-lg-12 pb-2"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-lg-6"
>
<div
class=
"col-lg-6"
>
<a
href=
"#
"
class=
"btn btn-danger btn-block btn-sm"
>
Book Now
</a>
<a
th:href=
"@{/lista-oglasa/{oglasid}(oglasid=${oglasi[i+1].getOglasId()})}
"
class=
"btn btn-danger btn-block btn-sm"
>
Book Now
</a>
</div>
</div>
<div
class=
"col-lg-6"
>
<div
class=
"col-lg-6"
>
<a
href=
"#"
class=
"btn btn-info btn-block btn-sm"
>
Apply For Rent
</a>
<a
href=
"#"
class=
"btn btn-info btn-block btn-sm"
>
Apply For Rent
</a>
...
@@ -207,7 +207,7 @@
...
@@ -207,7 +207,7 @@
<div
class=
"col-lg-12 pb-2"
>
<div
class=
"col-lg-12 pb-2"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-lg-6"
>
<div
class=
"col-lg-6"
>
<a
href=
"#
"
class=
"btn btn-danger btn-block btn-sm"
>
Book Now
</a>
<a
th:href=
"@{/lista-oglasa/{oglasid}(oglasid=${oglasi[i+2].getOglasId()})}
"
class=
"btn btn-danger btn-block btn-sm"
>
Book Now
</a>
</div>
</div>
<div
class=
"col-lg-6"
>
<div
class=
"col-lg-6"
>
<a
href=
"#"
class=
"btn btn-info btn-block btn-sm"
>
Apply For Rent
</a>
<a
href=
"#"
class=
"btn btn-info btn-block btn-sm"
>
Apply For Rent
</a>
...
...
SkuciSe/src/main/resources/templates/oglas.html
0 → 100644
View file @
2bbbc39c
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta
name=
"description"
content=
""
/>
<meta
name=
"author"
content=
""
/>
<title>
SkuciSe
</title>
<link
rel=
"shortcut icon"
type=
"image/x-icon"
href=
"/images/logo.ico"
/>
<link
href=
'https://fonts.googleapis.com/css?family=Jost'
rel=
'stylesheet'
>
<link
href=
"//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"
rel=
"stylesheet"
id=
"bootstrap-css"
>
<!-- Favicon-->
<link
rel=
"icon"
type=
"image/x-icon"
href=
"assets/favicon.ico"
/>
<!-- CSS only -->
<link
href=
"https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css"
rel=
"stylesheet"
integrity=
"sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx"
crossorigin=
"anonymous"
>
<!-- Core theme CSS (includes Bootstrap)-->
<link
href=
"/css/oglasiStyle.css"
rel=
"stylesheet"
/>
</head>
<body
th:object=
"${loggedUser}"
>
<nav
class=
"navbar navbar-icon-top navbar-expand-lg p-3"
>
<a
class=
"navbar-brand"
href=
"#"
>
</a>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
aria-controls=
"navbarSupportedContent"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
<span
class=
"navbar-toggler-icon"
></span>
</button>
<div
class=
"collapse navbar-collapse"
id=
"navbarSupportedContent"
>
<ul
class=
"navbar-nav mr-auto"
>
<li
class=
"nav-item active"
>
<a
class=
"nav-link"
th:href=
"@{/index}"
>
<i
class=
"fa fa-home"
></i>
Pocetna
<span
class=
"sr-only"
>
(current)
</span>
</a>
</li>
<li
class=
"nav-item active"
>
<a
class=
"nav-link"
th:href=
"@{/lista-oglasa}"
>
<i
class=
"fa fa-poll-h"
></i>
Lista oglasa
<span
class=
"sr-only"
>
(current)
</span>
</a>
</li>
</ul>
<form
class=
"form-inline my-2 my-lg-0"
th:if=
"${loggedUser != null}"
>
<a
th:href=
"@{/novi-oglas}"
>
<button
type=
"button"
class=
"btn btn-primary btn-md mr-2"
><i
class=
"fa-solid fa-plus"
></i>
Postavite
novi oglas
</button>
</a>
</form>
<ul
class=
"navbar-nav"
>
<li
class=
"nav-item"
th:if=
"${loggedUser == null}"
>
<a
th:href=
"@{/login}"
><i
class=
"fas fa-sign-in-alt"
style=
"color:#495056"
></i><span
style=
"padding:10px;color:#495056"
>
Prijavi se
</span></a>
</li>
<li
class=
"nav-item"
th:if=
"${loggedUser == null}"
>
<a
th:href=
"@{/register}"
><i
class=
"fa-solid fa-circle-user"
style=
"color:#495056"
></i><span
style=
"padding:10px;color:#495056"
>
Registruj se
</span></a>
</li>
<li
th:if=
"${loggedUser != null}"
>
<div
class=
"dropdown mr-4"
>
<button
class=
"btn btn-secondary dropdown-toggle round"
type=
"button"
id=
"dropdownMenuButton"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
<i
class=
"fa-solid fa-circle-user"
></i><span
style=
"padding:10px;"
th:text=
"${loggedUser.getKorisnik().getIme()}"
></span>
</button>
<div
class=
"dropdown-menu"
aria-labelledby=
"dropdownMenuButton"
>
<a
class=
"dropdown-item"
th:href=
"@{/profile}"
>
Moj Profil
</a>
<a
class=
"dropdown-item"
th:href=
"@{/mojioglasi}"
>
Moji Oglasi
</a>
<a
class=
"dropdown-item"
th:href=
"@{/mojizahtevi}"
>
Moji Zahtevi
</a>
<a
th:if=
"${loggedUser.getKorisnik().getTipId() == 2}"
class=
"dropdown-item"
th:href=
"@{/lista-korisnika}"
>
Lista Profila
</a>
<form
th:action=
"@{/logout}"
method=
"post"
id=
"my_form"
class=
"dropdown-item"
>
<a
href=
"#"
onclick=
"document.getElementById('my_form').submit(); return false;"
><i
class=
"fas fa-sign-in-alt"
></i><span
style=
"padding:5px;"
>
Odjavi se
</span></a>
</form>
</div>
</div>
</li>
</ul>
</div>
</nav>
<div
class=
"container"
th:object=
"${oglas}"
>
<h1
th:text=
"${oglas.toString()}"
></h1>
</div>
<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></h6>
<ul
class=
"list-unstyled"
>
<li>
Pocetna
</li>
<li>
O nama
</li>
<li>
Blog
</li>
<li>
Portfolio
</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></h6>
<p
class=
"mb-1"
>
Radoja Domanovića 12
</p>
<p>
Kragujevac 34000
</p></div>
</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>
®
</span>
SkuciSe All Rights Reserved.
</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>
PERA PERIC
</b></h6><small>
<span><i
class=
"fa fa-envelope"
aria-hidden=
"true"
></i></span>
pera@gmail.com
</small></div>
<div
class=
"col-xl-2 col-md-4 col-sm-4 col-auto order-2 align-self-end mt-3 "
><h6
class=
"text-muted bold-text"
><b>
ACA ACIC
</b></h6><small><span><i
class=
"fa fa-envelope"
aria-hidden=
"true"
></i></span>
aca@gmail.com
</small></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>
<script
src=
"https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity=
"sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin=
"anonymous"
></script>
<script
src=
"https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js"
integrity=
"sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin=
"anonymous"
></script>
<script
src=
"https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js"
integrity=
"sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin=
"anonymous"
></script>
<script
src=
"https://kit.fontawesome.com/51d1fadef3.js"
crossorigin=
"anonymous"
></script>
<script
src=
"/js/main.js"
></script>
</body>
</html>
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