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
1
Merge Requests
1
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
Oscar Enrique Gonzalez Escurra
th-app-java
Commits
e03ab869
Commit
e03ab869
authored
Nov 23, 2021
by
willgonzz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no se puede crear convocatoria del mismo cargo si existe una abierta
parent
805430c0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java
+11
-3
curriculumsearch/src/main/webapp/jsp/convocatorias.jsp
+4
-0
No files found.
curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java
View file @
e03ab869
...
...
@@ -2,6 +2,7 @@ package com.roshka.controller;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.List
;
import
com.roshka.modelo.Cargo
;
import
com.roshka.modelo.ConvocatoriaCargo
;
...
...
@@ -16,6 +17,7 @@ import org.hibernate.jpa.TypedParameterValue;
import
org.hibernate.type.IntegerType
;
import
org.hibernate.type.LongType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.MessageSource
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.validation.BindingResult
;
...
...
@@ -24,6 +26,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
@Controller
public
class
ConvocatoriaController
{
...
...
@@ -38,7 +41,7 @@ public class ConvocatoriaController {
}
@RequestMapping
(
"/convocatorias"
)
public
String
menuConvocatorias
(
Model
model
,
public
String
menuConvocatorias
(
Model
model
,
RedirectAttributes
redirectAttrs
,
@RequestParam
(
required
=
false
)
Long
cargoId
,
@RequestParam
(
required
=
false
)
Integer
isOpen
//1: true, 0: false
)
{
...
...
@@ -57,7 +60,13 @@ public class ConvocatoriaController {
}
@PostMapping
(
"/convocatoria"
)
public
String
guardarConvocatoria
(
@ModelAttribute
ConvocatoriaCargo
convocatoria
,
BindingResult
result
)
{
public
String
guardarConvocatoria
(
@ModelAttribute
ConvocatoriaCargo
convocatoria
,
BindingResult
result
,
RedirectAttributes
redirectAttributes
)
{
for
(
ConvocatoriaCargo
conv:
convoRepo
.
findByCargoId
(
convocatoria
.
getCargoId
()))
{
if
(
conv
.
getEstado
()==
EstadoConvocatoria
.
abierto
){
redirectAttributes
.
addFlashAttribute
(
"SUCCESS_MESSAGE"
,
"Ya existe una convocatoria Abierta con ese cargo"
);
return
"redirect:/convocatorias"
;
}
}
if
(
result
.
hasErrors
());
convocatoria
.
setFechaInicio
(
new
Date
());
convocatoria
.
setEstado
(
EstadoConvocatoria
.
abierto
);
...
...
@@ -88,7 +97,6 @@ public class ConvocatoriaController {
@RequestMapping
(
"/convocatoria/{id}"
)
public
String
guardarConvocatoria
(
@ModelAttribute
ConvocatoriaCargo
convocatoria
,
BindingResult
result
,
@PathVariable
(
required
=
false
)
Long
id
,
Model
model
)
{
if
(
result
.
hasErrors
());
if
(
id
!=
null
)
convocatoria
.
setId
(
id
);
convocatoria
=
convoRepo
.
findByIdConvocatoriaCargo
(
id
);
convocatoria
.
setEstado
(
EstadoConvocatoria
.
cerrado
);
...
...
curriculumsearch/src/main/webapp/jsp/convocatorias.jsp
View file @
e03ab869
...
...
@@ -27,6 +27,9 @@
</div>
<div>
<a href="/convocatoria">Agregar Nueva Convocatoria</a>
<c:if test="${SUCCESS_MESSAGE != null}">
<div id="status_message">${SUCCESS_MESSAGE}</div>
</c:if>
<table class="table">
<thead>
<tr>
...
...
@@ -57,6 +60,7 @@
</table>
</div>
</layout:put>
<layout:put block="scripts" type="APPEND">
<script language="JavaScript">
...
...
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