Commit 68982c86 by Billy Larru

proyectado comparativo arreglado

parent 13a75ffd
...@@ -444,18 +444,67 @@ let initDatePicker = (...selectorName) => { ...@@ -444,18 +444,67 @@ let initDatePicker = (...selectorName) => {
} }
const setTiposContratoOnSelect = (nodeIdentifier, optionAll = true) => { const setSelects = (nodeIdentifier) => {
ajaxWebService $(`${nodeIdentifier}`).select2({
.get(`contratoTipo`) containerCssClass: 'select-xs',
.then((response) => { ajax: {
let $select = $(`${nodeIdentifier}`) url: `http://sistem16:666/policias`,
let option dataType: `json`,
if (optionAll) { delay: 1000,
option = `<option value="">TODOS</option>` data: function (params) {
} return {
response.data.forEach((value, id) => { q: params.term, // search term
option += `<option value="${value.id}">${value.nombre}</option>` page: params.page
}) };
$select.html(option).selectpicker() },
}) processResults: function (data, params) {
// parse the results into the format expected by Select2
// since we are using custom formatting functions we do not need to
// alter the remote JSON data, except to indicate that infinite
// scrolling can be used
params.page = params.page || 1;
return {
results: data,
pagination: {
more: (params.page * 30) < data.length
}
};
},
cache: true
},
placeholder: `Buscar`,
allowClear: true,
escapeMarkup: function (markup) {
return markup;
}, // let our custom formatter work
minimumInputLength: 1,
templateResult: formatRepo,
templateSelection: formatRepoSelection
});
function formatRepo(repo) {
if (repo.loading) {
return repo.text;
}
var markup = `
<div class='select2-result-repository clearfix'>
<div class='select2-result-repository__title'>${repo.nombres}</div>`;
markup += `
<div class='select2-result-repository__statistics'>
<div class='select2-result-repository__forks'>${repo.dni}</div>
</div>
</div>`
return markup;
}
function formatRepoSelection(repo) {
if (repo.id) {
return repo.nombres;
} else {
return repo.text;
}
}
} }
\ No newline at end of file
...@@ -115,18 +115,25 @@ function getColumnDefs() { ...@@ -115,18 +115,25 @@ function getColumnDefs() {
function listarPolicias(selectorName) { function listarPolicias(selectorName) {
ajaxWebService.get(URI_POLICIAS).then((result) => { setSelects(selectorName);
let policias = result.data;
policias = _.orderBy(policias, p => p.nombres);
let html = `<option value="">[TODOS]</option>`;
policias.forEach(p => html += `<option documento_identidad="${p.dni}" value="${p.id}">${p.nombres}</option>`);
$(`${selectorName}`).html(html);
$('.select-search').select2();
});
} }
function verReporte(objParams = {}) { function verReporte() {
ajaxWebService.get(URI_POLICIA_PROYECTADO_COMPARATIVO, objParams).then((response) => { debugger
// let policia_nombres = $("#cboPolicias option:selected").text();
let fecha_inicio = $("#dpFechaInicio").val();
let jsonPolicia = $('#cboPolicias').select2('data')[0];
let dni = jsonPolicia ? jsonPolicia.dni : "";
let params = cleanQueryParams({
policia_dni: dni,
fecha_entrada: fecha_inicio
});
ajaxWebService.get(URI_POLICIA_PROYECTADO_COMPARATIVO, {params}).then((response) => {
let columns = getColumns(); let columns = getColumns();
let columnDefs = getColumnDefs(); let columnDefs = getColumnDefs();
......
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