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

@ -41,6 +41,17 @@ class Facturas extends \App\Controllers\BaseResourceController
public function index()
{
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
} else {
$clienteId = 0;
}
$this->viewData['cliente_id'] = $clienteId;
$this->viewData['usingClientSideDataTable'] = true;
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Tarifaextra.tarifaextra')]);
@ -64,6 +75,17 @@ class Facturas extends \App\Controllers\BaseResourceController
['title' => lang("Facturas.facturaList"), 'route' => "javascript:void(0);", 'active' => true]
];
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
} else {
$clienteId = 0;
}
$viewData['cliente_id'] = $clienteId;
return view(static::$viewPath . 'viewFacturasList', $viewData);
}
@ -105,6 +127,10 @@ class Facturas extends \App\Controllers\BaseResourceController
$sanitizedData['user_updated_id'] = auth()->user()->id;
$sanitizedData['user_created_id'] = auth()->user()->id;
if(!$sanitizedData['creditoAsegurado']){
$sanitizedData['creditoAsegurado'] = 0;
}
if ($allData && $successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
@ -205,13 +231,14 @@ class Facturas extends \App\Controllers\BaseResourceController
$requestedOrder = $reqData['order']['0']['column'] ?? 0;
$order = FacturaModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 0];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$cliente_id = $reqData['cliente_id'] ?? -1;
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
$resourceData = $this->model->getResource($search, $cliente_id)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource("")->countAllResults(),
$this->model->getResource($search)->countAllResults()
$this->model->getResource("", $cliente_id)->countAllResults(),
$this->model->getResource($search, $cliente_id)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);

View File

