mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'add/calculo_credito_cliente' into 'main'
Add/calculo credito cliente See merge request jjimenez/safekat!620
This commit is contained in:
@ -21,6 +21,8 @@ const SK_PERMISSION_MATRIX = [
|
||||
"presupuesto-cliente.edit",
|
||||
"presupuesto-cliente.delete",
|
||||
"presupuesto-cliente.menu",
|
||||
"pedidos-validacion.view",
|
||||
"pedidos-validacion.menu",
|
||||
"pedidos-activos.view",
|
||||
"pedidos-activos.menu",
|
||||
"pedidos-finalizados.view",
|
||||
|
||||
@ -21,6 +21,8 @@ const SK_PERMISSIONS = [
|
||||
'presupuesto-cliente.edit' => 'Can edit',
|
||||
'presupuesto-cliente.delete' => 'Can delete',
|
||||
'presupuesto-cliente.menu' => 'Menu shall be visualize',
|
||||
'pedidos-validacion.view' => 'Can view',
|
||||
'pedidos-validacion.menu' => 'Menu shall be visualize',
|
||||
'pedidos-activos.view' => 'Can view',
|
||||
'pedidos-activos.menu' => 'Menu shall be visualize',
|
||||
'pedidos-finalizados.view' => 'Can view',
|
||||
|
||||
@ -743,8 +743,8 @@ $routes->group('presupuestotiradasalternativas', ['namespace' => 'App\Controller
|
||||
});
|
||||
|
||||
$routes->group('pedidos', ['namespace' => 'App\Controllers\Pedidos'], function ($routes) {
|
||||
$routes->get('list', 'Pedido::todos', ['as' => 'listaPresupuestos']);
|
||||
$routes->get('listActivos', 'Pedido::activos', ['as' => 'listaPresupuestosActivos']);
|
||||
$routes->get('list', 'Pedido::todos', ['as' => 'listaPedidos']);
|
||||
$routes->get('listActivos', 'Pedido::activos', ['as' => 'listaPedidosActivos']);
|
||||
$routes->get('listFinalizados', 'Pedido::finalizados', ['as' => 'listaFinalizados']);
|
||||
$routes->get('listCancelados', 'Pedido::cancelados', ['as' => 'listaCancelados']);
|
||||
$routes->post('datatable', 'Pedido::datatable', ['as' => 'dataTableOfPedidos']);
|
||||
|
||||
@ -68,7 +68,7 @@ class Pedido extends \App\Controllers\BaseResourceController
|
||||
'pedidoEntity' => new PedidoEntity(),
|
||||
'usingServerSideDataTable' => true,
|
||||
'pageTitle' => lang('Pedidos.Pedidos'),
|
||||
'estadoPedidos' => 'activo',
|
||||
'estadoPedidos' => 'produccion',
|
||||
['title' => lang("App.menu_pedidos"), 'route' => site_url('pedidos/todos'), 'active' => true]
|
||||
];
|
||||
|
||||
@ -112,6 +112,32 @@ class Pedido extends \App\Controllers\BaseResourceController
|
||||
return view(static::$viewPath . 'viewPedidosList', $viewData);
|
||||
}
|
||||
|
||||
public function validacion()
|
||||
{
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Pedidos.pedido')]),
|
||||
'pedidoEntity' => new PedidoEntity(),
|
||||
'usingServerSideDataTable' => true,
|
||||
'pageTitle' => lang('Pedidos.Pedidos'),
|
||||
'estadoPedidos' => 'validacion',
|
||||
['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);
|
||||
}
|
||||
|
||||
public function cancelados()
|
||||
{
|
||||
$viewData = [
|
||||
@ -284,6 +310,12 @@ class Pedido extends \App\Controllers\BaseResourceController
|
||||
$this->viewData['importePendiente'] = $pendiente;
|
||||
}
|
||||
|
||||
$modelOrden = new \App\Models\OrdenTrabajo\OrdenTrabajoModel();
|
||||
$orden = $modelOrden->where('pedido_id', $pedidoEntity->id)->first();
|
||||
if($orden){
|
||||
$this->viewData['orden_id'] = $orden->id;
|
||||
}
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Pedidos.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
@ -317,23 +349,22 @@ class Pedido extends \App\Controllers\BaseResourceController
|
||||
$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);
|
||||
$extra_data['total_tirada'] = $totalTirada;
|
||||
$extra_data['total'] = $total;
|
||||
$total2 = 0;
|
||||
if($showTotal){
|
||||
$total2 = $model_linea->getTotalOfTotalAceptado();
|
||||
$total2 = $model_linea->getTotalOfTotalAceptado($estado);
|
||||
$tirada2 = $model_linea->getTotalTirada($estado);
|
||||
$extra_data['total2'] = $total2;
|
||||
$extra_data['total_tirada2'] = $tirada2;
|
||||
}
|
||||
|
||||
if($total2 != 0){
|
||||
$total = "" . $total . " \n(" . $total2 . ")";
|
||||
}
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$model_linea->getResource("", $estado)->countAllResults(),
|
||||
$model_linea->getResource($searchValues, $estado)->countAllResults(),
|
||||
"",
|
||||
[
|
||||
'total_tirada' => $totalTirada,
|
||||
'total' => $total
|
||||
]
|
||||
$extra_data
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
|
||||
@ -401,6 +401,17 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
|
||||
$this->viewData['cliente_id'] = $presupuestoEntity->cliente_id;
|
||||
|
||||
$modelPedidoLinea = new \App\Models\Pedidos\PedidoLineaModel();
|
||||
$linea = $modelPedidoLinea->where('presupuesto_id', $id)->first();
|
||||
if($linea){
|
||||
$this->viewData['pedido_id'] = $linea->pedido_id;
|
||||
$modelOrden = new \App\Models\OrdenTrabajo\OrdenTrabajoModel();
|
||||
$orden = $modelOrden->where('pedido_id', $linea->pedido_id)->first();
|
||||
if($orden){
|
||||
$this->viewData['orden_id'] = $orden->id;
|
||||
}
|
||||
}
|
||||
|
||||
// Si se ha llamado a esta funcion porque se ha duplicado el presupuesto
|
||||
// se actualiza la bbdd para que sólo ejecute algunas funciones una vez
|
||||
if ($presupuestoEntity->is_duplicado) {
|
||||
|
||||
@ -153,7 +153,7 @@ class Ordentrabajo extends BaseController
|
||||
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||
->edit(
|
||||
"fecha_encuadernado_at",
|
||||
fn($q) => Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y")
|
||||
fn($q) => $q->fecha_encuadernado_at? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y"):""
|
||||
)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
@ -168,7 +168,7 @@ class Ordentrabajo extends BaseController
|
||||
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||
->edit(
|
||||
"fecha_encuadernado_at",
|
||||
fn($q) => Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y")
|
||||
fn($q) => $q->fecha_encuadernado_at?Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y"):""
|
||||
)
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
|
||||
@ -749,7 +749,8 @@ return [
|
||||
"menu_informes" => "Informes",
|
||||
|
||||
"menu_pedidos" => "Pedidos",
|
||||
"menu_pedidos_activos" => "Activos",
|
||||
"menu_pedidos_validacion" => "Validación",
|
||||
"menu_pedidos_activos" => "Producción",
|
||||
"menu_pedidos_finalizados" => "Finalizados",
|
||||
"menu_pedidos_cancelados" => "Cancelados",
|
||||
"menu_pedidos_todos" => "Todos",
|
||||
|
||||
@ -33,7 +33,8 @@ return [
|
||||
'direccionesSection' => 'Direcciones',
|
||||
'presupuestoSection' => 'Presupuestos',
|
||||
'presupuestoClienteSection' => 'Presupuestos de Cliente',
|
||||
'pedidosActivosSection' => 'Activos',
|
||||
'pedidosValidacionSection' => 'Validación',
|
||||
'pedidosActivosSection' => 'Producción',
|
||||
'pedidosFinalizadosSection' => 'Finalizados',
|
||||
'pedidosCanceladosSection' => 'Cancelados',
|
||||
'pedidosTodosSection' => 'Todos',
|
||||
|
||||
@ -61,9 +61,9 @@ class OrdenTrabajoDate extends Model
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = [];
|
||||
protected $afterInsert = ["updateOrdenTrabajoUser"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = [];
|
||||
protected $afterUpdate = ["updateOrdenTrabajoUser"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
|
||||
@ -75,7 +75,7 @@ class PedidoLineaModel extends \App\Models\BaseModel
|
||||
}
|
||||
}
|
||||
|
||||
if($cliente_id != -1) {
|
||||
if($cliente_id != -1 && $cliente_id != "-1") {
|
||||
$builder->where("t3.cliente_id", $cliente_id);
|
||||
}
|
||||
|
||||
@ -106,9 +106,11 @@ 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");
|
||||
$builder->join("clientes t4", "t4.id = t3.cliente_id", "left");
|
||||
$builder->join("users t5", "t5.id = t4.comercial_id", "left");
|
||||
$builder->join("ubicaciones t6", "t6.id = t1.ubicacion_id", "left");
|
||||
|
||||
|
||||
if($cliente_id != -1) {
|
||||
if($cliente_id != -1 && $cliente_id != "-1") {
|
||||
$builder->where("t3.cliente_id", $cliente_id);
|
||||
}
|
||||
|
||||
@ -128,7 +130,7 @@ class PedidoLineaModel extends \App\Models\BaseModel
|
||||
}
|
||||
|
||||
if ($estado !== '') {
|
||||
$builder->where('estado', $estado);
|
||||
$builder->where('t2.estado', $estado);
|
||||
}
|
||||
|
||||
// Aplicar el orden y el límite
|
||||
@ -146,8 +148,11 @@ 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");
|
||||
$builder->join("clientes t4", "t4.id = t3.cliente_id", "left");
|
||||
$builder->join("users t5", "t5.id = t4.comercial_id", "left");
|
||||
$builder->join("ubicaciones t6", "t6.id = t1.ubicacion_id", "left");
|
||||
|
||||
if($cliente_id != -1) {
|
||||
if($cliente_id != -1 && $cliente_id != "-1") {
|
||||
$builder->where("t3.cliente_id", $cliente_id);
|
||||
}
|
||||
|
||||
@ -167,7 +172,7 @@ class PedidoLineaModel extends \App\Models\BaseModel
|
||||
}
|
||||
|
||||
if ($estado !== '') {
|
||||
$builder->where('estado', $estado);
|
||||
$builder->where('t2.estado', $estado);
|
||||
}
|
||||
|
||||
// Aplicar el orden y el límite
|
||||
@ -177,7 +182,7 @@ class PedidoLineaModel extends \App\Models\BaseModel
|
||||
return $builder->get()->getRow()->total;
|
||||
}
|
||||
|
||||
public function getTotalOfTotalAceptado()
|
||||
public function getTotalOfTotalAceptado($estado = "")
|
||||
{
|
||||
|
||||
$builder = $this->db
|
||||
@ -187,10 +192,30 @@ 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 ($estado !== '') {
|
||||
$builder->where('t2.estado', $estado);
|
||||
}
|
||||
|
||||
return $builder->get()->getRow()->total;
|
||||
}
|
||||
|
||||
public function getTotalTirada($estado = "")
|
||||
{
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->selectSum('t3.tirada', 'total_tirada');
|
||||
|
||||
$builder->join("pedidos t2", "t2.id = t1.pedido_id", "left");
|
||||
$builder->join("presupuestos t3", "t1.presupuesto_id = t3.id", "left");
|
||||
|
||||
if ($estado !== '') {
|
||||
$builder->where('t2.estado', $estado);
|
||||
}
|
||||
|
||||
return $builder->get()->getRow()->total_tirada;
|
||||
}
|
||||
|
||||
public function obtenerLineasPedidoSinFacturar($cliente_id) {
|
||||
$resultaArray = [];
|
||||
|
||||
|
||||
@ -193,7 +193,7 @@ class PresupuestoAcabadosModel extends \App\Models\BaseModel
|
||||
->table($this->table . " t1")
|
||||
->set('presupuesto_id', $presupuesto_id)
|
||||
->set('tarifa_acabado_id', $tarifa->tarifa_id)
|
||||
->set('proveedor_id', $proveedor, false)
|
||||
->set('proveedor_id', $proveedor)
|
||||
->set('precio_unidad', $tarifa->precio_unidad)
|
||||
->set('precio_total', $tarifa->precio_total)
|
||||
->set('margen', $tarifa->margen)
|
||||
|
||||
@ -9,7 +9,7 @@ use CodeIgniter\Model;
|
||||
|
||||
class TarifaExtraMaquinaModel extends Model
|
||||
{
|
||||
protected $table = 'tarifa_acabado_maquinas';
|
||||
protected $table = 'tarifa_extra_maquinas';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = TarifaExtraMaquinaEntity::class;
|
||||
|
||||
@ -17,12 +17,12 @@ use App\Models\Configuracion\ConfigVariableModel;
|
||||
use App\Models\Presupuestos\PresupuestoModel;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
use CodeIgniter\Email\Email;
|
||||
use App\Services\EmailService;
|
||||
|
||||
class ChatService extends BaseService
|
||||
{
|
||||
protected ?ChatEntity $chatEntity;
|
||||
protected Email $emailService;
|
||||
protected EmailService $emailService;
|
||||
protected UserModel $userModel;
|
||||
protected ChatModel $chatModel;
|
||||
protected ChatMessageModel $chatMessageModel;
|
||||
|
||||
@ -253,7 +253,8 @@ class PresupuestoService extends BaseService
|
||||
$linea['fields']['precio_libro'] = $linea['fields']['pliegos_libro'] * $linea['fields']['precios_pliegos'];
|
||||
// Precio papel pedido
|
||||
$linea['fields']['precio_pedido'] = $linea['fields']['precio_libro'] * ($datosPedido->tirada + $datosPedido->merma);
|
||||
$linea['fields']['margen_papel_pedido'] = $linea['fields']['pliegos_libro'] * $margen_pliego_impresion * ($datosPedido->tirada + $datosPedido->merma);;
|
||||
$linea['fields']['margen_papel_pedido'] = $linea['fields']['pliegos_libro'] * $margen_pliego_impresion * ($datosPedido->tirada + $datosPedido->merma);
|
||||
;
|
||||
|
||||
$linea['fields']['a_favor_fibra'] = $parametrosRotativa->a_favor_fibra;
|
||||
$linea['fields']['maquina'] = $maquina->maquina;
|
||||
@ -890,17 +891,16 @@ class PresupuestoService extends BaseService
|
||||
if ($lomoRedondo) {
|
||||
$ancho_total += 6;
|
||||
}
|
||||
}
|
||||
else if ($uso == 'faja' || $uso == 'sobrecubierta') {
|
||||
} else if ($uso == 'faja' || $uso == 'sobrecubierta') {
|
||||
if ($datosPedido->solapas) {
|
||||
// 7 es el vuelo de la tapa dura sobre el interior
|
||||
$ancho_total += (floatval($datosPedido->solapas_ancho) * 2) + (2 * self::SANGRE_FORMAS) + 2*7;
|
||||
$ancho_total += (floatval($datosPedido->solapas_ancho) * 2) + (2 * self::SANGRE_FORMAS) + 2 * 7;
|
||||
}
|
||||
}
|
||||
|
||||
// si es sobrecubierta
|
||||
// Se añaden 5mm de sangre por cada lado + 2 * 7mm de vuelo portada y contraportada -> total 52
|
||||
else{
|
||||
else {
|
||||
$ancho_total += (2 * 7 + 2 * self::SANGRE_FORMAS);
|
||||
}
|
||||
}
|
||||
@ -1897,8 +1897,17 @@ class PresupuestoService extends BaseService
|
||||
}
|
||||
|
||||
if ($id_linea != 0 && $pedido_id != 0) {
|
||||
if($data_pedido['estado'] == "produccion"){
|
||||
$response = (new Pedido())->to_produccion($pedido_id);
|
||||
if ($data_pedido['estado'] == "produccion") {
|
||||
|
||||
$serviceProduction = service('production');
|
||||
$modelPedido = model('App\Models\Pedidos\PedidoModel');
|
||||
$pedido = $modelPedido->find($pedido_id);
|
||||
$serviceProduction->setPedido($pedido);
|
||||
if (!$pedido->orden_trabajo()) {
|
||||
|
||||
$r = $serviceProduction->createOrdenTrabajo();
|
||||
$modelPedido->set(['estado' => 'produccion'])->where('id', $pedido_id)->update();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -13,9 +13,20 @@
|
||||
<!--//.card-header -->
|
||||
<form id="pedidoForm" method="post" class="card-body" action="<?= $formAction ?>">
|
||||
<?= csrf_field() ?>
|
||||
<div class="card-body">
|
||||
<div class="card-body pt-0">
|
||||
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
|
||||
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
||||
<?php if (isset($orden_id)): ?>
|
||||
<div class="row mt-1 justify-content-end">
|
||||
<div class="col-auto">
|
||||
<div class="btn mt-3 btn-warning waves-effect waves-light ml-2"
|
||||
onclick="window.location.href='<?= route_to("viewOrdenTrabajoEdit", $orden_id) ?>'" >
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Orden</span>
|
||||
<i class="ti ti-building-factory-2 ti-xs"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?= view("themes/vuexy/form/pedidos/_cabeceraItems") ?>
|
||||
<?= view("themes/vuexy/form/pedidos/_lineasItems") ?>
|
||||
<?php if (!(auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?>
|
||||
@ -29,7 +40,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12 d-flex justify-content-between">
|
||||
<div class="pt-4">
|
||||
<?= anchor(route_to("listaPresupuestos"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
|
||||
<?= anchor(route_to("listaPedidos"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
|
||||
</div><!-- /.card-footer -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -72,10 +72,10 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
||||
var title = $(this).text();
|
||||
if($(this).hasClass("totalizador")){
|
||||
if(i==9){
|
||||
$(this).html('<span id="total_tirada" class="autonumeric"></span>');
|
||||
$(this).html('<span id="total_tirada" class="autonumeric-int"></span><br><span id="total_tirada_2" class="mostrar-totales autonumeric-int d-none"></span>');
|
||||
}
|
||||
else if(i==10){
|
||||
$(this).html('<span id="total_aceptado" class="autonumeric"></span>');
|
||||
$(this).html('<span id="total_aceptado" class="autonumeric"></span>€<br><span id="total_aceptado_2" class="mostrar-totales autonumeric d-none"></span><span class="mostrar-totales d-none">€</span>');
|
||||
}
|
||||
}
|
||||
else{
|
||||
@ -125,7 +125,9 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
||||
|
||||
}
|
||||
else if (i == 11) {
|
||||
// Agregar un selector en la tercera columna
|
||||
|
||||
if("<?= $estadoPedidos ?>" == "" || "<?= $estadoPedidos ?>" == "todos"){
|
||||
|
||||
$(this).html('<select class="form-control" style="min-width:100px;max-width:120px;font-size:0.8rem !important;"></select>');
|
||||
|
||||
// Agregar opciones al selector
|
||||
@ -145,6 +147,10 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
||||
theTable.column(i).search(val).draw();
|
||||
});
|
||||
}
|
||||
else{
|
||||
$(this).html('<span></span>');
|
||||
}
|
||||
}
|
||||
else{
|
||||
$(this).html('<input type="text" class="form-control " style="min-width:100px;max-width:120px;font-size:0.8rem !important;" />');
|
||||
|
||||
@ -189,7 +195,7 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
||||
}
|
||||
],
|
||||
stateSave: false,
|
||||
order: [[0, 'asc']],
|
||||
order: [[0, 'desc']],
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
@ -256,17 +262,21 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
||||
{ 'data': actionBtns }
|
||||
],
|
||||
drawCallback: function (settings) {
|
||||
$('#total_tirada').text(settings.json.extra.total_tirada);
|
||||
$('#total_aceptado').text(settings.json.extra.total);
|
||||
}
|
||||
});
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
var api = this.api();
|
||||
|
||||
$('#total_tirada').text(settings.json.extra.total_tirada??0);
|
||||
$('#total_tirada_2').text(settings.json.extra.total_tirada2??0);
|
||||
$('#total_aceptado').text(settings.json.extra.total??0);
|
||||
$('#total_aceptado_2').text(settings.json.extra.total2??0);
|
||||
AutoNumeric.multiple('.autonumeric', { decimalPlaces: 2 });
|
||||
AutoNumeric.multiple('.autonumeric-int', { decimalPlaces: 0 });
|
||||
|
||||
const dateCols = [1,2];
|
||||
const priceCols = [10];
|
||||
|
||||
for (let coln of dateCols) {
|
||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
api.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
const datestr = cell.innerHTML;
|
||||
const dateStrLen = datestr.toString().trim().length;
|
||||
if (dateStrLen > 0) {
|
||||
@ -277,19 +287,30 @@ $('#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);
|
||||
api.column(3).visible(false);
|
||||
}
|
||||
else{
|
||||
theTable.column(3).visible(true);
|
||||
api.column(3).visible(true);
|
||||
}
|
||||
},
|
||||
"rowCallback": function(row, data, index) {
|
||||
if('<?= $estadoPedidos ?>' == 'todos'){
|
||||
if (data['estado'] === "cancelado") {
|
||||
$(row).css('background-color', '#ffcccc'); // Rojo claro
|
||||
} else if (data['estado'] === "validacion") {
|
||||
$(row).css('background-color', '#fff5cc'); // Amarillo claro
|
||||
} else if (data['estado'] === "finalizado") {
|
||||
$(row).css('background-color', '#ccffcc'); // Verde claro
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).on('click', '.btn-edit', function(e) {
|
||||
var url = '<?= route_to('editarPedido', ':id') ?>';
|
||||
url = url.replace(':id', `${$(this).attr('data-id')}` );
|
||||
@ -301,6 +322,12 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) {
|
||||
});
|
||||
|
||||
$('#showTotal').on('change', function() {
|
||||
if($('#showTotal').is(':checked')){
|
||||
$('.mostrar-totales').removeClass('d-none');
|
||||
}
|
||||
else{
|
||||
$('.mostrar-totales').addClass('d-none');
|
||||
}
|
||||
theTable.clearPipeline();
|
||||
theTable.ajax.reload(null, false);
|
||||
//theTable.draw();
|
||||
|
||||
@ -31,6 +31,28 @@
|
||||
<input type="hidden" name="POD" id="POD" class="form-control"
|
||||
value="<?= $POD ?>"></input>
|
||||
|
||||
<?php if (isset($orden__id) || isset($pedido_id)): ?>
|
||||
<div class="row mt-1 justify-content-end">
|
||||
<?php if (isset($pedido_id)): ?>
|
||||
<div class="col-auto">
|
||||
<div class="btn mt-3 btn-warning waves-effect waves-light ml-2"
|
||||
onclick="window.location.href='<?= route_to("editarPedido", $pedido_id) ?>'" >
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1"><?= lang('Pedidos.pedido') ?></span>
|
||||
<i class="ti ti-file-description ti-xs"></i>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($orden_id)): ?>
|
||||
<div class="col-auto">
|
||||
<div class="btn mt-3 btn-warning waves-effect waves-light ml-2"
|
||||
onclick="window.location.href='<?= route_to("viewOrdenTrabajoEdit", $orden_id) ?>'" >
|
||||
<span class="align-middle d-sm-inline-block d-none me-sm-1">Orden</span>
|
||||
<i class="ti ti-building-factory-2 ti-xs"></i>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?= view("themes/vuexy/form/presupuestos/admin/_datosPresupuestoItems") ?>
|
||||
<?= view("themes/vuexy/form/presupuestos/admin/_datosLibroItems") ?>
|
||||
<?php if (str_contains($formAction, 'edit')): ?>
|
||||
|
||||
@ -292,73 +292,76 @@ id = -1;
|
||||
|
||||
<?php if (str_contains($formAction, 'edit')): ?>
|
||||
|
||||
<!------------------------------------------->
|
||||
<!-- Código JS para tableOfTarifaencuadernacionlineashoras -->
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
<!------------------------------------------->
|
||||
<!-- Código JS para tableOfTarifaencuadernacionlineashoras -->
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
const lastColNr3 = $('#tableOfTarifaencuadernacionlineasHoras').find("tr:first th").length - 1;
|
||||
const lastColNr3 = $('#tableOfTarifaencuadernacionlineasHoras').find("tr:first th").length - 1;
|
||||
|
||||
var editor3 = new $.fn.dataTable.Editor( {
|
||||
var editor3 = new $.fn.dataTable.Editor({
|
||||
ajax: {
|
||||
url: "<?= route_to('editorOfTarifaEncuadernacionLineasHoras') ?>",
|
||||
headers: {
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?> v,
|
||||
},
|
||||
},
|
||||
table : "#tableOfTarifaencuadernacionlineasHoras",
|
||||
idSrc: 'id',
|
||||
fields: [
|
||||
{name: "id",
|
||||
"type": "readonly"},
|
||||
{
|
||||
name: "id",
|
||||
"type": "readonly"
|
||||
},
|
||||
{
|
||||
name: "tiempo_min",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "tiempo_min",
|
||||
class :"autonumeric"
|
||||
name: "tiempo_min",
|
||||
class: "autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "tiempo_max",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "tiempo_max",
|
||||
class :"autonumeric"
|
||||
name: "tiempo_max",
|
||||
class: "autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "precio_hora",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "precio_hora",
|
||||
class :"autonumeric"
|
||||
name: "precio_hora",
|
||||
class: "autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "total_min",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "total_min",
|
||||
class :"autonumeric"
|
||||
name: "total_min",
|
||||
class: "autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "margen",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "margen",
|
||||
class :"autonumeric"
|
||||
name: "margen",
|
||||
class: "autonumeric"
|
||||
}
|
||||
}, {
|
||||
"name": "tirada_encuadernacion_id",
|
||||
"type": "hidden"
|
||||
},{
|
||||
}, {
|
||||
"name": "deleted_at",
|
||||
"type": "hidden"
|
||||
},{
|
||||
}, {
|
||||
"name": "is_deleted",
|
||||
"type": "hidden"
|
||||
},
|
||||
]
|
||||
} );
|
||||
editor3.on('open', (event) => {
|
||||
});
|
||||
|
||||
editor3.on('open', (event) => {
|
||||
$("input.autonumeric").each(function () {
|
||||
let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
|
||||
if (autoNumericInstance) {
|
||||
@ -368,13 +371,14 @@ id = -1;
|
||||
new AutoNumeric(this, {
|
||||
decimalCharacter: ",",
|
||||
digitGroupSeparator: ".",
|
||||
allowDecimalPadding : 'floats',
|
||||
allowDecimalPadding: 'floats',
|
||||
decimalPlaces: 2,
|
||||
unformatOnSubmit: true,
|
||||
});
|
||||
})
|
||||
})
|
||||
editor3.on('preSubmit', (e, d, type) => {
|
||||
})
|
||||
|
||||
editor3.on('preSubmit', (e, d, type) => {
|
||||
if (d.data) {
|
||||
Object.keys(d.data).forEach(function (key) {
|
||||
// Find all elements with class .autonumeric
|
||||
@ -388,62 +392,63 @@ id = -1;
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
editor3.on( 'preSubmit', function ( e, d, type ) {
|
||||
if ( type === 'create'){
|
||||
})
|
||||
|
||||
editor3.on('preSubmit', function (e, d, type) {
|
||||
if (type === 'create') {
|
||||
d.data[0]['tirada_encuadernacion_id'] = selected_tirada_id;
|
||||
}
|
||||
else if(type === 'edit' ) {
|
||||
for (v in d.data){
|
||||
else if (type === 'edit') {
|
||||
for (v in d.data) {
|
||||
d.data[v]['tirada_encuadernacion_id'] = selected_tirada_id;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
editor3.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
editor3.on('postSubmit', function (e, json, data, action) {
|
||||
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
editor3.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||
editor3.on('submitSuccess', function (e, json, data, action) {
|
||||
|
||||
theTable3.clearPipeline();
|
||||
theTable3.draw();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var theTable3 = $('#tableOfTarifaencuadernacionlineasHoras').DataTable( {
|
||||
draw:3,
|
||||
var theTable3 = $('#tableOfTarifaencuadernacionlineasHoras').DataTable({
|
||||
draw: 3,
|
||||
serverSide: true,
|
||||
processing: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
lengthMenu: [ 5, 10, 25],
|
||||
order: [[ 0, "asc" ], [ 1, "asc" ]],
|
||||
lengthMenu: [5, 10, 25],
|
||||
order: [[0, "asc"], [1, "asc"]],
|
||||
pageLength: 10,
|
||||
lengthChange: true,
|
||||
searching: false,
|
||||
paging: true,
|
||||
info: false,
|
||||
dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
ajax: $.fn.dataTable.pipeline({
|
||||
url: '<?= route_to('dataTableOfTarifaEncuadernacionLineasHoras') ?>',
|
||||
data: function ( d ) {
|
||||
data: function (d) {
|
||||
d.tirada_id = selected_tirada_id;
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
headers: { 'X-Requested-With': 'XMLHttpRequest' },
|
||||
async: true,
|
||||
}),
|
||||
columns: [
|
||||
{ 'data': 'id' },
|
||||
{ 'data': 'tiempo_min',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'tiempo_max',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'precio_hora',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'total_min',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'margen',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'tiempo_min', render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'tiempo_max', render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'precio_hora', render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'total_min', render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'margen', render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{
|
||||
data: actionBtns,
|
||||
className: 'row-edit dt-center'
|
||||
@ -455,7 +460,7 @@ id = -1;
|
||||
searchable: false,
|
||||
targets: [lastColNr3]
|
||||
},
|
||||
{"orderData": [ 0, 1 ], "targets": 0 },
|
||||
{ "orderData": [0, 1], "targets": 0 },
|
||||
|
||||
],
|
||||
language: {
|
||||
@ -465,7 +470,7 @@ id = -1;
|
||||
{
|
||||
extend: 'collection',
|
||||
text: 'Exportar',
|
||||
buttons:[
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'print', {
|
||||
extend: 'pdfHtml5',
|
||||
orientation: 'landscape',
|
||||
@ -482,12 +487,12 @@ id = -1;
|
||||
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
|
||||
|
||||
},
|
||||
action: function ( e, dt, node, config ) {
|
||||
if(selected_tirada_id == -1){
|
||||
action: function (e, dt, node, config) {
|
||||
if (selected_tirada_id == -1) {
|
||||
popErrorAlert("<?= lang('TarifaEncuadernacionLineas.validation.error_seleccion_tiradas') ?>");
|
||||
}
|
||||
else{
|
||||
formOptions= {
|
||||
else {
|
||||
formOptions = {
|
||||
submitTrigger: -1,
|
||||
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
|
||||
|
||||
@ -497,11 +502,11 @@ id = -1;
|
||||
},
|
||||
}
|
||||
]
|
||||
} );
|
||||
});
|
||||
|
||||
|
||||
// Activate an inline edit on click of a table cell
|
||||
$('#tableOfTarifaencuadernacionlineasHoras').on( 'click', 'tbody span.edit', function (e) {
|
||||
// Activate an inline edit on click of a table cell
|
||||
$('#tableOfTarifaencuadernacionlineasHoras').on('click', 'tbody span.edit', function (e) {
|
||||
editor3.inline(
|
||||
theTable3.cells(this.parentNode.parentNode, '*').nodes(),
|
||||
{
|
||||
@ -512,10 +517,10 @@ id = -1;
|
||||
submit: 'allIfChanged'
|
||||
}
|
||||
);
|
||||
} );
|
||||
});
|
||||
|
||||
// Delete row
|
||||
function remove_lineas_horas(dataId, row){
|
||||
// Delete row
|
||||
function remove_lineas_horas(dataId, row) {
|
||||
|
||||
$.ajax({
|
||||
url: `/tarifas/tarifaencuadernacionlineashoras/delete/${dataId}`,
|
||||
@ -529,32 +534,32 @@ id = -1;
|
||||
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<!------------------------------------------->
|
||||
<!-- Código JS para tableOfTarifaencuadernacionlineas -->
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
const lastColNr = $('#tableOfTarifaencuadernacionlineas').find("tr:first th").length - 1;
|
||||
|
||||
|
||||
<!------------------------------------------->
|
||||
<!-- Código JS para tableOfTarifaencuadernacionlineas -->
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
const lastColNr = $('#tableOfTarifaencuadernacionlineas').find("tr:first th").length - 1;
|
||||
|
||||
var editor = new $.fn.dataTable.Editor( {
|
||||
var editor = new $.fn.dataTable.Editor({
|
||||
ajax: {
|
||||
url: "<?= route_to('editorOfTarifaEncuadernacionLineas') ?>",
|
||||
headers: {
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?> v,
|
||||
},
|
||||
},
|
||||
table : "#tableOfTarifaencuadernacionlineas",
|
||||
idSrc: 'id',
|
||||
fields: [
|
||||
{name: "id",
|
||||
"type": "readonly"},
|
||||
{
|
||||
name: "id",
|
||||
"type": "readonly"
|
||||
},
|
||||
{
|
||||
name: "dimensiones_id",
|
||||
"type": "select"
|
||||
@ -563,78 +568,78 @@ id = -1;
|
||||
name: "paginas_libro_min",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "paginas_libro_min",
|
||||
class :"autonumeric"
|
||||
name: "paginas_libro_min",
|
||||
class: "autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "precio_min",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "precio_min",
|
||||
class :"autonumeric"
|
||||
name: "precio_min",
|
||||
class: "autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "paginas_libro_max",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "paginas_libro_max",
|
||||
class :"autonumeric"
|
||||
name: "paginas_libro_max",
|
||||
class: "autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "precio_max",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "precio_min",
|
||||
class :"autonumeric"
|
||||
name: "precio_min",
|
||||
class: "autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "total_min",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "total_min",
|
||||
class :"autonumeric"
|
||||
name: "total_min",
|
||||
class: "autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "margen",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "margen",
|
||||
class :"autonumeric"
|
||||
name: "margen",
|
||||
class: "autonumeric"
|
||||
}
|
||||
}, {
|
||||
"name": "tirada_encuadernacion_id",
|
||||
"type": "hidden"
|
||||
},{
|
||||
}, {
|
||||
"name": "deleted_at",
|
||||
"type": "hidden"
|
||||
},{
|
||||
}, {
|
||||
"name": "is_deleted",
|
||||
"type": "hidden"
|
||||
},
|
||||
]
|
||||
]
|
||||
} );
|
||||
|
||||
// Generación de la lista de proveedores (id, nombre) para encuadernación
|
||||
const dimensionesList = <?php echo json_encode($dimensiones); ?>;
|
||||
editor.field( 'dimensiones_id' ).update( dimensionesList );
|
||||
editor.on('open',(event)=>{
|
||||
// Generación de la lista de proveedores (id, nombre) para encuadernación
|
||||
const dimensionesList = <? php echo json_encode($dimensiones); ?>;
|
||||
editor.field('dimensiones_id').update(dimensionesList);
|
||||
editor.on('open', (event) => {
|
||||
$("input.autonumeric").each(function () {
|
||||
let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
|
||||
if(autoNumericInstance){
|
||||
if (autoNumericInstance) {
|
||||
autoNumericInstance.remove()
|
||||
|
||||
}
|
||||
new AutoNumeric(this, {
|
||||
alwaysAllowDecimalCharacter: true,
|
||||
decimalCharacter: ",",
|
||||
decimalPlaces : 2,
|
||||
allowDecimalPadding : 'floats',
|
||||
decimalPlaces: 2,
|
||||
allowDecimalPadding: 'floats',
|
||||
digitGroupSeparator: ".",
|
||||
unformatOnSubmit : true,
|
||||
unformatOnSubmit: true,
|
||||
});
|
||||
})
|
||||
})
|
||||
editor.on( 'preSubmit', function ( e, d, type ) {
|
||||
})
|
||||
editor.on('preSubmit', function (e, d, type) {
|
||||
if (d.data) {
|
||||
Object.keys(d.data).forEach(function (key) {
|
||||
// Find all elements with class .autonumeric
|
||||
@ -648,67 +653,68 @@ id = -1;
|
||||
});
|
||||
});
|
||||
}
|
||||
if ( type === 'create'){
|
||||
if (type === 'create') {
|
||||
d.data[0]['tirada_encuadernacion_id'] = selected_tirada_id;
|
||||
}
|
||||
else if(type === 'edit' ) {
|
||||
for (v in d.data){
|
||||
else if (type === 'edit') {
|
||||
for (v in d.data) {
|
||||
d.data[v]['tirada_encuadernacion_id'] = selected_tirada_id;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
editor.on('postSubmit', function (e, json, data, action) {
|
||||
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
editor.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||
editor.on('submitSuccess', function (e, json, data, action) {
|
||||
|
||||
theTable.clearPipeline();
|
||||
theTable.draw();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var theTable = $('#tableOfTarifaencuadernacionlineas').DataTable( {
|
||||
draw:2,
|
||||
var theTable = $('#tableOfTarifaencuadernacionlineas').DataTable({
|
||||
draw: 2,
|
||||
serverSide: true,
|
||||
processing: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
lengthMenu: [ 5, 10, 25],
|
||||
order: [[ 0, "asc" ], [ 1, "asc" ]],
|
||||
lengthMenu: [5, 10, 25],
|
||||
order: [[0, "asc"], [1, "asc"]],
|
||||
pageLength: 10,
|
||||
lengthChange: true,
|
||||
searching: false,
|
||||
paging: true,
|
||||
info: false,
|
||||
dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
ajax: $.fn.dataTable.pipeline({
|
||||
url: '<?= route_to('dataTableOfTarifaEncuadernacionLineas') ?>',
|
||||
data: function ( d ) {
|
||||
data: function (d) {
|
||||
d.tirada_id = selected_tirada_id;
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
headers: { 'X-Requested-With': 'XMLHttpRequest' },
|
||||
async: true,
|
||||
}),
|
||||
columns: [
|
||||
{ 'data': 'id' },
|
||||
{ 'data': 'dimensiones_id',
|
||||
render: function(data, type, row, meta) {
|
||||
{
|
||||
'data': 'dimensiones_id',
|
||||
render: function (data, type, row, meta) {
|
||||
var value = dimensionesList.find(element => element.value === data);
|
||||
return value['label'];
|
||||
},
|
||||
},
|
||||
{ 'data': 'paginas_libro_min',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'precio_max',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'paginas_libro_max',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'precio_min',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'total_min',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'margen' ,render : (d) => `<span class="autonumeric">${d}</span>`},
|
||||
{ 'data': 'paginas_libro_min', render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'precio_max', render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'paginas_libro_max', render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'precio_min', render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'total_min', render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'margen', render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{
|
||||
data: actionBtns,
|
||||
className: 'row-edit dt-center'
|
||||
@ -720,7 +726,7 @@ id = -1;
|
||||
searchable: false,
|
||||
targets: [lastColNr]
|
||||
},
|
||||
{"orderData": [ 0, 1 ], "targets": 0 },
|
||||
{ "orderData": [0, 1], "targets": 0 },
|
||||
|
||||
],
|
||||
language: {
|
||||
@ -730,7 +736,7 @@ id = -1;
|
||||
{
|
||||
extend: 'collection',
|
||||
text: 'Exportar',
|
||||
buttons:[
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'print', {
|
||||
extend: 'pdfHtml5',
|
||||
orientation: 'landscape',
|
||||
@ -747,12 +753,12 @@ id = -1;
|
||||
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
|
||||
|
||||
},
|
||||
action: function ( e, dt, node, config ) {
|
||||
if(selected_tirada_id == -1){
|
||||
action: function (e, dt, node, config) {
|
||||
if (selected_tirada_id == -1) {
|
||||
popErrorAlert("<?= lang('TarifaEncuadernacionLineas.validation.error_seleccion_tiradas') ?>");
|
||||
}
|
||||
else{
|
||||
formOptions= {
|
||||
else {
|
||||
formOptions = {
|
||||
submitTrigger: -1,
|
||||
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
|
||||
|
||||
@ -762,11 +768,11 @@ id = -1;
|
||||
},
|
||||
}
|
||||
]
|
||||
} );
|
||||
});
|
||||
|
||||
|
||||
// Activate an inline edit on click of a table cell
|
||||
$('#tableOfTarifaencuadernacionlineas').on( 'click', 'tbody span.edit', function (e) {
|
||||
// Activate an inline edit on click of a table cell
|
||||
$('#tableOfTarifaencuadernacionlineas').on('click', 'tbody span.edit', function (e) {
|
||||
editor.inline(
|
||||
theTable.cells(this.parentNode.parentNode, '*').nodes(),
|
||||
{
|
||||
@ -777,10 +783,10 @@ id = -1;
|
||||
submit: 'allIfChanged'
|
||||
}
|
||||
);
|
||||
} );
|
||||
});
|
||||
|
||||
// Delete row
|
||||
function remove_lineas(dataId, row){
|
||||
// Delete row
|
||||
function remove_lineas(dataId, row) {
|
||||
|
||||
$.ajax({
|
||||
url: `/tarifas/tarifaencuadernacionlineas/delete/${dataId}`,
|
||||
@ -794,77 +800,75 @@ id = -1;
|
||||
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
<!------------------------------------------->
|
||||
<!-- Código JS para tableOfTarifaencuadernaciontiradas -->
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
<!------------------------------------------->
|
||||
<!-- Código JS para tableOfTarifaencuadernaciontiradas -->
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
// Definicion de la ultima columna de la tabla
|
||||
const lastColNr2 = $('#tableOfTarifaencuadernaciontiradas').find("tr:first th").length - 1;
|
||||
|
||||
// Definicion de la ultima columna de la tabla
|
||||
const lastColNr2 = $('#tableOfTarifaencuadernaciontiradas').find("tr:first th").length - 1;
|
||||
|
||||
|
||||
// Datatables Editor
|
||||
var editor2 = new $.fn.dataTable.Editor( {
|
||||
// Datatables Editor
|
||||
var editor2 = new $.fn.dataTable.Editor({
|
||||
ajax: {
|
||||
url: "<?= route_to('editorOfTarifaEncuadernacionTiradas') ?>",
|
||||
headers: {
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?> v,
|
||||
},
|
||||
},
|
||||
table : "#tableOfTarifaencuadernaciontiradas",
|
||||
idSrc: 'id',
|
||||
fields: [ {
|
||||
fields: [{
|
||||
name: "proveedor_id",
|
||||
"type": "select"
|
||||
}, {
|
||||
name: "tirada_min",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "tirada_min",
|
||||
class :"autonumeric"
|
||||
name: "tirada_min",
|
||||
class: "autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "tirada_max",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "tirada_max",
|
||||
class :"autonumeric"
|
||||
name: "tirada_max",
|
||||
class: "autonumeric"
|
||||
}
|
||||
}, {
|
||||
name: "importe_fijo",
|
||||
attr: {
|
||||
type: "text",
|
||||
name : "importe_fijo",
|
||||
class :"autonumeric"
|
||||
name: "importe_fijo",
|
||||
class: "autonumeric"
|
||||
}
|
||||
}, {
|
||||
"name": "tarifa_encuadernacion_id",
|
||||
"type": "hidden"
|
||||
},{
|
||||
}, {
|
||||
name: "proveedor",
|
||||
"type": "hidden"
|
||||
}, {
|
||||
"name": "deleted_at",
|
||||
"type": "hidden"
|
||||
},{
|
||||
}, {
|
||||
"name": "is_deleted",
|
||||
"type": "hidden"
|
||||
},
|
||||
]
|
||||
]
|
||||
} );
|
||||
|
||||
|
||||
// Generación de la lista de proveedores (id, nombre) para encuadernación
|
||||
const suppliersList = <?php echo json_encode($proveedores); ?>;
|
||||
editor2.field( 'proveedor_id' ).update( suppliersList );
|
||||
// Generación de la lista de proveedores (id, nombre) para encuadernación
|
||||
const suppliersList = <? php echo json_encode($proveedores); ?>;
|
||||
editor2.field('proveedor_id').update(suppliersList);
|
||||
|
||||
editor2.on('open', (event) => {
|
||||
editor2.on('open', (event) => {
|
||||
$("input.autonumeric").each(function () {
|
||||
let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
|
||||
if (autoNumericInstance) {
|
||||
@ -874,13 +878,13 @@ id = -1;
|
||||
new AutoNumeric(this, {
|
||||
decimalCharacter: ",",
|
||||
digitGroupSeparator: ".",
|
||||
allowDecimalPadding : 'floats',
|
||||
allowDecimalPadding: 'floats',
|
||||
decimalPlaces: 2,
|
||||
unformatOnSubmit: true,
|
||||
});
|
||||
})
|
||||
})
|
||||
editor2.on('preSubmit', (e, d, type) => {
|
||||
})
|
||||
editor2.on('preSubmit', (e, d, type) => {
|
||||
if (d.data) {
|
||||
Object.keys(d.data).forEach(function (key) {
|
||||
// Find all elements with class .autonumeric
|
||||
@ -894,41 +898,41 @@ id = -1;
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
editor2.on( 'preSubmit', function ( e, d, type ) {
|
||||
if ( type === 'create'){
|
||||
})
|
||||
editor2.on('preSubmit', function (e, d, type) {
|
||||
if (type === 'create') {
|
||||
d.data[0]['tarifa_encuadernacion_id'] = id;
|
||||
}
|
||||
else if(type === 'edit' ) {
|
||||
for (v in d.data){
|
||||
else if (type === 'edit') {
|
||||
for (v in d.data) {
|
||||
d.data[v]['tarifa_encuadernacion_id'] = id;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
editor2.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
editor2.on('postSubmit', function (e, json, data, action) {
|
||||
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
editor2.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||
editor2.on('submitSuccess', function (e, json, data, action) {
|
||||
|
||||
theTable2.clearPipeline();
|
||||
theTable2.draw();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Tabla de tiradas
|
||||
var theTable2 = $('#tableOfTarifaencuadernaciontiradas').DataTable( {
|
||||
draw:1,
|
||||
// Tabla de tiradas
|
||||
var theTable2 = $('#tableOfTarifaencuadernaciontiradas').DataTable({
|
||||
draw: 1,
|
||||
serverSide: true,
|
||||
processing: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
lengthMenu: [ 5, 10, 25],
|
||||
order: [ 0, "asc" ],
|
||||
lengthMenu: [5, 10, 25],
|
||||
order: [0, "asc"],
|
||||
pageLength: 10,
|
||||
lengthChange: true,
|
||||
searching: false,
|
||||
@ -936,25 +940,26 @@ id = -1;
|
||||
select: true,
|
||||
info: false,
|
||||
dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
|
||||
ajax : $.fn.dataTable.pipeline( {
|
||||
ajax: $.fn.dataTable.pipeline({
|
||||
url: '<?= route_to('dataTableOfTarifaEncuadernacionTiradas') ?>',
|
||||
data: {
|
||||
id_tarifaencuadernacion: id,
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
headers: { 'X-Requested-With': 'XMLHttpRequest' },
|
||||
async: true,
|
||||
}),
|
||||
columns: [
|
||||
{ 'data': 'proveedor_id',
|
||||
render: function(data, type, row, meta) {
|
||||
{
|
||||
'data': 'proveedor_id',
|
||||
render: function (data, type, row, meta) {
|
||||
var value = suppliersList.find(element => element.value === data);
|
||||
return value['label'];
|
||||
},
|
||||
},
|
||||
{ 'data': 'tirada_min',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'tirada_max',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'importe_fijo',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'tirada_min', render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'tirada_max', render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'importe_fijo', render: (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{
|
||||
data: actionBtns,
|
||||
className: 'row-edit dt-center'
|
||||
@ -975,7 +980,7 @@ id = -1;
|
||||
{
|
||||
extend: 'collection',
|
||||
text: 'Exportar',
|
||||
buttons:[
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'print', {
|
||||
extend: 'pdfHtml5',
|
||||
orientation: 'landscape',
|
||||
@ -991,44 +996,44 @@ id = -1;
|
||||
submitTrigger: -1,
|
||||
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
|
||||
}
|
||||
} ]
|
||||
} );
|
||||
}]
|
||||
});
|
||||
|
||||
|
||||
// Obtener la id de la fila seleccionada o ponerla a -1 cuando no haya ninguna seleccionada
|
||||
var selected_tirada_id = -1;
|
||||
theTable2.on( 'select', function ( e, dt, type, indexes ) {
|
||||
if ( type === 'row' ) {
|
||||
// Obtener la id de la fila seleccionada o ponerla a -1 cuando no haya ninguna seleccionada
|
||||
var selected_tirada_id = -1;
|
||||
theTable2.on('select', function (e, dt, type, indexes) {
|
||||
if (type === 'row') {
|
||||
|
||||
selected_tirada_id = parseInt(theTable2.rows( indexes ).data().pluck( 'id' )[0]);
|
||||
if($('#por_horas').is(':checked')){
|
||||
selected_tirada_id = parseInt(theTable2.rows(indexes).data().pluck('id')[0]);
|
||||
if ($('#por_horas').is(':checked')) {
|
||||
theTable3.clearPipeline();
|
||||
theTable3.draw();
|
||||
}
|
||||
else{
|
||||
else {
|
||||
theTable.clearPipeline();
|
||||
theTable.draw();
|
||||
}
|
||||
}
|
||||
} );
|
||||
});
|
||||
|
||||
theTable2.on( 'deselect', function ( e, dt, type, indexes ) {
|
||||
if ( theTable2.rows( '.selected' ).count() == 0 ) {
|
||||
theTable2.on('deselect', function (e, dt, type, indexes) {
|
||||
if (theTable2.rows('.selected').count() == 0) {
|
||||
selected_tirada_id = -1;
|
||||
if($('#por_horas').is(':checked')){
|
||||
if ($('#por_horas').is(':checked')) {
|
||||
theTable3.clearPipeline();
|
||||
theTable3.draw();
|
||||
}
|
||||
else{
|
||||
else {
|
||||
theTable.clearPipeline();
|
||||
theTable.draw();
|
||||
}
|
||||
}
|
||||
} );
|
||||
});
|
||||
|
||||
|
||||
// Activate an inline edit on click of a table cell
|
||||
$('#tableOfTarifaencuadernaciontiradas').on( 'click', 'tbody span.edit', function (e) {
|
||||
// Activate an inline edit on click of a table cell
|
||||
$('#tableOfTarifaencuadernaciontiradas').on('click', 'tbody span.edit', function (e) {
|
||||
editor2.inline(
|
||||
theTable2.cells(this.parentNode.parentNode, '*').nodes(),
|
||||
{
|
||||
@ -1039,11 +1044,11 @@ id = -1;
|
||||
submit: 'allIfChanged'
|
||||
}
|
||||
);
|
||||
} );
|
||||
});
|
||||
|
||||
|
||||
// Delete row
|
||||
function remove_tiradas(dataId, row){
|
||||
// Delete row
|
||||
function remove_tiradas(dataId, row) {
|
||||
|
||||
$.ajax({
|
||||
url: `/tarifas/tarifaencuadernaciontiradas/delete/${dataId}`,
|
||||
@ -1058,26 +1063,26 @@ id = -1;
|
||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||
popErrorAlert(jqXHR.statusText)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
|
||||
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||
<?= $this->endSection() ?>
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
|
||||
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/datatables-sk/plugins/select/dataTables.select.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/datatables-sk/plugins/select/dataTables.select.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
@ -16,6 +16,13 @@ if (
|
||||
<?= lang("App.menu_pedidos") ?>
|
||||
</a>
|
||||
<ul class="menu-sub">
|
||||
<?php if (auth()->user()->can('pedidos-validacion.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("pedidos/pedido/validacion") ?>" class="menu-link">
|
||||
<?= lang("App.menu_pedidos_validacion") ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->can('pedidos-activos.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= site_url("pedidos/pedido/activos") ?>" class="menu-link">
|
||||
|
||||
@ -169,8 +169,8 @@ class PresupuestoAdminEdit {
|
||||
|
||||
new Ajax('/presupuestoadmin/edit/' + id, data, {},
|
||||
function (response) {
|
||||
popSuccessAlert(response.mensaje);
|
||||
$('#loader').modal('hide');
|
||||
sessionStorage.setItem('message', response.mensaje);
|
||||
location.reload();
|
||||
},
|
||||
function (error) {
|
||||
console.error(error);
|
||||
|
||||
Reference in New Issue
Block a user