falta boton excedentes

This commit is contained in:
2024-08-07 22:01:00 +02:00
parent d39a8a4e0b
commit b95930dcc2
6 changed files with 131 additions and 62 deletions

View File

@ -118,11 +118,10 @@ $('#addNewPedidoImpresion').on('click', function(){
yeniden(response.<?= csrf_token() ?>);
// se ajustan el ancho de las columnas
$('#tableOfLineasFactura').DataTable().columns.adjust().draw();
$('#pedidoImpresion').val(null).trigger('change');
// Se actualiza la tabla de lineas de factura
tableLineas.clearPipeline();
tableLineas.draw();
$('#tableOfLineasFactura').DataTable().columns.adjust().draw();
}
});
});

View File

@ -255,7 +255,7 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
error_text = 'El total del pedido ('+ total_aceptado + '€) no coincide con la línea ('+ subtotal + '€)';
}
return `
var returned_data = `
<div>
${data}
</div>
@ -265,11 +265,55 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
<span style="color: red;" id="error-${meta.row}">${error_text}</span>
</div>
<div class="mt-2">
<label for="input-${meta.row}">Total aceptado</label>
<input readonly type="text" id="input-${meta.row}" value="${row.total_aceptado}">
</div>
<div class="row mt-2">
<div style="margin-top: auto;" class="col-md-12 col-lg-2 px-4">
<label for="total-aceptado_-${meta.row}">Total aceptado</label>
<input readonly style="max-width: 110px;" type="text" id="total-aceptado_${meta.row}" value="${row.total_aceptado}">
</div>
`;
if (row.tirada_flexible === "1"){
returned_data += `
<div style="margin-top: auto;" class="col-md-12 col-lg-2 px-4">
<label for="descuento-tf_${meta.row}">Descuento tirada flexible</label>
<input readonly style="max-width: 110px;" type="text" id="descuento-tf_${meta.row}" value="${row.descuento_tirada_flexible}">
</div>
<div style="margin-top: auto;" class="col-md-12 col-lg-2 px-4">
<label for="tirada-albaran_${meta.row}">Tirada albarán</label>
<input readonly style="max-width: 110px;" type="text" id="tirada-albaran_${meta.row}" value="${row.cantidad_albaran}">
</div>
`;
if(row.cantidad<row.cantidad_albaran){
returned_data += `
<div style="margin-top: auto;" class="col-md-12 col-lg-2 px-4">
<button
type="button"
class="btn btn-label-primary float-start me-sm-3 me-1 btn-excedentes"
name="btn-excedentes_${meta.row}"
id="btn-excedentes_${meta.row}"
data-row="${meta.row}"
>
<span class="ti-xs ti ti-circle-plus me-1"></span>
Excedentes
</button>
</div>
</div>
`;
}
else{
returned_data += `
</div>
`;
}
}
else{
returned_data += `
</div>
`;
}
return returned_data;
}
else{
return `
@ -397,12 +441,12 @@ $(document).on('click', '.btn-delete', function(e) {
asyncConfirmDialogWithParams(
"Borrar Linea de Factura",
"¿Está seguro de borrar la línea? Esta acción no se puede deshacer.",
deleteConfirmed, function(){}, [dataId, row])
deleteConfirmedLinea, function(){}, [dataId, row])
}
});
function deleteConfirmed(params){
function deleteConfirmedLinea(params){
var factura_linea_id = params[0];
var row = params[1];
const row_data = tableLineas.row($(row)).data();
@ -456,5 +500,18 @@ $('#addLineaFactura').on('click', function() {
editor_lineas.inlineCreate('end', formOptions);
});
$('.btn-excedentes').on('click', function() {
const row = $(this).data('row');
console.row(row);
/*
const row_data = tableLineas.row(row).data();
const url = '<?= route_to('excedentes') ?>';
const formOptions= {
submitTrigger: 0,
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
};
editor_lineas.inlineCreate('end', formOptions);
*/
});
<?=$this->endSection() ?>