Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
th-app-java
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
Amparo Oliver
th-app-java
Commits
128c4b86
Commit
128c4b86
authored
Nov 02, 2021
by
willgonzz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tecnologia postulante
parent
6c7fe450
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
5 deletions
+84
-5
curriculumsearch/src/main/java/com/roshka/modelo/PostulanteTecnologia.java
+2
-1
curriculumsearch/src/main/resources/static/main.js
+47
-1
curriculumsearch/src/main/webapp/jsp/postulante-form.jsp
+35
-3
No files found.
curriculumsearch/src/main/java/com/roshka/modelo/PostulanteTecnologia.java
View file @
128c4b86
package
com
.
roshka
.
modelo
;
import
javax.persistence.CascadeType
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
...
...
@@ -18,7 +19,7 @@ public class PostulanteTecnologia {
private
long
id
;
@Column
(
name
=
"nivel"
)
private
Long
nivel
;
@ManyToOne
()
@ManyToOne
(
cascade
=
CascadeType
.
PERSIST
)
@JoinColumn
private
Tecnologia
tecnologia
;
@ManyToOne
()
...
...
curriculumsearch/src/main/resources/static/main.js
View file @
128c4b86
...
...
@@ -18,7 +18,6 @@ function agregarFieldExpierncia(){
const
div
=
document
.
querySelector
(
"#experiencias"
)
const
div1
=
document
.
createElement
(
'div'
);
let
content
=
'<ul>'
for
(
let
index
=
0
;
index
<
experiencias
.
length
;
index
++
)
{
const
exp
=
experiencias
[
index
];
if
(
exp
==
null
)
continue
;
...
...
@@ -37,13 +36,60 @@ function agregarFieldExpierncia(){
cont_experiencia
++
;
}
/*--------------------------------------------------------------------*/
function
agregarFieldTecnologia
(){
//recoger del form
const
pairs
=
{};
const
formtecn
=
document
.
querySelector
(
"[name=tecnologia-form]"
);
const
formData
=
new
FormData
(
formtecn
);
for
(
const
[
name
,
value
]
of
formData
){
pairs
[
name
]
=
value
}
tecnologias
[
cont_tecnologia
]
=
{}
tecnologias
[
cont_tecnologia
][
"tecnologia"
]
=
{
nombre
:
pairs
.
nombre
}
tecnologias
[
cont_tecnologia
][
"nivel"
]
=
pairs
.
nivel
//tecnologias[cont_tecnologia] = pairs;
formtecn
.
reset
();
//imprimir lista actualizada
const
div
=
document
.
querySelector
(
"#tecnologias"
)
const
div1
=
document
.
createElement
(
'div'
);
console
.
log
(
tecnologias
[
0
])
let
content1
=
'<ul>'
for
(
let
index
=
0
;
index
<
tecnologias
.
length
;
index
++
)
{
const
tecn
=
tecnologias
[
index
];
if
(
tecn
==
null
)
continue
;
content1
+=
`
<li id="tecn-
${
index
}
">
${
tecn
.
tecnologia
.
nombre
}
<button type="button" onclick="eliminarTecnologia(event)">Eliminar</button>
</li>
`
}
content1
+=
"</ul>"
div1
.
innerHTML
=
content1
div
.
innerHTML
=
''
;
div
.
appendChild
(
div1
);
cont_tecnologia
++
;
}
/*--------------------------------------------------------------------*/
function
eliminarExperiencia
(
event
)
{
//eliminar del array
experiencias
[
event
.
target
.
parentElement
.
id
.
split
(
"-"
)[
1
]]
=
null
//eliminar en html
event
.
target
.
parentElement
.
remove
()
}
/*----------------------------------------------------------------- */
function
eliminarTecnologia
(
event
)
{
//eliminar del array
tecnologias
[
event
.
target
.
parentElement
.
id
.
split
(
"-"
)[
1
]]
=
null
//eliminar en html
event
.
target
.
parentElement
.
remove
()
}
/*----------------------------------------------------------------- */
function
serializeJSON
(
form
)
{
// Create a new FormData object
const
formData
=
new
FormData
(
form
);
...
...
curriculumsearch/src/main/webapp/jsp/postulante-form.jsp
View file @
128c4b86
...
...
@@ -76,6 +76,12 @@
<div
id=
"experiencias"
>
</div>
<button
type=
"button"
class=
"btn btn-primary"
data-toggle=
"modal"
data-target=
"#tecnologiaForm"
>
Agregar Tecnologia
</button>
<div
id=
"tecnologias"
>
</div>
<button
type=
"submit"
class=
"btn btn-primary"
>
Submit
</button>
</form>
...
...
@@ -109,12 +115,37 @@
</div>
</div>
</div>
<!--------------------------------------------------------------------------------------->
<div
class=
"modal fade"
id=
"tecnologiaForm"
tabindex=
"-2"
role=
"dialog"
aria-labelledby=
"tecnologiaForm"
aria-hidden=
"true"
>
<div
class=
"modal-dialog"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h5
class=
"modal-title"
id=
"exampleModalLabel"
>
tecnologia
</h5>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</div>
<div
class=
"modal-body"
>
<form
name=
"tecnologia-form"
>
<label
for=
"nombre"
class=
"form-label"
>
Nombre
</label>
<input
type=
"text"
class=
"form-control"
name=
"nombre"
id=
"nombre"
>
<label
for=
"nivel"
class=
"form-label"
>
Nivel
</label>
<input
type=
"number"
class=
"form-control"
name=
"nivel"
id=
"nivel"
>
</form>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-secondary"
data-dismiss=
"modal"
>
Close
</button>
<button
type=
"button"
class=
"btn btn-primary"
onclick=
"agregarFieldTecnologia()"
data-dismiss=
"modal"
>
Agregar
</button>
</div>
</div>
</div>
</div>
<!--------------------------------------------------------------------------------------->
<!-- Optional JavaScript; choose one of the two! -->
<script
src=
"https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity=
"sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin=
"anonymous"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity=
"sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin=
"anonymous"
></script>
<script
src=
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity=
"sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin=
"anonymous"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity=
"sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin=
"anonymous"
></script>
<script
src=
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity=
"sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin=
"anonymous"
></script>
<script
src=
"./main.js"
></script>
</body>
</html>
\ No newline at end of file
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