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
5f36ddb0
Commit
5f36ddb0
authored
Aug 28, 2018
by
Billy Larru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit de borrador para no quitar el ejemplo de prueba de arreglo de promesas
parent
9a0af8e0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
442 additions
and
370 deletions
+442
-370
general.js
src/main/webapp/js/general.js
+283
-282
proyectar_asistencia_policias.js
src/main/webapp/js/pages/proyectar_asistencia_policias.js
+77
-8
proyectarAsistenciaPolicias.jsp
src/main/webapp/vistas/proyectarAsistenciaPolicias.jsp
+82
-80
No files found.
src/main/webapp/js/general.js
View file @
5f36ddb0
...
...
@@ -9,10 +9,10 @@ const PATH_SERVICIO_REST = 'http://app9.sacooliveros.edu.pe:8080/security-rest/a
//<editor-fold> SERVICIOS REST
const
ajaxWebService
=
axios
.
create
({
baseURL
:
'http://sistem16:666/'
baseURL
:
'http://sistem16:666/'
});
const
ajaxModal
=
axios
.
create
({
baseURL
:
`http://localhost:7070/Asistencia/vistas/modals/`
baseURL
:
`http://localhost:7070/Asistencia/vistas/modals/`
});
...
...
@@ -36,126 +36,126 @@ const URI_POLICIA_PROYECCION = "proyeccion";
$
.
extend
(
$
.
fn
.
dataTable
.
defaults
,
{
bSort
:
false
,
bFilter
:
false
,
aaSorting
:
[],
ordering
:
false
,
bLengthChange
:
false
,
bInfo
:
true
,
paging
:
true
,
iDisplayLength
:
20
,
bStateSave
:
false
,
autoWidth
:
false
,
responsive
:
true
,
stateSave
:
true
,
scrollX
:
true
,
responsive
:
true
,
language
:
{
lengthMenu
:
"Mostrar: _MENU_"
,
zeroRecords
:
" No se encontraron resultados"
,
info
:
" Mostrando del _START_ al _END_ de un total de _TOTAL_ registros"
,
infoEmpty
:
" Mostrando 0 de 0 registros"
,
search
:
"Filtrar:"
,
loadingRecords
:
"Cargando..."
,
processing
:
'<span style="width:100%;"><img src="http://www.snacklocal.com/images/ajaxload.gif"></span>'
,
paginate
:
{
first
:
"First"
,
last
:
"Last"
,
next
:
"Siguiente"
,
previous
:
"Anterior"
}
}
bSort
:
false
,
bFilter
:
false
,
aaSorting
:
[],
ordering
:
false
,
bLengthChange
:
false
,
bInfo
:
true
,
paging
:
true
,
iDisplayLength
:
20
,
bStateSave
:
false
,
autoWidth
:
false
,
responsive
:
true
,
stateSave
:
true
,
scrollX
:
true
,
responsive
:
true
,
language
:
{
lengthMenu
:
"Mostrar: _MENU_"
,
zeroRecords
:
" No se encontraron resultados"
,
info
:
" Mostrando del _START_ al _END_ de un total de _TOTAL_ registros"
,
infoEmpty
:
" Mostrando 0 de 0 registros"
,
search
:
"Filtrar:"
,
loadingRecords
:
"Cargando..."
,
processing
:
'<span style="width:100%;"><img src="http://www.snacklocal.com/images/ajaxload.gif"></span>'
,
paginate
:
{
first
:
"First"
,
last
:
"Last"
,
next
:
"Siguiente"
,
previous
:
"Anterior"
}
}
});
ajaxWebService
.
interceptors
.
response
.
use
(
function
(
response
)
{
// Do something with response data
let
respuesta
=
{
status
:
response
.
data
.
status
||
true
,
message
:
response
.
data
.
message
||
`Operación exitosa`
,
data
:
response
.
data
.
data
||
response
.
data
};
console
.
log
(
respuesta
)
return
respuesta
;
// Do something with response data
let
respuesta
=
{
status
:
response
.
data
.
status
||
true
,
message
:
response
.
data
.
message
||
`Operación exitosa`
,
data
:
response
.
data
.
data
||
response
.
data
};
console
.
log
(
respuesta
,
moment
().
format
(
"YYYY/DD/MM HH:MM:SS s"
)
)
return
respuesta
;
},
function
(
error
)
{
// Do something with response error
return
Promise
.
reject
(
error
);
// Do something with response error
return
Promise
.
reject
(
error
);
});
/*Ajax genral*/
const
ajaxRequestSendBody
=
obj
=>
{
let
body
=
JSON
.
stringify
(
obj
.
body
);
return
new
Promise
((
resolve
,
reject
)
=>
{
$
.
ajax
({
url
:
obj
.
url
,
type
:
obj
.
type
,
headers
:
obj
.
headers
,
data
:
{
body
:
body
},
beforeSend
:
(
xhr
,
settings
)
=>
{
},
success
:
(
response
,
textStatus
,
jqXHR
)
=>
{
resolve
(
response
)
},
error
:
(
jqXHR
,
textStatus
,
errorThrown
)
=>
{
reject
({
status
:
jqXHR
.
status
,
throw
:
errorThrown
||
{},
jqXHR
:
jqXHR
,
request
:
obj
})
}
})
})
let
body
=
JSON
.
stringify
(
obj
.
body
);
return
new
Promise
((
resolve
,
reject
)
=>
{
$
.
ajax
({
url
:
obj
.
url
,
type
:
obj
.
type
,
headers
:
obj
.
headers
,
data
:
{
body
:
body
},
beforeSend
:
(
xhr
,
settings
)
=>
{
},
success
:
(
response
,
textStatus
,
jqXHR
)
=>
{
resolve
(
response
)
},
error
:
(
jqXHR
,
textStatus
,
errorThrown
)
=>
{
reject
({
status
:
jqXHR
.
status
,
throw
:
errorThrown
||
{},
jqXHR
:
jqXHR
,
request
:
obj
})
}
})
})
}
/*Ajax General*/
/*Ajax genral*/
const
ajaxRequestGeneral
=
obj
=>
{
let
body
=
JSON
.
stringify
(
obj
.
body
);
return
new
Promise
((
resolve
,
reject
)
=>
{
$
.
ajax
({
url
:
obj
.
url
,
type
:
obj
.
type
,
headers
:
obj
.
headers
,
data
:
{
body
:
body
},
beforeSend
:
(
xhr
,
settings
)
=>
{
},
success
:
(
response
,
textStatus
,
jqXHR
)
=>
{
resolve
(
response
)
},
error
:
(
jqXHR
,
textStatus
,
errorThrown
)
=>
{
reject
({
status
:
jqXHR
.
status
,
throw
:
errorThrown
||
{},
jqXHR
:
jqXHR
,
request
:
obj
})
}
})
})
let
body
=
JSON
.
stringify
(
obj
.
body
);
return
new
Promise
((
resolve
,
reject
)
=>
{
$
.
ajax
({
url
:
obj
.
url
,
type
:
obj
.
type
,
headers
:
obj
.
headers
,
data
:
{
body
:
body
},
beforeSend
:
(
xhr
,
settings
)
=>
{
},
success
:
(
response
,
textStatus
,
jqXHR
)
=>
{
resolve
(
response
)
},
error
:
(
jqXHR
,
textStatus
,
errorThrown
)
=>
{
reject
({
status
:
jqXHR
.
status
,
throw
:
errorThrown
||
{},
jqXHR
:
jqXHR
,
request
:
obj
})
}
})
})
}
let
createSelectOptions
=
(
obj
,
valueName
,
textName
)
=>
{
let
options
=
''
obj
.
forEach
((
data
)
=>
{
options
+=
` < option value = "
${
data
[
valueName
]}
" >
${
data
[
textName
]}
< /option>`
})
return
options
let
options
=
''
obj
.
forEach
((
data
)
=>
{
options
+=
` < option value = "
${
data
[
valueName
]}
" >
${
data
[
textName
]}
< /option>`
})
return
options
}
let
customSwal
=
{
alert
(
title
,
text
,
type
)
{
let
colors
=
{
success
:
'#66BB6A'
,
error
:
'#EF5350'
,
warning
:
'#FF7043'
}
let
btnColor
=
colors
[
type
]
return
new
Promise
((
resolve
,
reject
)
=>
{
swal
({
title
:
title
,
text
:
text
,
confirmButtonColor
:
btnColor
,
type
:
type
},
(
isConfirm
)
=>
{
resolve
()
})
})
}
alert
(
title
,
text
,
type
)
{
let
colors
=
{
success
:
'#66BB6A'
,
error
:
'#EF5350'
,
warning
:
'#FF7043'
}
let
btnColor
=
colors
[
type
]
return
new
Promise
((
resolve
,
reject
)
=>
{
swal
({
title
:
title
,
text
:
text
,
confirmButtonColor
:
btnColor
,
type
:
type
},
(
isConfirm
)
=>
{
resolve
()
})
})
}
}
/**
...
...
@@ -168,44 +168,44 @@ let customSwal = {
let
getClosest
=
(
elem
,
selector
)
=>
{
// Element.matches() polyfill
if
(
!
Element
.
prototype
.
matches
)
{
Element
.
prototype
.
matches
=
Element
.
prototype
.
matchesSelector
||
Element
.
prototype
.
mozMatchesSelector
||
Element
.
prototype
.
msMatchesSelector
||
Element
.
prototype
.
oMatchesSelector
||
Element
.
prototype
.
webkitMatchesSelector
||
function
(
s
)
{
var
matches
=
(
this
.
document
||
this
.
ownerDocument
).
querySelectorAll
(
s
),
i
=
matches
.
length
while
(
--
i
>=
0
&&
matches
.
item
(
i
)
!==
this
)
{
}
return
i
>
-
1
}
}
if
(
!
Element
.
prototype
.
matches
)
{
Element
.
prototype
.
matches
=
Element
.
prototype
.
matchesSelector
||
Element
.
prototype
.
mozMatchesSelector
||
Element
.
prototype
.
msMatchesSelector
||
Element
.
prototype
.
oMatchesSelector
||
Element
.
prototype
.
webkitMatchesSelector
||
function
(
s
)
{
var
matches
=
(
this
.
document
||
this
.
ownerDocument
).
querySelectorAll
(
s
),
i
=
matches
.
length
while
(
--
i
>=
0
&&
matches
.
item
(
i
)
!==
this
)
{
}
return
i
>
-
1
}
}
// Get closest match
for
(;
elem
&&
elem
!==
document
;
elem
=
elem
.
parentNode
)
{
if
(
elem
.
matches
(
selector
))
return
elem
}
return
null
for
(;
elem
&&
elem
!==
document
;
elem
=
elem
.
parentNode
)
{
if
(
elem
.
matches
(
selector
))
return
elem
}
return
null
}
let
block
=
()
=>
{
$
.
blockUI
({
message
:
'<i class="icon-spinner4 spinner"></i>'
,
timeout
:
2000
,
//unblock after 2 seconds
overlayCSS
:
{
backgroundColor
:
'#1b2024'
,
opacity
:
0.8
,
cursor
:
'wait'
},
css
:
{
border
:
0
,
color
:
'#fff'
,
padding
:
0
,
backgroundColor
:
'transparent'
}
});
$
.
blockUI
({
message
:
'<i class="icon-spinner4 spinner"></i>'
,
timeout
:
2000
,
//unblock after 2 seconds
overlayCSS
:
{
backgroundColor
:
'#1b2024'
,
opacity
:
0.8
,
cursor
:
'wait'
},
css
:
{
border
:
0
,
color
:
'#fff'
,
padding
:
0
,
backgroundColor
:
'transparent'
}
});
}
//let logOut = () =>{
// document.querySelector('#logOut').addEventListener('click', (e) => {
...
...
@@ -222,39 +222,39 @@ let block = () => {
//}
let
logOut
=
()
=>
{
document
.
querySelector
(
'#logOut'
).
addEventListener
(
'click'
,
(
e
)
=>
{
window
.
location
.
href
=
'../vistas/logout'
;
});
document
.
querySelector
(
'#logOut'
).
addEventListener
(
'click'
,
(
e
)
=>
{
window
.
location
.
href
=
'../vistas/logout'
;
});
};
function
defaultConfigDatePicker
()
{
$
(
'.datepicker'
).
datepicker
({
dateFormat
:
'dd/mm/yy'
,
showButtonPanel
:
true
,
changeMonth
:
true
,
changeYear
:
true
,
minDate
:
'-4Y'
,
maxDate
:
'+1Y'
,
inline
:
true
});
$
.
datepicker
.
regional
[
'es'
]
=
{
closeText
:
'Cerrar'
,
prevText
:
'<Ant'
,
nextText
:
'Sig>'
,
currentText
:
'Hoy'
,
monthNames
:
[
'Enero'
,
'Febrero'
,
'Marzo'
,
'Abril'
,
'Mayo'
,
'Junio'
,
'Julio'
,
'Agosto'
,
'Setiembre'
,
'Octubre'
,
'Noviembre'
,
'Diciembre'
],
monthNamesShort
:
[
'Ene'
,
'Feb'
,
'Mar'
,
'Abr'
,
'May'
,
'Jun'
,
'Jul'
,
'Ago'
,
'Sep'
,
'Oct'
,
'Nov'
,
'Dic'
],
dayNames
:
[
'Domingo'
,
'Lunes'
,
'Martes'
,
'Miércoles'
,
'Jueves'
,
'Viernes'
,
'Sábado'
],
dayNamesShort
:
[
'Dom'
,
'Lun'
,
'Mar'
,
'Mie'
,
'Jue'
,
'Vie'
,
'Sáb'
],
dayNamesMin
:
[
'Do'
,
'Lu'
,
'Ma'
,
'Mi'
,
'Ju'
,
'Vi'
,
'Sá'
],
weekHeader
:
'Sm'
,
dateFormat
:
'dd/mm/yy'
,
firstDay
:
1
,
isRTL
:
false
,
showMonthAfterYear
:
false
,
yearSuffix
:
''
};
$
.
datepicker
.
setDefaults
(
$
.
datepicker
.
regional
[
'es'
]);
;
$
(
'.datepicker'
).
datepicker
({
dateFormat
:
'dd/mm/yy'
,
showButtonPanel
:
true
,
changeMonth
:
true
,
changeYear
:
true
,
minDate
:
'-4Y'
,
maxDate
:
'+1Y'
,
inline
:
true
});
$
.
datepicker
.
regional
[
'es'
]
=
{
closeText
:
'Cerrar'
,
prevText
:
'<Ant'
,
nextText
:
'Sig>'
,
currentText
:
'Hoy'
,
monthNames
:
[
'Enero'
,
'Febrero'
,
'Marzo'
,
'Abril'
,
'Mayo'
,
'Junio'
,
'Julio'
,
'Agosto'
,
'Setiembre'
,
'Octubre'
,
'Noviembre'
,
'Diciembre'
],
monthNamesShort
:
[
'Ene'
,
'Feb'
,
'Mar'
,
'Abr'
,
'May'
,
'Jun'
,
'Jul'
,
'Ago'
,
'Sep'
,
'Oct'
,
'Nov'
,
'Dic'
],
dayNames
:
[
'Domingo'
,
'Lunes'
,
'Martes'
,
'Miércoles'
,
'Jueves'
,
'Viernes'
,
'Sábado'
],
dayNamesShort
:
[
'Dom'
,
'Lun'
,
'Mar'
,
'Mie'
,
'Jue'
,
'Vie'
,
'Sáb'
],
dayNamesMin
:
[
'Do'
,
'Lu'
,
'Ma'
,
'Mi'
,
'Ju'
,
'Vi'
,
'Sá'
],
weekHeader
:
'Sm'
,
dateFormat
:
'dd/mm/yy'
,
firstDay
:
1
,
isRTL
:
false
,
showMonthAfterYear
:
false
,
yearSuffix
:
''
};
$
.
datepicker
.
setDefaults
(
$
.
datepicker
.
regional
[
'es'
]);
;
}
...
...
@@ -279,149 +279,149 @@ function defaultConfigDatePicker() {
(
function
(
a
)
{
a
.
fn
.
validCampo
=
function
(
b
)
{
a
(
this
).
on
({
keypress
:
function
(
a
)
{
var
c
=
a
.
which
,
d
=
a
.
keyCode
,
e
=
String
.
fromCharCode
(
c
).
toLowerCase
(),
f
=
b
;
(
-
1
!=
f
.
indexOf
(
e
)
||
9
==
d
||
37
!=
c
&&
37
==
d
||
39
==
d
&&
39
!=
c
||
8
==
d
||
46
==
d
&&
46
!=
c
)
&&
161
!=
c
||
a
.
preventDefault
()
}})
}
a
.
fn
.
validCampo
=
function
(
b
)
{
a
(
this
).
on
({
keypress
:
function
(
a
)
{
var
c
=
a
.
which
,
d
=
a
.
keyCode
,
e
=
String
.
fromCharCode
(
c
).
toLowerCase
(),
f
=
b
;
(
-
1
!=
f
.
indexOf
(
e
)
||
9
==
d
||
37
!=
c
&&
37
==
d
||
39
==
d
&&
39
!=
c
||
8
==
d
||
46
==
d
&&
46
!=
c
)
&&
161
!=
c
||
a
.
preventDefault
()
}})
}
})(
jQuery
);
function
primeraLetraMayuscula
(
str
)
{
let
strLower
=
str
.
toLowerCase
();
let
caracter
=
strLower
.
substr
(
0
,
1
).
toUpperCase
();
let
cadena
=
caracter
+
strLower
.
substr
(
1
);
return
cadena
;
let
strLower
=
str
.
toLowerCase
();
let
caracter
=
strLower
.
substr
(
0
,
1
).
toUpperCase
();
let
cadena
=
caracter
+
strLower
.
substr
(
1
);
return
cadena
;
}
const
makeDatatable
=
(
jsonForDatatable
=
{
data
:
[],
columns
:
[],
columnDefs
:
[],
wrapsNameDatatable
:
``
,
classNameForDatatable
:
``
,
footerFilter
:
false
,
highlighting
:
true
})
=>
{
let
data
=
jsonForDatatable
.
data
;
let
columns
=
jsonForDatatable
.
columns
;
let
columnDefs
=
jsonForDatatable
.
columns
;
let
wrapsNameDatatable
=
jsonForDatatable
.
wrapsNameDatatable
let
nameDatatable
=
`
${
wrapsNameDatatable
}
-datatable`
let
classNameForDatatable
=
jsonForDatatable
.
classNameForDatatable
let
highlighting
=
jsonForDatatable
.
highlighting
let
footerFilter
=
jsonForDatatable
.
footerFilter
let
table_head
=
`
columns
:
[],
columnDefs
:
[],
wrapsNameDatatable
:
``
,
classNameForDatatable
:
``
,
footerFilter
:
false
,
highlighting
:
true
})
=>
{
let
data
=
jsonForDatatable
.
data
;
let
columns
=
jsonForDatatable
.
columns
;
let
columnDefs
=
jsonForDatatable
.
columns
;
let
wrapsNameDatatable
=
jsonForDatatable
.
wrapsNameDatatable
let
nameDatatable
=
`
${
wrapsNameDatatable
}
-datatable`
let
classNameForDatatable
=
jsonForDatatable
.
classNameForDatatable
let
highlighting
=
jsonForDatatable
.
highlighting
let
footerFilter
=
jsonForDatatable
.
footerFilter
let
table_head
=
`
<table id="
${
nameDatatable
}
" class="
${
classNameForDatatable
}
table-hover" cellspacing="0" width="100%">`
;
let
table_head_th
=
`
let
table_head_th
=
`
<thead>
<tr>`
;
columns
.
forEach
((
obj
)
=>
{
let
title
=
`undefined`
;
if
(
obj
.
title
)
{
title
=
obj
.
title
;
}
else
if
(
obj
.
data
)
{
title
=
obj
.
data
;
}
table_head_th
+=
`
columns
.
forEach
((
obj
)
=>
{
let
title
=
`undefined`
;
if
(
obj
.
title
)
{
title
=
obj
.
title
;
}
else
if
(
obj
.
data
)
{
title
=
obj
.
data
;
}
table_head_th
+=
`
<th>
${
title
}
</th>`
})
table_head_th
+=
`
})
table_head_th
+=
`
</tr>
</thead>`
let
table_foot_th
=
``
;
if
(
footerFilter
)
{
table_foot_th
=
`
let
table_foot_th
=
``
;
if
(
footerFilter
)
{
table_foot_th
=
`
<tfoot>
<tr>`
;
columns
.
forEach
((
obj
)
=>
{
let
title
=
`undefined`
;
if
(
obj
.
title
)
{
title
=
obj
.
title
;
}
else
if
(
obj
.
data
)
{
title
=
obj
.
data
;
}
table_foot_th
+=
`
columns
.
forEach
((
obj
)
=>
{
let
title
=
`undefined`
;
if
(
obj
.
title
)
{
title
=
obj
.
title
;
}
else
if
(
obj
.
data
)
{
title
=
obj
.
data
;
}
table_foot_th
+=
`
<th>
${
title
}
</th>`
})
table_foot_th
+=
`
})
table_foot_th
+=
`
</tr>
</tfoot>
`
}
}
let
table_foot
=
`</table>`
let
table_foot
=
`</table>`
$
(
`#
${
wrapsNameDatatable
}
`
).
empty
().
append
(
`
${
table_head
}${
table_head_th
}${
table_foot_th
}${
table_foot
}
`
);
if
(
footerFilter
)
{
$
(
`#
${
wrapsNameDatatable
}
`
).
empty
().
append
(
`
${
table_head
}${
table_head_th
}${
table_foot_th
}${
table_foot
}
`
);
if
(
footerFilter
)
{
// Setup - add a text input to each footer cell
$
(
`#
${
nameDatatable
}
tfoot th`
).
each
(
function
()
{
var
title
=
$
(
this
).
text
();
$
(
this
).
html
(
`<input type="text" class="form-control" placeholder="
${
title
}
" />`
);
});
}
$
(
`#
${
nameDatatable
}
`
)
.
DataTable
({
data
,
columns
,
columnDefs
,
fixedColumns
:
{
leftColumns
:
1
,
rightColumns
:
1
}
});
if
(
footerFilter
)
{
$
(
`#
${
nameDatatable
}
tfoot th`
).
each
(
function
()
{
var
title
=
$
(
this
).
text
();
$
(
this
).
html
(
`<input type="text" class="form-control" placeholder="
${
title
}
" />`
);
});
}
$
(
`#
${
nameDatatable
}
`
)
.
DataTable
({
data
,
columns
,
columnDefs
,
fixedColumns
:
{
leftColumns
:
1
,
rightColumns
:
1
}
});
if
(
footerFilter
)
{
// DataTable
let
table
=
$
(
`#
${
nameDatatable
}
`
).
DataTable
();
// Apply the search
table
.
columns
().
every
(
function
()
{
var
that
=
this
;
$
(
'input'
,
this
.
footer
()).
on
(
'keyup change'
,
function
()
{
if
(
that
.
search
()
!==
this
.
value
)
{
that
.
search
(
this
.
value
)
.
draw
();
}
});
});
$
(
`#
${
wrapsNameDatatable
}
.dataTables_scrollBody`
).
appendTo
(
`#
${
wrapsNameDatatable
}
.dataTables_scroll`
);
}
if
(
highlighting
)
{
let
table
=
$
(
`#
${
nameDatatable
}
`
).
DataTable
();
$
(
`#
${
nameDatatable
}
tbody`
)
.
on
(
'mouseenter'
,
'td'
,
function
()
{
let
colIdx
=
table
.
cell
(
this
).
index
().
column
;
$
(
table
.
cells
().
nodes
()).
removeClass
(
'highlight'
);
$
(
table
.
column
(
colIdx
).
nodes
()).
addClass
(
'highlight'
);
});
}
return
Promise
.
resolve
({
datatable
:
$
(
`#
${
nameDatatable
}
`
),
container
:
$
(
`#
${
wrapsNameDatatable
}
`
)
});
let
table
=
$
(
`#
${
nameDatatable
}
`
).
DataTable
();
// Apply the search
table
.
columns
().
every
(
function
()
{
var
that
=
this
;
$
(
'input'
,
this
.
footer
()).
on
(
'keyup change'
,
function
()
{
if
(
that
.
search
()
!==
this
.
value
)
{
that
.
search
(
this
.
value
)
.
draw
();
}
});
});
$
(
`#
${
wrapsNameDatatable
}
.dataTables_scrollBody`
).
appendTo
(
`#
${
wrapsNameDatatable
}
.dataTables_scroll`
);
}
if
(
highlighting
)
{
let
table
=
$
(
`#
${
nameDatatable
}
`
).
DataTable
();
$
(
`#
${
nameDatatable
}
tbody`
)
.
on
(
'mouseenter'
,
'td'
,
function
()
{
let
colIdx
=
table
.
cell
(
this
).
index
().
column
;
$
(
table
.
cells
().
nodes
()).
removeClass
(
'highlight'
);
$
(
table
.
column
(
colIdx
).
nodes
()).
addClass
(
'highlight'
);
});
}
return
Promise
.
resolve
({
datatable
:
$
(
`#
${
nameDatatable
}
`
),
container
:
$
(
`#
${
wrapsNameDatatable
}
`
)
});
}
const
randomIntFromInterval
=
(
minimum
,
maximum
)
=>
{
return
Math
.
round
(
Math
.
random
()
*
(
maximum
-
minimum
)
+
minimum
);
return
Math
.
round
(
Math
.
random
()
*
(
maximum
-
minimum
)
+
minimum
);
}
const
cleanQueryParams
=
(
params
=
{})
=>
{
for
(
var
key
in
params
)
{
if
(
params
.
hasOwnProperty
(
key
))
{
if
(
!
params
[
key
])
{
delete
params
[
key
];
}
}
}
return
params
;
for
(
var
key
in
params
)
{
if
(
params
.
hasOwnProperty
(
key
))
{
if
(
!
params
[
key
])
{
delete
params
[
key
];
}
}
}
return
params
;
}
\ No newline at end of file
src/main/webapp/js/pages/proyectar_asistencia_policias.js
View file @
5f36ddb0
...
...
@@ -64,7 +64,6 @@ function defaultConfigHandsonTable() {
function
mostrarVistaPrevia
()
{
ajaxWebService
.
get
(
URI_POLICIA_PROYECCION
).
then
((
response
)
=>
{
debugger
if
(
response
.
status
)
{
handsonTable
.
destroy
();
let
container
=
document
.
getElementById
(
"tblProyectado"
);
...
...
@@ -194,15 +193,85 @@ function guardarCambios() {
});
// let mrd = {
// id: 1,
// sede_descripcion: "ARENALES",
// asistencia_entrada: "10:00",
// asistencia_salida: "22:22"
// };
//
// ajaxWebService.patch("http://sistem16:666/proyeccion/1", mrd)
// setInterval(() => {
// console.log(moment().format("YYYY/DD/MM HH:MM:SS s"))
// }, 500)
// let timer1 = () => {
// return new Promise((resolve, reject) => {
// resolve(ajaxWebService.get("https://yts.am/api/v2/list_movies.json"))
// });
// }
//
// let timer2 = () => {
// return new Promise((resolve, reject) => {
// let mrd = {
// id: 2,
// sede_descripcion: "ARENALES",
// asistencia_entrada: "10:00",
// asistencia_salida: "22:22"
// };
//
// resolve(ajaxWebService.get("https://yts.am/api/v2/list_movies.json?sort=seeds&limit=15"))
// })
// }
// Promise.all([ajaxWebService.get("https://yts.am/api/v2/list_movies.json"), ajaxWebService.get("https://yts.am/api/v2/list_movies.json?sort=seeds&limit=15")])
// .then((value) => {
// console.log(`FIN`, moment().format("YYYY/DD/MM HH:MM:SS s"))
// debugger;
// })
Promise
.
all
(
dataRequest
.
map
(
p
=>
ajaxWebService
.
patch
(
`
${
URI_POLICIA_PROYECCION
}
/
${
p
.
id
}
`
,
p
)))
.
then
(
axios
.
spread
(
function
(...
pms
)
{
console
.
log
(
"POR FIN"
)
}))
let
promises
=
[]
dataRequest
.
forEach
(
d
=>
{
promises
.
push
(
ajaxWebService
.
patch
(
`
${
URI_POLICIA_PROYECCION
}
/
${
d
.
id
}
`
,
d
))
});
axios
.
all
(
promises
)
.
then
(
axios
.
spread
(
function
(
acct
,
perms
)
{
debugger
}));
swal
({
title
:
'Está seguro de guardar los cambios?'
,
text
:
""
,
type
:
'warning'
,
showCancelButton
:
true
,
confirmButtonColor
:
'#3085d6'
,
cancelButtonColor
:
'#d33'
,
confirmButtonText
:
'Sí, guardar!'
}).
then
((
result
)
=>
{
if
(
result
.
value
)
{
// dataRequest.forEach(d => {
// promises.push(ajaxWebService.patch(`${URI_POLICIA_PROYECCION}/${d.id}`, d))
// });
// Promise.all([get1(), get2()])
// .then(function ([acct, perms]) {
// swal(
// {
// type: 'success',
// title: '¡Se guardaron los cambios correctamente!',
// showConfirmButton: false,
// timer: 1500
// }
// );
// });
}
})
// ajaxWebService.patch(URI_POLICIA_PROYECCION, dataRequest).then((response) => {
//
...
...
src/main/webapp/vistas/proyectarAsistenciaPolicias.jsp
View file @
5f36ddb0
...
...
@@ -2,97 +2,98 @@
<
%@
page
contentType=
"text/html"
pageEncoding=
"UTF-8"
%
>
<!DOCTYPE html>
<html>
<head>
<
%@
include
file=
"templates/header.jsp"
%
>
<!--template-core-->
<!--css de la pagina-->
<head>
<
%@
include
file=
"templates/header.jsp"
%
>
<!--template-core-->
<!--css de la pagina-->
<link
href=
"../css/lib/sweetalert2.min.css"
rel=
"stylesheet"
type=
"text/css"
/>
<!--css-->
</head>
<body>
<
%@
include
file=
"templates/header-body.jsp"
%
>
<!-- content -->
<div
class=
"col-md-6 col-md-offset-3"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel-heading"
>
<h5
class=
"panel-title"
>
Proyección de Asistencias
</h5>
</div>
<!--css--
>
</head
>
<body
>
<
%@
include
file=
"templates/header-body.jsp"
%
>
<!-- content --
>
<div
class=
"col-md-6 col-md-offset-3"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel-heading
"
>
<h5
class=
"panel-title"
>
Proyección de Asistencias
</h5
>
</div
>
<div
class=
"panel-body"
>
<div
class=
"row"
>
<div
class=
"col-md-6 form-group"
>
<label>
Policia
</label
>
<select
class=
"select-search form-control"
id=
"cboPoliciasFiltro"
>
</select
>
</div
>
<div
class=
"col-md-6 form-group
"
>
<label>
Sede
</label
>
<select
id=
"cboSedesFiltro"
class=
"select-search form-control"
>
<div
class=
"panel-body"
>
<div
class=
"row"
>
<div
class=
"col-md-6 form-group"
>
<label>
Policia
</label>
<select
class=
"select-search form-control"
id=
"cboPoliciasFiltro"
>
</select>
</div>
<div
class=
"col-md-6 form-group"
>
<label>
Sede
</label>
<select
id=
"cboSedesFiltro"
class=
"select-search form-control"
>
</select>
</div>
</div>
</select>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-6 form-group"
>
<label>
Fecha Inicio
</label>
<div
class=
"input-group"
>
<span
class=
"input-group-addon"
><i
class=
"icon-calendar"
></i></span>
<input
type=
"text"
class=
"form-control"
name=
"dpFechaInicio"
id=
"dpFechaInicio"
>
</div>
</div>
<div
class=
"col-md-6 form-group"
>
<label>
Fecha Fin
</label>
<div
class=
"input-group"
>
<span
class=
"input-group-addon"
><i
class=
"icon-calendar"
></i></span>
<input
type=
"text"
class=
"form-control"
name=
"dpFechaFin"
id=
"dpFechaFin"
>
</div>
</div>
</div>
</div>
<div
class=
"panel-footer"
>
<div
class=
"text-center"
>
<button
class=
"btn btn-primary"
id=
"btnVistaPrevia"
><i
class=
"icon-eye4"
></i>
Ver
</button>
<!--<button class="btn btn-warning" id="btnLimpiar"><i class="fa fa-eraser"></i> Limpiar</button>-->
</div>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-6 form-group"
>
<label>
Fecha Inicio
</label>
<div
class=
"input-group"
>
<span
class=
"input-group-addon"
><i
class=
"icon-calendar"
></i></span>
<input
type=
"text"
class=
"form-control"
name=
"dpFechaInicio"
id=
"dpFechaInicio"
>
</div>
</div>
<div
class=
"col-md-6 form-group"
>
<label>
Fecha Fin
</label>
<div
class=
"input-group"
>
<span
class=
"input-group-addon"
><i
class=
"icon-calendar"
></i></span>
<input
type=
"text"
class=
"form-control"
name=
"dpFechaFin"
id=
"dpFechaFin"
>
</div>
</div>
</div>
</div>
<div
class=
"panel-footer"
>
<div
class=
"text-center"
>
<button
class=
"btn btn-primary"
id=
"btnVistaPrevia"
><i
class=
"icon-eye4"
></i>
Ver
</button>
<!--<button class="btn btn-warning" id="btnLimpiar"><i class="fa fa-eraser"></i> Limpiar</button>-->
</div>
</div>
</div>
</div>
<div
class=
"col-md-12"
>
<div
class=
"panel panel-primary card-3"
>
<div
class=
"panel-heading"
>
<h6
class=
"panel-title"
style=
"font-size: 15px; font-family: inherit"
><i
class=
"icon icon-search4"
></i>
ASISTENCIAS PROYECTADAS
</h6>
<div
class=
"heading-elements"
>
<button
type=
"button"
id=
"btnGuardarCambios"
class=
"btn bg-slate border-slate-600 btn-xs"
><i
class=
"glyphicon glyphicon-plus"
></i>
Guardar cambios
</button>
</div>
</div>
<div
id=
"tblProyectado"
></div>
</div>
</div>
<div
class=
"col-md-12"
>
<div
class=
"panel panel-primary card-3"
>
<div
class=
"panel-heading"
>
<h6
class=
"panel-title"
style=
"font-size: 15px; font-family: inherit"
><i
class=
"icon icon-search4"
></i>
ASISTENCIAS PROYECTADAS
</h6>
<div
class=
"heading-elements"
>
<button
type=
"button"
id=
"btnGuardarCambios"
class=
"btn bg-slate border-slate-600 btn-xs"
><i
class=
"glyphicon glyphicon-plus"
></i>
Guardar cambios
</button>
</div>
</div>
<div
id=
"tblProyectado"
></div>
</div>
</div>
<!-- / content -->
<!-- / content -->
<
%@
include
file=
"templates/footer-body.jsp"
%
>
<!--js de la pagina-->
<
%@
include
file=
"templates/footer-body.jsp"
%
>
<!--js de la pagina-->
<script
src=
"../plantilla/assets/js/plugins/ui/moment/moment.min.js"
type=
"text/javascript"
></script>
<script
src=
"../plantilla/assets/js/plugins/pickers/daterangepicker.js"
></script>
<script
src=
"../plantilla/assets/js/core/libraries/jquery_ui/widgets.min.js"
></script>
<script
src=
"../plantilla/assets/js/plugins/tables/datatables/datatables.min.js"
type=
"text/javascript"
></script>
<script
src=
"../js/lib/dataTables.rowsGroup.js"
type=
"text/javascript"
></script>
<script
src=
"../plantilla/assets/js/plugins/tables/handsontable/handsontable.min.js"
></script>
<script
src=
"../js/lib/jquery.inputmask.bundle.min.js"
type=
"text/javascript"
></script>
<script
src=
"../js/lib/lodash.js"
type=
"text/javascript"
></script>
<script
src=
"../js/lib/sweetalert2.min.js"
type=
"text/javascript"
></script>
<script
src=
"../js/lib/axios.min.js"
type=
"text/javascript"
></script>
<script
src=
"../plantilla/assets/js/plugins/forms/selects/select2.min.js"
></script>
<script
src=
"../js/pages/proyectar_asistencia_policias.js"
type=
"text/javascript"
></script>
<!--js-->
<script
src=
"../plantilla/assets/js/plugins/ui/moment/moment.min.js"
type=
"text/javascript"
></script>
<script
src=
"../plantilla/assets/js/plugins/pickers/daterangepicker.js"
></script>
<script
src=
"../plantilla/assets/js/core/libraries/jquery_ui/widgets.min.js"
></script>
<script
src=
"../plantilla/assets/js/plugins/tables/datatables/datatables.min.js"
type=
"text/javascript"
></script>
<script
src=
"../js/lib/dataTables.rowsGroup.js"
type=
"text/javascript"
></script>
<script
src=
"../plantilla/assets/js/plugins/tables/handsontable/handsontable.min.js"
></script>
<script
src=
"../js/lib/jquery.inputmask.bundle.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/selects/select2.min.js"
></script>
<script
src=
"../js/pages/proyectar_asistencia_policias.js"
type=
"text/javascript"
></script>
<!--js-->
</body>
</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