{% extends "IngresoBundle:Default:customJS.html.twig" %} {% block columns %} {data:'id'}, {data:'contratista'}, {data:'tipo_doc'}, {data:'documento'}, {data:'fecha_carga'}, {data:'estado'}, {% endblock %} {% block editIcon %} Registrar fecha{% endblock %} {% block editTitle %}{% endblock %} {% block extendVars %} var totales = { ok: 0, vencido: 0, vencer: 0 }, chartOk, chartProximo, chartVencidos, nombre = [], total = []; {% endblock %} {% block tableOrder %} columnDefs: [ { targets: [0,1], visible: false } ], order: [[1, 'asc'],[5, 'desc']], {% endblock %} {% block extraButtons %} { text: ' Ver historial', titleAttr: 'Historial de documentos', className: 'btn-hideable', action: function() { var path = '{{paths.track}}', id = table.row( { selected: true } ).id(); path = path.slice(0,-1) + id; var $modal = $('#{{idModalTrack}}'), $body = $modal.find('.modal-body-content').empty(), $load = $modal.find('.load'); $modal.modal(); $load.fadeIn(); $.get(path, function(html) { $load.hide(); $body.append(html) $body.find('form').submit(function(event) { event.preventDefault(); $(this).find('button[type="submit"]').html(''); $.post(path, $(this).serialize(), function(data, textStatus, xhr) { $body.empty(); table.ajax.reload(); $modal.modal('hide'); }); }); }); }} {% endblock %} {% block extendConfig %} createdRow: function ( row, data, index ) { if (data.estado.match(/ok/i)) { totales['ok']++; $('td', row).eq(3).addClass('cell-success'); } else if (data.estado.match(/vencido/i)) { totales['vencido']++; $('td', row).eq(3).addClass('cell-danger'); } else if (data.estado.match(/vencer/i)) { totales['vencer']++; $('td', row).eq(3).addClass('cell-warning'); } }, drawCallback: function ( settings ) { var api = this.api(); var rows = api.rows( {page:'current'} ).nodes(); var last = null; api.column(1, {page:'current'} ).data().each( function ( group, i ) { if ( last !== group ) { $(rows).eq( i ).before( '