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
b64d2556
Commit
b64d2556
authored
Aug 31, 2018
by
Billy Larru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cambiar estado de registro en crear rol de policias
parent
ed6ef304
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
43 deletions
+27
-43
crearRolPolicia.js
src/main/webapp/js/pages/crearRolPolicia.js
+27
-43
No files found.
src/main/webapp/js/pages/crearRolPolicia.js
View file @
b64d2556
...
...
@@ -48,19 +48,22 @@ function listarRolesPolicias(objParams = {}) {
data
:
`estado`
,
className
:
'text-center'
,
render
:
(
data
)
=>
{
let
editar
=
""
;
let
eliminar
=
""
;
let
acciones
=
""
;
console
.
log
(
data
);
if
(
Object
.
is
(
data
,
1
))
{
return
` <span data-placement="left" title="Ver detalle" data-toggle="tooltip" style="cursor: pointer"> <i class='ver-detalle icon-calendar2 text-primary-700'></i> </span>
<span data-toggle="tooltip" data-placement="left" title="Desactivar Rol" style="cursor: pointer"> <i class='eliminar icon-cancel-circle2 text-danger-700'></i> </span>
`
;
if
(
data
===
1
)
{
editar
=
`<span data-placement="left" title="Ver detalle" data-toggle="tooltip" style="cursor: pointer"> <i class='ver-detalle icon-calendar2 text-primary-700'></i> </span>`
;
eliminar
=
`<span data-placement="left" title="Desactivar Rol" style="cursor: pointer"> <i class="eliminar fa fa-power-off text-danger-700"></i> </span>`
;
}
else
{
return
null
;
eliminar
=
`<span data-placement="left" title="Eliminar" style="cursor: pointer"> <i class="eliminar fa fa-power-off text-success-700"></i> </span>`
;
}
acciones
=
editar
+
eliminar
;
return
acciones
;
}
}
];
let
columnDefs
=
[
{
orderable
:
false
,
width
:
'1%'
,
targets
:
0
,
className
:
"text-center"
},
{
orderable
:
false
,
width
:
'8%'
,
targets
:
1
},
...
...
@@ -71,10 +74,8 @@ function listarRolesPolicias(objParams = {}) {
{
orderable
:
false
,
width
:
'8%'
,
targets
:
6
,
className
:
"text-center"
},
{
orderable
:
false
,
width
:
'8%'
,
targets
:
7
,
className
:
"text-center"
}
];
let
wrapsNameDatatable
=
`divRoles`
;
let
classNameForDatatable
=
`display table table-bordered`
;
makeDatatable
(
wrapsNameDatatable
,
{
data
:
response
.
data
,
...
...
@@ -86,7 +87,6 @@ function listarRolesPolicias(objParams = {}) {
nodes
.
container
.
on
(
"click"
,
".ver-detalle"
,
function
()
{
let
data
=
nodes
.
datatable
.
DataTable
().
row
(
$
(
this
).
parents
(
"tr"
)).
data
();
console
.
log
(
data
);
ajaxModal
.
get
(
"policias/mantenimientoRol/detalleRol.jspf"
).
then
((
response
)
=>
{
debugger
swal
({
...
...
@@ -110,40 +110,51 @@ function listarRolesPolicias(objParams = {}) {
$
(
"#listaDias"
).
html
(
htmlList
);
}
});
});
});
nodes
.
container
.
on
(
"click"
,
".eliminar"
,
function
()
{
let
data
=
nodes
.
datatable
.
DataTable
().
row
(
$
(
this
).
parents
(
"tr"
)).
data
();
mostrarModalEliminacion
(
data
);
});
});
});
}
const
mostrarModalEliminacion
=
(
data
)
=>
{
let
{
id
,
estado
}
=
data
;
let
titulo
=
""
;
let
textoConfirmacion
=
""
let
tituloOperacion
=
""
;
if
(
estado
)
{
titulo
=
'Está seguro de eliminar el rol?'
;
textoConfirmacion
=
'Sí, eliminar!'
;
tituloOperacion
=
'¡Eliminado exitosamente!'
;
estado
=
0
;
}
else
{
titulo
=
'Está seguro de activar?'
;
textoConfirmacion
=
'Sí, activar!'
;
tituloOperacion
=
'¡Activado exitosamente!'
;
estado
=
1
;
}
swal
({
title
:
'Está seguro de eliminar el rol?'
,
title
:
titulo
,
text
:
""
,
type
:
'warning'
,
showCancelButton
:
true
,
confirmButtonColor
:
'#3085d6'
,
cancelButtonColor
:
'#d33'
,
confirmButtonText
:
'Sí, eliminar!'
confirmButtonText
:
textoConfirmacion
}).
then
((
result
)
=>
{
if
(
result
.
value
)
{
ajaxWebService
.
patch
(
`
${
URI_ROL_POLICIA
}
/
${
id
}
`
,
{
estado
}).
then
((
response
)
=>
{
if
(
response
.
status
)
{
swal
({
type
:
'success'
,
title
:
'¡Eliminado correctamente!'
,
title
:
tituloOperacion
,
showConfirmButton
:
false
,
timer
:
1500
});
...
...
@@ -152,14 +163,7 @@ const mostrarModalEliminacion = (data) => {
});
}
});
};
const
listarTipoRoles
=
()
=>
{
ajaxWebService
.
get
(
URI_TIPOROL_POLICIA
).
then
((
response
)
=>
{
let
tipoRoles
=
response
.
data
;
...
...
@@ -210,7 +214,6 @@ function modificarServicio() {
$
(
"#modal-header"
).
addClass
(
'bg-jade'
);
$
(
"#botones-editar"
).
removeClass
(
'hidden'
);
$
(
"#btnCerrar"
).
addClass
(
"hidden"
);
animar
();
// e.preventDefault();
}
...
...
@@ -232,13 +235,10 @@ function registrarRolPolicia() {
let
policia_dni
=
$
(
"#cboPolicias option:selected"
).
attr
(
"documento_identidad"
);
let
hora_entrada
=
$
(
"#cboTipoRol option:selected"
).
data
(
'hora-entrada'
);
let
hora_salida
=
$
(
"#cboTipoRol option:selected"
).
data
(
'hora-salida'
);
debugger
let
fechas
=
generarFechas
(
fecha_inicio
,
fecha_fin
);
let
detalles_rol
=
[];
let
numero
=
1
;
fechas
.
map
((
f
)
=>
{
let
obj
=
{
...
...
@@ -258,7 +258,6 @@ function registrarRolPolicia() {
};
detalles_rol
.
push
(
detalle_rol
);
});
let
params
=
{
numeroFila
:
policia_id
,
policia_id
,
...
...
@@ -275,7 +274,6 @@ function registrarRolPolicia() {
detalles_rol
,
estado
};
ajaxWebService
.
post
(
URI_ROL_POLICIA
,
params
)
.
then
((
response
)
=>
{
debugger
;
...
...
@@ -312,7 +310,6 @@ function cancelar() {
function
animar
()
{
let
animation
=
`fadeIn`
;
$
(
"#modal_body_tombo2"
).
addClass
(
`animated
${
animation
}
`
).
one
(
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend"
,
function
()
{
$
(
this
).
removeClass
(
`animated
${
animation
}
`
);
});
...
...
@@ -345,23 +342,16 @@ function mostrarModalNuevoRol() {
listarFrecuenciaRol
();
listarSedes
(
"#cboSedesModal"
);
listarPolicias
(
"#cboPolicias"
);
$
(
'.selectpicker'
).
selectpicker
({
style
:
'btn-info'
,
size
:
4
});
$
(
'.select-search'
).
select2
();
$
(
".btn.dropdown-toggle.bs-placeholder"
).
removeClass
(
"btn-info"
);
$
(
".btn.dropdown-toggle.bs-placeholder"
).
css
({
border
:
"1px solid #ddd"
,
backgroundColor
:
"#fff"
});
$
(
"#dpRangoFechas"
).
daterangepicker
({
"autoApply"
:
true
,
"locale"
:
{
...
...
@@ -404,8 +394,6 @@ function mostrarModalNuevoRol() {
// console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')');
});
$
(
"#dpRangoFechas"
).
datepicker
(
'setDate'
,
'now'
);
defaultConfigDatePicker
();
}
}).
then
((
result
)
=>
{
...
...
@@ -422,17 +410,13 @@ function buscarRoles() {
let
sede_id
=
$
(
"#cboSedesFiltro"
).
val
();
let
fecha_inicio
=
$
(
"#dpFechaInicio"
).
val
();
let
fecha_fin
=
$
(
"#dpFechaFin"
).
val
();
let
rangoFechas
=
generarFechas
(
fecha_inicio
,
fecha_fin
);
let
params
=
cleanQueryParams
({
policia_id
,
sede_id
,
fecha_inicio
:
rangoFechas
});
console
.
log
(
params
);
listarRolesPolicias
({
params
});
}
...
...
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