Merge branch 'main' into 'feat/soporte'

Main

See merge request jjimenez/safekat!548
This commit is contained in:
2025-02-18 11:13:37 +00:00
9 changed files with 96 additions and 30 deletions

View File

@ -543,7 +543,7 @@
return '<?= lang('MaquinasTarifasImpresions.colorhq') ?>';
}
},
{ 'data': 'precio',render : (d) => `<span class="autonumeric">${d}</span>` },
{ 'data': 'precio',render : (d) => `<span class="autonumeric-decimal" data-decimal-places="6">${d}</span>` },
{ 'data': 'margen',render : (d) => `<span class="autonumeric">${d}</span>` },
{
data: actionBtns,

View File

@ -64,7 +64,9 @@ const actionBtns = function(data) {
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
<?php if(auth()->user()->can('presupuesto.delete')): ?>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
<?php endif; ?>
</div>
</td>`;
}
@ -240,7 +242,7 @@ $(document).on('click', '.btn-remove', function(e) {
const row = $(this).closest('tr');
if ($.isNumeric(dataId)) {
$.ajax({
url: `/presupuestoadmin/delete/${dataId}`,
url: `/presupuestos/presupuestocliente/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');

View File

@ -55,7 +55,9 @@ const actionBtns = function(data) {
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
<?php if(auth()->user()->can('presupuesto.delete')): ?>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
<?php endif; ?>
</div>
</td>`;
};
@ -287,13 +289,13 @@ $(document).on('click', '.btn-edit', function(e) {
window.location.href = `/presupuestoadmin/edit/${$(this).attr('data-id')}/`;
});
theTable.on('click', 'tr', function () {
var data = theTable.row(this).data();
console.log(data);
theTable.on('click', 'tbody td:not(:last-child)', function () {
var data = theTable.row($(this).closest('tr')).data();
var url = '/presupuestoadmin/edit/' + data['id'];
window.location.href = url;
});
$(document).on('click', '.btn-delete', function(e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
});
@ -304,7 +306,7 @@ $(document).on('click', '.btn-remove', function(e) {
const row = $(this).closest('tr');
if ($.isNumeric(dataId)) {
$.ajax({
url: `/presupuestoadmin/delete/${dataId}`,
url: `/presupuestos/presupuestocliente/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle');

View File

@ -50,21 +50,25 @@
const lastColNr = $('#tableOfPresupuestos').find("tr:first th").length - 1;
const actionBtns = function(data) {
if(data.estado == 'borrador')
if(data.estado == 'borrador'){
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
<?php if(auth()->user()->can('presupuesto-cliente.delete')): ?>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
<?php endif; ?>
</div>
</td>`;
else
}
else{
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-eye ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
</div>
</td>`;
}
};
// Setup - add a text input to each footer cell
@ -292,8 +296,8 @@ theTable = $('#tableOfPresupuestos').DataTable({
]
});
theTable.on('click', 'tr', function () {
var data = theTable.row(this).data();
theTable.on('click', 'tbody td:not(:last-child)', function () {
var data = theTable.row($(this).closest('tr')).data();
var url = '/presupuestos/presupuestocliente/edit/' + data['id'];
window.location.href = url;
});

View File

@ -2,19 +2,16 @@
/**
* MENU PRESUPUESTOS VISTA CLIENTES
*/
if (auth()->user()->inGroup('cliente-admin')
|| auth()->user()->inGroup('cliente-editor')
|| auth()->user()->inGroup('admin')
) {
if (auth()->user()->can('presupuesto-cliente.menu') || auth()->user()->inGroup('admin')) {
if(auth()->user()->can('presupuesto-cliente.menu')){
?>
<li class="menu-item">
<a href="javascript:void(0);" class="menu-link menu-toggle">
<i class="menu-icon tf-icons ti ti-currency-dollar"></i>
<?php
echo(
auth()->user()->inGroup('admin') ?
auth()->user()->can('presupuesto.menu') ?
lang("App.menu_presupuestos_clientes") :
lang("App.menu_presupuestos")
);
@ -38,6 +35,6 @@ if (auth()->user()->inGroup('cliente-admin')
</ul>
</li>
<?php
}
} ?>