mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando
This commit is contained in:
@ -10,6 +10,18 @@
|
||||
<div id="accordionAlbaranesTip" class="accordion-collapse collapse show" data-bs-parent="#accordioAlbaranes">
|
||||
<div class="accordion-body">
|
||||
|
||||
|
||||
<div class="col-12 d-flex flex-row-reverse mt-4 gap-2">
|
||||
<div id="generar_albaranes" class="btn mt-3 btn-success waves-effect waves-light ml-2">
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang('Pedidos.generarAlbaranes') ?></span>
|
||||
<i class="ti ti-player-play ti-xs"></i>
|
||||
</div>
|
||||
|
||||
<div id="borrar_albaranes" class="btn mt-3 btn-danger waves-effect waves-light ml-2">
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang('Pedidos.borrarAlbaranes') ?></span>
|
||||
<i class="ti ti-trash ti-xs"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!-- /.accordion-body -->
|
||||
</div>
|
||||
@ -19,6 +31,24 @@
|
||||
|
||||
<?=$this->section('additionalInlineJs') ?>
|
||||
|
||||
$('#generar_albaranes').on('click', function(){
|
||||
|
||||
var lineasPedido = $('#tableOfLineasPedido').DataTable();
|
||||
var presupuestos = lineasPedido.column(0).data().unique().toArray();
|
||||
|
||||
$.ajax({
|
||||
url: '<?= route_to('crearAlbaranesPedido') ?>',
|
||||
type: 'POST',
|
||||
data: {
|
||||
pedido_id: <?= $pedidoEntity->id ?>,
|
||||
presupuestos_id: presupuestos,
|
||||
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v,
|
||||
},
|
||||
success: function(response){
|
||||
console.log(response);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
@ -13,8 +13,9 @@
|
||||
<table id="tableOfLineasPedido" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><?= lang('Pedidos.presupuesto') ?></th>
|
||||
<th><?=lang('Pedidos.unidades')?></th>
|
||||
<th><?= lang('Pedidos.unidades')?></th>
|
||||
<th><?= lang('Pedidos.concepto') ?></th>
|
||||
<th><?= lang('Pedidos.total') ?></th>
|
||||
</tr>
|
||||
@ -25,7 +26,7 @@
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="4" style="text-align:right">Total:</th>
|
||||
<th colspan="5" style="text-align:right">Total:</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
@ -37,7 +38,6 @@
|
||||
|
||||
<?=$this->section('additionalInlineJs') ?>
|
||||
|
||||
const lastColNr = $('#tableOfLineasPedido').find("tr:first th").length - 1;
|
||||
const viewPresupuestoBtns = function(data) {
|
||||
return `
|
||||
<td class="text-right py-0 align-middle">
|
||||
@ -55,7 +55,7 @@ var tableOfLineasPedido = new DataTable('#tableOfLineasPedido',{
|
||||
scrollX: true,
|
||||
searchable: false,
|
||||
info: false,
|
||||
dom: '',
|
||||
dom: 't',
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
@ -68,19 +68,8 @@ var tableOfLineasPedido = new DataTable('#tableOfLineasPedido',{
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
async: true,
|
||||
}),
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
orderable: false,
|
||||
data: null,
|
||||
defaultContent: ''
|
||||
},
|
||||
{
|
||||
targets: [1,2,3],
|
||||
orderable: false,
|
||||
},
|
||||
],
|
||||
columns: [
|
||||
{data: 'numero'},
|
||||
{
|
||||
data: viewPresupuestoBtns,
|
||||
className: 'dt-center'
|
||||
@ -89,6 +78,24 @@ var tableOfLineasPedido = new DataTable('#tableOfLineasPedido',{
|
||||
{data: 'concepto'},
|
||||
{data: 'total'},
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
visible: false,
|
||||
orderable: false,
|
||||
searchable: false
|
||||
},
|
||||
{
|
||||
targets: 1,
|
||||
orderable: false,
|
||||
data: null,
|
||||
defaultContent: ''
|
||||
},
|
||||
{
|
||||
targets: [2,3,4],
|
||||
orderable: false,
|
||||
},
|
||||
],
|
||||
footerCallback: function (row, data, start, end, display) {
|
||||
let api = this.api();
|
||||
|
||||
@ -103,14 +110,14 @@ var tableOfLineasPedido = new DataTable('#tableOfLineasPedido',{
|
||||
|
||||
// Total over all pages
|
||||
total = api
|
||||
.column(3)
|
||||
.column(4)
|
||||
.data()
|
||||
.reduce((a, b) => intVal(a) + intVal(b), 0);
|
||||
|
||||
// Update footer
|
||||
api.column(3).footer().innerHTML =
|
||||
api.column(4).footer().innerHTML =
|
||||
'Total: ' + total;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user