@ -40,6 +40,17 @@ class Pedido extends \App\Controllers\BaseResourceController
public function index()
{
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
} else {
$clienteId = -1;
}
$this->viewData['cliente_id'] = $clienteId;
$this->viewData['usingClientSideDataTable'] = true;
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Tarifaextra.tarifaextra')]);
@ -52,13 +63,24 @@ class Pedido extends \App\Controllers\BaseResourceController
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Pedidos.pedido')]),
'presupuestoEntity' => new PedidoEntity(),
'pedidoEntity' => new PedidoEntity(),
'usingServerSideDataTable' => true,
'pageTitle' => lang('Pedidos.Pedidos'),
'estadoPedidos' => 'activo',
['title' => lang("App.menu_pedidos"), 'route' => site_url('pedidos/todos'), 'active' => true]
];
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
} else {
$clienteId = -1;
}
$viewData['cliente_id'] = $clienteId;
return view(static::$viewPath . 'viewPedidosList', $viewData);
}
@ -67,13 +89,24 @@ class Pedido extends \App\Controllers\BaseResourceController
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Pedidos.pedido')]),
'presupuestoEntity' => new PedidoEntity(),
'pedidoEntity' => new PedidoEntity(),
'usingServerSideDataTable' => true,
'pageTitle' => lang('Pedidos.Pedidos'),
'estadoPedidos' => 'finalizado',
['title' => lang("App.menu_pedidos"), 'route' => site_url('pedidos/todos'), 'active' => true]
];
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
} else {
$clienteId = -1;
}
$viewData['cliente_id'] = $clienteId;
return view(static::$viewPath . 'viewPedidosList', $viewData);
}
@ -82,13 +115,24 @@ class Pedido extends \App\Controllers\BaseResourceController
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Pedidos.pedido')]),
'presupuestoEntity' => new PedidoEntity(),
'pedidoEntity' => new PedidoEntity(),
'usingServerSideDataTable' => true,
'pageTitle' => lang('Pedidos.Pedidos'),
'estadoPedidos' => 'cancelado',
['title' => lang("App.menu_pedidos"), 'route' => site_url('pedidos/todos'), 'active' => true]
];
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
} else {
$clienteId = -1;
}
$viewData['cliente_id'] = $clienteId;
return view(static::$viewPath . 'viewPedidosList', $viewData);
}
@ -98,13 +142,24 @@ class Pedido extends \App\Controllers\BaseResourceController
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Pedidos.pedido')]),
'presupuestoEntity' => new PedidoEntity(),
'pedidoEntity' => new PedidoEntity(),
'usingServerSideDataTable' => true,
'pageTitle' => lang('Pedidos.Pedidos'),
'estadoPedidos' => 'todos',
['title' => lang("App.menu_pedidos"), 'route' => site_url('pedidos/todos'), 'active' => true]
];
if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) {
// Se obtiene el cliente ID a partir del usuario de la sesion
$model_user = model('App\Models\Usuarios\UserModel');
$user = $model_user->find(auth()->user()->id);
$clienteId = $user->cliente_id;
} else {
$clienteId = -1;
}
$viewData['cliente_id'] = $clienteId;
return view(static::$viewPath . 'viewPedidosList', $viewData);
}
@ -242,6 +297,7 @@ class Pedido extends \App\Controllers\BaseResourceController
$order = PedidoModel::SORTABLE_TODOS[$requestedOrder >= 0 ? $requestedOrder : 0];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$estado = $reqData['estado'] ?? 'todos';
$cliente_id = $reqData['cliente_id'] ?? -1;
if($estado == 'todos') $estado = '';
$showTotal = $reqData['showTotal'] ?? false;
@ -249,9 +305,9 @@ class Pedido extends \App\Controllers\BaseResourceController
$searchValues = get_filter_datatables_columns($reqData);
$model_linea = model('\App\Models\Pedidos\PedidoLineaModel');
$resourceData = $model_linea->getResource($searchValues, $estado)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
$totalTirada = $model_linea->getSumOfTirada($searchValues, $estado, $start, $length);
$total = $model_linea->getSumOfTotalAceptado($searchValues, $estado, $start, $length);
$resourceData = $model_linea->getResource($searchValues, $estado, $cliente_id)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
$totalTirada = $model_linea->getSumOfTirada($searchValues, $estado, $cliente_id, $start, $length);
$total = $model_linea->getSumOfTotalAceptado($searchValues, $estado, $cliente_id, $start, $length);
$total2 = 0;
if($showTotal){
$total2 = $model_linea->getTotalOfTotalAceptado();

View File

@ -72,7 +72,7 @@ class FacturaModel extends \App\Models\BaseModel {
public static $labelField = "id";
public function getResource(string $search = "")
public function getResource(string $search = "", $cliente_id=-1)
{
$builder = $this->db
->table($this->table . " t1")
@ -90,8 +90,16 @@ class FacturaModel extends \App\Models\BaseModel {
$builder->join("formas_pago t4", "t3.forma_pago_id = t4.id", "left");
$builder->where("t1.deleted_at IS NULL");
if(auth()->user()->inGroup("cliente-admin") || auth()->user()->inGroup("cliente-editor")) {
$builder->where("t1.estado", "validada");
}
if($cliente_id != -1) {
$builder->where("t1.cliente_id", $cliente_id);
}
$builder->groupBy("t1.id"); // Agrupa por id de la factura
return empty($search)
? $builder
: $builder

View File

@ -48,7 +48,7 @@ class PedidoLineaModel extends \App\Models\BaseModel
public static $labelField = "id";
public function getResource($search = [], $estado="")
public function getResource($search = [], $estado="", $cliente_id = -1)
{
$builder = $this->db
->table($this->table . " t1")
@ -75,6 +75,10 @@ class PedidoLineaModel extends \App\Models\BaseModel
}
}
if($cliente_id != -1) {
$builder->where("t3.cliente_id", $cliente_id);
}
if (empty($search))
return $builder;
else {
@ -93,7 +97,7 @@ class PedidoLineaModel extends \App\Models\BaseModel
}
}
public function getSumOfTirada(array $search, $estado = '', $start = 0, $length = 5)
public function getSumOfTirada(array $search, $estado = '', $cliente_id=-1, $start = 0, $length = 5)
{
$builder = $this->db
@ -104,6 +108,9 @@ class PedidoLineaModel extends \App\Models\BaseModel
$builder->join("presupuestos t3", "t1.presupuesto_id = t3.id", "left");
if($cliente_id != -1) {
$builder->where("t3.cliente_id", $cliente_id);
}
// Aplica los filtros de búsqueda y estado
if (!empty($search)) {
@ -130,7 +137,7 @@ class PedidoLineaModel extends \App\Models\BaseModel
return $builder->get()->getRow()->total_tirada;
}
public function getSumOfTotalAceptado(array $search, $estado = '', $start = 0, $length = 5)
public function getSumOfTotalAceptado(array $search, $estado = '', $cliente_id=-1, $start = 0, $length = 5)
{
$builder = $this->db
@ -140,7 +147,9 @@ class PedidoLineaModel extends \App\Models\BaseModel
$builder->join("pedidos t2", "t2.id = t1.pedido_id", "left");
$builder->join("presupuestos t3", "t1.presupuesto_id = t3.id", "left");
if($cliente_id != -1) {
$builder->where("t3.cliente_id", $cliente_id);
}
// Aplica los filtros de búsqueda y estado
if (!empty($search)) {

View File

@ -139,6 +139,7 @@ class BuscadorModel extends \App\Models\BaseModel
$builder->where("t1.is_deleted", 0);
if (empty($search))
return $builder;
else {

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') ?>';

View File

@ -22,17 +22,19 @@
</div>
</div><!--//.mb-3 -->
<div class="col-md-12 col-lg-4 px-4">
<div class="mb-1">
<label for="cliente" class="form-label">
<?= lang('Pedidos.cliente') ?>
<div class="btn-group btn-group-sm">
<a href="<?= route_to('editarCliente', $pedidoEntity->cliente_id); ?>" target="_blank" ><i class="ti ti-file-search ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
</div>
</label>
<input readonly id="cliente" name="cliente" tabindex="2" maxLength="11" class="form-control" value="<?= old('cliente', $pedidoEntity->cliente) ?>" >
</div>
</div><!--//.mb-3 -->
<?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" class="form-label">
<?= lang('Pedidos.cliente') ?>
<div class="btn-group btn-group-sm">
<a href="<?= route_to('editarCliente', $pedidoEntity->cliente_id); ?>" target="_blank" ><i class="ti ti-file-search ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
</div>
</label>
<input readonly id="cliente" name="cliente" tabindex="2" maxLength="11" class="form-control" value="<?= old('cliente', $pedidoEntity->cliente) ?>" >
</div>
</div><!--//.mb-3 -->
<?php endif; ?>
<div class="col-md-12 col-lg-3 px-4">
@ -55,102 +57,104 @@
</div><!--//.mb-3 -->
<?php if (!(auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?>
<div class="accordion accordion mt-3 accordion-without-arrow" id="FechasPedido">
<div class="card accordion-item active mt-3 mx-2">
<h2 class="accordion-header" id="headingFechas">
<button type="button" class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#accordionIcon-1" aria-controls="accordionIcon-1">
<i class="ti ti-businessplan ti-sm mx-2"></i><?= lang('Pedidos.totales') ?>
</button>
</h2>
<div class="accordion accordion mt-3 accordion-without-arrow" id="FechasPedido">
<div class="card accordion-item active mt-3 mx-2">
<h2 class="accordion-header" id="headingFechas">
<button type="button" class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#accordionIcon-1" aria-controls="accordionIcon-1">
<i class="ti ti-businessplan ti-sm mx-2"></i><?= lang('Pedidos.totales') ?>
</button>
</h2>
<div id="accordionFechasTip" class="accordion show" data-bs-parent="#accordioFechas">
<div class="accordion-body">
<div class="row">
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-1">
<label for="total_precio" class="form-label">
<?= lang('Pedidos.total_precio') ?>
</label>
<input readonly id="total_precio" name="total_precio" tabindex="1" maxLength="11" class="form-control" value="<?= old('total_precio', $pedidoEntity->total_precio) ?>" >
</div>
</div><!--//.mb-3 -->
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-1">
<label for="total_tirada" class="form-label">
<?= lang('Pedidos.total_tirada') ?>
</label>
<input readonly id="total_tirada" name="total_tirada" tabindex="1" maxLength="11" class="form-control" value="<?= old('total_tirada', $pedidoEntity->total_tirada ) ?>" >
</div>
</div><!--//.mb-3 -->
<div id="accordionFechasTip" class="accordion show" data-bs-parent="#accordioFechas">
<div class="accordion-body">
<div class="row">
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-1">
<label for="total_precio" class="form-label">
<?= lang('Pedidos.total_precio') ?>
</label>
<input readonly id="total_precio" name="total_precio" tabindex="1" maxLength="11" class="form-control" value="<?= old('total_precio', $pedidoEntity->total_precio) ?>" >
</div>
</div><!--//.mb-3 -->
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-1">
<label for="total_tirada" class="form-label">
<?= lang('Pedidos.total_tirada') ?>
</label>
<input readonly id="total_tirada" name="total_tirada" tabindex="1" maxLength="11" class="form-control" value="<?= old('total_tirada', $pedidoEntity->total_tirada ) ?>" >
</div>
</div><!--//.mb-3 -->
</div>
</div> <!--//accordion-body -->
</div> <!--//accordionFechasTip-->
</div> <!--//card-->
</div>
</div> <!--//accordion-body -->
</div> <!--//accordionFechasTip-->
</div> <!--//card-->
</div>
<div class="accordion accordion mt-3 accordion-without-arrow" id="FechasPedido">
<div class="card accordion-item active mt-3 mx-2">
<h2 class="accordion-header" id="headingFechas">
<button type="button" class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#accordionIcon-1" aria-controls="accordionIcon-1">
<i class="ti ti-calendar ti-sm mx-2"></i><?= lang("Pedidos.fechas") ?>
</button>
</h2>
<div class="accordion accordion mt-3 accordion-without-arrow" id="FechasPedido">
<div class="card accordion-item active mt-3 mx-2">
<h2 class="accordion-header" id="headingFechas">
<button type="button" class="accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#accordionIcon-1" aria-controls="accordionIcon-1">
<i class="ti ti-calendar ti-sm mx-2"></i><?= lang("Pedidos.fechas") ?>
</button>
</h2>
<div id="accordionFechasTip" class="accordion show" data-bs-parent="#accordioFechas">
<div class="accordion-body">
<div class="row">
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-1">
<label for="fecha_entrega_real" class="fecha-pedido form-label">
<?= lang('Pedidos.fecha_entrega_real') ?>
</label>
<input type="text" value="" id="fecha_entrega_real" name="fecha_entrega_real" tabindex="1" maxLength="11" class="form-control" value="<?= old('fecha_entrega_real', $pedidoEntity->fecha_entrega_real) ?>" >
<div id="accordionFechasTip" class="accordion show" data-bs-parent="#accordioFechas">
<div class="accordion-body">
<div class="row">
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-1">
<label for="fecha_entrega_real" class="fecha-pedido form-label">
<?= lang('Pedidos.fecha_entrega_real') ?>
</label>
<input type="text" value="" id="fecha_entrega_real" name="fecha_entrega_real" tabindex="1" maxLength="11" class="form-control" value="<?= old('fecha_entrega_real', $pedidoEntity->fecha_entrega_real) ?>" >
</div>
</div>
</div>
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-1">
<label for="fecha_impresion" class="form-label">
<?= lang('Pedidos.fecha_impresion') ?>
</label>
<input type="text" id="fecha_impresion" name="fecha_impresion" tabindex="1" maxLength="11" class="fecha-pedido form-control" value="<?= old('fecha_impresion', $pedidoEntity->fecha_impresion) ?>" >
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-1">
<label for="fecha_impresion" class="form-label">
<?= lang('Pedidos.fecha_impresion') ?>
</label>
<input type="text" id="fecha_impresion" name="fecha_impresion" tabindex="1" maxLength="11" class="fecha-pedido form-control" value="<?= old('fecha_impresion', $pedidoEntity->fecha_impresion) ?>" >
</div>
</div>
</div>
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-1">
<label for="fecha_encuadernado" class="form-label">
<?= lang('Pedidos.fecha_encuadernado') ?>
</label>
<input type="text" id="fecha_encuadernado" name="fecha_encuadernado" tabindex="1" maxLength="11" class="fecha-pedido form-control" value="<?= old('fecha_encuadernado', $pedidoEntity->fecha_encuadernado) ?>" >
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-1">
<label for="fecha_encuadernado" class="form-label">
<?= lang('Pedidos.fecha_encuadernado') ?>
</label>
<input type="text" id="fecha_encuadernado" name="fecha_encuadernado" tabindex="1" maxLength="11" class="fecha-pedido form-control" value="<?= old('fecha_encuadernado', $pedidoEntity->fecha_encuadernado) ?>" >
</div>
</div>
</div>
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-1">
<label for="fecha_entrega_externo" class="form-label">
<?= lang('Pedidos.fecha_entrega_externo') ?>
</label>
<input type="text" id="fecha_entrega_externo" name="fecha_entrega_externo" tabindex="1" maxLength="11" class="fecha-pedido form-control" value="<?= old('fecha_entrega_externo', $pedidoEntity->fecha_entrega_externo) ?>" >
<div class="col-md-12 col-lg-3 px-4">
<div class="mb-1">
<label for="fecha_entrega_externo" class="form-label">
<?= lang('Pedidos.fecha_entrega_externo') ?>
</label>
<input type="text" id="fecha_entrega_externo" name="fecha_entrega_externo" tabindex="1" maxLength="11" class="fecha-pedido form-control" value="<?= old('fecha_entrega_externo', $pedidoEntity->fecha_entrega_externo) ?>" >
</div>
</div>
</div>
</div>
</div>
</div> <!--//accordionFechasTip-->
</div> <!--//card-->
</div>
</div> <!--//accordionFechasTip-->
</div> <!--//card-->
</div>
<?php if ($pedidoEntity->estado !== 'finalizado' && $pedidoEntity->estado !== 'cancelado'): ?>
<div class="col-12 d-flex flex-row-reverse mt-4 gap-2">
<div id="pedido_finalizado" class="buton-estado btn mt-3 btn-success waves-effect waves-light ml-2">
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang('Pedidos.finalizar') ?></span>
<i class="ti ti-hourglass-empty ti-xs"></i>
<?php if ($pedidoEntity->estado !== 'finalizado' && $pedidoEntity->estado !== 'cancelado'): ?>
<div class="col-12 d-flex flex-row-reverse mt-4 gap-2">
<div id="pedido_finalizado" class="buton-estado btn mt-3 btn-success waves-effect waves-light ml-2">
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang('Pedidos.finalizar') ?></span>
<i class="ti ti-hourglass-empty ti-xs"></i>
</div>
<div id="pedido_cancelado" class="buton-estado btn mt-3 btn-danger waves-effect waves-light ml-2">
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang('Pedidos.cancelar') ?></span>
<i class="ti ti-circle-x ti-xs"></i>
</div>
</div>
<div id="pedido_cancelado" class="buton-estado btn mt-3 btn-danger waves-effect waves-light ml-2">
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang('Pedidos.cancelar') ?></span>
<i class="ti ti-circle-x ti-xs"></i>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
</div>

View File

@ -17,7 +17,9 @@
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/vuexy/form/pedidos/_cabeceraItems") ?>
<?= view("themes/vuexy/form/pedidos/_lineasItems") ?>
<?= view("themes/vuexy/form/pedidos/_albaranesItems") ?>
<?php if (!(auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?>
<?= view("themes/vuexy/form/pedidos/_albaranesItems") ?>
<?php endif; ?>
<?= view("themes/vuexy/form/pedidos/_facturasItems") ?>
</div><!-- /.card-body -->
<div class="pt-4">

View File

@ -199,6 +199,7 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
data: function(d, settings){
d.estado= "<?= $estadoPedidos ?>";
d.showTotal= $('#showTotal').is(':checked')? "1":"0";
d.cliente_id = "<?= $cliente_id ?>";
},
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
@ -283,6 +284,14 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
});
}
if(<?= $cliente_id ?> != -1){
// Se oculta la columna de cliente (3)
theTable.column(3).visible(false);
}
else{
theTable.column(3).visible(true);
}
});

185
ci4/composer.lock generated
View File

@ -8,16 +8,16 @@
"packages": [
{
"name": "codeigniter4/framework",
"version": "v4.5.1",
"version": "v4.5.5",
"source": {
"type": "git",
"url": "https://github.com/codeigniter4/framework.git",
"reference": "9b2cd730db29d14ac6e760fb15c4bcac15184ec4"
"reference": "2849e7ff36b4c4aa1376d990a9a1e3f0c393b8d0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/codeigniter4/framework/zipball/9b2cd730db29d14ac6e760fb15c4bcac15184ec4",
"reference": "9b2cd730db29d14ac6e760fb15c4bcac15184ec4",
"url": "https://api.github.com/repos/codeigniter4/framework/zipball/2849e7ff36b4c4aa1376d990a9a1e3f0c393b8d0",
"reference": "2849e7ff36b4c4aa1376d990a9a1e3f0c393b8d0",
"shasum": ""
},
"require": {
@ -34,7 +34,7 @@
"kint-php/kint": "^5.0.4",
"mikey179/vfsstream": "^1.6",
"nexusphp/cs-config": "^3.6",
"phpunit/phpunit": "^10.5.16",
"phpunit/phpunit": "^10.5.16 || ^11.2",
"predis/predis": "^1.1 || ^2.0"
},
"suggest": {
@ -78,7 +78,7 @@
"slack": "https://codeigniterchat.slack.com",
"source": "https://github.com/codeigniter4/CodeIgniter4"
},
"time": "2024-04-14T04:18:29+00:00"
"time": "2024-09-07T08:49:38+00:00"
},
{
"name": "codeigniter4/settings",
@ -137,16 +137,16 @@
},
{
"name": "codeigniter4/shield",
"version": "v1.0.3",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/codeigniter4/shield.git",
"reference": "3fbac7a3da41ebaac7d51708244f68df596409f0"
"reference": "22a8b3b58dafa7a5c080bc61446653aeb9fffc06"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/codeigniter4/shield/zipball/3fbac7a3da41ebaac7d51708244f68df596409f0",
"reference": "3fbac7a3da41ebaac7d51708244f68df596409f0",
"url": "https://api.github.com/repos/codeigniter4/shield/zipball/22a8b3b58dafa7a5c080bc61446653aeb9fffc06",
"reference": "22a8b3b58dafa7a5c080bc61446653aeb9fffc06",
"shasum": ""
},
"require": {
@ -165,7 +165,8 @@
"mockery/mockery": "^1.0",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan-strict-rules": "^1.5",
"rector/rector": "1.0.4"
"phpunit/phpunit": "^9.6",
"rector/rector": "1.1.0"
},
"suggest": {
"ext-curl": "Required to use the password validation rule via PwnedValidator class.",
@ -206,7 +207,7 @@
"slack": "https://codeigniterchat.slack.com",
"source": "https://github.com/codeigniter4/shield"
},
"time": "2024-04-14T08:57:57+00:00"
"time": "2024-06-13T08:54:48+00:00"
},
{
"name": "dompdf/dompdf",
@ -660,16 +661,16 @@
},
{
"name": "phpseclib/phpseclib",
"version": "3.0.41",
"version": "3.0.42",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
"reference": "621c73f7dcb310b61de34d1da4c4204e8ace6ceb"
"reference": "db92f1b1987b12b13f248fe76c3a52cadb67bb98"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/621c73f7dcb310b61de34d1da4c4204e8ace6ceb",
"reference": "621c73f7dcb310b61de34d1da4c4204e8ace6ceb",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/db92f1b1987b12b13f248fe76c3a52cadb67bb98",
"reference": "db92f1b1987b12b13f248fe76c3a52cadb67bb98",
"shasum": ""
},
"require": {
@ -750,7 +751,7 @@
],
"support": {
"issues": "https://github.com/phpseclib/phpseclib/issues",
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.41"
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.42"
},
"funding": [
{
@ -766,20 +767,20 @@
"type": "tidelift"
}
],
"time": "2024-08-12T00:13:54+00:00"
"time": "2024-09-16T03:06:04+00:00"
},
{
"name": "psr/log",
"version": "3.0.0",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001"
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001",
"reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001",
"url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"shasum": ""
},
"require": {
@ -814,22 +815,22 @@
"psr-3"
],
"support": {
"source": "https://github.com/php-fig/log/tree/3.0.0"
"source": "https://github.com/php-fig/log/tree/3.0.2"
},
"time": "2021-07-14T16:46:02+00:00"
"time": "2024-09-11T13:17:53+00:00"
},
{
"name": "sabberworm/php-css-parser",
"version": "v8.5.1",
"version": "v8.6.0",
"source": {
"type": "git",
"url": "https://github.com/MyIntervals/PHP-CSS-Parser.git",
"reference": "4a3d572b0f8b28bb6fd016ae8bbfc445facef152"
"reference": "d2fb94a9641be84d79c7548c6d39bbebba6e9a70"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/4a3d572b0f8b28bb6fd016ae8bbfc445facef152",
"reference": "4a3d572b0f8b28bb6fd016ae8bbfc445facef152",
"url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/d2fb94a9641be84d79c7548c6d39bbebba6e9a70",
"reference": "d2fb94a9641be84d79c7548c6d39bbebba6e9a70",
"shasum": ""
},
"require": {
@ -879,9 +880,9 @@
],
"support": {
"issues": "https://github.com/MyIntervals/PHP-CSS-Parser/issues",
"source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.5.1"
"source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.6.0"
},
"time": "2024-02-15T16:41:13+00:00"
"time": "2024-07-01T07:33:21+00:00"
}
],
"packages-dev": [
@ -1020,23 +1021,24 @@
},
{
"name": "mikey179/vfsstream",
"version": "v1.6.11",
"version": "v1.6.12",
"source": {
"type": "git",
"url": "https://github.com/bovigo/vfsStream.git",
"reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f"
"reference": "fe695ec993e0a55c3abdda10a9364eb31c6f1bf0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bovigo/vfsStream/zipball/17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f",
"reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f",
"url": "https://api.github.com/repos/bovigo/vfsStream/zipball/fe695ec993e0a55c3abdda10a9364eb31c6f1bf0",
"reference": "fe695ec993e0a55c3abdda10a9364eb31c6f1bf0",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"php": ">=7.1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.5|^5.0"
"phpunit/phpunit": "^7.5||^8.5||^9.6",
"yoast/phpunit-polyfills": "^2.0"
},
"type": "library",
"extra": {
@ -1067,20 +1069,20 @@
"source": "https://github.com/bovigo/vfsStream/tree/master",
"wiki": "https://github.com/bovigo/vfsStream/wiki"
},
"time": "2022-02-23T02:02:42+00:00"
"time": "2024-08-29T18:43:31+00:00"
},
{
"name": "myclabs/deep-copy",
"version": "1.11.1",
"version": "1.12.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c"
"reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
"reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c",
"reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c",
"shasum": ""
},
"require": {
@ -1088,11 +1090,12 @@
},
"conflict": {
"doctrine/collections": "<1.6.8",
"doctrine/common": "<2.13.3 || >=3,<3.2.2"
"doctrine/common": "<2.13.3 || >=3 <3.2.2"
},
"require-dev": {
"doctrine/collections": "^1.6.8",
"doctrine/common": "^2.13.3 || ^3.2.2",
"phpspec/prophecy": "^1.10",
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
},
"type": "library",
@ -1118,7 +1121,7 @@
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.11.1"
"source": "https://github.com/myclabs/DeepCopy/tree/1.12.0"
},
"funding": [
{
@ -1126,20 +1129,20 @@
"type": "tidelift"
}
],
"time": "2023-03-08T13:26:56+00:00"
"time": "2024-06-12T14:39:25+00:00"
},
{
"name": "nikic/php-parser",
"version": "v5.0.2",
"version": "v5.2.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13"
"reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13",
"reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb",
"reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb",
"shasum": ""
},
"require": {
@ -1150,7 +1153,7 @@
},
"require-dev": {
"ircmaxell/php-yacc": "^0.0.7",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
"phpunit/phpunit": "^9.0"
},
"bin": [
"bin/php-parse"
@ -1182,9 +1185,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2"
"source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0"
},
"time": "2024-03-05T20:51:40+00:00"
"time": "2024-09-15T16:40:33+00:00"
},
{
"name": "phar-io/manifest",
@ -1306,35 +1309,35 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.31",
"version": "9.2.32",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "48c34b5d8d983006bd2adc2d0de92963b9155965"
"reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965",
"reference": "48c34b5d8d983006bd2adc2d0de92963b9155965",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5",
"reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"ext-xmlwriter": "*",
"nikic/php-parser": "^4.18 || ^5.0",
"nikic/php-parser": "^4.19.1 || ^5.1.0",
"php": ">=7.3",
"phpunit/php-file-iterator": "^3.0.3",
"phpunit/php-text-template": "^2.0.2",
"sebastian/code-unit-reverse-lookup": "^2.0.2",
"sebastian/complexity": "^2.0",
"sebastian/environment": "^5.1.2",
"sebastian/lines-of-code": "^1.0.3",
"sebastian/version": "^3.0.1",
"theseer/tokenizer": "^1.2.0"
"phpunit/php-file-iterator": "^3.0.6",
"phpunit/php-text-template": "^2.0.4",
"sebastian/code-unit-reverse-lookup": "^2.0.3",
"sebastian/complexity": "^2.0.3",
"sebastian/environment": "^5.1.5",
"sebastian/lines-of-code": "^1.0.4",
"sebastian/version": "^3.0.2",
"theseer/tokenizer": "^1.2.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
"phpunit/phpunit": "^9.6"
},
"suggest": {
"ext-pcov": "PHP extension that provides line coverage",
@ -1343,7 +1346,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "9.2-dev"
"dev-main": "9.2.x-dev"
}
},
"autoload": {
@ -1372,7 +1375,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32"
},
"funding": [
{
@ -1380,7 +1383,7 @@
"type": "github"
}
],
"time": "2024-03-02T06:37:42+00:00"
"time": "2024-08-22T04:23:01+00:00"
},
{
"name": "phpunit/php-file-iterator",
@ -1625,45 +1628,45 @@
},
{
"name": "phpunit/phpunit",
"version": "9.6.19",
"version": "9.6.20",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "a1a54a473501ef4cdeaae4e06891674114d79db8"
"reference": "49d7820565836236411f5dc002d16dd689cde42f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8",
"reference": "a1a54a473501ef4cdeaae4e06891674114d79db8",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/49d7820565836236411f5dc002d16dd689cde42f",
"reference": "49d7820565836236411f5dc002d16dd689cde42f",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.3.1 || ^2",
"doctrine/instantiator": "^1.5.0 || ^2",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xml": "*",
"ext-xmlwriter": "*",
"myclabs/deep-copy": "^1.10.1",
"phar-io/manifest": "^2.0.3",
"phar-io/version": "^3.0.2",
"myclabs/deep-copy": "^1.12.0",
"phar-io/manifest": "^2.0.4",
"phar-io/version": "^3.2.1",
"php": ">=7.3",
"phpunit/php-code-coverage": "^9.2.28",
"phpunit/php-file-iterator": "^3.0.5",
"phpunit/php-code-coverage": "^9.2.31",
"phpunit/php-file-iterator": "^3.0.6",
"phpunit/php-invoker": "^3.1.1",
"phpunit/php-text-template": "^2.0.3",
"phpunit/php-timer": "^5.0.2",
"sebastian/cli-parser": "^1.0.1",
"sebastian/code-unit": "^1.0.6",
"phpunit/php-text-template": "^2.0.4",
"phpunit/php-timer": "^5.0.3",
"sebastian/cli-parser": "^1.0.2",
"sebastian/code-unit": "^1.0.8",
"sebastian/comparator": "^4.0.8",
"sebastian/diff": "^4.0.3",
"sebastian/environment": "^5.1.3",
"sebastian/exporter": "^4.0.5",
"sebastian/global-state": "^5.0.1",
"sebastian/object-enumerator": "^4.0.3",
"sebastian/resource-operations": "^3.0.3",
"sebastian/type": "^3.2",
"sebastian/diff": "^4.0.6",
"sebastian/environment": "^5.1.5",
"sebastian/exporter": "^4.0.6",
"sebastian/global-state": "^5.0.7",
"sebastian/object-enumerator": "^4.0.4",
"sebastian/resource-operations": "^3.0.4",
"sebastian/type": "^3.2.1",
"sebastian/version": "^3.0.2"
},
"suggest": {
@ -1708,7 +1711,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.20"
},
"funding": [
{
@ -1724,7 +1727,7 @@
"type": "tidelift"
}
],
"time": "2024-04-05T04:35:58+00:00"
"time": "2024-07-10T11:45:39+00:00"
},
{
"name": "psr/container",