mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Actualizacion automatica: 2024-07-31 22:54:20
This commit is contained in:
@ -23,7 +23,7 @@
|
||||
<th><?= lang('Pedidos.titulo') ?></th>
|
||||
<th><?= lang('Pedidos.ubicacion') ?></th>
|
||||
<th><?= lang('Pedidos.inc_rei') ?></th>
|
||||
<th><?= lang('Pedidos.num_paginas') ?></th>
|
||||
<th class='noFilter'><?= lang('Pedidos.num_paginas') ?></th>
|
||||
<th><?= lang('Pedidos.tiradas') ?></th>
|
||||
<th><?= lang('Pedidos.total_presupuesto') ?></th>
|
||||
<th><?= lang('Pedidos.estado') ?></th>
|
||||
@ -57,6 +57,73 @@
|
||||
</td>`;
|
||||
};
|
||||
|
||||
// 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('<input id="bs-rangepicker-range" type="text" class="form-control " style="min-width:100px;max-width:120px;font-size:0.8rem !important;" />');
|
||||
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 type="text" class="form-control " style="min-width:100px;max-width:120px;font-size:0.8rem !important;" />');
|
||||
|
||||
$('input', this).on('change clear', function () {
|
||||
if (theTable.column(i).search() !== this.value) {
|
||||
theTable
|
||||
.column(i)
|
||||
.search(this.value)
|
||||
.draw();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
$(this).html('<span></span>');
|
||||
}
|
||||
});
|
||||
|
||||
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' ? '<i class="ti ti-check"></i>' : '';
|
||||
});
|
||||
}
|
||||
|
||||
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') ?>
|
||||
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/fixedheader/fixedHeader.dataTables.min.css") ?>">
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/bootstrap-daterangepicker/bootstrap-daterangepicker.css') ?>" />
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
@ -171,6 +263,9 @@
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.colVis.min.js") ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/moment/moment.js') ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/bootstrap-daterangepicker/bootstrap-daterangepicker.js') ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||
|
||||
Reference in New Issue
Block a user