{% extends 'base.html.twig' %}
{% block js_document_ready %}
function addZeroBefore(n) {
return (n < 10 ? '0' : '') + n;
}
//defino variable para fecha actual
var currentdate = new Date();
var datetime = "Extraído el: " + currentdate.getDate() + "/"
+ addZeroBefore((currentdate.getMonth()+1)) + "/"
+ currentdate.getFullYear() + " "
+ addZeroBefore(currentdate.getHours()) + ":"
+ addZeroBefore(currentdate.getMinutes()) + ":"
+ addZeroBefore(currentdate.getSeconds());
$('#datatable').dataTable({
pageLength: 15,
dom: 'Bfrtip',
buttons: [
{
extend: 'excel',
title: '{{convocatoria.titulo}}',
text: 'Excel description',
titleAttr: 'Descargar Excel',
exportOptions: {
columns: ':visible:not(.not-export-col)'
}
{# customize: function (xlsx) {
function _createNode(doc, nodeName, opts) {
var tempNode = doc.createElement(nodeName);
if (opts) {
if (opts.attr) {
$(tempNode).attr(opts.attr);
}
if (opts.children) {
$.each(opts.children, function (key, value) {
tempNode.appendChild(value);
});
}
if (opts.text !== null && opts.text !== undefined) {
tempNode.appendChild(doc.createTextNode(opts.text));
}
}
return tempNode;
}
var sheet = xlsx.xl.worksheets['sheet1.xml'];
function mergeFunction(referenceString = false) {
// reference string format: 'B1:E1'
var mergeCells = $('mergeCells', sheet);
var rows = $('row', sheet);
if (!referenceString) {
alert('no reference string on merge function call');
return
}
mergeCells[0].appendChild(_createNode(sheet, 'mergeCell', {
attr: {
ref: referenceString
}
}));
mergeCells.attr('count', mergeCells.attr('count') + 1);
}
$(`row:nth-child(2) c`, sheet).attr('s', '67'); // custom style
// loop to merge cells by 3 in second row
for(let iterator=1; iterator<=numberOfColumnsInFirstTable; iterator++){
let startOfMergedCell = getLetterCodeByNumIndex(iterator*3-2);
let endOfMergedCell = getLetterCodeByNumIndex(iterator*3);
mergeFunction(`${startOfMergedCell}1:${endOfMergedCell}1`);
}
} #}
},
{
extend: 'pdf',
title: '{{convocatoria.titulo}}',
text: 'PDF picture_as_pdf',
titleAttr: 'Descargar PDF',
exportOptions: {
columns: ':visible:not(.not-export-col)'
},
//customizo footer con fecha de extracción y número de página
customize: function(doc) {
doc['footer'] = (function(page, pages) {
return {
columns: [
{
alignment: 'center',
text: [
{ text: datetime, italics: true },
]
},
{
alignment: 'center',
text: [
{ text: page.toString(), italics: true },
' de ',
{ text: pages.toString(), italics: true }
]
},
],
margin: [2, 0]
}
});
}
},
'colvis'
],
filter : false,
language: {
"url": "//cdn.datatables.net/plug-ins/1.12.1/i18n/es-ES.json"
},
aLengthMenu: "",
bAutoWidth: false,
"columns": [
{ "data": "cargo" },
{ "data": "cantInscriptos" },
{ "data": "admitidas",
render: function ( data, type, row ) {
return 'Presentadas (' + row.presentadas + ')'+ '
Admitidas (' + row.admitidas + ')'+ '
Rechazadas (' + row.rechazadas + ')'+ '
Desestimadas (' + row.desestimadas + ')';
}
},
{ "data": "genero",
render: function ( data, type, row ) {
return 'Femenino (' + row.femenino + ')'+ '
Masculino (' + row.masculino + ')'+ '
Otros (' + row.otro + ')';
}
},
{# { "data": "notificaciones" },
{ "data": "confirmadosQueSi",
render: function ( data, type, row ) {
return 'Por SI (' + row.confirmadosQueSi + ')'+ '
Por NO (' + row.confirmadosQueNo + ')'+ '
Sin Resp. (' + row.noRespondieron + ')';
}
}, #}
{ "data": "acciones" ,
render: function(data, type, row, meta) {
if (type === 'display') {
$botones = [
' ',
'people_alt',
' ',
].join('');
return $botones;
}
return data;
},
},
],
order: [[ 1, 'asc' ]],
columnDefs: [
// These are the column name variables that will be sent to the server
{
"name": "cargo",
"targets": 0
},
{
"name": "cantInscriptos",
"targets": 1
},
{
"name": "admitidas",
"targets": 2
},
{
"name": "genero",
"targets": 3
},
{# {
"name": "notificaciones",
"targets": 3
},
{
"name": "confirmadosQueSi",
"targets": 4
}, #}
{
"searchable": false,
"orderable": false,
"targets": 4
},
],
serverSide: false,
processing: true,
ajax: {
url: '{{ path('app_inscripciones_por_cargo_datos', { 'id': idConvocatoria }) }}',
type: 'POST'
}
});
// the "href" attribute of the modal trigger must specify the modal ID that wants to be triggered
{# $('.modal1').modal(); #}
$('select').formSelect();
var select = $('select');
$('.limpiar').click(function(){
$("input[type=text]").val("");
select.prop('selectedIndex', 0); //Sets the first option as selected
select.material_select(); //Update material select
form.submit();
});
{% endblock %}
{% block breadcrumb %}
Cargo | Inscriptos | Estado inscripciones | Inscripciones por Género |
{# Notificaciones de asistencia a examen |
Confirmaciones | #}Acciones |
---|