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