mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'fix/comercial_presu_cliente_menu' into 'main'
corregidos permisos borrar en presupuestos See merge request jjimenez/safekat!546
This commit is contained in:
@ -45,10 +45,6 @@ const SK_PERMISSION_MATRIX = [
|
|||||||
"tarifa-encuadernacion.edit",
|
"tarifa-encuadernacion.edit",
|
||||||
"tarifa-encuadernacion.delete",
|
"tarifa-encuadernacion.delete",
|
||||||
"tarifa-encuadernacion.menu",
|
"tarifa-encuadernacion.menu",
|
||||||
"tarifa-extra.create",
|
|
||||||
"tarifa-extra.edit",
|
|
||||||
"tarifa-extra.delete",
|
|
||||||
"tarifa-extra.menu",
|
|
||||||
"tarifa-envio.create",
|
"tarifa-envio.create",
|
||||||
"tarifa-envio.edit",
|
"tarifa-envio.edit",
|
||||||
"tarifa-envio.delete",
|
"tarifa-envio.delete",
|
||||||
@ -122,8 +118,27 @@ const SK_PERMISSION_MATRIX = [
|
|||||||
"pedidos-todos.menu",
|
"pedidos-todos.menu",
|
||||||
],
|
],
|
||||||
"comercial" => [
|
"comercial" => [
|
||||||
"token.token",
|
"clientes.create",
|
||||||
"token.menu",
|
"clientes.edit",
|
||||||
|
"clientes.menu",
|
||||||
|
"direcciones.create",
|
||||||
|
"direcciones.edit",
|
||||||
|
"direcciones.menu",
|
||||||
|
"presupuesto.create",
|
||||||
|
"presupuesto.edit",
|
||||||
|
"presupuesto.delete",
|
||||||
|
"presupuesto.menu",
|
||||||
|
"presupuesto-cliente.create",
|
||||||
|
"presupuesto-cliente.edit",
|
||||||
|
"presupuesto-cliente.menu",
|
||||||
|
"pedidos-activos.view",
|
||||||
|
"pedidos-activos.menu",
|
||||||
|
"pedidos-finalizados.view",
|
||||||
|
"pedidos-finalizados.menu",
|
||||||
|
"pedidos-cancelados.view",
|
||||||
|
"pedidos-cancelados.menu",
|
||||||
|
"pedidos-todos.view",
|
||||||
|
"pedidos-todos.menu",
|
||||||
],
|
],
|
||||||
"produccion" => [
|
"produccion" => [
|
||||||
"clientes.create",
|
"clientes.create",
|
||||||
|
|||||||
@ -64,7 +64,9 @@ const actionBtns = function(data) {
|
|||||||
<td class="text-right py-0 align-middle">
|
<td class="text-right py-0 align-middle">
|
||||||
<div class="btn-group btn-group-sm">
|
<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-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>
|
</div>
|
||||||
</td>`;
|
</td>`;
|
||||||
}
|
}
|
||||||
@ -240,7 +242,7 @@ $(document).on('click', '.btn-remove', function(e) {
|
|||||||
const row = $(this).closest('tr');
|
const row = $(this).closest('tr');
|
||||||
if ($.isNumeric(dataId)) {
|
if ($.isNumeric(dataId)) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: `/presupuestoadmin/delete/${dataId}`,
|
url: `/presupuestos/presupuestocliente/delete/${dataId}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
}).done((data, textStatus, jqXHR) => {
|
}).done((data, textStatus, jqXHR) => {
|
||||||
$('#confirm2delete').modal('toggle');
|
$('#confirm2delete').modal('toggle');
|
||||||
|
|||||||
@ -55,7 +55,9 @@ const actionBtns = function(data) {
|
|||||||
<td class="text-right py-0 align-middle">
|
<td class="text-right py-0 align-middle">
|
||||||
<div class="btn-group btn-group-sm">
|
<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-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>
|
</div>
|
||||||
</td>`;
|
</td>`;
|
||||||
};
|
};
|
||||||
@ -287,13 +289,13 @@ $(document).on('click', '.btn-edit', function(e) {
|
|||||||
window.location.href = `/presupuestoadmin/edit/${$(this).attr('data-id')}/`;
|
window.location.href = `/presupuestoadmin/edit/${$(this).attr('data-id')}/`;
|
||||||
});
|
});
|
||||||
|
|
||||||
theTable.on('click', 'tr', function () {
|
theTable.on('click', 'tbody td:not(:last-child)', function () {
|
||||||
var data = theTable.row(this).data();
|
var data = theTable.row($(this).closest('tr')).data();
|
||||||
console.log(data);
|
|
||||||
var url = '/presupuestoadmin/edit/' + data['id'];
|
var url = '/presupuestoadmin/edit/' + data['id'];
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$(document).on('click', '.btn-delete', function(e) {
|
$(document).on('click', '.btn-delete', function(e) {
|
||||||
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
$(".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');
|
const row = $(this).closest('tr');
|
||||||
if ($.isNumeric(dataId)) {
|
if ($.isNumeric(dataId)) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: `/presupuestoadmin/delete/${dataId}`,
|
url: `/presupuestos/presupuestocliente/delete/${dataId}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
}).done((data, textStatus, jqXHR) => {
|
}).done((data, textStatus, jqXHR) => {
|
||||||
$('#confirm2delete').modal('toggle');
|
$('#confirm2delete').modal('toggle');
|
||||||
|
|||||||
@ -50,21 +50,25 @@
|
|||||||
|
|
||||||
const lastColNr = $('#tableOfPresupuestos').find("tr:first th").length - 1;
|
const lastColNr = $('#tableOfPresupuestos').find("tr:first th").length - 1;
|
||||||
const actionBtns = function(data) {
|
const actionBtns = function(data) {
|
||||||
if(data.estado == 'borrador')
|
if(data.estado == 'borrador'){
|
||||||
return `
|
return `
|
||||||
<td class="text-right py-0 align-middle">
|
<td class="text-right py-0 align-middle">
|
||||||
<div class="btn-group btn-group-sm">
|
<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-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>
|
</div>
|
||||||
</td>`;
|
</td>`;
|
||||||
else
|
}
|
||||||
|
else{
|
||||||
return `
|
return `
|
||||||
<td class="text-right py-0 align-middle">
|
<td class="text-right py-0 align-middle">
|
||||||
<div class="btn-group btn-group-sm">
|
<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>
|
<a href="javascript:void(0);"><i class="ti ti-eye ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</td>`;
|
</td>`;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Setup - add a text input to each footer cell
|
// Setup - add a text input to each footer cell
|
||||||
@ -292,8 +296,8 @@ theTable = $('#tableOfPresupuestos').DataTable({
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
theTable.on('click', 'tr', function () {
|
theTable.on('click', 'tbody td:not(:last-child)', function () {
|
||||||
var data = theTable.row(this).data();
|
var data = theTable.row($(this).closest('tr')).data();
|
||||||
var url = '/presupuestos/presupuestocliente/edit/' + data['id'];
|
var url = '/presupuestos/presupuestocliente/edit/' + data['id'];
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,19 +2,16 @@
|
|||||||
/**
|
/**
|
||||||
* MENU PRESUPUESTOS VISTA CLIENTES
|
* 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">
|
<li class="menu-item">
|
||||||
<a href="javascript:void(0);" class="menu-link menu-toggle">
|
<a href="javascript:void(0);" class="menu-link menu-toggle">
|
||||||
<i class="menu-icon tf-icons ti ti-currency-dollar"></i>
|
<i class="menu-icon tf-icons ti ti-currency-dollar"></i>
|
||||||
<?php
|
<?php
|
||||||
echo(
|
echo(
|
||||||
auth()->user()->inGroup('admin') ?
|
auth()->user()->can('presupuesto.menu') ?
|
||||||
lang("App.menu_presupuestos_clientes") :
|
lang("App.menu_presupuestos_clientes") :
|
||||||
lang("App.menu_presupuestos")
|
lang("App.menu_presupuestos")
|
||||||
);
|
);
|
||||||
@ -38,6 +35,6 @@ if (auth()->user()->inGroup('cliente-admin')
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<?php
|
<?php
|
||||||
}
|
|
||||||
} ?>
|
} ?>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user