casi terminado

This commit is contained in:
2024-07-17 14:51:47 +02:00
parent 99e9bf51a6
commit 4c33167764
5 changed files with 52 additions and 18 deletions

View File

@ -28,7 +28,7 @@
</tfoot>
</table>
<div class="row">
<div id="addPagoRow" class="row">
<div class="col-md-12 col-lg-2">
<button
type="button"
@ -50,6 +50,10 @@
<?=$this->section('additionalInlineJs') ?>
const formas_pago = <?= json_encode($facturaEntity->formas_pago) ?>;
var formaPagoLookup = {};
formas_pago.forEach(function(pago) {
formaPagoLookup[pago.value] = pago.label;
});
const actionBtns_pagos = function(data) {
return `
@ -92,12 +96,21 @@ var editor_pagos = new $.fn.dataTable.Editor( {
{
name: "fecha_pago_at",
type: "datetime",
format: "DD/MM/YYYY"
def: function () {
return new Date().toISOString().split('T')[0]; // YYYY-MM-DD
},
wireFormat: 'YYYY-MM-DD HH:mm:ss',
displayFormat: 'DD/MM/YYYY',
},
{
name: "fecha_vencimiento_at",
type: "datetime",
format: "DD/MM/YYYY"
def: () => new Date(),
def: function () {
return new Date().toISOString().split('T')[0]; // YYYY-MM-DD
},
wireFormat: 'YYYY-MM-DD HH:mm:ss',
displayFormat: 'DD/MM/YYYY',
},
{
name: "id",
@ -146,7 +159,12 @@ var tablePagos = $('#tableOfLineasPagos').DataTable({
className: 'row-edit dt-center'
},
{data: "id"},
{data: "forma_pago_id"},
{
data: "forma_pago_id",
render: function(data, type, row) {
return formaPagoLookup[data] || data;
}
},
{data: "notes"},
{
data: "fecha_vencimiento_at",
@ -183,7 +201,16 @@ var tablePagos = $('#tableOfLineasPagos').DataTable({
{
visible: false,
targets: [1]
}
},
{
width: '40%', // Ajusta el ancho para la columna de notas
targets: 3
},
{
width: '10%', // Ajusta el ancho para la columna de notas
targets: [4, 5, 6]
},
],
footerCallback: function (row, data, start, end, display) {
var api = this.api();
@ -268,7 +295,11 @@ function updateFooterLineas(table){
pendiente: pendientePago
}
}).done((data, textStatus, jqXHR) => {
//console.log(data);
if($('#pendiente-pago').html() == '0.00'){
$('#addPagoRow').hide();
} else {
$('#validarFactura').show();
}
}).fail((jqXHR, textStatus, errorThrown) => {
popErrorAlert(jqXHR.responseJSON.messages.error)
})

View File

@ -27,6 +27,7 @@
<th><?= lang('Facturas.estadoPago') ?></th>
<th><?= lang('Facturas.formaPago') ?></th>
<th><?= lang('Facturas.vencimiento') ?></th>
<th><?= lang('Facturas.dias') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
@ -196,13 +197,14 @@
break;
default:
return '--'; // Debug
return data; // Debug
break;
}
}
},
{ 'data': 'vencimiento' },
{ 'data': 'dias_vencimiento' },
{ 'data': actionBtns }
]
});