Commit 1d1369b1 by Billy Larru

registrando rol de policia

parent 6e376188
......@@ -11,7 +11,8 @@ function listarRolesPolicias() {
let columns = [
{
title: `N°`,
data: `numeroFila`
// data: `numeroFila`
data: `id`
},
{
title: `APELLIDOS Y NOMBRES`,
......@@ -42,7 +43,7 @@ function listarRolesPolicias() {
data: `estado`
},
];
let columnDefs = [
{orderable: false, width: '5%', targets: 0, className: "text-center"},
{orderable: false, width: '5%', targets: 1},
......@@ -53,7 +54,7 @@ function listarRolesPolicias() {
{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`;
let footer = false
......@@ -75,7 +76,7 @@ function listarTipoRoles() {
let roles = result.data;
let html = "<option>[SELECCIONE]</option>";
roles.forEach(rol => html += `<option value="${rol.codigo}">${rol.descripcion}</option>`);
$("#cboRol").html(html);
$("#cboTipoRol").html(html);
});
}
......@@ -125,42 +126,45 @@ function modificarServicio() {
}
function registrarRolPolicia() {
[
{
id: "",
nombres: "",
sede: {
id: "",
nombre: ""
},
rol: {
nombre: "",
id: ""
}
}
]
[
{
id: "",
nombres: "",
sede_id: "",
sede_nombre: "",
rol_nombre: "",
rol_id: ""
}
]
let policia_nombres = $("#cboPolicias option:selected").text();
let policia_id = $("#cboPolicias").val();
let tiporol_id = $("#cboTipoRol").val();
let tiporol_descripcion = $("#cboTipoRol option:selected").text();
;
let rango_fechas = $("#dpRangoFechas").val();
let split_fechas = rango_fechas.split("-").map(f => f.trim());
let fecha_inicio = split_fechas[0];
let fecha_fin = split_fechas[1];
let frecuencia_id = $("#cboFrecuenciaRol").val();
let frecuencia_descripcion = $("#cboFrecuenciaRol option:selected").text();
let sede_id = $("#cboSedes").val();
let sede_descripcion = $("#cboSedes option:selected").text();
let estado = 1;
let params = {
policia_id,
policia_nombres,
sede_id,
sede_descripcion,
fecha_inicio,
fecha_fin,
tiporol_id,
tiporol_descripcion,
frecuencia_id,
frecuencia_descripcion,
estado
};
debugger;
axios.post('/policias', {
nombre: 'billy',
rol: 'regular',
frecuencia: ''
})
.then(function (response) {
console.log(response);
axios.post(URI_LISTAR_ROL_POLICIA, params)
.then( (result) => {
debugger
listarRolesPolicias();
console.log(result.data);
})
.catch(function (error) {
.catch(error => {
console.log(error);
});
}
......@@ -194,6 +198,7 @@ function guardarCambios() {
$().ready(function () {
init();
defaultConfigDataTable();
$('.selectpicker').selectpicker({
style: 'btn-info',
size: 4
......
......@@ -31,7 +31,7 @@
<div class="row">
<div class="col-md-6 form-group">
<label>Tipo de rol</label>
<select class="form-control" id="cboRol">
<select class="form-control" id="cboTipoRol">
</select>
</div>
......@@ -39,7 +39,7 @@
<label>Rango de fechas: </label>
<div class="input-group">
<span class="input-group-addon"><i class="icon-calendar22"></i></span>
<input type="text" class="form-control daterange-basic" value="01/06/2018 - 30/06/2018">
<input type="text" class="form-control daterange-basic" value="01/06/2018 - 30/06/2018" id="dpRangoFechas">
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment