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
d6a70654
Commit
d6a70654
authored
Aug 29, 2018
by
Billy Larru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asignar monto amanecidas arreglado
parent
a2885ef4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
174 additions
and
163 deletions
+174
-163
general.js
src/main/webapp/js/general.js
+18
-0
asignar_monto_amanecida.js
src/main/webapp/js/pages/asignar_monto_amanecida.js
+155
-160
asignarMontoAmanecida.jsp
src/main/webapp/vistas/asignarMontoAmanecida.jsp
+1
-3
No files found.
src/main/webapp/js/general.js
View file @
d6a70654
...
...
@@ -442,4 +442,21 @@ let initDatePicker = (...selectorName) => {
$
(
id
).
datepicker
(
'setDate'
,
'now'
);
});
}
const
setTiposContratoOnSelect
=
(
nodeIdentifier
,
optionAll
=
true
)
=>
{
ajaxWebService
.
get
(
`contratoTipo`
)
.
then
((
response
)
=>
{
let
$select
=
$
(
`
${
nodeIdentifier
}
`
)
let
option
if
(
optionAll
)
{
option
=
`<option value="">TODOS</option>`
}
response
.
data
.
forEach
((
value
,
id
)
=>
{
option
+=
`<option value="
${
value
.
id
}
">
${
value
.
nombre
}
</option>`
})
$select
.
html
(
option
).
selectpicker
()
$select
.
selectpicker
();
})
}
\ No newline at end of file
src/main/webapp/js/pages/asignar_monto_amanecida.js
View file @
d6a70654
function
getColumns
()
{
let
columns
=
[
{
title
:
`N°`
,
data
:
`id`
,
className
:
'text-center'
},
{
title
:
`CONCEPTO`
,
data
:
`descripcion`
,
className
:
`text-center`
,
},
{
title
:
`MONTO AMANECIDA 12h`
,
data
:
`monto12h`
,
className
:
'text-center'
},
{
title
:
`MONTO AMANECIDA 24h`
,
data
:
`monto24h`
,
className
:
'text-center'
},
{
title
:
'ESTADO'
,
data
:
`estado`
,
className
:
"text-center"
,
render
:
(
data
)
=>
{
let
label
=
""
;
let
contenido
=
""
;
if
(
data
===
1
)
{
label
=
`label label-success`
;
contenido
=
"ACTIVO"
;
}
else
if
(
data
===
0
)
{
label
=
`label label-danger`
;
contenido
=
"PASIVO"
;
}
return
`<span class="
${
label
}
">
${
contenido
}
</span>`
;
}
},
{
title
:
`ACCIONES`
,
data
:
null
,
className
:
'text-center'
,
render
:
(
data
)
=>
{
let
acciones
=
`<span data-placement="left" title="Editar" style="cursor: pointer"> <i class="editar icon-pencil text-slate-800"></i> </span>
let
columns
=
[
{
title
:
`N°`
,
data
:
`id`
,
className
:
'text-center'
},
{
title
:
`CONCEPTO`
,
data
:
`descripcion`
,
className
:
`text-center`
,
},
{
title
:
`MONTO AMANECIDA 12h`
,
data
:
`monto12h`
,
className
:
'text-center'
},
{
title
:
`MONTO AMANECIDA 24h`
,
data
:
`monto24h`
,
className
:
'text-center'
},
{
title
:
'ESTADO'
,
data
:
`estado`
,
className
:
"text-center"
,
render
:
(
data
)
=>
{
let
label
=
""
;
let
contenido
=
""
;
if
(
data
===
1
)
{
label
=
`label label-success`
;
contenido
=
"ACTIVO"
;
}
else
if
(
data
===
0
)
{
label
=
`label label-danger`
;
contenido
=
"PASIVO"
;
}
return
`<span class="
${
label
}
">
${
contenido
}
</span>`
;
}
},
{
title
:
`ACCIONES`
,
data
:
null
,
className
:
'text-center'
,
render
:
(
data
)
=>
{
let
acciones
=
`<span data-placement="left" title="Editar" style="cursor: pointer"> <i class="editar icon-pencil text-slate-800"></i> </span>
<span data-placement="left" title="Eliminar" style="cursor: pointer"> <i class="eliminar icon-cancel-circle2 text-danger-700"></i> </span>`
;
return
acciones
;
}
}
];
return
acciones
;
}
}
];
return
columns
;
return
columns
;
}
function
getColumnDefs
()
{
let
columnDefs
=
[
{
orderable
:
false
,
width
:
'3
%'
,
targets
:
0
,
className
:
"text-center"
},
{
orderable
:
false
,
width
:
'10
%'
,
targets
:
1
,
className
:
"text-center"
},
{
orderable
:
false
,
width
:
'30
%'
,
targets
:
2
,
className
:
"text-center"
},
{
orderable
:
false
,
width
:
'7
%'
,
targets
:
3
,
className
:
"text-center"
},
{
orderable
:
false
,
width
:
'7
%'
,
targets
:
4
,
className
:
"text-center"
},
];
return
columnDefs
;
let
columnDefs
=
[
{
orderable
:
false
,
width
:
'1
%'
,
targets
:
0
,
className
:
"text-center"
},
{
orderable
:
false
,
width
:
'15
%'
,
targets
:
1
,
className
:
"text-center"
},
{
orderable
:
false
,
width
:
'15
%'
,
targets
:
2
,
className
:
"text-center"
},
{
orderable
:
false
,
width
:
'15
%'
,
targets
:
3
,
className
:
"text-center"
},
{
orderable
:
false
,
width
:
'8
%'
,
targets
:
4
,
className
:
"text-center"
},
];
return
columnDefs
;
}
function
cambiarFormatoDecimal
(
selectorName
)
{
$
(
selectorName
).
formatter
({
pattern
:
'{{999}}.00'
});
$
(
selectorName
).
formatter
({
pattern
:
'{{999}}.00'
});
}
function
registrar
()
{
let
descripcion
=
$
(
"#txtDescripcion"
).
val
();
let
monto24h
=
parseFloat
(
$
(
"#txtMonto12h"
).
val
());
let
monto12h
=
parseFloat
(
$
(
"#txtMonto24h"
).
val
());
let
estado
=
1
;
let
params
=
{
descripcion
,
monto12h
,
monto24h
,
estado
};
axios
.
post
(
URI_POLICIA_MONTOS_AMANECIDAS
,
params
).
then
((
response
)
=>
{
response
.
data
=
formatResponse
(
response
);
if
(
response
.
data
.
status
)
{
swal
({
type
:
'success'
,
title
:
'¡Se registró correctamente!'
,
showConfirmButton
:
false
,
timer
:
1500
});
listarMontos
();
}
});
let
descripcion
=
$
(
"#txtDescripcion"
).
val
();
let
monto24h
=
parseFloat
(
$
(
"#txtMonto12h"
).
val
());
let
monto12h
=
parseFloat
(
$
(
"#txtMonto24h"
).
val
());
let
estado
=
1
;
let
params
=
{
descripcion
,
monto12h
,
monto24h
,
estado
};
axios
.
post
(
URI_POLICIA_MONTOS_AMANECIDAS
,
params
).
then
((
response
)
=>
{
response
.
data
=
formatResponse
(
response
);
if
(
response
.
data
.
status
)
{
swal
({
type
:
'success'
,
title
:
'¡Se registró correctamente!'
,
showConfirmButton
:
false
,
timer
:
1500
});
listarMontos
();
}
});
}
function
inicializarInputsModal
(
data
=
{}){
$
(
"#txtEditarConcepto"
).
val
(
data
.
descripcion
);
$
(
"#txtEditarMonto12h"
).
val
(
data
.
monto12h
);
$
(
"#txtEditarMonto24h"
).
val
(
data
.
monto24h
);
debugger
$
(
"#txtEditarConcepto"
).
val
(
data
.
descripcion
);
$
(
"#txtEditarMonto12h"
).
val
(
data
.
monto12h
);
$
(
"#txtEditarMonto24h"
).
val
(
data
.
monto24h
);
debugger
}
function
mostrarMensajeResultadoModal
(
result
=
{}){
if
(
result
.
value
)
{
swal
({
type
:
'success'
,
title
:
'¡Se realizó la actualización correctamente!'
,
showConfirmButton
:
false
,
timer
:
1500
});
if
(
result
.
value
)
{
swal
({
type
:
'success'
,
title
:
'¡Se realizó la actualización correctamente!'
,
showConfirmButton
:
false
,
timer
:
1500
});
}
}
function
mostrarModalEdicion
(
data
=
{})
{
axios
.
get
(
"modals/policias/asignarMontoAmanecida/editarMontoConcepto.jsp"
).
then
((
response
)
=>
{
swal
({
title
:
'<strong>Editar Montos de amanecidas</strong>'
,
html
:
response
.
data
,
showCloseButton
:
true
,
showCancelButton
:
true
,
focusConfirm
:
false
,
confirmButtonText
:
'<i class="fa fa-thumbs-up"></i> Guardar cambios'
,
confirmButtonAriaLabel
:
'Thumbs up, great!'
,
cancelButtonText
:
'Cancelar'
,
cancelButtonAriaLabel
:
'Thumbs down'
,
width
:
'15%'
,
onOpen
:
()
=>
{
inicializarInputsModal
(
data
);
}
}).
then
((
result
)
=>
{
mostrarMensajeResultadoModal
(
result
);
});
});
axios
.
get
(
"modals/policias/asignarMontoAmanecida/editarMontoConcepto.jsp"
).
then
((
response
)
=>
{
swal
({
title
:
'<strong>Editar Montos de amanecidas</strong>'
,
html
:
response
.
data
,
showCloseButton
:
true
,
showCancelButton
:
true
,
focusConfirm
:
false
,
confirmButtonText
:
'<i class="fa fa-thumbs-up"></i> Guardar cambios'
,
confirmButtonAriaLabel
:
'Thumbs up, great!'
,
cancelButtonText
:
'Cancelar'
,
cancelButtonAriaLabel
:
'Thumbs down'
,
width
:
'15%'
,
onOpen
:
()
=>
{
inicializarInputsModal
(
data
);
}
}).
then
((
result
)
=>
{
mostrarMensajeResultadoModal
(
result
);
});
});
}
function
mostrarModalEliminacion
(
data
)
{
axios
.
put
(
URI_POLICIA_MONTOS_AMANECIDAS
,
data
)
axios
.
put
(
URI_POLICIA_MONTOS_AMANECIDAS
,
data
)
swal
({
type
:
'success'
,
title
:
'¡Eliminado correctamente!'
,
showConfirmButton
:
false
,
timer
:
1500
});
swal
({
type
:
'success'
,
title
:
'¡Eliminado correctamente!'
,
showConfirmButton
:
false
,
timer
:
1500
});
}
function
listarMontos
(
objParams
=
{})
{
axios
.
get
(
URI_POLICIA_MONTOS_AMANECIDAS
,
objParams
).
then
((
response
)
=>
{
response
.
data
=
formatResponse
(
response
);
let
columns
=
getColumns
();
let
columnDefs
=
getColumnDefs
();
let
wrapsNameDatatable
=
`divDatatable`
;
let
classNameForDatatable
=
`display table table-bordered`
;
let
footer
=
false
;
makeDatatable
(
{
data
:
response
.
data
.
data
,
columns
,
columnDefs
,
wrapsNameDatatable
,
classNameForDatatable
,
footer
}
).
then
((
datatable
)
=>
{
$
(
datatable
).
on
(
"click"
,
".editar"
,
function
()
{
let
data
=
$
(
datatable
).
DataTable
().
row
(
$
(
this
).
parents
(
"tr"
)).
data
();
mostrarModalEdicion
(
data
);
});
$
(
datatable
).
on
(
"click"
,
".eliminar"
,
function
()
{
let
data
=
$
(
datatable
).
DataTable
().
row
(
$
(
this
).
parents
(
"tr"
)).
data
();
mostrarModalEliminacion
(
data
);
});
});
});
ajaxWebService
.
get
(
URI_POLICIA_MONTOS_AMANECIDAS
,
objParams
).
then
((
response
)
=>
{
let
columns
=
getColumns
();
let
columnDefs
=
getColumnDefs
();
let
wrapsNameDatatable
=
`divDatatable`
;
let
classNameForDatatable
=
`display table table-bordered`
;
makeDatatable
(
wrapsNameDatatable
,
{
data
:
response
.
data
,
columns
,
columnDefs
,
},
classNameForDatatable
,
).
then
((
nodes
)
=>
{
nodes
.
container
.
on
(
"click"
,
".editar"
,
function
()
{
let
data
=
nodes
.
datatable
.
DataTable
().
row
(
$
(
this
).
parents
(
"tr"
)).
data
();
mostrarModalEdicion
(
data
);
});
nodes
.
container
.
on
(
"click"
,
".eliminar"
,
function
()
{
let
data
=
nodes
.
datatable
.
DataTable
().
row
(
$
(
this
).
parents
(
"tr"
)).
data
();
mostrarModalEliminacion
(
data
);
});
});
});
}
$
().
ready
(
function
()
{
// cambiarFormatoDecimal("#txtMonto12h");
// cambiarFormatoDecimal("#txtMonto24h");
defaultConfigDataTable
();
listarMontos
();
$
(
"#btnRegistrar"
).
click
(
registrar
);
listarMontos
();
$
(
"#btnRegistrar"
).
click
(
registrar
);
});
\ No newline at end of file
src/main/webapp/vistas/asignarMontoAmanecida.jsp
View file @
d6a70654
...
...
@@ -50,7 +50,7 @@
<div
class=
"row"
>
<div
class=
"col-md-
7 col-md-offset-2
"
>
<div
class=
"col-md-
6 col-md-offset-3
"
>
<div
class=
"panel panel-primary card-3"
style=
"margin-top: 30px"
>
<div
class=
"panel-heading"
style=
"padding: 8px 15px"
>
<h6
class=
"panel-title"
style=
"font-size: 15px; font-family: inherit"
><i
class=
"icon icon-search4"
></i>
LISTADO
</h6>
...
...
@@ -68,12 +68,10 @@
<
%@
include
file=
"templates/footer-body.jsp"
%
>
<!--js de la pagina-->
<script
src=
"../plantilla/assets/js/plugins/tables/datatables/datatables.min.js"
type=
"text/javascript"
></script>
<script
src=
"../plantilla/assets/js/core/libraries/jquery_ui/interactions.min.js"
></script>
<script
src=
"../plantilla/assets/js/core/libraries/jquery_ui/widgets.min.js"
></script>
<script
src=
"../js/lib/sweetalert2.min.js"
type=
"text/javascript"
></script>
<script
src=
"../js/lib/lodash.js"
type=
"text/javascript"
></script>
<script
src=
"../js/lib/axios.min.js"
type=
"text/javascript"
></script>
<script
src=
"../plantilla/assets/js/plugins/forms/inputs/formatter.min.js"
></script>
<script
src=
"../js/pages/asignar_monto_amanecida.js"
></script>
<!--js-->
...
...
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