customizada vista de peiddos y facturas cliente

This commit is contained in:
2024-09-16 13:58:53 +02:00
parent d860d6426c
commit 4ce8b22c5a
13 changed files with 350 additions and 205 deletions

View File

@ -37,6 +37,7 @@
<?php endif; ?>
</div>
<?php if(!(auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?>
<div class="col-md-12 col-lg-2 px-4">
<div class="mb-1">
<label for="serie_id" class="form-label">
@ -47,6 +48,7 @@
</select>
</div>
</div><!--//.mb-3 -->
<div class="col-md-12 col-lg-2 px-4">
@ -60,6 +62,7 @@
</select>
</div>
</div><!--//.mb-3 -->
<?php endif; ?>
<div class="col-md-12 col-lg-2 px-4">
@ -72,6 +75,7 @@
</div>
<?php if(!(auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?>
<div class="col-md-12 col-lg-4 px-4">
<div class="mb-1">
<label for="cliente_id" class="form-label">
@ -85,6 +89,7 @@
</select>
</div>
</div><!--//.mb-3 -->
<?php endif; ?>
</div><!--//.row -->
@ -201,6 +206,7 @@
]
) ?>
<?php if(!(auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?>
<button
type="button"
class="btn btn-label-primary float-start me-sm-3 me-1"
@ -209,7 +215,7 @@
<span class="ti-xs ti ti-copy me-1"></span>
<?= lang("Facturas.duplicar") ?>
</button>
<?php endif; ?>
</div>
</div>

View File

@ -244,7 +244,7 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({
data: "descripcion",
render: function (data, type, row, meta) {
if(row.pedido_linea_impresion_id != null){
if(row.pedido_linea_impresion_id != null && <?= (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? 0 : 1 ?>){
// se convierten a float data.total_aceptado y subtotal
var total_aceptado = parseFloat(row.total_aceptado);

View File

@ -28,6 +28,7 @@
</tfoot>
</table>
<?php if(!(auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?>
<div id="addPagoRow" class="row">
<div class="col-md-12 col-lg-2">
<button
@ -40,7 +41,7 @@
</button>
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
@ -56,12 +57,16 @@ formas_pago.forEach(function(pago) {
});
const actionBtns_pagos = function(data) {
<?php if(!(auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?>
return `
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete-pago mx-2" data-id="${data.id}"></i></a>
<span class="edit-pago"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit-pago mx-2" data-id="${data.id}"></i></a></span>
<span class="cancel-pago"></span>
</div>`;
<?php else: ?>
return '';
<?php endif; ?>
}
var editor_pagos = new $.fn.dataTable.Editor( {

View File

@ -142,6 +142,9 @@
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfFacturas') ?>',
method: 'POST',
data: function(d, settings){
d.cliente_id = "<?= $cliente_id ?>";
},
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
@ -258,6 +261,18 @@
]
});
theTable.on( 'draw.dt', function () {
if(<?= $cliente_id ?> != -1){
theTable.column(3).visible(false);
theTable.column(7).visible(false);
theTable.column(8).visible(false);
theTable.column(9).visible(false);
theTable.column(10).visible(false);
theTable.column(11).visible(false);
theTable.column(12).visible(false);
}
});
$(document).on('click', '.btn-edit', function(e) {
var url = '<?= route_to('editarFactura', ':id') ?>';