mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
customizada vista de peiddos y facturas cliente
This commit is contained in:
@ -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);
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)) {
|
||||
|
||||
@ -139,6 +139,7 @@ class BuscadorModel extends \App\Models\BaseModel
|
||||
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
|
||||
|
||||
if (empty($search))
|
||||
return $builder;
|
||||
else {
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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( {
|
||||
|
||||
@ -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') ?>';
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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">
|
||||
|
||||
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user