Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
awesomelands
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
Vuk Lazovic
awesomelands
Commits
aebb1091
Commit
aebb1091
authored
Sep 20, 2022
by
Pavle Opric
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dodati tacno generisani oglasi
parent
3f49670c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
13 deletions
+67
-13
src/main/java/app/model/Oglas.java
+21
-2
src/main/java/app/usluga/web/DodajKontrol.java
+1
-0
src/main/resources/templates/dodaj.html
+41
-7
src/main/resources/templates/property.html
+4
-4
No files found.
src/main/java/app/model/Oglas.java
View file @
aebb1091
...
...
@@ -7,13 +7,15 @@ import javax.persistence.*;
public
class
Oglas
{
public
Oglas
(
String
ime
,
int
vlasnik_id
,
String
lokacija
,
int
cena
,
int
kvadratura
,
String
slika
)
{
public
Oglas
(
String
ime
,
int
vlasnik_id
,
String
lokacija
,
int
cena
,
int
kvadratura
,
String
slika
,
String
tip
,
String
opis
)
{
this
.
ime
=
ime
;
this
.
vlasnik_id
=
vlasnik_id
;
this
.
lokacija
=
lokacija
;
this
.
cena
=
cena
;
this
.
kvadratura
=
kvadratura
;
this
.
slika
=
slika
;
this
.
tip
=
tip
;
this
.
opis
=
opis
;
}
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
...
...
@@ -25,12 +27,22 @@ public class Oglas
int
cena
;
int
kvadratura
;
String
slika
;
String
tip
;
String
opis
;
public
Oglas
()
{
}
public
String
getIme
()
{
public
String
getOpis
()
{
return
opis
;
}
public
void
setOpis
(
String
opis
)
{
this
.
opis
=
opis
;
}
public
String
getIme
()
{
return
ime
;
}
...
...
@@ -77,7 +89,14 @@ public class Oglas
public
void
setSlika
(
String
slika
)
{
this
.
slika
=
slika
;
}
public
String
getTip
()
{
return
tip
;
}
public
void
setTip
(
String
tip
)
{
this
.
tip
=
tip
;
}
@Override
...
...
src/main/java/app/usluga/web/DodajKontrol.java
View file @
aebb1091
...
...
@@ -44,6 +44,7 @@ public class DodajKontrol {
public
String
registruj
(
@ModelAttribute
(
"user"
)
Oglas
o
)
{
System
.
out
.
println
();
o
.
setVlasnik_id
(
SecurityContextHolder
.
getContext
().
getAuthentication
().
getPrincipal
().
hashCode
());
//o.setTip(request.getParameter("selectedVehicles"););
ku
.
save
(
o
);
return
"redirect:/"
;
}
...
...
src/main/resources/templates/dodaj.html
View file @
aebb1091
...
...
@@ -87,7 +87,7 @@
<div
class=
"alert alert-info"
>
Uspesno ste se registrovali!
</div>
</div>
<h1>
Doda
vanje novog oglasa
</h1>
<h1>
Doda
jte novi oglas
</h1>
<form
th:action=
"@{/dodaj}"
method=
"post"
th:object=
"${user}"
>
<div
class=
"form-group"
>
...
...
@@ -103,14 +103,47 @@
<input
id=
"firstName"
class=
"form-control"
th:field=
"*{cena}"
required
autofocus=
"autofocus"
/>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label"
for=
"firstName"
>
Kvadratura
</label>
<input
id=
"firstName"
class=
"form-control"
th:field=
"*{kvadratura}"
required
autofocus=
"autofocus"
/>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label"
for=
"firstName"
>
Lokacija
</label>
<input
id=
"firstName"
class=
"form-control"
th:field=
"*{lokacija}"
required
autofocus=
"autofocus"
/>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label"
for=
"firstName"
>
Opis
</label>
<input
id=
"firstName"
class=
"form-control"
th:field=
"*{opis}"
required
autofocus=
"autofocus"
/>
</div>
<div>
<label
for=
"lista"
>
Tip oglasa:
</label>
<select
name=
"tipovi"
id=
"lista"
>
<option
value=
"1"
>
Izdavanje
</option>
<option
value=
"2"
>
Prodaja
</option>
</select>
</div>
<script>
async
function
fja
()
{
alert
(
document
.
getElementById
(
"lista"
).
options
[
document
.
getElementById
(
"lista"
).
selectedIndex
].
text
);
}
</script>
<div
style=
"visibility: hidden;position:absolute;"
class=
"form-group"
>
<label
class=
"control-label"
for=
"firstName"
>
SLIKA
</label>
<input
id=
"slika"
class=
"form-control"
th:field=
"*{slika}"
required
autofocus=
"autofocus"
/>
</div>
<div
style=
"visibility: hidden;position:absolute;"
class=
"form-group"
>
<label
class=
"control-label"
for=
"firstName"
>
SLIKA
</label>
<input
id=
"listic"
class=
"form-control"
th:field=
"*{tip}"
required
autofocus=
"autofocus"
/>
</div>
...
...
@@ -118,7 +151,7 @@
<input
id=
"fileupload"
type=
"file"
/>
<button
id=
"upload_button"
onclick=
"uploadFile()"
type=
"submit"
class=
"btn btn-success"
>
Registruj
me
</button>
<button
id=
"upload_button"
onclick=
"uploadFile()"
type=
"submit"
class=
"btn btn-success"
>
Registruj
</button>
...
...
@@ -130,7 +163,7 @@
formData
.
append
(
"file"
,
fileupload
.
files
[
0
]);
document
.
getElementById
(
'slika'
).
value
=
fileupload
.
files
[
0
].
name
;
document
.
getElementById
(
"listic"
).
value
=
document
.
getElementById
(
"lista"
).
options
[
document
.
getElementById
(
"lista"
).
selectedIndex
].
text
;
let
response
=
await
fetch
(
'/upload'
,{
method
:
'POST'
,
body
:
formData
...
...
@@ -141,6 +174,7 @@
}
}
</script>
<script>
...
...
@@ -155,7 +189,7 @@
</script>
<span>
Vec imate nalog?
<a
href=
"/"
th:href=
"@{/login}"
>
Prijavite se
</a></span>
</div>
</form>
</div>
...
...
src/main/resources/templates/property.html
View file @
aebb1091
...
...
@@ -341,20 +341,20 @@
"</div>"
+
"</a>"
+
"<div class=
\"
text p-3
\"
>"
+
"<span class=
\"
status sale
\"
>
Sale
</span>"
+
"<span class=
\"
status sale
\"
>
"
+
oglasi
[
i
].
tip
+
"
</span>"
+
"<div class=
\"
d-flex
\"
>"
+
"<div class=
\"
one
\"
>"
+
"<h3><a href=
\"
property-single.html
\"
>"
+
oglasi
[
i
].
ime
+
"</a></h3>"
+
"<p>
Apartment
</p>"
+
"<p>
"
+
oglasi
[
i
].
lokacija
+
"
</p>"
+
"</div>"
+
"<div class=
\"
two
\"
>"
+
"<span class=
\"
price
\"
>"
+
oglasi
[
i
].
cena
+
"$</span>"
+
"</div>"
+
"</div>"
+
"<p>
Far far away, behind the word mountains, far from the countries</p>"
+
"<p>
"
+
oglasi
[
i
].
opis
+
"<hr>"
+
"<p class=
\"
bottom-area d-flex
\"
>"
+
"<span><i class=
\"
flaticon-selection
\"
></i>
250sqft
</span>"
+
"<span><i class=
\"
flaticon-selection
\"
></i>
"
+
oglasi
[
i
].
kvadratura
+
"
</span>"
+
"<span class=
\"
ml-auto
\"
><i class=
\"
flaticon-bathtub
\"
></i> 3</span>"
+
"<span><i class=
\"
flaticon-bed
\"
></i> 4</span>"
+
"</p>"
+
...
...
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