commit para mergear antes de ramas nuevas

This commit is contained in:
2024-07-15 11:23:13 +02:00
parent e18368e647
commit 955fa05666
12 changed files with 197 additions and 39 deletions

View File

@ -14,6 +14,7 @@
<thead>
<tr>
<th></th>
<th>id</th>
<th></th>
<th></th>
<th></th>
@ -86,7 +87,7 @@ const actionBtns = function(data) {
<div class="row mb-2">
<div class="btn-group btn-group-sm"><span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i></a>
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
</div>
</div>
</td>`;
@ -97,7 +98,7 @@ const actionBtns = function(data) {
<div class="row mb-2">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i></a>
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
</div>
</div>
<div class="row">
@ -107,7 +108,7 @@ const actionBtns = function(data) {
}
};
var editor = new $.fn.dataTable.Editor( {
var editor_lineas = new $.fn.dataTable.Editor( {
ajax: {
url: "<?= route_to('editorOfLineasFacturas') ?>",
headers: {
@ -121,28 +122,14 @@ var editor = new $.fn.dataTable.Editor( {
name: "unidades",
}, {
name: "concepto",
type: "textarea"
name: "concepto"
}, {
name: "precio_unidad",
}, {
name: "iva",
}, {
"name": "factura_id",
"type": "hidden"
}, {
"name": "pedido_linea_impresion_id",
"type": "hidden"
},{
"name": "pedido_maquetacion_id",
"type": "hidden"
},
}
]
} );
editor.on( 'preSubmit', function ( e, d, type ) {
editor_lineas.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['factura_id'] = <?= $facturaEntity->id ?>;
}
@ -154,12 +141,12 @@ editor.on( 'preSubmit', function ( e, d, type ) {
});
editor.on( 'postSubmit', function ( e, json, data, action ) {
editor_lineas.on( 'postSubmit', function ( e, json, data, action ) {
yeniden(json.<?= csrf_token() ?>);
});
editor.on( 'submitSuccess', function ( e, json, data, action ) {
editor_lineas.on( 'submitSuccess', function ( e, json, data, action ) {
tableLineas.clearPipeline();
tableLineas.draw();
@ -168,7 +155,7 @@ editor.on( 'submitSuccess', function ( e, json, data, action ) {
// Activate an inline edit on click of a table cell
$('#tableOfLineasFactura').on( 'click', 'tbody span.edit', function (e) {
editor.inline(
editor_lineas.inline(
tableLineas.cells(this.parentNode.parentNode, '*').nodes(),
{
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
@ -189,11 +176,41 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
scrollX: true,
columns: [
{data: null, render: actionBtns},
{data: "id"},
{data: "pedido_linea_impresion_id"},
{data: "pedido_maquetacion_id"},
{data: "pedido_id"},
{data: "unidades"},
{data: "concepto"},
{
data: "concepto",
render: function (data, type, row, meta) {
// se convierten a float data.total_aceptado y subtotal
var total_aceptado = parseFloat(row.total_aceptado);
var subtotal = parseFloat(row.subtotal);
var error_text = '';
if(total_aceptado != subtotal){
error_text = 'El total del pedido ('+ total_aceptado + '€) no coincide con la línea ('+ subtotal + '€)';
}
return `
<div>
${data}
</div>
<div class="mt-5">
<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>
`;
}
},
{data: "precio_unidad"},
{data: "iva"},
{data: "subtotal"},
@ -219,7 +236,7 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
},
{
visible: false,
targets: [1, 2, 3, 9, 10]
targets: [1, 2, 3, 4, 10, 11]
}
],