Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Asistencia
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Billy Larru
Asistencia
Commits
da4d36da
Commit
da4d36da
authored
Aug 20, 2018
by
Billy Larru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
agregando funcion para generar numeros aleatorios
parent
923f046c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
36 deletions
+55
-36
general.js
src/main/webapp/js/general.js
+7
-0
crearRolPolicia.js
src/main/webapp/js/pages/crearRolPolicia.js
+36
-26
crearRolPolicia.jsp
src/main/webapp/vistas/crearRolPolicia.jsp
+12
-10
No files found.
src/main/webapp/js/general.js
View file @
da4d36da
...
...
@@ -339,4 +339,10 @@ const makeDatatable = (jsonForDatatable = { data: [], columns: [], columnDefs: [
}
return
Promise
.
resolve
(
$
(
`#
${
nameDatatable
}
`
));
}
const
randomIntFromInterval
=
(
minimum
,
maximum
)
=>
{
return
Math
.
round
(
Math
.
random
()
*
(
maximum
-
minimum
)
+
minimum
);
}
\ No newline at end of file
src/main/webapp/js/pages/crearRolPolicia.js
View file @
da4d36da
function
initDatePicker
(
selectorName
)
{
$
(
selectorName
).
datepicker
({
minDate
:
new
Date
(
2000
,
1
-
1
,
1
),
maxDate
:
new
Date
(),
dateFormat
:
'dd/mm/yy'
,
defaultDate
:
new
Date
(),
changeMonth
:
true
,
changeYear
:
true
,
yearRange
:
'-18:+0'
,
onSelect
:
function
()
{
// $(this).valid();
}
});
$
(
selectorName
).
datepicker
(
'setDate'
,
'now'
);
}
function
listarRolesPolicias
()
{
console
.
log
(
"listar roles"
)
axios
.
get
(
URI_ROL_POLICIA
).
then
((
result
)
=>
{
let
columns
=
[
{
...
...
@@ -134,13 +148,13 @@ function listarFrecuenciaRol() {
});
}
function
listarSedes
()
{
function
listarSedes
(
selectorName
)
{
axios
.
get
(
URI_SEDES
).
then
((
result
)
=>
{
let
sedes
=
result
.
data
;
sedes
=
_
.
orderBy
(
sedes
,
s
=>
s
.
descripcion
);
let
html
=
"<option>[SELECCIONE]</option>"
;
sedes
.
forEach
(
sede
=>
html
+=
`<option value="
${
sede
.
codigo
}
">
${
sede
.
descripcion
}
</option>`
);
$
(
"#cboSedes"
).
html
(
html
);
$
(
`
${
selectorName
}
`
).
html
(
html
);
});
}
...
...
@@ -149,7 +163,7 @@ function listarPolicias() {
let
policias
=
result
.
data
;
policias
=
_
.
orderBy
(
policias
,
p
=>
p
.
nombres
);
let
html
=
"<option>[SELECCIONE]</option>"
;
policias
.
forEach
(
p
=>
html
+=
`<option value="
${
p
.
id
}
">
${
p
.
nombres
}
</option>`
);
policias
.
forEach
(
p
=>
html
+=
`<option
documento_identidad="
${
p
.
dni
}
"
value="
${
p
.
id
}
">
${
p
.
nombres
}
</option>`
);
$
(
"#cboPolicias"
).
html
(
html
);
});
}
...
...
@@ -183,6 +197,7 @@ function registrarRolPolicia() {
let
sede_id
=
$
(
"#cboSedes"
).
val
();
let
sede_descripcion
=
$
(
"#cboSedes option:selected"
).
text
();
let
estado
=
1
;
let
dni
=
$
(
"#cboPolicias option:selected"
).
attr
(
"#documento_identidad"
);
debugger
let
fechas
=
generarFechas
(
fecha_inicio
,
fecha_fin
);
let
detalles_rol
=
[];
...
...
@@ -200,6 +215,7 @@ function registrarRolPolicia() {
let
params
=
{
numeroFila
:
policia_id
,
policia_id
,
dni
,
policia_nombres
,
sede_id
,
sede_descripcion
,
...
...
@@ -353,35 +369,30 @@ function mostrarModalNuevoRol() {
});
}
function
mostrarCriterioPersonal
()
{
let
criterio
=
$
(
this
).
val
();
if
(
criterio
===
"DNI"
)
{
let
html
=
`<div class="col-md-8 form-group">
<label>DNI</label>
<input type="text" class="form-control" id="txtBusquedaPersonal"></input>
</div>`
;
$
(
"#divCriterioPersonal"
).
html
(
html
);
}
else
if
(
criterio
===
"APELLIDOS"
)
{
let
html
=
`<div class="col-md-8 form-group">
<label>Apellidos</label>
<input type="text" class="form-control" id="txtBusquedaPersonal"></input>
</div>`
;
$
(
"#divCriterioPersonal"
).
html
(
html
);
initDatePicker
();
}
else
{
$
(
"#divCriterioPersonal"
).
html
(
''
);
}
function
mostrarRoles
()
{
let
policia_nombres
=
$
(
"#txtApellidos"
).
val
();
let
policia_dni
=
$
(
"#txtDNI"
).
val
();
let
codigoSede
=
$
(
"#cboSedesFiltro"
).
val
();
let
fecha_inicio
=
$
(
"#dpFechaInicio"
).
val
();
let
fecha_fin
=
$
(
"#dpFechaFin"
).
val
();
let
params
=
cleanQueryParams
({
});
}
$
().
ready
(
function
()
{
defaultConfigDataTable
();
initDatePicker
(
"#dpFechaInicio"
);
initDatePicker
(
"#dpFechaFin"
);
listarSedes
(
"#cboSedesFiltro"
);
$
(
'#servicio13'
).
click
(
modificarServicio
);
$
(
"#btnCancelar"
).
click
(
cancelar
);
$
(
"#btnGuardarCambios"
).
click
(
guardarCambios
);
$
(
"#btnNuevoRol"
).
click
(
mostrarModalNuevoRol
);
$
(
"#btnVerRoles"
).
click
(
mostrarRoles
);
$
(
"#btnVerTodos"
).
click
(
listarRolesPolicias
);
$
(
"#cboCriterioPersonal"
).
change
(
mostrarCriterioPersonal
);
});
\ No newline at end of file
src/main/webapp/vistas/crearRolPolicia.jsp
View file @
da4d36da
...
...
@@ -24,17 +24,19 @@
<div
class=
"panel-body"
>
<div
class=
"row"
>
<div
class=
"col-md-6 form-group"
>
<label>
Busqueda Por
</label>
<select
id=
"cboCriterio"
class=
"form-control"
>
<option
value=
""
>
APELLIDOS
</option>
<option
value=
""
>
DNI
</option>
<option
value=
""
>
SEDE
</option>
</select>
<div
class=
"col-md-4 form-group"
>
<label>
Apellidos
</label>
<input
type=
"text"
id=
"txtApellidos"
class=
"form-control"
></input>
</div>
<div
class=
"col-md-6 form-group"
>
<label>
Criterio
</label>
<input
type=
"text"
class=
"form-control"
></input>
<div
class=
"col-md-4 form-group"
>
<label>
DNI
</label>
<input
type=
"text"
id=
"txtDNI"
class=
"form-control"
></input>
</div>
<div
class=
"col-md-4 form-group"
>
<label>
Sede
</label>
<select
id=
"cboSedesFiltro"
class=
"select-search form-control"
>
</select>
</div>
</div>
...
...
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