diff --git a/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php b/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php
index 1a169428..351031c4 100644
--- a/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php
+++ b/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php
@@ -23,7 +23,7 @@
= lang('Pedidos.titulo') ?> |
= lang('Pedidos.ubicacion') ?> |
= lang('Pedidos.inc_rei') ?> |
- = lang('Pedidos.num_paginas') ?> |
+ = lang('Pedidos.num_paginas') ?> |
= lang('Pedidos.tiradas') ?> |
= lang('Pedidos.total_presupuesto') ?> |
= lang('Pedidos.estado') ?> |
@@ -57,6 +57,73 @@
`;
};
+// Setup - add a text input to each footer cell
+$('#tableOfPedidos thead tr').clone(true).appendTo('#tableOfPedidos thead');
+$('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
+ if (!$(this).hasClass("noFilter")) {
+ var title = $(this).text();
+ if(i==1){
+ $(this).html('');
+ var bsRangePickerRange = $('#bs-rangepicker-range')
+ bsRangePickerRange.daterangepicker({
+ ranges: {
+ '= lang('datePicker.hoy') ?>': [moment(), moment()],
+ '= lang('datePicker.ayer') ?>': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
+ '= lang('datePicker.ultimos7') ?>': [moment().subtract(6, 'days'), moment()],
+ '= lang('datePicker.ultimos30') ?>': [moment().subtract(29, 'days'), moment()],
+ '= lang('datePicker.esteMes') ?>': [moment().startOf('month'), moment().endOf('month')],
+ '= lang('datePicker.ultimoMes') ?>': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
+ },
+ opens: 'right',
+ language: '= config('Basics')->i18n ?>',
+ "locale": {
+ "customRangeLabel": "= lang('datePicker.personalizar') ?>",
+ "format": "YYYY-MM-DD",
+ "separator": " ",
+ "applyLabel": "= lang('datePicker.aplicar') ?>",
+ "cancelLabel": "= lang('datePicker.limpiar') ?>",
+
+ },
+ "alwaysShowCalendars": true,
+ autoUpdateInput: false,
+
+ });
+
+ bsRangePickerRange.on('apply.daterangepicker', function(ev, picker) {
+ $(this).val(picker.startDate.format('YYYY-MM-DD') + ' ' + picker.endDate.format('YYYY-MM-DD'));
+ theTable
+ .column(i)
+ .search(this.value)
+ .draw();
+ });
+
+ bsRangePickerRange.on('cancel.daterangepicker', function(ev, picker) {
+ $(this).val('');
+ theTable
+ .column(i)
+ .search(this.value)
+ .draw();
+ });
+
+ }
+ else{
+ $(this).html('');
+
+ $('input', this).on('change clear', function () {
+ if (theTable.column(i).search() !== this.value) {
+ theTable
+ .column(i)
+ .search(this.value)
+ .draw();
+ }
+ });
+ }
+ }
+ else {
+ $(this).html('');
+ }
+});
+
theTable = $('#tableOfPedidos').DataTable({
processing: true,
serverSide: true,
@@ -66,9 +133,9 @@
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
pageLength: 50,
lengthChange: true,
- "dom": 'lfBrtip',
+ "dom": '<"mb-3"l>Brtip',
"buttons": [
- 'copy', 'csv', 'excel', 'print', {
+ 'colvis', 'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'A4'
@@ -143,14 +210,37 @@
theTable.on( 'draw.dt', function () {
const boolCols = [];
+ const dateCols = [1];
+ const priceCols = [10];
for (let coln of boolCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '' : '';
});
}
+
+ for (let coln of dateCols) {
+ theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
+ const datestr = cell.innerHTML;
+ const dateStrLen = datestr.toString().trim().length;
+ if (dateStrLen > 0) {
+ let dateTimeParts= datestr.split(/[- :]/); // regular expression split that creates array with: year, month, day, hour, minutes, seconds values
+ dateTimeParts[1]--; // monthIndex begins with 0 for January and ends with 11 for December so we need to decrement by one
+ const d = new Date(...dateTimeParts); // new Date(datestr);
+ cell.innerHTML = d.toLocaleDateString();
+ }
+ });
+ }
+
+ for (let coln of priceCols) {
+ theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
+ cell.innerHTML = parseFloat(cell.innerHTML).toFixed(2);
+
+ });
+ }
});
+
$(document).on('click', '.btn-edit', function(e) {
var url = '= route_to('editarPedido', ':id') ?>';
url = url.replace(':id', `${$(this).attr('data-id')}` );
@@ -163,6 +253,8 @@
=$this->section('css') ?>
">
+ ">
+
=$this->endSection() ?>
@@ -171,6 +263,9 @@
+
+
+