mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
mergeando del main a mi rama
This commit is contained in:
@ -370,8 +370,8 @@ $routes->group('clienteprecios', ['namespace' => 'App\Controllers\Clientes'], fu
|
||||
$routes->post('datatable', 'Clienteprecios::datatable', ['as' => 'dataTableOfClienteprecios']);
|
||||
$routes->post('datatable_editor', 'Clienteprecios::datatable_editor', ['as' => 'editorOfClienteprecios']);
|
||||
});
|
||||
$routes->resource('clienteprecios', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clienteprecios', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->resource('clienteprecios', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clienteprecios', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('clienteplantillaprecios', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||
$routes->get('', 'Clienteplantillaprecios::index', ['as' => 'clienteplantillapreciosList']);
|
||||
@ -391,6 +391,10 @@ $routes->group('clienteplantillaprecioslineas', ['namespace' => 'App\Controllers
|
||||
});
|
||||
$routes->resource('clienteplantillaprecioslineas', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'clienteplantillaprecioslineas', 'except' => 'show,new,create,update']);
|
||||
|
||||
$routes->group('clienteusuarios', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||
$routes->post('datatable', 'Clienteusuarios::datatable', ['as' => 'dataTableOfClienteUsuarios']);
|
||||
});
|
||||
|
||||
|
||||
$routes->group('formas-pagos', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Formaspagos::index', ['as' => 'formaDePagoList']);
|
||||
@ -512,6 +516,7 @@ $routes->group('clientecontactos', ['namespace' => 'App\Controllers\Clientes'],
|
||||
$routes->post('(:num)/edit', 'Clientecontactos::edit/$1', ['as' => 'updateClienteContactos']);
|
||||
$routes->post('datatable', 'Clientecontactos::datatable', ['as' => 'dataTableOfClienteContactos']);
|
||||
$routes->post('datatable_editor', 'Clientecontactos::datatable_editor', ['as' => 'editorOfClienteContactos']);
|
||||
$routes->get('delete/(:num)', 'Clientecontactos::delete/$1', ['as' => 'deleteClienteContactos']);
|
||||
$routes->post('allmenuitems', 'Clientecontactos::allItemsSelect', ['as' => 'select2ItemsOfClienteContactos']);
|
||||
$routes->post('menuitems', 'Clientecontactos::menuItems', ['as' => 'menuItemsOfClienteContactos']);
|
||||
});
|
||||
|
||||
@ -60,7 +60,6 @@ class Clientecontactos extends \App\Controllers\GoBaseResourceController
|
||||
public function add()
|
||||
{
|
||||
|
||||
|
||||
$requestMethod = $this->request->getMethod();
|
||||
|
||||
if ($requestMethod === 'post') :
|
||||
|
||||
77
ci4/app/Controllers/Clientes/Clienteusuarios.php
Normal file
77
ci4/app/Controllers/Clientes/Clienteusuarios.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php namespace App\Controllers\Clientes;
|
||||
|
||||
|
||||
use App\Controllers\GoBaseResourceController;
|
||||
|
||||
use App\Models\Clientes\ClienteUsuariosModel;
|
||||
use App\Models\Collection;
|
||||
|
||||
use App\Entities\Clientes\ClienteContactoEntity;
|
||||
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
|
||||
use App\Models\Clientes\ClienteContactoModel;
|
||||
use DataTables\Editor;
|
||||
use DataTables\Editor\Field;
|
||||
use DataTables\Editor\Validate;
|
||||
|
||||
class Clienteusuarios extends \App\Controllers\GoBaseResourceController
|
||||
{
|
||||
|
||||
protected $modelName = ClienteUsuariosModel::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectName = 'Contacto de cliente';
|
||||
protected static $singularObjectNameCc = 'contactoDeCliente';
|
||||
protected static $pluralObjectName = 'Contactos de cliente';
|
||||
protected static $pluralObjectNameCc = 'contactosDeCliente';
|
||||
|
||||
protected static $controllerSlug = 'cliente-contactos';
|
||||
|
||||
protected static $viewPath = 'themes/backend/vuexy/form/clientes/usuarios/';
|
||||
|
||||
protected $indexRoute = 'contactoDeClienteList';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
$this->viewData['pageTitle'] = lang('ClienteContactos.moduleTitle');
|
||||
$this->viewData['usingSweetAlert'] = true;
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
if (!isset($reqData['draw']) || !isset($reqData['columns'])) {
|
||||
$errstr = 'No data available in response to this specific request.';
|
||||
$response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr);
|
||||
return $response;
|
||||
}
|
||||
$start = $reqData['start'] ?? 0;
|
||||
$length = $reqData['length'] ?? 5;
|
||||
$search = $reqData['search']['value'];
|
||||
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
||||
$order = ClienteUsuariosModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
|
||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||
|
||||
$id_C = $reqData['id_cliente'] ?? -1;
|
||||
|
||||
$resourceData = $this->model->getResource("", $id_C)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource()->countAllResults(),
|
||||
$this->model->getResource("", $id_C)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -117,6 +117,24 @@ class Tarifaencuadernaciontiradas extends \App\Controllers\GoBaseResourceControl
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_max.required'))
|
||||
),
|
||||
Field::inst('importe_fijo')
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::numeric', array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.decimal'))
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.required'))
|
||||
),
|
||||
Field::inst('precio_min')
|
||||
->getFormatter( 'Format::toDecimalChar')->setFormatter( 'Format::fromDecimalChar')
|
||||
->validator('Validate::numeric', array(
|
||||
"decimal" => ',',
|
||||
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.decimal'))
|
||||
)
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_min.required'))
|
||||
),
|
||||
Field::inst('proveedor_id')
|
||||
->validator('Validate::notEmpty', array(
|
||||
'message' => lang('TarifaEncuadernacionTiradas.validation.tirada_max.required'))
|
||||
|
||||
@ -9,8 +9,6 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"nombre" => null,
|
||||
"precio_min" => 0,
|
||||
"importe_fijo" => 0,
|
||||
"mostrar_en_presupuesto" => 1,
|
||||
"tipo_encuadernacion" => 0,
|
||||
"servicio_encuadernacion" => 0,
|
||||
@ -23,8 +21,6 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity
|
||||
"updated_at" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"precio_min" => "float",
|
||||
"importe_fijo" => "float",
|
||||
"mostrar_en_presupuesto" => "int",
|
||||
"tipo_encuadernacion" => "int",
|
||||
"servicio_encuadernacion" => "int",
|
||||
|
||||
@ -11,6 +11,8 @@ class TarifaEncuadernacionTirada extends \CodeIgniter\Entity\Entity
|
||||
"tirada_min" => 0,
|
||||
"tirada_max" => 0,
|
||||
"proveedor_id" => 0,
|
||||
"precio_min" => 0,
|
||||
"importe_fijo" => 0,
|
||||
"user_created_id" => 0,
|
||||
"user_updated_id" => 0,
|
||||
"is_deleted" => 0,
|
||||
@ -22,6 +24,8 @@ class TarifaEncuadernacionTirada extends \CodeIgniter\Entity\Entity
|
||||
"tirada_min" => "float",
|
||||
"tirada_max" => "float",
|
||||
"proveedor_id" => "int",
|
||||
"precio_min" => "float",
|
||||
"importe_fijo" => "float",
|
||||
"user_created_id" => "int",
|
||||
"user_updated_id" => "int",
|
||||
"is_deleted" => "int",
|
||||
|
||||
@ -130,8 +130,8 @@ return [
|
||||
"profile_subtitle_tfa" => "Autenticación de dos factores (2FA)",
|
||||
"profile_first_name" => "Nombre",
|
||||
"profile_first_name_ph" => "Escriba su nombre",
|
||||
"profile_last_name" => "Apellido",
|
||||
"profile_last_name_ph" => "Escriba su apellido",
|
||||
"profile_last_name" => "Apellidos",
|
||||
"profile_last_name_ph" => "Escriba sus apellidos",
|
||||
"profile_email" => "Correo Electrónico",
|
||||
"profile_email_ph" => "Escriba su correo electrónico",
|
||||
"profile_mobile" => "Teléfono Móvil",
|
||||
|
||||
@ -24,6 +24,11 @@ return [
|
||||
'libroCosidoTapaDura' => "Cosido Tapa Dura",
|
||||
'libroFresadoTapaBlanda' => "Fresado Tapa Blanda",
|
||||
'libroFresadoTapaDura' => "Fresado Tapa Dura",
|
||||
'libroEspiralTapaDura' => "Espiral Tapa Dura",
|
||||
'libroEspiralTapaBlanda' => "Espiral Tapa Blanda",
|
||||
'libroWireoTapaDura' => "Wire-o Tapa Dura",
|
||||
'libroWireoTapaBlanda' => "Wire-o Tapa Blanda",
|
||||
'libroGrapado' => "Grapado",
|
||||
|
||||
'datosPresupuesto' => 'Datos generales del presupuesto',
|
||||
'datosLibro' => 'Datos del libro',
|
||||
|
||||
@ -6,8 +6,8 @@ return [
|
||||
'id' => 'ID',
|
||||
'moduleTitle' => 'Tarifa Encuadernación Lineas',
|
||||
'deleteLine' => 'el registro seleccionado',
|
||||
'precioMax' => 'Precio Max',
|
||||
'precioMin' => 'Precio Min',
|
||||
'precioMax' => 'Precio Pág. Max',
|
||||
'precioMin' => 'Precio Pág. Min',
|
||||
'tiempoMin' => 'Tiempo Min',
|
||||
'tiempoMax' => 'Tiempo Max',
|
||||
'precioHora' => 'Precio/hora',
|
||||
|
||||
110
ci4/app/Models/Clientes/ClienteUsuariosModel.php
Normal file
110
ci4/app/Models/Clientes/ClienteUsuariosModel.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Clientes;
|
||||
|
||||
class ClienteUsuariosModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "auth_user";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
const SORTABLE = [
|
||||
0 => "t1.first_name",
|
||||
1 => "t1.last_name",
|
||||
2 => "t1.email",
|
||||
];
|
||||
|
||||
protected $allowedFields = ["id", "first_name", "last_name", "email"];
|
||||
protected $returnType = "App\Entities\Usuarios\UserEntity";
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $useSoftDeletes = false;
|
||||
|
||||
protected $createdField = "created_at";
|
||||
|
||||
protected $updatedField = "updated_at";
|
||||
|
||||
public static $labelField = "nombre";
|
||||
|
||||
protected $validationRules = [
|
||||
"last_name" => [
|
||||
"label" => "ClienteContactos.apellidos",
|
||||
"rules" => "trim|max_length[500]",
|
||||
],
|
||||
"email" => [
|
||||
"label" => "ClienteContactos.email",
|
||||
"rules" => "trim|max_length[150]|valid_email|permit_empty",
|
||||
],
|
||||
"first_name" => [
|
||||
"label" => "ClienteContactos.nombre",
|
||||
"rules" => "trim|max_length[100]",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"last_name" => [
|
||||
"max_length" => "ClienteContactos.validation.apellidos.max_length",
|
||||
],
|
||||
|
||||
"email" => [
|
||||
"max_length" => "ClienteContactos.validation.email.max_length",
|
||||
"valid_email" => "ClienteContactos.validation.email.valid_email",
|
||||
],
|
||||
"first_name" => [
|
||||
"max_length" => "ClienteContactos.validation.nombre.max_length",
|
||||
],
|
||||
];
|
||||
|
||||
public function findAllWithClientes(string $selcols = "*", int $limit = null, int $offset = 0)
|
||||
{
|
||||
$sql =
|
||||
"SELECT t1." .
|
||||
$selcols .
|
||||
", t2.nombre AS cliente_id FROM " .
|
||||
$this->table .
|
||||
" t1 LEFT JOIN clientes t2 ON t1.cliente_id = t2.id";
|
||||
if (!is_null($limit) && intval($limit) > 0) {
|
||||
$sql .= " LIMIT " . $limit;
|
||||
}
|
||||
|
||||
if (!is_null($offset) && intval($offset) > 0) {
|
||||
$sql .= " OFFSET " . $offset;
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
$result = $query->getResultObject();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get resource data.
|
||||
*
|
||||
* @param string $search
|
||||
*
|
||||
* @return \CodeIgniter\Database\BaseBuilder
|
||||
*/
|
||||
public function getResource(string $search = "", $cliente_id = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id_user AS id, t1.first_name AS nombre, t1.last_name AS apellidos, t1.email AS email"
|
||||
);
|
||||
|
||||
$builder->where('t1.id_user', $cliente_id);
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.first_name", $search)
|
||||
->orLike("t1.last_name", $search)
|
||||
->orLike("t1.email", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
@ -297,7 +297,7 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
|
||||
|
||||
private function calcularTarifa($tarifa, $paginas, $ejemplares, $is_POD=false){
|
||||
|
||||
$precio_unidad = floatval($tarifa->precio_min) - (floatval($tarifa->precio_min) - floatval($tarifa->precio_max))/($tarifa->paginas_max - $tarifa->paginas_min) * ($paginas - $tarifa->paginas_min);
|
||||
$precio_unidad = floatval($tarifa->precio_max) - (floatval($tarifa->precio_max) - floatval($tarifa->precio_min))/($tarifa->paginas_max - $tarifa->paginas_min) * ($paginas - $tarifa->paginas_min);
|
||||
if ($paginas > $tarifa->paginas_max)
|
||||
$precio_unidad = $tarifa->precio_max;
|
||||
$precio_unidad = $precio_unidad* (1+ floatval($tarifa->margen)/100.0);
|
||||
|
||||
@ -14,18 +14,14 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
|
||||
|
||||
const SORTABLE = [
|
||||
0 => "t1.nombre",
|
||||
1 => "t1.precio_min",
|
||||
2 => "t1.importe_fijo",
|
||||
3 => "t1.mostrar_en_presupuesto",
|
||||
4 => "t1.tipo_encuadernacion",
|
||||
5 => "t1.servicio_encuadernacion",
|
||||
1 => "t1.mostrar_en_presupuesto",
|
||||
2 => "t1.tipo_encuadernacion",
|
||||
3 => "t1.servicio_encuadernacion",
|
||||
|
||||
];
|
||||
|
||||
protected $allowedFields = [
|
||||
"nombre",
|
||||
"precio_min",
|
||||
"importe_fijo",
|
||||
"mostrar_en_presupuesto",
|
||||
"tipo_encuadernacion",
|
||||
"servicio_encuadernacion",
|
||||
@ -51,30 +47,13 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
|
||||
"label" => "Tarifaencuadernacion.nombre",
|
||||
"rules" => "trim|required|max_length[255]",
|
||||
],
|
||||
|
||||
"precio_min" => [
|
||||
"label" => "Tarifaencuadernacion.precioMin",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"importe_fijo" => [
|
||||
"label" => "Tarifaencuadernacion.importeFijo",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"nombre" => [
|
||||
"max_length" => "Tarifaencuadernacion.validation.nombre.max_length",
|
||||
"required" => "Tarifaencuadernacion.validation.nombre.required",
|
||||
],
|
||||
"precio_min" => [
|
||||
"required" => "Tarifaencuadernacion.validation.precio_min.required",
|
||||
"decimal" => "Tarifaencuadernacion.validation.precio_min.decimal",
|
||||
],
|
||||
"importe_fijo" => [
|
||||
"required" => "Tarifaencuadernacion.validation.importe_fijo.required",
|
||||
"decimal" => "Tarifaencuadernacion.validation.importe_fijo.decimal",
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
@ -87,7 +66,7 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
|
||||
public function getResource(string $search = "")
|
||||
{
|
||||
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id, t1.nombre AS nombre,
|
||||
t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo, t1.mostrar_en_presupuesto AS mostrar_en_presupuesto,
|
||||
t1.mostrar_en_presupuesto AS mostrar_en_presupuesto,
|
||||
t1.tipo_encuadernacion AS tipo_encuadernacion, t1.servicio_encuadernacion AS servicio_encuadernacion,
|
||||
t1.por_horas AS por_horas");
|
||||
|
||||
@ -144,7 +123,7 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS tarifa_enc_id, t1.nombre AS tarifa_enc_nombre, t1.precio_min AS tarifa_precio_min, t1.importe_fijo AS tarifa_importe_fijo,
|
||||
"t1.id AS tarifa_enc_id, t1.nombre AS tarifa_enc_nombre, t2.precio_min AS tarifa_precio_min, t2.importe_fijo AS tarifa_importe_fijo,
|
||||
t2.id AS tarifa_tirada_id, t2.proveedor_id AS proveedor_id, t5.nombre AS proveedor_nombre, t2.tirada_min AS tirada_min, t2.tirada_max AS tirada_max,
|
||||
t3.id AS tarifa_linea_id, t3.paginas_libro_min AS paginas_min, t3.paginas_libro_max AS paginas_max, t3.precio_min AS precio_min, t3.precio_max AS precio_max, t3.margen AS margen,
|
||||
t4.ancho_min AS ancho_min, t4.ancho_max AS ancho_max, t4.alto_min AS alto_min, t4.alto_max AS alto_max"
|
||||
@ -180,7 +159,7 @@ class TarifaEncuadernacionModel extends \App\Models\GoBaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS tarifa_enc_id, t1.nombre AS tarifa_enc_nombre, t1.precio_min AS tarifa_precio_min, t1.importe_fijo AS tarifa_importe_fijo,
|
||||
"t1.id AS tarifa_enc_id, t1.nombre AS tarifa_enc_nombre, t2.precio_min AS tarifa_precio_min, t2.importe_fijo AS tarifa_importe_fijo,
|
||||
t2.id AS tarifa_tirada_id, t2.proveedor_id AS proveedor_id, t5.nombre AS proveedor_nombre, t2.tirada_min AS tirada_min, t2.tirada_max AS tirada_max,
|
||||
t3.id AS tarifa_linea_id, t3.tiempo_min AS tiempo_min, t3.tiempo_max AS tiempo_max, t3.precio_hora AS precio_hora, t3.margen AS margen"
|
||||
)
|
||||
|
||||
@ -16,7 +16,8 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\GoBaseModel
|
||||
0 => "t3.nombre",
|
||||
1 => "t1.tirada_min",
|
||||
2 => "t1.tirada_max",
|
||||
|
||||
3 => "t1.precio_min",
|
||||
4 => "t1.importe_fijo",
|
||||
];
|
||||
|
||||
protected $allowedFields = [
|
||||
@ -24,6 +25,8 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\GoBaseModel
|
||||
"tirada_min",
|
||||
"tirada_max",
|
||||
"proveedor_id",
|
||||
"precio_min",
|
||||
"importe_fijo",
|
||||
"user_created_id",
|
||||
"user_updated_id",
|
||||
"is_deleted",
|
||||
@ -49,7 +52,15 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\GoBaseModel
|
||||
"tirada_min" => [
|
||||
"label" => "TarifaEncuadernacionTiradas.tiradaMin",
|
||||
"rules" => "required|integer",
|
||||
]
|
||||
],
|
||||
"precio_min" => [
|
||||
"label" => "Tarifaencuadernacion.precioMin",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"importe_fijo" => [
|
||||
"label" => "Tarifaencuadernacion.importeFijo",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
@ -60,7 +71,15 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\GoBaseModel
|
||||
"tirada_min" => [
|
||||
"integer" => "TarifaEncuadernacionTiradas.validation.tirada_min.integer",
|
||||
"required" => "TarifaEncuadernacionTiradas.validation.tirada_min.required",
|
||||
]
|
||||
],
|
||||
"precio_min" => [
|
||||
"required" => "Tarifaencuadernacion.validation.precio_min.required",
|
||||
"decimal" => "Tarifaencuadernacion.validation.precio_min.decimal",
|
||||
],
|
||||
"importe_fijo" => [
|
||||
"required" => "Tarifaencuadernacion.validation.importe_fijo.required",
|
||||
"decimal" => "Tarifaencuadernacion.validation.importe_fijo.decimal",
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
@ -75,8 +94,10 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\GoBaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.tarifa_encuadernacion_id AS tarifa_encuadernacion_id, t1.tirada_min AS tirada_min,
|
||||
t1.tirada_max AS tirada_max, t3.nombre AS proveedor, t3.id AS proveedor_id, t2.id AS tarifa_encuadernacion"
|
||||
"t1.id AS id, t1.tarifa_encuadernacion_id AS tarifa_encuadernacion_id,
|
||||
t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo,
|
||||
t1.tirada_min AS tirada_min, t1.tirada_max AS tirada_max,
|
||||
t3.nombre AS proveedor, t3.id AS proveedor_id, t2.id AS tarifa_encuadernacion"
|
||||
);
|
||||
//JJO
|
||||
$builder->where('tarifa_encuadernacion_id', $tarifa_encuadernacion_id);
|
||||
@ -92,10 +113,14 @@ class TarifaEncuadernacionTiradaModel extends \App\Models\GoBaseModel
|
||||
->groupStart()
|
||||
->Like("t1.tirada_min", $search)
|
||||
->orLike("t1.tirada_max", $search)
|
||||
->orLike("t1.precio_min", $search)
|
||||
->orLike("t1.importe_fijo", $search)
|
||||
->orLike("t3.nombre", $search)
|
||||
->orLike("t1.tirada_min", $search)
|
||||
->orLike("t1.tirada_max", $search)
|
||||
->orLike("t3.nombre", $search)
|
||||
->orLike("t1.precio_min", $search)
|
||||
->orLike("t1.importe_fijo", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ if (session()->has('error')) {
|
||||
</div>
|
||||
|
||||
|
||||
<?= $this->section('additionalInlineJs') ?>
|
||||
<?= $this->section('globalJsFunctions') ?>
|
||||
|
||||
function popAlert(message, alertClass, alertIcon, containerId = 'sk-alert'){
|
||||
var htmlString = `
|
||||
|
||||
@ -564,7 +564,6 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php if ($formAction !== site_url('cliente/add')){ ?>
|
||||
<div class="tab-pane fade" id="tarifascliente" role="tabpanel">
|
||||
<?= view("themes/backend/vuexy/form/clientes/cliente/convert2templateModal") ?>
|
||||
@ -610,7 +609,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade" id="contactos" role="tabpanel">
|
||||
<table id="tableOfClienteContactos"
|
||||
class="table table-striped table-hover" style="width: 100%;">
|
||||
@ -629,7 +627,6 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade" id="domicilio-entrega" role="tabpanel">
|
||||
<?= view("themes/backend/vuexy/form/clientes/cliente/_clienteDireccionesForm") ?>
|
||||
<table id="tableOfDireccionesEnvio" class="table dt-responsive dataTable" style="width: 100%;">
|
||||
@ -662,7 +659,20 @@
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="usuarios" role="tabpanel">
|
||||
<h3>Proximanente</h3>
|
||||
<table id="tableOfClienteUsuarios" class="table table-striped table-hover" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th><?= lang('App.profile_first_name') ?></th>
|
||||
<th><?= lang('App.profile_last_name') ?></th>
|
||||
<th><?= lang('App.profile_email') ?></th>
|
||||
<th class="text-nowrap" style="min-width:100px"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
@ -673,27 +683,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
<?php /* A implementar en el controller
|
||||
<div class="mb-3">
|
||||
<label for="limiteCreditoUserId" class="form-label">
|
||||
<?= lang('Clientes.limiteCreditoUserId') ?>*
|
||||
</label>
|
||||
<input type="number" id="limiteCreditoUserId" name="limite_credito_user_id" required placeholder="1"
|
||||
maxLength="10" class="form-control"
|
||||
value="<?= old('limite_credito_user_id', $clienteEntity->limite_credito_user_id) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="limiteCreditoChangeAt" class="form-label">
|
||||
<?= lang('Clientes.limiteCreditoChangeAt') ?>*
|
||||
</label>
|
||||
<input type="text" id="limiteCreditoChangeAt" name="limite_credito_change_at" required
|
||||
placeholder="2017-02-13 12:38:03" maxLength="20" class="form-control"
|
||||
value="<?= old('limite_credito_change_at', $clienteEntity->limite_credito_change_at) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
*/ ?>
|
||||
|
||||
|
||||
|
||||
<?php if ($formAction !== site_url('cliente/add')){ ?>
|
||||
@ -701,6 +690,12 @@
|
||||
/****************************************
|
||||
Funcionamiento general
|
||||
*****************************************/
|
||||
const url = window.location.href;
|
||||
const url_parts = url.split('/');
|
||||
let id = -1;
|
||||
if(url_parts[url_parts.length-2] == 'edit'){
|
||||
id = url_parts[url_parts.length-1];
|
||||
}
|
||||
|
||||
$(document).on('click', '.btn-remove', function(e) {
|
||||
|
||||
@ -718,18 +713,21 @@ $(document).on('click', '.btn-remove', function(e) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
/****************************************
|
||||
Contactos
|
||||
*****************************************/
|
||||
|
||||
const lastColNr = $('#tableOfClienteContactos').find("tr:first th").length - 1;
|
||||
|
||||
const actionBtns = function(data) {
|
||||
return `
|
||||
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
|
||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-deleted mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
|
||||
<span class="cancel"></span>
|
||||
`;
|
||||
};
|
||||
@ -779,7 +777,6 @@ $(document).on('click', '.btn-remove', function(e) {
|
||||
|
||||
|
||||
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
||||
|
||||
yeniden(json.<?= csrf_token() ?>);
|
||||
});
|
||||
|
||||
@ -803,33 +800,27 @@ $(document).on('click', '.btn-remove', function(e) {
|
||||
);
|
||||
} );
|
||||
|
||||
|
||||
// Delete row
|
||||
$('#tableOfClienteContactos').on( 'click', 'tbody span.remove', function (e) {
|
||||
$(document).on('click', '.btn-deleted', function(e) {
|
||||
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
||||
});
|
||||
|
||||
Swal.fire({
|
||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Basic.global.sweet.line'))]) ?>',
|
||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
|
||||
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
|
||||
cancelButtonColor: '#d33'
|
||||
})
|
||||
.then((result) => {
|
||||
const dataId = $(this).data('id');
|
||||
const row = $(this).closest('tr');
|
||||
if (result.value) {
|
||||
editor
|
||||
.create( false )
|
||||
.edit( this.parentNode, false)
|
||||
.set( 'deleted_at', new Date().toISOString().slice(0, 19).replace('T', ' ') )
|
||||
.set( 'is_deleted', 1 )
|
||||
.submit();
|
||||
|
||||
}
|
||||
});
|
||||
$(document).on('click', '.btn-remove', function(e) {
|
||||
const dataId = $(this).attr('data-id');
|
||||
const row = $(this).closest('tr');
|
||||
if ($.isNumeric(dataId)) {
|
||||
$.ajax({
|
||||
url: `/clientecontactos/delete/${dataId}`,
|
||||
method: 'GET',
|
||||
}).done((data, textStatus, jqXHR) => {
|
||||
$('#confirm2delete').modal('toggle');
|
||||
theTable.clearPipeline();
|
||||
theTable.row($(row)).invalidate().draw();
|
||||
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
var theTable = $('#tableOfClienteContactos').DataTable( {
|
||||
@ -1457,6 +1448,67 @@ function delete_direccion_envio(dataId){
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
/****************************************
|
||||
Contactos
|
||||
*****************************************/
|
||||
|
||||
const lastColNrCU = $('#tableOfClienteUsuarios').find("tr:first th").length - 1;
|
||||
|
||||
var theTableCU = $('#tableOfClienteUsuarios').DataTable( {
|
||||
serverSide: true,
|
||||
processing: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
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( {
|
||||
url: '<?= route_to('dataTableOfClienteUsuarios') ?>',
|
||||
data: {
|
||||
//id_cliente: id,
|
||||
id_cliente: 1,
|
||||
},
|
||||
method: 'POST',
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
async: true,
|
||||
}),
|
||||
columns: [
|
||||
{ 'data': 'id' },
|
||||
{ 'data': 'nombre' },
|
||||
{ 'data': 'apellidos' },
|
||||
{ 'data': 'email' },
|
||||
{
|
||||
data: actionBtns,
|
||||
className: 'row-edit dt-center'
|
||||
}
|
||||
],
|
||||
columnDefs: [
|
||||
{
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
targets: [lastColNrCU]
|
||||
},
|
||||
{
|
||||
"orderData": [ 0, 1 ],
|
||||
"targets": 0
|
||||
},
|
||||
|
||||
],
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
}
|
||||
} );
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?=$this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.bootstrap5.min.css') ?>">
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
$('#saveForm').click();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#soporteId').select2({
|
||||
@ -230,11 +230,9 @@
|
||||
|
||||
|
||||
<?=$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") ?>">
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/sk-datatables.css') ?>">
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>">
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
@ -121,6 +121,11 @@ $('#tableOfPresupuestos thead tr:eq(1) th').each(function (i) {
|
||||
selector.append('<option value="libroCosidoTapaDura"><?= lang('Presupuestos.libroCosidoTapaDura') ?></option>');
|
||||
selector.append('<option value="libroFresadoTapaBlanda"><?= lang('Presupuestos.libroFresadoTapaBlanda') ?></option>');
|
||||
selector.append('<option value="libroFresadoTapaDura"><?= lang('Presupuestos.libroFresadoTapaDura') ?></option>');
|
||||
selector.append('<option value="libroEspiralTapaDura"><?= lang('Presupuestos.libroEspiralTapaDura') ?></option>');
|
||||
selector.append('<option value="libroEspiralTapaBlanda"><?= lang('Presupuestos.libroEspiralTapaBlanda') ?></option>');
|
||||
selector.append('<option value="libroWireoTapaDura"><?= lang('Presupuestos.libroWireoTapaDura') ?></option>');
|
||||
selector.append('<option value="libroWireoTapaBlanda"><?= lang('Presupuestos.libroWireoTapaBlanda') ?></option>');
|
||||
selector.append('<option value="libroGrapado"><?= lang('Presupuestos.libroGrapado') ?></option>');
|
||||
|
||||
selector.on('change', function () {
|
||||
var val = $.fn.dataTable.util.escapeRegex(
|
||||
@ -207,6 +212,27 @@ theTable = $('#tableOfPresupuestos').DataTable({
|
||||
return '<?= lang('Presupuestos.libroFresadoTapaDura') ?>';
|
||||
break;
|
||||
|
||||
|
||||
case "libroEspiralTapaDura":
|
||||
return '<?= lang('Presupuestos.libroEspiralTapaDura') ?>';
|
||||
break;
|
||||
|
||||
case "libroEspiralTapaBlanda":
|
||||
return '<?= lang('Presupuestos.libroEspiralTapaBlanda') ?>';
|
||||
break;
|
||||
|
||||
case "libroWireoTapaDura":
|
||||
return '<?= lang('Presupuestos.libroWireoTapaDura') ?>';
|
||||
break;
|
||||
|
||||
case "libroWireoTapaBlanda":
|
||||
return '<?= lang('Presupuestos.libroWireoTapaBlanda') ?>';
|
||||
break;
|
||||
|
||||
case "libroGrapado":
|
||||
return '<?= lang('Presupuestos.libroGrapado') ?>';
|
||||
break;
|
||||
|
||||
default:
|
||||
return data; // Debug
|
||||
break;
|
||||
|
||||
@ -220,6 +220,7 @@ $(document).on('click', '.delete-add-row', function(e) {
|
||||
update_resumen: true,
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
showBreadCrumbSaveButton(true);
|
||||
|
||||
})
|
||||
|
||||
|
||||
@ -173,4 +173,4 @@
|
||||
</div> <!-- //.accordion-body -->
|
||||
</div> <!-- //.accordion-collapse -->
|
||||
</div> <!-- //.accordion-item -->
|
||||
</div> <!-- //.accordion -->
|
||||
</div> <!-- //.accordion -->
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
* Seccion para las funciones generales de la pagina
|
||||
***************************************************************************************/
|
||||
|
||||
|
||||
$('.nav-servicios button').on('shown.bs.tab', function(){
|
||||
$("#tableOfServiciosEncuadernacion").DataTable().columns.adjust();
|
||||
$("#tableOfServiciosPreimpresion").DataTable().columns.adjust();
|
||||
@ -16,6 +15,7 @@ $('#serv_default').on('click', function(){
|
||||
get_tarifas_enc('default').then(
|
||||
get_tarifas_manipulado('default')
|
||||
)
|
||||
showBreadCrumbSaveButton(true);
|
||||
})
|
||||
|
||||
// Delete row
|
||||
@ -73,6 +73,7 @@ $(document).on('click', '.btn-delete-serv', function(e) {
|
||||
update_tiradas_alternativas: true
|
||||
})
|
||||
//updateTotales(false, true, false)
|
||||
showBreadCrumbSaveButton(true);
|
||||
|
||||
});
|
||||
|
||||
@ -369,6 +370,8 @@ $('#insertar_serv_acabado').on('click', function(){
|
||||
popErrorAlert(window.Presupuestos.errores.error_servicios_duplicados, 'serv-acabado-alert');
|
||||
}
|
||||
check_serv_acabado_error();
|
||||
showBreadCrumbSaveButton(true);
|
||||
|
||||
})
|
||||
|
||||
|
||||
@ -1298,13 +1301,16 @@ function servicioFerro(){
|
||||
}
|
||||
|
||||
$('#insertar_serv_preimpresion').on('click', function(){
|
||||
const tarifa_text = $('#add_servicio_preimpresion_list').select2('data')[0].text.trim()
|
||||
|
||||
if( $('#add_servicio_preimpresion_list').select2('data')[0].text.trim().length > 0){
|
||||
if($('#tableOfServiciosPreimpresion tr > td:contains(' + tarifa_text + ')').length == 0)
|
||||
get_tarifas_preimpresion($('#add_servicio_preimpresion_list').select2('data')[0].id);
|
||||
else{
|
||||
popErrorAlert(window.Presupuestos.errores.error_servicios_duplicados, 'serv-preimpresion-alert')
|
||||
|
||||
let data = $('#add_servicio_preimpresion_list').select2('data');
|
||||
if (data.length > 0) {
|
||||
const tarifa_text = data[0].text.trim();
|
||||
if (tarifa_text.length > 0) {
|
||||
if ($('#tableOfServiciosPreimpresion tr > td:contains(' + tarifa_text + ')').length == 0)
|
||||
get_tarifas_preimpresion(data[0].id);
|
||||
else {
|
||||
popErrorAlert(window.Presupuestos.errores.error_servicios_duplicados, 'serv-preimpresion-alert');
|
||||
}
|
||||
}
|
||||
}
|
||||
check_serv_preimpresion_error()
|
||||
|
||||
@ -852,7 +852,7 @@ var tableLineasPresupuesto = new DataTable('#tableLineasPresupuesto',{
|
||||
var select = $('<select>')
|
||||
.attr('id', row.row_id + '_gramaje')
|
||||
.attr('name', row.row_id + '_gramaje')
|
||||
.addClass('form-control form-select-sm lp-cell lp-select ' + row.row_class + '-select')
|
||||
.addClass('form-control form-select-sm lp-cell lp-select ' )//+ row.row_class + '-select')
|
||||
.css('min-width', '40px')
|
||||
|
||||
var option = '<option value="" selected>'+ parseInt(data)+'</option>';
|
||||
@ -1504,7 +1504,20 @@ $('#btn_addLinea').on("click", function (e) {
|
||||
/***********************
|
||||
* Funciones LP BN
|
||||
************************/
|
||||
async function set_lp_bn_gramaje(){
|
||||
function change_papelGenerico_lp_bn(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_bn_papel option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_bn(true)
|
||||
set_lp_bn_gramaje()
|
||||
}
|
||||
}
|
||||
|
||||
async function set_lp_bn_gramaje(mantenerSeleccion = false){
|
||||
|
||||
var previous = $('#lp_bn_gramaje option:selected').text()
|
||||
$('#lp_bn_gramaje').data('val', previous);
|
||||
|
||||
var datos = {
|
||||
tipo: 'gramajeLineasPresupuesto',
|
||||
uso: 'interior',
|
||||
@ -1517,7 +1530,7 @@ async function set_lp_bn_gramaje(){
|
||||
type: 'post',
|
||||
url: window.routes_lp.menuItemsOfCosidotapablanda,
|
||||
beforeSend: function() {
|
||||
clear_lp_bn(true)
|
||||
$('#lp_bn_gramaje').empty()
|
||||
},
|
||||
data: datos,
|
||||
dataType: 'json',
|
||||
@ -1527,14 +1540,21 @@ async function set_lp_bn_gramaje(){
|
||||
var option = $('<option/>', {'value':data.menu[item].id, 'text':data.menu[item].text})
|
||||
$('#lp_bn_gramaje').append(option);
|
||||
});
|
||||
$('#lp_bn_gramaje').val('')
|
||||
if(mantenerSeleccion){
|
||||
$('#lp_bn_gramaje option').filter(function() {
|
||||
return $(this).html() == previous;
|
||||
}).prop('selected', true);
|
||||
}
|
||||
else{
|
||||
$('#lp_bn_gramaje').val('')
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async function set_lp_bn_papelImpresion(){
|
||||
|
||||
var datos = {
|
||||
@ -1831,8 +1851,16 @@ function fill_lp_bn(row, fromComparator=false){
|
||||
}
|
||||
|
||||
function eventos_lp_bn(isInkjet = false){
|
||||
$('#lp_bn_papel').bind("focus", {clear_selectors: true}, clear_lp_bn);
|
||||
$('#lp_bn_gramaje').bind("focus", set_lp_bn_gramaje);
|
||||
|
||||
$('#lp_bn_papel').bind("change", change_papelGenerico_lp_bn);
|
||||
$('#lp_bn_gramaje').bind("focus", {mantenerSeleccion: true}, set_lp_bn_gramaje);
|
||||
$('#lp_bn_gramaje').on('change', function(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_bn_gramaje option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_bn(true)
|
||||
}
|
||||
});
|
||||
$('#lp_bn_papelImpresion').focus("focus", set_lp_bn_papelImpresion);
|
||||
$('#lp_bn_maquina').bind("focus", set_lp_bn_maquina);
|
||||
$('#lp_bn_maquina').bind("change", change_lp_bn_maquina);
|
||||
@ -1850,7 +1878,20 @@ function eventos_lp_bn(isInkjet = false){
|
||||
/***********************
|
||||
* Funciones LP COLOR
|
||||
************************/
|
||||
async function set_lp_color_gramaje(){
|
||||
function change_papelGenerico_lp_color(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_color_papel option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_color(true)
|
||||
set_lp_color_gramaje()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function set_lp_color_gramaje(mantenerSeleccion = false){
|
||||
|
||||
var previous = $('#lp_color_gramaje option:selected').text()
|
||||
$('#lp_color_gramaje').data('val', previous);
|
||||
|
||||
var datos = {
|
||||
tipo: 'gramajeLineasPresupuesto',
|
||||
@ -1864,7 +1905,7 @@ async function set_lp_color_gramaje(){
|
||||
type: 'post',
|
||||
url: window.routes_lp.menuItemsOfCosidotapablanda,
|
||||
beforeSend: function() {
|
||||
clear_lp_color(true)
|
||||
$('#lp_color_gramaje').empty()
|
||||
},
|
||||
data: datos,
|
||||
dataType: 'json',
|
||||
@ -1874,7 +1915,14 @@ async function set_lp_color_gramaje(){
|
||||
var option = $('<option/>', {'value':data.menu[item].id, 'text':data.menu[item].text})
|
||||
$('#lp_color_gramaje').append(option);
|
||||
});
|
||||
$('#lp_color_gramaje').val('')
|
||||
if(mantenerSeleccion){
|
||||
$('#lp_color_gramaje option').filter(function() {
|
||||
return $(this).html() == previous;
|
||||
}).prop('selected', true);
|
||||
}
|
||||
else{
|
||||
$('#lp_color_gramaje').val('')
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -2169,8 +2217,15 @@ function fill_lp_color(row, fromComparator=false){
|
||||
|
||||
function eventos_lp_color(isInkjet = false){
|
||||
|
||||
$('#lp_color_papel').bind("focus", {clear_selectors: true}, clear_lp_color);
|
||||
$('#lp_color_gramaje').bind("focus", set_lp_color_gramaje);
|
||||
$('#lp_color_papel').bind("change", change_papelGenerico_lp_color);
|
||||
$('#lp_color_gramaje').bind("focus", {mantenerSeleccion: true}, set_lp_color_gramaje);
|
||||
$('#lp_color_gramaje').on('change', function(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_color_gramaje option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_color(true)
|
||||
}
|
||||
});
|
||||
$('#lp_color_papelImpresion').focus("focus", set_lp_color_papelImpresion);
|
||||
$('#lp_color_maquina').bind("focus", set_lp_color_maquina);
|
||||
$('#lp_color_maquina').bind("change", change_lp_color_maquina);
|
||||
@ -2189,7 +2244,20 @@ function eventos_lp_color(isInkjet = false){
|
||||
/***********************
|
||||
* Funciones LP BNHQ
|
||||
************************/
|
||||
async function set_lp_bnhq_gramaje(){
|
||||
function change_papelGenerico_lp_bnhq(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_bnhq_papel option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_bnhq(true)
|
||||
set_lp_bnhq_gramaje()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function set_lp_bnhq_gramaje(mantenerSeleccion = false){
|
||||
|
||||
var previous = $('#lp_bnhq_gramaje option:selected').text()
|
||||
$('#lp_bnhq_gramaje').data('val', previous);
|
||||
|
||||
var datos = {
|
||||
tipo: 'gramajeLineasPresupuesto',
|
||||
@ -2203,7 +2271,7 @@ async function set_lp_bnhq_gramaje(){
|
||||
type: 'post',
|
||||
url: window.routes_lp.menuItemsOfCosidotapablanda,
|
||||
beforeSend: function() {
|
||||
clear_lp_bnhq(true)
|
||||
$('#lp_bnhq_gramaje').empty()
|
||||
},
|
||||
data: datos,
|
||||
dataType: 'json',
|
||||
@ -2213,7 +2281,14 @@ async function set_lp_bnhq_gramaje(){
|
||||
var option = $('<option/>', {'value':data.menu[item].id, 'text':data.menu[item].text})
|
||||
$('#lp_bnhq_gramaje').append(option);
|
||||
});
|
||||
$('#lp_bnhq_gramaje').val('')
|
||||
if(mantenerSeleccion){
|
||||
$('#lp_bnhq_gramaje option').filter(function() {
|
||||
return $(this).html() == previous;
|
||||
}).prop('selected', true);
|
||||
}
|
||||
else{
|
||||
$('#lp_bnhq_gramaje').val('')
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -2507,8 +2582,15 @@ function fill_lp_bnhq(row, fromComparator=false){
|
||||
}
|
||||
|
||||
function eventos_lp_bnhq(isInkjet = false){
|
||||
$('#lp_bnhq_papel').bind("focus", {clear_selectors: true}, clear_lp_bnhq);
|
||||
$('#lp_bnhq_gramaje').bind("focus", set_lp_bnhq_gramaje);
|
||||
$('#lp_bnhq_papel').bind("change", change_papelGenerico_lp_bnhq);
|
||||
$('#lp_bnhq_gramaje').bind("focus", {mantenerSeleccion: true}, set_lp_bnhq_gramaje);
|
||||
$('#lp_bnhq_gramaje').on('change', function(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_bnhq_gramaje option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_bnhq(true)
|
||||
}
|
||||
});
|
||||
$('#lp_bnhq_papelImpresion').focus("focus", set_lp_bnhq_papelImpresion);
|
||||
$('#lp_bnhq_maquina').bind("focus", set_lp_bnhq_maquina);
|
||||
$('#lp_bnhq_maquina').bind("change", change_lp_bnhq_maquina);
|
||||
@ -2526,7 +2608,20 @@ function eventos_lp_bnhq(isInkjet = false){
|
||||
/***********************
|
||||
* Funciones LP COLORHQ
|
||||
************************/
|
||||
async function set_lp_colorhq_gramaje(){
|
||||
function change_papelGenerico_lp_colorhq(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_colorhq_papel option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_colorhq(true)
|
||||
set_lp_colorhq_gramaje()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function set_lp_colorhq_gramaje(mantenerSeleccion = false){
|
||||
|
||||
var previous = $('#lp_colorhq_gramaje option:selected').text()
|
||||
$('#lp_colorhq_gramaje').data('val', previous);
|
||||
|
||||
var datos = {
|
||||
tipo: 'gramajeLineasPresupuesto',
|
||||
@ -2540,7 +2635,7 @@ async function set_lp_colorhq_gramaje(){
|
||||
type: 'post',
|
||||
url: window.routes_lp.menuItemsOfCosidotapablanda,
|
||||
beforeSend: function() {
|
||||
clear_lp_colorhq(true)
|
||||
$('#lp_colorhq_gramaje').empty()
|
||||
},
|
||||
data: datos,
|
||||
dataType: 'json',
|
||||
@ -2550,14 +2645,19 @@ async function set_lp_colorhq_gramaje(){
|
||||
var option = $('<option/>', {'value':data.menu[item].id, 'text':data.menu[item].text})
|
||||
$('#lp_colorhq_gramaje').append(option);
|
||||
});
|
||||
$('#lp_colorhq_gramaje').val('')
|
||||
if(mantenerSeleccion){
|
||||
$('#lp_colorhq_gramaje option').filter(function() {
|
||||
return $(this).html() == previous;
|
||||
}).prop('selected', true);
|
||||
}
|
||||
else{
|
||||
$('#lp_colorhq_gramaje').val('')
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
async function set_lp_colorhq_papelImpresion(){
|
||||
|
||||
var datos = {
|
||||
@ -2854,8 +2954,15 @@ function fill_lp_colorhq(row, fromComparator=false){
|
||||
|
||||
function eventos_lp_colorhq(isInkjet = false){
|
||||
|
||||
$('#lp_colorhq_papel').bind("focus", {clear_selectors: true}, clear_lp_colorhq);
|
||||
$('#lp_colorhq_gramaje').bind("focus", set_lp_colorhq_gramaje);
|
||||
$('#lp_colorhq_papel').bind("change", change_papelGenerico_lp_colorhq);
|
||||
$('#lp_colorhq_gramaje').bind("focus", {mantenerSeleccion: true}, set_lp_colorhq_gramaje);
|
||||
$('#lp_colorhq_gramaje').on('change', function(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_colorhq_gramaje option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_colorhq(true)
|
||||
}
|
||||
});
|
||||
$('#lp_colorhq_papelImpresion').focus("focus", set_lp_colorhq_papelImpresion);
|
||||
$('#lp_colorhq_maquina').bind("focus", set_lp_colorhq_maquina);
|
||||
$('#lp_colorhq_maquina').bind("change", change_lp_colorhq_maquina);
|
||||
@ -2874,7 +2981,18 @@ function eventos_lp_colorhq(isInkjet = false){
|
||||
/***********************
|
||||
* Funciones LP ROT_BN
|
||||
************************/
|
||||
async function set_lp_rot_bn_gramaje(){
|
||||
function change_papelGenerico_lp_rot_bn(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_rot_bn_papel option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_rot_bn(true)
|
||||
set_lp_rot_bn_gramaje()
|
||||
}
|
||||
}
|
||||
async function set_lp_rot_bn_gramaje(mantenerSeleccion = false){
|
||||
|
||||
var previous = $('#lp_rot_bn_gramaje option:selected').text()
|
||||
$('#lp_rot_bn_gramaje').data('val', previous);
|
||||
|
||||
var datos = {
|
||||
tipo: 'gramajeLineasPresupuesto',
|
||||
@ -2888,7 +3006,7 @@ async function set_lp_rot_bn_gramaje(){
|
||||
type: 'post',
|
||||
url: window.routes_lp.menuItemsOfCosidotapablanda,
|
||||
beforeSend: function() {
|
||||
clear_lp_rot_bn(true)
|
||||
$('#lp_rot_bn_gramaje').empty()
|
||||
},
|
||||
data: datos,
|
||||
dataType: 'json',
|
||||
@ -2898,7 +3016,13 @@ async function set_lp_rot_bn_gramaje(){
|
||||
var option = $('<option/>', {'value':data.menu[item].id, 'text':data.menu[item].text})
|
||||
$('#lp_rot_bn_gramaje').append(option);
|
||||
});
|
||||
$('#lp_rot_bn_gramaje').val('')
|
||||
if(mantenerSeleccion){
|
||||
const option = $("select#lp_rot_bn_gramaje option:equal('" + previous + "')");
|
||||
option.prop('selected', true);
|
||||
}
|
||||
else{
|
||||
$('#lp_rot_bn_gramaje').val('')
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -3203,8 +3327,15 @@ function fill_lp_rot_bn(row, fromComparador=false){
|
||||
}
|
||||
|
||||
function eventos_lp_rot_bn(){
|
||||
$('#lp_rot_bn_papel').bind("focus", {clear_selectors: true}, clear_lp_rot_bn);
|
||||
$('#lp_rot_bn_gramaje').bind("focus", set_lp_rot_bn_gramaje);
|
||||
$('#lp_rot_bn_papel').bind("change", change_papelGenerico_lp_rot_bn);
|
||||
$('#lp_rot_bn_gramaje').bind("focus", {mantenerSeleccion: true}, set_lp_rot_bn_gramaje);
|
||||
$('#lp_rot_bn_gramaje').on('change', function(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_rot_bn_gramaje option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_rot_bn(true)
|
||||
}
|
||||
});
|
||||
$('#lp_rot_bn_papelImpresion').focus("focus", set_lp_rot_bn_papelImpresion);
|
||||
$('#lp_rot_bn_maquina').bind("focus", set_lp_rot_bn_maquina);
|
||||
$('#lp_rot_bn_maquina').bind("change", change_lp_rot_bn_maquina);
|
||||
@ -3220,7 +3351,20 @@ function eventos_lp_rot_bn(){
|
||||
/***********************
|
||||
* Funciones LP ROT_COLOR
|
||||
************************/
|
||||
async function set_lp_rot_color_gramaje(){
|
||||
function change_papelGenerico_lp_rot_color(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_rot_color_papel option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_rot_color(true)
|
||||
set_lp_rot_color_gramaje()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function set_lp_rot_color_gramaje(mantenerSeleccion = false){
|
||||
|
||||
var previous = $('#lp_rot_color_gramaje option:selected').text()
|
||||
$('#lp_rot_color_gramaje').data('val', previous);
|
||||
|
||||
var datos = {
|
||||
tipo: 'gramajeLineasPresupuesto',
|
||||
@ -3234,7 +3378,7 @@ async function set_lp_rot_color_gramaje(){
|
||||
type: 'post',
|
||||
url: window.routes_lp.menuItemsOfCosidotapablanda,
|
||||
beforeSend: function() {
|
||||
clear_lp_rot_color(true)
|
||||
$('#lp_rot_color_gramaje').empty()
|
||||
},
|
||||
data: datos,
|
||||
dataType: 'json',
|
||||
@ -3244,7 +3388,13 @@ async function set_lp_rot_color_gramaje(){
|
||||
var option = $('<option/>', {'value':data.menu[item].id, 'text':data.menu[item].text})
|
||||
$('#lp_rot_color_gramaje').append(option);
|
||||
});
|
||||
$('#lp_rot_color_gramaje').val('')
|
||||
if(mantenerSeleccion){
|
||||
const option = $("select#lp_rot_color_gramaje option:equal('" + previous + "')");
|
||||
option.prop('selected', true);
|
||||
}
|
||||
else{
|
||||
$('#lp_rot_color_gramaje').val('')
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -3554,8 +3704,15 @@ function fill_lp_rot_color(row, fromComparador=false){
|
||||
}
|
||||
|
||||
function eventos_lp_rot_color(){
|
||||
$('#lp_rot_color_papel').bind("focus", {clear_selectors: true}, clear_lp_rot_color);
|
||||
$('#lp_rot_color_gramaje').bind("focus", set_lp_rot_color_gramaje);
|
||||
$('#lp_rot_color_papel').bind("change", change_papelGenerico_lp_rot_color);
|
||||
$('#lp_rot_color_gramaje').bind("focus", {mantenerSeleccion: true}, set_lp_rot_color_gramaje);
|
||||
$('#lp_rot_color_gramaje').on('change', function(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_rot_color_gramaje option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_rot_color(true)
|
||||
}
|
||||
});
|
||||
$('#lp_rot_color_papelImpresion').focus("focus", set_lp_rot_color_papelImpresion);
|
||||
$('#lp_rot_color_maquina').bind("focus", set_lp_rot_color_maquina);
|
||||
$('#lp_rot_color_maquina').bind("change", change_lp_rot_color_maquina);
|
||||
@ -3571,7 +3728,20 @@ function eventos_lp_rot_color(){
|
||||
/***********************
|
||||
* Funciones LP CUBIERTA
|
||||
************************/
|
||||
async function set_lp_cubierta_gramaje(){
|
||||
function change_papelGenerico_lp_cubierta(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_cubierta_papel option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_cubierta(true)
|
||||
set_lp_cubierta_gramaje()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function set_lp_cubierta_gramaje(mantenerSeleccion = false){
|
||||
|
||||
var previous = $('#lp_cubierta_gramaje option:selected').text()
|
||||
$('#lp_cubierta_gramaje').data('val', previous);
|
||||
|
||||
var datos = {
|
||||
tipo: 'gramajeLineasPresupuesto',
|
||||
@ -3585,7 +3755,7 @@ async function set_lp_cubierta_gramaje(){
|
||||
type: 'post',
|
||||
url: window.routes_lp.menuItemsOfCosidotapablanda,
|
||||
beforeSend: function() {
|
||||
clear_lp_cubierta(true)
|
||||
$('#lp_cubierta_gramaje').empty()
|
||||
},
|
||||
data: datos,
|
||||
dataType: 'json',
|
||||
@ -3595,7 +3765,14 @@ async function set_lp_cubierta_gramaje(){
|
||||
var option = $('<option/>', {'value':data.menu[item].id, 'text':data.menu[item].text})
|
||||
$('#lp_cubierta_gramaje').append(option);
|
||||
});
|
||||
$('#lp_cubierta_gramaje').val('')
|
||||
if(mantenerSeleccion){
|
||||
$('#lp_cubierta_gramaje option').filter(function() {
|
||||
return $(this).html() == previous;
|
||||
}).prop('selected', true);
|
||||
}
|
||||
else{
|
||||
$('#lp_cubierta_gramaje').val('')
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -3836,8 +4013,15 @@ function fill_lp_cubierta(row, fromComparador=false){
|
||||
|
||||
function eventos_lp_cubierta(){
|
||||
|
||||
$('#lp_cubierta_papel').bind("focus", {clear_selectors: true}, clear_lp_cubierta);
|
||||
$('#lp_cubierta_gramaje').bind("focus", set_lp_cubierta_gramaje);
|
||||
$('#lp_cubierta_papel').bind("change", change_papelGenerico_lp_cubierta);
|
||||
$('#lp_cubierta_gramaje').bind("focus", {mantenerSeleccion: true}, set_lp_cubierta_gramaje);
|
||||
$('#lp_cubierta_gramaje').on('change', function(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_cubierta_gramaje option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_cubierta(true)
|
||||
}
|
||||
});
|
||||
$('#lp_cubierta_papelImpresion').focus("focus", set_lp_cubierta_papelImpresion);
|
||||
$('#lp_cubierta_maquina').bind("focus", set_lp_cubierta_maquina);
|
||||
$('#lp_cubierta_maquina').bind("change", change_lp_cubierta_maquina);
|
||||
@ -3857,7 +4041,20 @@ function check_update_cubierta(){
|
||||
/***********************
|
||||
* Funciones LP SOBRECUBIERTA
|
||||
************************/
|
||||
async function set_lp_sobrecubierta_gramaje(){
|
||||
function change_papelGenerico_lp_sobrecubierta(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_sobrecubierta_papel option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_sobrecubierta(true)
|
||||
set_lp_sobrecubierta_gramaje()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function set_lp_sobrecubierta_gramaje(mantenerSeleccion = false){
|
||||
|
||||
var previous = $('#lp_sobrecubierta_gramaje option:selected').text()
|
||||
$('#lp_sobrecubierta_gramaje').data('val', previous);
|
||||
|
||||
var datos = {
|
||||
tipo: 'gramajeLineasPresupuesto',
|
||||
@ -3871,7 +4068,7 @@ async function set_lp_sobrecubierta_gramaje(){
|
||||
type: 'post',
|
||||
url: window.routes_lp.menuItemsOfCosidotapablanda,
|
||||
beforeSend: function() {
|
||||
clear_lp_sobrecubierta(true)
|
||||
$('#lp_sobrecubierta_gramaje').empty()
|
||||
},
|
||||
data: datos,
|
||||
dataType: 'json',
|
||||
@ -3881,7 +4078,14 @@ async function set_lp_sobrecubierta_gramaje(){
|
||||
var option = $('<option/>', {'value':data.menu[item].id, 'text':data.menu[item].text})
|
||||
$('#lp_sobrecubierta_gramaje').append(option);
|
||||
});
|
||||
$('#lp_sobrecubierta_gramaje').val('')
|
||||
if(mantenerSeleccion){
|
||||
$('#lp_sobrecubierta_gramaje option').filter(function() {
|
||||
return $(this).html() == previous;
|
||||
}).prop('selected', true);
|
||||
}
|
||||
else{
|
||||
$('#lp_sobrecubierta_gramaje').val('')
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -4108,8 +4312,15 @@ function fill_lp_sobrecubierta(row, fromComparador=false){
|
||||
|
||||
function eventos_lp_sobrecubierta(){
|
||||
|
||||
$('#lp_sobrecubierta_papel').bind("focus", {clear_selectors: true}, clear_lp_sobrecubierta);
|
||||
$('#lp_sobrecubierta_gramaje').bind("focus", set_lp_sobrecubierta_gramaje);
|
||||
$('#lp_sobrecubierta_papel').bind("change", change_papelGenerico_lp_sobrecubierta);
|
||||
$('#lp_sobrecubierta_gramaje').bind("focus", {mantenerSeleccion: true}, set_lp_sobrecubierta_gramaje);
|
||||
$('#lp_sobrecubierta_gramaje').on('change', function(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_sobrecubierta_gramaje option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_sobrecubierta(true)
|
||||
}
|
||||
});
|
||||
$('#lp_sobrecubierta_papelImpresion').focus("focus", set_lp_sobrecubierta_papelImpresion);
|
||||
$('#lp_sobrecubierta_maquina').bind("focus", set_lp_sobrecubierta_maquina);
|
||||
$('#lp_sobrecubierta_maquina').bind("change", change_lp_sobrecubierta_maquina);
|
||||
@ -4162,6 +4373,14 @@ function getLomoCubiertaLineasPresupuesto(){
|
||||
/***********************
|
||||
* Funciones LP GUARDAS
|
||||
************************/
|
||||
function change_papelGenerico_lp_guardas(){
|
||||
var previous = $(this).data('val');
|
||||
const selected = $("select#lp_guardas_papel option:selected");
|
||||
if(selected.text() != previous){
|
||||
clear_lp_guardas(true)
|
||||
}
|
||||
}
|
||||
|
||||
function clear_lp_guardas(clear_selectors){
|
||||
let pags = $("#lp_guardas_paginas option:selected" ).val()
|
||||
$(".lp-guardas-input" ).val("0")
|
||||
@ -4315,7 +4534,7 @@ function fill_lp_guardas(row, fromComparador=false){
|
||||
|
||||
function eventos_lp_guardas(isInkjet = false){
|
||||
|
||||
$('#lp_guardas_papel').bind("focus", {clear_selectors: true}, clear_lp_guardas);
|
||||
$('#lp_guardas_papel').bind("change", change_papelGenerico_lp_guardas);
|
||||
$('#lp_guardas_papelImpresion').focus("focus", set_lp_guardas_papelImpresion);
|
||||
$('#lp_guardas_maquina').bind("focus", set_lp_guardas_maquina);
|
||||
$('#lp_guardas_maquina').bind("change", calcularPresupuesto_guardas);
|
||||
|
||||
@ -61,6 +61,7 @@ $('#add_tirada_alt').on('click', function () {
|
||||
|
||||
const tirada_alt = parseInt($('#tirada_alt').val());
|
||||
add_tirada_alternativa(tirada_alt);
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
|
||||
@ -274,6 +275,7 @@ $(document).on('click', '.btn-delete-tirada', function (e) {
|
||||
tableTiradas.row(row)
|
||||
.remove()
|
||||
.draw();
|
||||
showBreadCrumbSaveButton(true);
|
||||
})
|
||||
|
||||
|
||||
|
||||
@ -214,65 +214,49 @@
|
||||
<!------------------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
|
||||
// Obtener todos los campos de entrada del formulario
|
||||
const formInputs = document.querySelectorAll('input, textarea, select');
|
||||
$(window).on('load', function() {
|
||||
|
||||
//console.log(formInputs)
|
||||
|
||||
// Crear un objeto para almacenar los valores originales
|
||||
const originalValues = {};
|
||||
|
||||
// Guardar los valores originales
|
||||
formInputs.forEach(function(input) {
|
||||
if (input.type === 'checkbox') {
|
||||
originalValues[input.id] = input.checked;
|
||||
} else {
|
||||
originalValues[input.id] = input.tagName.toLowerCase() === 'select'
|
||||
? $(input).val() // jQuery para obtener el valor de un select2
|
||||
: input.value;
|
||||
}
|
||||
// Detectar cambios en inputs de texto
|
||||
$('input[type="text"]').on('input', function() {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
|
||||
// Agregar un evento de cambio a cada campo de entrada
|
||||
formInputs.forEach(function(input) {
|
||||
if (input.tagName.toLowerCase() === 'select' && $(input).data('select2')) {
|
||||
// Para elementos select2
|
||||
$(input).on('change', function() {
|
||||
verificarCambios();
|
||||
});
|
||||
} else {
|
||||
// Para otros tipos de campos
|
||||
input.addEventListener('input', function() {
|
||||
verificarCambios();
|
||||
});
|
||||
}
|
||||
// Detectar cambios en inputs de texto
|
||||
$('input[type="number"]').on('input', function() {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
function verificarCambios() {
|
||||
// Verificar si hay cambios con respecto a los originales
|
||||
var cambiosDetectados = Array.from(formInputs).some(function(input) {
|
||||
return input.type === 'checkbox'
|
||||
? input.checked !== originalValues[input.id]
|
||||
: input.tagName.toLowerCase() === 'select'
|
||||
? $(input).val() !== originalValues[input.id]
|
||||
: input.value !== originalValues[input.id];
|
||||
});
|
||||
// Detectar cambios en select
|
||||
$('select').change(function() {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Mostrar alerta solo si hay cambios
|
||||
if (cambiosDetectados) {
|
||||
showBreadCrumbSaveButton(true);
|
||||
}else{
|
||||
showBreadCrumbSaveButton(false);
|
||||
}
|
||||
}
|
||||
// Detectar cambios en checkboxes
|
||||
$('input[type="checkbox"]').change(function() {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
$('#bc-save').on( "click", function() {
|
||||
showBreadCrumbSaveButton(false);
|
||||
$('#saveForm').click()
|
||||
} );
|
||||
// Detectar cambios en textareas
|
||||
$('textarea').on('input', function() {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en otros tipos de input
|
||||
$('input[type="radio"]').change(function() {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en otros tipos de input
|
||||
$('input:not([type])').on('input', function() {
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#bc-save').on( "click", function() {
|
||||
showBreadCrumbSaveButton(false);
|
||||
$('#saveForm').click()
|
||||
} );
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
@ -7,21 +7,7 @@
|
||||
</label>
|
||||
<input type="text" id="nombre" name="nombre" maxLength="255" class="form-control" value="<?=old('nombre', $tarifaEncuadernacionEntity->nombre) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="nombre" class="form-label">
|
||||
<?=lang('Tarifaencuadernacion.precioMin') ?>*
|
||||
</label>
|
||||
<input type="text" id="precio_min" name="precio_min" class="form-control" value="<?=old('precio_min', $tarifaEncuadernacionEntity->precio_min) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="nombre" class="form-label">
|
||||
<?=lang('Tarifaencuadernacion.importeFijo') ?>*
|
||||
</label>
|
||||
<input type="text" id="importe_fijo" name="importe_fijo" class="form-control" value="<?=old('importe_fijo', $tarifaEncuadernacionEntity->importe_fijo) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
</div><!--//.col -->
|
||||
</div><!-- //.row -->
|
||||
|
||||
|
||||
@ -49,6 +49,8 @@
|
||||
<th><?= lang('TarifaEncuadernacionTiradas.proveedor') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionTiradas.tiradaMin') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionTiradas.tiradaMax') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.precioMin') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.importeFijo') ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -78,9 +80,9 @@
|
||||
<th>ID</th>
|
||||
<th><?= lang('TarifaEncuadernacionLineas.dimensiones') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionLineas.paginasMin') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionLineas.precioMax') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionLineas.paginasMax') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionLineas.precioMin') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionLineas.paginasMax') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionLineas.precioMax') ?></th>
|
||||
<th><?= lang('TarifaEncuadernacionLineas.margen') ?></th>
|
||||
<th style="min-width:100px"></th>
|
||||
</tr>
|
||||
@ -470,11 +472,11 @@
|
||||
{
|
||||
name: "paginas_libro_min"
|
||||
}, {
|
||||
name: "precio_max"
|
||||
name: "precio_min"
|
||||
}, {
|
||||
name: "paginas_libro_max"
|
||||
}, {
|
||||
name: "precio_min"
|
||||
name: "precio_max"
|
||||
}, {
|
||||
name: "margen"
|
||||
}, {
|
||||
@ -659,6 +661,10 @@
|
||||
name: "tirada_min"
|
||||
}, {
|
||||
name: "tirada_max"
|
||||
}, {
|
||||
name: "precio_min"
|
||||
}, {
|
||||
name: "importe_fijo"
|
||||
}, {
|
||||
"name": "tarifa_encuadernacion_id",
|
||||
"type": "hidden"
|
||||
@ -740,6 +746,8 @@
|
||||
},
|
||||
{ 'data': 'tirada_min' },
|
||||
{ 'data': 'tirada_max' },
|
||||
{ 'data': 'precio_min' },
|
||||
{ 'data': 'importe_fijo' },
|
||||
{
|
||||
data: actionBtns,
|
||||
className: 'row-edit dt-center'
|
||||
|
||||
@ -17,8 +17,6 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('Tarifaencuadernacion.nombre') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.precioMin') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.importeFijo') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.mostrar_en_presupuesto') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.tipo_encuadernacion') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.servicio_encuadernacion') ?></th>
|
||||
@ -90,8 +88,6 @@
|
||||
],
|
||||
columns : [
|
||||
{ 'data': 'nombre' },
|
||||
{ 'data': 'precio_min' },
|
||||
{ 'data': 'importe_fijo' },
|
||||
{ 'data': 'mostrar_en_presupuesto' },
|
||||
{ 'data': 'tipo_encuadernacion' },
|
||||
{ 'data': 'servicio_encuadernacion' },
|
||||
@ -100,7 +96,7 @@
|
||||
});
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
const boolCols = [3,4,5];
|
||||
const boolCols = [1,2,3];
|
||||
for (let coln of boolCols) {
|
||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
|
||||
@ -139,6 +139,19 @@ if (!empty($token) && $tfa == false) {
|
||||
</li>
|
||||
<!--/ Notification -->
|
||||
|
||||
<!-- Search Budgets -->
|
||||
<li class="nav-item navbar-dropdown dropdown me-3 me-xl-1">
|
||||
<a
|
||||
class="nav-link hide-arrow"
|
||||
href="<?= site_url('presupuestos/buscador'); ?>"
|
||||
title="Acceso directo a buscador de presupuestos"
|
||||
>
|
||||
<i class="ti ti-report-search ti-md"></i>
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<!--/ Search Budgets -->
|
||||
|
||||
<!-- View Mode links -->
|
||||
<li class="nav-item dropdown-shortcuts navbar-dropdown dropdown me-2 me-xl-0">
|
||||
<a
|
||||
|
||||
@ -372,6 +372,19 @@ if (!empty($token) && $tfa == false) {
|
||||
</li>
|
||||
<!--/ Notification -->
|
||||
|
||||
<!-- Search Budgets -->
|
||||
<li class="nav-item navbar-dropdown dropdown me-3 me-xl-1">
|
||||
<a
|
||||
class="nav-link hide-arrow"
|
||||
href="<?= site_url('presupuestos/buscador'); ?>"
|
||||
title="Acceso directo a buscador de presupuestos"
|
||||
>
|
||||
<i class="ti ti-report-search ti-md"></i>
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<!--/ Search Budgets -->
|
||||
|
||||
<!-- View Mode links -->
|
||||
<li class="nav-item dropdown-shortcuts navbar-dropdown dropdown me-2 me-xl-0">
|
||||
<a
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?= $this->section('additionalInlineJs') ?>
|
||||
<?= $this->section('globalJsFunctions') ?>
|
||||
|
||||
function showBreadCrumbSaveButton(showIt = false){
|
||||
if(showIt === true){
|
||||
|
||||
@ -134,6 +134,19 @@ if (!empty($token) && $tfa == false) {
|
||||
</li>
|
||||
<!--/ Notification -->
|
||||
|
||||
<!-- Search Budgets -->
|
||||
<li class="nav-item navbar-dropdown dropdown me-3 me-xl-1">
|
||||
<a
|
||||
class="nav-link hide-arrow"
|
||||
href="<?= site_url('presupuestos/buscador'); ?>"
|
||||
title="Acceso directo a buscador de presupuestos"
|
||||
>
|
||||
<i class="ti ti-report-search ti-md"></i>
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<!--/ Search Budgets -->
|
||||
|
||||
<!-- View Mode links -->
|
||||
<li class="nav-item dropdown-shortcuts navbar-dropdown dropdown me-2 me-xl-0">
|
||||
<a
|
||||
@ -346,6 +359,7 @@ if (isset($global_js_variables)) {
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
<?= $this->renderSection('globalJsFunctions') ?>
|
||||
|
||||
var theTable;
|
||||
var <?=csrf_token() ?? 'token'?>v = '<?= csrf_hash() ?>';
|
||||
|
||||
@ -139,6 +139,19 @@ if (!empty($token) && $tfa == false) {
|
||||
</li>
|
||||
<!--/ Notification -->
|
||||
|
||||
<!-- Search Budgets -->
|
||||
<li class="nav-item navbar-dropdown dropdown me-3 me-xl-1">
|
||||
<a
|
||||
class="nav-link hide-arrow"
|
||||
href="<?= site_url('presupuestos/buscador'); ?>"
|
||||
title="Acceso directo a buscador de presupuestos"
|
||||
>
|
||||
<i class="ti ti-report-search ti-md"></i>
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<!--/ Search Budgets -->
|
||||
|
||||
<!-- View Mode links -->
|
||||
<li class="nav-item dropdown-shortcuts navbar-dropdown dropdown me-2 me-xl-0">
|
||||
<a
|
||||
|
||||
@ -140,6 +140,19 @@ if (!empty($token) && $tfa == false) {
|
||||
</li>
|
||||
<!--/ Notification -->
|
||||
|
||||
<!-- Search Budgets -->
|
||||
<li class="nav-item navbar-dropdown dropdown me-3 me-xl-1">
|
||||
<a
|
||||
class="nav-link hide-arrow"
|
||||
href="<?= site_url('presupuestos/buscador'); ?>"
|
||||
title="Acceso directo a buscador de presupuestos"
|
||||
>
|
||||
<i class="ti ti-report-search ti-md"></i>
|
||||
|
||||
</a>
|
||||
</li>
|
||||
<!--/ Search Budgets -->
|
||||
|
||||
<!-- View Mode links -->
|
||||
<li class="nav-item dropdown-shortcuts navbar-dropdown dropdown me-2 me-xl-0">
|
||||
<a
|
||||
|
||||
Reference in New Issue
Block a user