mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en comparador
This commit is contained in:
@ -579,6 +579,9 @@ $routes->group('presupuestoadmin', ['namespace' => 'App\Controllers\Presupuestos
|
|||||||
$routes->post('datatable_2', 'Presupuestoadmin::datatable_2', ['as' => 'updateDataOfPresupuestoAdmin']);
|
$routes->post('datatable_2', 'Presupuestoadmin::datatable_2', ['as' => 'updateDataOfPresupuestoAdmin']);
|
||||||
$routes->post('allmenuitems', 'Presupuestoadmin::allItemsSelect', ['as' => 'select2ItemsOfPresupuestoAdmin']);
|
$routes->post('allmenuitems', 'Presupuestoadmin::allItemsSelect', ['as' => 'select2ItemsOfPresupuestoAdmin']);
|
||||||
$routes->post('menuitems', 'Presupuestoadmin::menuItems', ['as' => 'menuItemsOfPresupuestoAdmin']);
|
$routes->post('menuitems', 'Presupuestoadmin::menuItems', ['as' => 'menuItemsOfPresupuestoAdmin']);
|
||||||
|
|
||||||
|
$routes->get('papelgenerico', 'Presupuestoadmin::getPapelGenerico');
|
||||||
|
$routes->get('papelgramaje', 'Presupuestoadmin::getGramaje');
|
||||||
});
|
});
|
||||||
$routes->resource('presupuestoadmin', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestoadmin', 'except' => 'show,new,create,update']);
|
$routes->resource('presupuestoadmin', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Presupuestoadmin', 'except' => 'show,new,create,update']);
|
||||||
|
|
||||||
|
|||||||
@ -89,6 +89,8 @@ class Users extends \App\Controllers\GoBaseController
|
|||||||
|
|
||||||
// Marcar el username como NULL
|
// Marcar el username como NULL
|
||||||
$sanitizedData = $this->sanitized($postData, true);
|
$sanitizedData = $this->sanitized($postData, true);
|
||||||
|
$email = $sanitizedData['email'];
|
||||||
|
unset($sanitizedData['email']);
|
||||||
|
|
||||||
$noException = true;
|
$noException = true;
|
||||||
|
|
||||||
@ -100,7 +102,7 @@ class Users extends \App\Controllers\GoBaseController
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
// The Email is unique
|
// The Email is unique
|
||||||
if ($this->user_model->isEmailUnique($sanitizedData['email'])) {
|
if ($this->user_model->isEmailUnique($email)) {
|
||||||
|
|
||||||
// Crear el usuario si pasa la validación
|
// Crear el usuario si pasa la validación
|
||||||
$user = new \CodeIgniter\Shield\Entities\User([
|
$user = new \CodeIgniter\Shield\Entities\User([
|
||||||
@ -109,8 +111,6 @@ class Users extends \App\Controllers\GoBaseController
|
|||||||
'last_name' => $sanitizedData['last_name'],
|
'last_name' => $sanitizedData['last_name'],
|
||||||
'cliente_id' => $sanitizedData['cliente_id'],
|
'cliente_id' => $sanitizedData['cliente_id'],
|
||||||
'comments' => $sanitizedData['comments'],
|
'comments' => $sanitizedData['comments'],
|
||||||
'email' => $sanitizedData['email'],
|
|
||||||
'password' => $sanitizedData['password'],
|
|
||||||
'status' => $sanitizedData['status'] ?? 0,
|
'status' => $sanitizedData['status'] ?? 0,
|
||||||
'active' => $sanitizedData['active'] ?? 0,
|
'active' => $sanitizedData['active'] ?? 0,
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -336,15 +336,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
|
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
|
||||||
$this->viewData['incReiList'] = array('incidencia' => lang('Presupuestos.incidencia'), 'reimpresion' => lang('Presupuestos.reimpresion'), 'sin_cargo' => lang('Presupuestos.sinCargo'));
|
$this->viewData['incReiList'] = array('incidencia' => lang('Presupuestos.incidencia'), 'reimpresion' => lang('Presupuestos.reimpresion'), 'sin_cargo' => lang('Presupuestos.sinCargo'));
|
||||||
$this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
|
$this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
|
||||||
$this->viewData['papelGenericoNegroList'] = $this->getPapelGenericoNegro();
|
|
||||||
$this->viewData['papelGenericoNegroHQList'] = $this->getPapelGenericoNegroHQ();
|
|
||||||
$this->viewData['papelGenericoColorList'] = $this->getPapelGenericoColor();
|
|
||||||
$this->viewData['papelGenericoColorHQList'] = $this->getPapelGenericoColorHQ();
|
|
||||||
$this->viewData['papelGenericoCubiertaList'] = $this->getPapelGenericoCubierta();
|
|
||||||
$this->viewData['papelGenericoGuardasList'] = $this->getPapelGenericoGuardas();
|
|
||||||
$this->viewData['papelGenericoSobrecubiertaList'] = $this->getPapelGenericoSobreCubierta();
|
|
||||||
$this->viewData['papelGenericoRotativaNegroList'] = $this->getPapelGenericoRotativaNegro();
|
|
||||||
$this->viewData['papelGenericoRotativaColorList'] = $this->getPapelGenericoRotativaColor();
|
|
||||||
|
|
||||||
// Acabados exteriores
|
// Acabados exteriores
|
||||||
$this->viewData['acabadosCubierta'] = $this->getAcabadosCubierta();
|
$this->viewData['acabadosCubierta'] = $this->getAcabadosCubierta();
|
||||||
@ -475,6 +467,7 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
|
|
||||||
$modelPapelFormato = new PapelFormatoModel();
|
$modelPapelFormato = new PapelFormatoModel();
|
||||||
$modelCliente = new ClienteModel();
|
$modelCliente = new ClienteModel();
|
||||||
|
$modelPapelGenerico = new PapelGenericoModel();
|
||||||
|
|
||||||
|
|
||||||
$presupuesto = $this->model->find($id);
|
$presupuesto = $this->model->find($id);
|
||||||
@ -537,7 +530,12 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
$data['datosLibro']['fajaColor'] = $presupuesto->faja_color;
|
$data['datosLibro']['fajaColor'] = $presupuesto->faja_color;
|
||||||
|
|
||||||
$data['comparador']['tipo_impresion'] = $presupuesto->comp_tipo_impresion;
|
$data['comparador']['tipo_impresion'] = $presupuesto->comp_tipo_impresion;
|
||||||
$data['comparador']['json_data'] = $presupuesto->comparador_json_data;
|
$data['comparador']['json_data'] = json_decode($presupuesto->comparador_json_data, true);
|
||||||
|
foreach ($data['comparador']['json_data'] as &$item) {
|
||||||
|
$item['papel_nombre'] = $modelPapelGenerico->getNombre($item['papel_id'])['nombre'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$data['datosGenerales']['posPaginasColor'] = $presupuesto->comp_pos_paginas_color;
|
$data['datosGenerales']['posPaginasColor'] = $presupuesto->comp_pos_paginas_color;
|
||||||
@ -1231,105 +1229,99 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPapelGenerico(){
|
||||||
|
|
||||||
protected function getPapelGenericoRotativaNegro()
|
if ($this->request->isAJAX()) {
|
||||||
{
|
|
||||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
$POD_value = $this->getPOD();
|
||||||
$data = $model->getPapelForComparador('negro', false, false, true);
|
$tirada = $this->request->getGet("tirada");
|
||||||
array_unshift($data, (object)array(
|
$isPOD = intval($tirada)<=intval($POD_value);
|
||||||
"id" => 0,
|
|
||||||
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
$tipo_impresion_id = $this->request->getGet("tipo_impresion");
|
||||||
));
|
$tapa_dura = model('App\Models\Configuracion\TipoPresupuestoModel')->get_isTapaDura(intval($tipo_impresion_id));
|
||||||
return $data;
|
|
||||||
|
$tipo = $this->request->getGet("tipo");
|
||||||
|
|
||||||
|
$uso = $this->request->getGet("uso") ?? 'interior';
|
||||||
|
$cubierta = false;
|
||||||
|
if($uso=='cubierta'){
|
||||||
|
$cubierta = true;
|
||||||
|
}
|
||||||
|
$sobrecubierta = false;
|
||||||
|
if($uso=='sobrecubierta'){
|
||||||
|
$sobrecubierta = true;
|
||||||
|
}
|
||||||
|
$guardas = false;
|
||||||
|
if($uso=='guardas'){
|
||||||
|
$guardas = true;
|
||||||
|
}
|
||||||
|
$rotativa = false;
|
||||||
|
if($uso=='rotativa'){
|
||||||
|
$rotativa = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||||
|
$query = $model->getPapelForComparador($tipo, $cubierta, $sobrecubierta, $rotativa, $guardas, $tapa_dura, $isPOD);
|
||||||
|
if ($this->request->getGet("q")) {
|
||||||
|
$query->groupStart()
|
||||||
|
->orLike("lg_papel_generico.nombre", $this->request->getGet("q"))
|
||||||
|
->groupEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->response->setJSON($query->orderBy("t1.nombre", "asc")->get()->getResultObject());
|
||||||
|
} else {
|
||||||
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getPapelGenericoRotativaColor()
|
public function getGramaje(){
|
||||||
{
|
if ($this->request->isAJAX()) {
|
||||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
|
||||||
$data = $model->getPapelForComparador('color', false, false, true);
|
$papel_generico_id = $this->request->getGet("papel_generico");
|
||||||
array_unshift($data, (object)array(
|
|
||||||
"id" => 0,
|
$POD_value = $this->getPOD();
|
||||||
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
$tirada = $this->request->getGet("tirada");
|
||||||
));
|
$isPOD = intval($tirada)<=intval($POD_value);
|
||||||
return $data;
|
|
||||||
|
$tipo_impresion_id = $this->request->getGet("tipo_impresion");
|
||||||
|
$tapa_dura = model('App\Models\Configuracion\TipoPresupuestoModel')->get_isTapaDura(intval($tipo_impresion_id));
|
||||||
|
|
||||||
|
$tipo = $this->request->getGet("tipo");
|
||||||
|
|
||||||
|
$uso = $this->request->getGet("uso") ?? 'interior';
|
||||||
|
$cubierta = false;
|
||||||
|
if($uso=='cubierta'){
|
||||||
|
$cubierta = true;
|
||||||
|
}
|
||||||
|
$sobrecubierta = false;
|
||||||
|
if($uso=='sobrecubierta'){
|
||||||
|
$sobrecubierta = true;
|
||||||
|
}
|
||||||
|
$guardas = false;
|
||||||
|
if($uso=='guardas'){
|
||||||
|
$guardas = true;
|
||||||
|
}
|
||||||
|
$rotativa = false;
|
||||||
|
if($uso=='rotativa'){
|
||||||
|
$rotativa = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||||
|
$query = $model->getGramajeForComparador($tipo, $papel_generico_id, $cubierta, $sobrecubierta, $rotativa, $guardas, $tapa_dura, $isPOD);
|
||||||
|
if ($this->request->getGet("q")) {
|
||||||
|
$query->groupStart()
|
||||||
|
->orLike("lg_papel_generico.nombre", $this->request->getGet("q"))
|
||||||
|
->groupEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->response->setJSON($query->orderBy("t1.nombre", "asc")->get()->getResultObject());
|
||||||
|
} else {
|
||||||
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getPapelGenericoNegro()
|
|
||||||
{
|
|
||||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
|
||||||
$data = $model->getPapelForComparador('negro', false, false);
|
|
||||||
array_unshift($data, (object)array(
|
|
||||||
"id" => 0,
|
|
||||||
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
|
||||||
));
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getPapelGenericoNegroHQ()
|
|
||||||
{
|
|
||||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
|
||||||
$data = $model->getPapelForComparador('negrohq', false, false);
|
|
||||||
array_unshift($data, (object)array(
|
|
||||||
"id" => 0,
|
|
||||||
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
|
||||||
));
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getPapelGenericoColor()
|
|
||||||
{
|
|
||||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
|
||||||
$data = $model->getPapelForComparador('color', false, false);
|
|
||||||
array_unshift($data, (object)array(
|
|
||||||
"id" => 0,
|
|
||||||
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
|
||||||
));
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getPapelGenericoColorHQ()
|
|
||||||
{
|
|
||||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
|
||||||
$data = $model->getPapelForComparador('colorhq', false, false);
|
|
||||||
array_unshift($data, (object)array(
|
|
||||||
"id" => 0,
|
|
||||||
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
|
||||||
));
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getPapelGenericoCubierta()
|
|
||||||
{
|
|
||||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
|
||||||
$data = $model->getPapelForComparador('colorhq', true, false);
|
|
||||||
array_unshift($data, (object)array(
|
|
||||||
"id" => 0,
|
|
||||||
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
|
||||||
));
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getPapelGenericoGuardas()
|
|
||||||
{
|
|
||||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
|
||||||
$data = $model->getPapelForComparador('colorhq', false, false, false, true);
|
|
||||||
array_unshift($data, (object)array(
|
|
||||||
"id" => 0,
|
|
||||||
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
|
||||||
));
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getPapelGenericoSobreCubierta()
|
|
||||||
{
|
|
||||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
|
||||||
$data = $model->getPapelForComparador('colorhq', false, true);
|
|
||||||
array_unshift($data, (object)array(
|
|
||||||
"id" => 0,
|
|
||||||
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
|
||||||
));
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getServiciosPreimpresion()
|
protected function getServiciosPreimpresion()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,6 +13,7 @@ class UserEntity extends \CodeIgniter\Entity\Entity
|
|||||||
"status" => null,
|
"status" => null,
|
||||||
"status_message" => null,
|
"status_message" => null,
|
||||||
'active' => null,
|
'active' => null,
|
||||||
|
"comments" => null,
|
||||||
"last_active" => null,
|
"last_active" => null,
|
||||||
"created_at" => null,
|
"created_at" => null,
|
||||||
"updated_at" => null,
|
"updated_at" => null,
|
||||||
|
|||||||
@ -129,141 +129,185 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
|||||||
return empty($search)
|
return empty($search)
|
||||||
? $builder
|
? $builder
|
||||||
: $builder
|
: $builder
|
||||||
->groupStart()
|
->groupStart()
|
||||||
->like("t1.id", $search)
|
->like("t1.id", $search)
|
||||||
->orLike("t1.nombre", $search)
|
->orLike("t1.nombre", $search)
|
||||||
->orLike("t1.code", $search)
|
->orLike("t1.code", $search)
|
||||||
->orLike("t1.code_ot", $search)
|
->orLike("t1.code_ot", $search)
|
||||||
->orLike("t1.id", $search)
|
->orLike("t1.id", $search)
|
||||||
->orLike("t1.nombre", $search)
|
->orLike("t1.nombre", $search)
|
||||||
->orLike("t1.code", $search)
|
->orLike("t1.code", $search)
|
||||||
->orLike("t1.code_ot", $search)
|
->orLike("t1.code_ot", $search)
|
||||||
->groupEnd();
|
->groupEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getPapelForComparador($tipo, $is_cubierta = false, $is_sobrecubierta = false, $rotativa = false, $is_guardas = false, $mostrar_cliente = null)
|
public function getPapelForComparador(
|
||||||
{
|
$tipo,
|
||||||
|
$is_cubierta = false,
|
||||||
|
$is_sobrecubierta = false,
|
||||||
|
$rotativa = false,
|
||||||
|
$is_guardas = false,
|
||||||
|
$tapa_dura = false,
|
||||||
|
$POD = false
|
||||||
|
) {
|
||||||
/*
|
/*
|
||||||
1.-> Tipo impresion
|
1.-> Tipo impresion
|
||||||
2.-> Maquina
|
2.-> Maquina
|
||||||
3.-> Papeles impresion asociados a esa maquina
|
3.-> Papeles impresion asociados a esa maquina
|
||||||
4.-> papeles genericos que aparecen en esos papeles impresion
|
4.-> papeles genericos que aparecen en esos papeles impresion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ($POD == true && ($tipo == 'color' || $tipo == 'negro')) {
|
||||||
|
if ($tipo == 'color')
|
||||||
|
$tipo = 'colorhq';
|
||||||
|
else if ($tipo == 'negro')
|
||||||
|
$tipo = 'negrohq';
|
||||||
|
}
|
||||||
|
|
||||||
$builder = $this->db
|
$builder = $this->db
|
||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select(
|
->select(
|
||||||
"t1.id as id, t1.nombre AS nombre"
|
"t1.id as id, t1.nombre AS nombre",
|
||||||
// for debug, t2.nombre AS nombre_papel_impresion, t4.nombre AS maquina_nombre, t5.uso AS tarifa_uso, t5.tipo AS tarifa_tipo"
|
// for debug, t2.nombre AS nombre_papel_impresion, t4.nombre AS maquina_nombre, t5.uso AS tarifa_uso, t5.tipo AS tarifa_tipo"
|
||||||
)
|
)
|
||||||
->distinct('t1.id')
|
->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "inner")
|
||||||
->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "left")
|
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "inner")
|
||||||
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "left")
|
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "inner")
|
||||||
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "left")
|
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "inner")
|
||||||
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "left")
|
|
||||||
|
|
||||||
->where("t1.is_deleted", 0)
|
->where("t1.is_deleted", 0)
|
||||||
|
->where("t1.show_in_client", 1)
|
||||||
->where("t2.is_deleted", 0)
|
->where("t2.is_deleted", 0)
|
||||||
->where("t2.isActivo", 1)
|
->where("t2.isActivo", 1)
|
||||||
->where("t3.active", 1)
|
->where("t3.active", 1)
|
||||||
->where("t4.is_deleted", 0)
|
->where("t4.is_deleted", 0)
|
||||||
->where("t4.tipo", "impresion")
|
->where("t4.tipo", "impresion")
|
||||||
->where("t5.is_deleted", 0)
|
->where("t5.is_deleted", 0)
|
||||||
->where("t5.tipo", $tipo);
|
->where("t5.tipo", $tipo)
|
||||||
|
->distinct('t1.id');
|
||||||
|
|
||||||
|
// Validación adicional para asegurar que t1.id esté presente en las combinaciones con t3.active = 1
|
||||||
|
$builder->whereIn("t1.id", function ($subQuery) {
|
||||||
|
$subQuery->select("t1_inner.id")
|
||||||
|
->from("lg_papel_generico t1_inner")
|
||||||
|
->join("lg_papel_impresion t2_inner", "t2_inner.papel_generico_id = t1_inner.id", "inner")
|
||||||
|
->join("lg_maquina_papel_impresion t3_inner", "t3_inner.papel_impresion_id = t2_inner.id", "inner")
|
||||||
|
->where("t3_inner.active", 1);
|
||||||
|
});
|
||||||
|
|
||||||
if ($is_cubierta == true) {
|
if ($is_cubierta == true) {
|
||||||
|
|
||||||
$builder->where("t2.cubierta", 1);
|
$builder->where("t2.cubierta", 1);
|
||||||
$builder->where("t5.uso", 'cubierta');
|
$builder->where("t5.uso", 'cubierta');
|
||||||
}
|
if ($tapa_dura == true) {
|
||||||
|
$builder->where("t2.use_for_tapa_dura", 1);
|
||||||
if ($is_sobrecubierta == true) {
|
}
|
||||||
|
} else if ($is_sobrecubierta == true) {
|
||||||
$builder->where("t2.sobrecubierta", 1);
|
$builder->where("t2.sobrecubierta", 1);
|
||||||
$builder->where("t5.uso", 'sobrecubierta');
|
$builder->where("t5.uso", 'sobrecubierta');
|
||||||
}
|
} else if ($is_guardas == true) {
|
||||||
|
|
||||||
if ($is_cubierta == false && $is_sobrecubierta == false) {
|
|
||||||
$builder->where("t5.uso", 'interior');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($is_guardas == true) {
|
|
||||||
$builder->where("t2.guardas", 1);
|
$builder->where("t2.guardas", 1);
|
||||||
|
} else {
|
||||||
|
$builder->where("t2.interior", 1);
|
||||||
|
$builder->where("t5.uso", 'interior');
|
||||||
|
if ($tipo == 'negro' || $tipo == 'negrohq')
|
||||||
|
$builder->where("t2.bn", 1);
|
||||||
|
else if ($tipo == 'color' || $tipo == 'colorhq')
|
||||||
|
$builder->where("t2.color", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($rotativa == true) {
|
if ($tipo == 'colorhq' || $tipo == 'negrohq') {
|
||||||
|
$builder->where("t2.rotativa", 0);
|
||||||
|
} else if ($rotativa && $POD == false) {
|
||||||
$builder->where("t2.rotativa", 1);
|
$builder->where("t2.rotativa", 1);
|
||||||
|
} else if ($POD) {
|
||||||
|
$builder->where("t2.rotativa", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mostrar_cliente != null) {
|
//$query = $this->db->getLastQuery();
|
||||||
$builder->where("t1.show_in_client", $mostrar_cliente);
|
return $builder;
|
||||||
}
|
|
||||||
|
|
||||||
$data = $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
|
|
||||||
//var_dump($this->db->getLastQuery());
|
|
||||||
return $data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGramajeComparador(string $papel_generico_nombre = "", $uso = "", $ejemplares = 0)
|
public function getGramajeForComparador(
|
||||||
{
|
$tipo,
|
||||||
if ($uso == 'cubierta' || $uso == 'sobrecubierta')
|
$selected_papel_id,
|
||||||
$tipo = 'colorhq';
|
$is_cubierta = false,
|
||||||
else
|
$is_sobrecubierta = false,
|
||||||
$tipo = $uso; // color y colorhq valen para los dos
|
$rotativa = false,
|
||||||
if ($uso == 'bn')
|
$is_guardas = false,
|
||||||
$tipo = "negro";
|
$tapa_dura = false,
|
||||||
if ($uso == 'bnhq')
|
$POD = false
|
||||||
$tipo = "negrohq";
|
) {
|
||||||
|
if ($POD == true && ($tipo == 'color' || $tipo == 'negro')) {
|
||||||
|
if ($tipo == 'color')
|
||||||
|
$tipo = 'colorhq';
|
||||||
|
else if ($tipo == 'negro')
|
||||||
|
$tipo = 'negrohq';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$builder = $this->db
|
$builder = $this->db
|
||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select(
|
->select(
|
||||||
"t2.gramaje AS text"
|
"t2.gramaje as id, t2.gramaje as nombre",
|
||||||
|
// for debug, t2.nombre AS nombre_papel_impresion, t4.nombre AS maquina_nombre, t5.uso AS tarifa_uso, t5.tipo AS tarifa_tipo"
|
||||||
)
|
)
|
||||||
->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "left")
|
->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "inner")
|
||||||
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "left")
|
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "inner")
|
||||||
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "left")
|
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "inner")
|
||||||
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "left")
|
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "inner")
|
||||||
|
|
||||||
|
->where("t1.id", $selected_papel_id)
|
||||||
->where("t1.is_deleted", 0)
|
->where("t1.is_deleted", 0)
|
||||||
|
->where("t1.show_in_client", 1)
|
||||||
->where("t2.is_deleted", 0)
|
->where("t2.is_deleted", 0)
|
||||||
->where("t2.isActivo", 1)
|
->where("t2.isActivo", 1)
|
||||||
->where("t3.active", 1)
|
->where("t3.active", 1)
|
||||||
->where("t4.is_deleted", 0)
|
->where("t4.is_deleted", 0)
|
||||||
->where("t4.tipo", "impresion")
|
->where("t4.tipo", "impresion")
|
||||||
|
->where("t5.is_deleted", 0)
|
||||||
->where("t5.tipo", $tipo)
|
->where("t5.tipo", $tipo)
|
||||||
->where("t1.nombre", $papel_generico_nombre);
|
->distinct('t2.gramaje');
|
||||||
|
|
||||||
$uso_tarifa = 'interior';
|
// Validación adicional para asegurar que t1.id esté presente en las combinaciones con t3.active = 1
|
||||||
|
$builder->whereIn("t1.id", function ($subQuery) {
|
||||||
|
$subQuery->select("t1_inner.id")
|
||||||
|
->from("lg_papel_generico t1_inner")
|
||||||
|
->join("lg_papel_impresion t2_inner", "t2_inner.papel_generico_id = t1_inner.id", "inner")
|
||||||
|
->join("lg_maquina_papel_impresion t3_inner", "t3_inner.papel_impresion_id = t2_inner.id", "inner")
|
||||||
|
->where("t3_inner.active", 1);
|
||||||
|
});
|
||||||
|
|
||||||
if ($uso == 'bn' || $uso == 'bnhq')
|
if ($is_cubierta == true) {
|
||||||
$builder->where("t2.bn", 1);
|
|
||||||
else if ($uso == 'color' || $uso == 'colorhq')
|
|
||||||
$builder->where("t2.color", 1);
|
|
||||||
else if ($uso == 'cubierta') {
|
|
||||||
$uso_tarifa = 'cubierta';
|
|
||||||
$builder->where("t2.cubierta", 1);
|
$builder->where("t2.cubierta", 1);
|
||||||
} else if ($uso == 'sobrecubierta') {
|
$builder->where("t5.uso", 'cubierta');
|
||||||
$uso_tarifa = 'sobrecubierta';
|
if ($tapa_dura == true) {
|
||||||
|
$builder->where("t2.use_for_tapa_dura", 1);
|
||||||
|
}
|
||||||
|
} else if ($is_sobrecubierta == true) {
|
||||||
$builder->where("t2.sobrecubierta", 1);
|
$builder->where("t2.sobrecubierta", 1);
|
||||||
|
$builder->where("t5.uso", 'sobrecubierta');
|
||||||
|
} else if ($is_guardas == true) {
|
||||||
|
$builder->where("t2.guardas", 1);
|
||||||
|
} else {
|
||||||
|
$builder->where("t2.interior", 1);
|
||||||
|
$builder->where("t5.uso", 'interior');
|
||||||
|
if ($tipo == 'negro' || $tipo == 'negrohq')
|
||||||
|
$builder->where("t2.bn", 1);
|
||||||
|
else if ($tipo == 'color' || $tipo == 'colorhq')
|
||||||
|
$builder->where("t2.color", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$builder->where("t5.uso", $uso_tarifa);
|
if ($tipo == 'colorhq' || $tipo == 'negrohq') {
|
||||||
|
$builder->where("t2.rotativa", 0);
|
||||||
$builder->where("t4.min <=", $ejemplares);
|
} else if ($rotativa && $POD == false) {
|
||||||
$builder->where("t4.max >=", $ejemplares);
|
$builder->where("t2.rotativa", 1);
|
||||||
|
} else if ($POD) {
|
||||||
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
|
$builder->where("t2.rotativa", 0);
|
||||||
$id = 1;
|
|
||||||
foreach ($values as $value) {
|
|
||||||
$value->id = $id;
|
|
||||||
$id++;
|
|
||||||
}
|
}
|
||||||
$values_array = array_map(function ($value) {
|
|
||||||
return $value->text;
|
|
||||||
}, $values);
|
|
||||||
$unique_values = array_unique($values_array);
|
|
||||||
return array_values(array_intersect_key($values, $unique_values));
|
|
||||||
|
|
||||||
|
//$query = $this->db->getLastQuery();
|
||||||
|
return $builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
//tipo: negro, negrohq, color, colorhq
|
//tipo: negro, negrohq, color, colorhq
|
||||||
@ -323,7 +367,6 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
|||||||
}, $values);
|
}, $values);
|
||||||
$unique_values = array_unique($values_array);
|
$unique_values = array_unique($values_array);
|
||||||
return array_values(array_intersect_key($values, $unique_values));
|
return array_values(array_intersect_key($values, $unique_values));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -337,9 +380,9 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ($POD == true && ($tipo == 'color' || $tipo == 'negro')) {
|
if ($POD == true && ($tipo == 'color' || $tipo == 'negro')) {
|
||||||
if($tipo == 'color')
|
if ($tipo == 'color')
|
||||||
$tipo = 'colorhq';
|
$tipo = 'colorhq';
|
||||||
else if($tipo == 'negro')
|
else if ($tipo == 'negro')
|
||||||
$tipo = 'negrohq';
|
$tipo = 'negrohq';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +446,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
|||||||
if ($is_cubierta == true) {
|
if ($is_cubierta == true) {
|
||||||
$builder->where("t2.cubierta", 1);
|
$builder->where("t2.cubierta", 1);
|
||||||
$builder->where("t5.uso", 'cubierta');
|
$builder->where("t5.uso", 'cubierta');
|
||||||
if($tapa_dura == true){
|
if ($tapa_dura == true) {
|
||||||
$builder->where("t2.use_for_tapa_dura", 1);
|
$builder->where("t2.use_for_tapa_dura", 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -417,19 +460,16 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
|||||||
|
|
||||||
if ($papel_especial == true) {
|
if ($papel_especial == true) {
|
||||||
$builder->where("t1.show_in_client_special", 1);
|
$builder->where("t1.show_in_client_special", 1);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$builder->where("t1.show_in_client_special", 0);
|
$builder->where("t1.show_in_client_special", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($tipo == 'colorhq' || $tipo == 'negrohq') {
|
if ($tipo == 'colorhq' || $tipo == 'negrohq') {
|
||||||
$builder->where("t2.rotativa", 0);
|
$builder->where("t2.rotativa", 0);
|
||||||
}
|
} else {
|
||||||
else{
|
if ($POD == false) {
|
||||||
if($POD == false){
|
|
||||||
$builder->where("t2.rotativa", 1);
|
$builder->where("t2.rotativa", 1);
|
||||||
}
|
} else if ($POD == true) {
|
||||||
else if ($POD == true){
|
|
||||||
$builder->where("t2.rotativa", 0);
|
$builder->where("t2.rotativa", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,14 +20,13 @@ class UserModel extends \App\Models\BaseModel
|
|||||||
|
|
||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
"username",
|
"username",
|
||||||
"email",
|
|
||||||
"first_name",
|
"first_name",
|
||||||
"last_name",
|
"last_name",
|
||||||
"client_id",
|
"client_id",
|
||||||
"status",
|
"status",
|
||||||
"status_message",
|
"status_message",
|
||||||
"active",
|
"active",
|
||||||
"country",
|
"comments",
|
||||||
"last_active",
|
"last_active",
|
||||||
"created_at",
|
"created_at",
|
||||||
"updated_at",
|
"updated_at",
|
||||||
@ -39,143 +38,25 @@ class UserModel extends \App\Models\BaseModel
|
|||||||
|
|
||||||
|
|
||||||
protected $validationRules = [
|
protected $validationRules = [
|
||||||
"address" => [
|
|
||||||
"label" => "Users.address",
|
|
||||||
"rules" => "trim|max_length[255]",
|
|
||||||
],
|
|
||||||
"blocked" => [
|
|
||||||
"label" => "Users.blocked",
|
|
||||||
"rules" => "required|permit_empty",
|
|
||||||
],
|
|
||||||
"city" => [
|
|
||||||
"label" => "Users.city",
|
|
||||||
"rules" => "trim|max_length[255]",
|
|
||||||
],
|
|
||||||
"country" => [
|
|
||||||
"label" => "Users.country",
|
|
||||||
"rules" => "trim|max_length[2]",
|
|
||||||
],
|
|
||||||
"date_birth" => [
|
|
||||||
"label" => "Users.dateBirth",
|
|
||||||
"rules" => "valid_date|permit_empty",
|
|
||||||
],
|
|
||||||
"email" => [
|
|
||||||
"label" => "Users.email",
|
|
||||||
"rules" => "trim|required|max_length[150]|valid_email",
|
|
||||||
],
|
|
||||||
"email_confirmed" => [
|
|
||||||
"label" => "Users.emailConfirmed",
|
|
||||||
"rules" => "required|integer",
|
|
||||||
],
|
|
||||||
"first_name" => [
|
"first_name" => [
|
||||||
"label" => "Users.firstName",
|
"label" => "Users.firstName",
|
||||||
"rules" => "trim|max_length[150]",
|
"rules" => "trim|max_length[150]",
|
||||||
],
|
],
|
||||||
"language" => [
|
|
||||||
"label" => "Users.language",
|
|
||||||
"rules" => "trim|max_length[10]",
|
|
||||||
],/*
|
|
||||||
"last_access" => [
|
|
||||||
"label" => "Users.lastAccess",
|
|
||||||
"rules" => "valid_date",
|
|
||||||
],*/
|
|
||||||
"last_ip" => [
|
|
||||||
"label" => "Users.lastIp",
|
|
||||||
"rules" => "max_length[50]",
|
|
||||||
],
|
|
||||||
"last_name" => [
|
"last_name" => [
|
||||||
"label" => "Users.lastName",
|
"label" => "Users.lastName",
|
||||||
"rules" => "trim|max_length[150]",
|
"rules" => "trim|max_length[150]",
|
||||||
],
|
],
|
||||||
"mobile" => [
|
|
||||||
"label" => "Users.mobile",
|
|
||||||
"rules" => "trim|max_length[50]",
|
|
||||||
],
|
|
||||||
"password" => [
|
|
||||||
"label" => "Users.password",
|
|
||||||
"rules" => "required|max_length[35]",
|
|
||||||
],
|
|
||||||
"picture" => [
|
|
||||||
"label" => "Users.picture",
|
|
||||||
"rules" => "trim|max_length[150]",
|
|
||||||
],
|
|
||||||
"state" => [
|
|
||||||
"label" => "Users.state",
|
|
||||||
"rules" => "trim|max_length[255]",
|
|
||||||
],
|
|
||||||
"zip_code" => [
|
|
||||||
"label" => "Users.zipCode",
|
|
||||||
"rules" => "trim|max_length[50]",
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $validationMessages = [
|
protected $validationMessages = [
|
||||||
"address" => [
|
|
||||||
"max_length" => "Users.validation.address.max_length",
|
|
||||||
],
|
|
||||||
|
|
||||||
"blocked" => [
|
|
||||||
"required" => "Users.validation.email_confirmed.required",
|
|
||||||
],
|
|
||||||
"city" => [
|
|
||||||
"max_length" => "Users.validation.city.max_length",
|
|
||||||
],
|
|
||||||
"country" => [
|
|
||||||
"max_length" => "Users.validation.country.max_length",
|
|
||||||
"required" => "Users.validation.country.required",
|
|
||||||
],
|
|
||||||
"date_birth" => [
|
|
||||||
"valid_date" => "Users.validation.date_birth.valid_date",
|
|
||||||
],
|
|
||||||
"email" => [
|
|
||||||
"max_length" => "Users.validation.email.max_length",
|
|
||||||
"required" => "Users.validation.email.required",
|
|
||||||
"valid_email" => "Users.validation.email.valid_email",
|
|
||||||
],
|
|
||||||
"email_confirmed" => [
|
|
||||||
"integer" => "Users.validation.email_confirmed.integer",
|
|
||||||
"required" => "Users.validation.email_confirmed.required",
|
|
||||||
],
|
|
||||||
"first_name" => [
|
"first_name" => [
|
||||||
"max_length" => "Users.validation.first_name.max_length",
|
"max_length" => "Users.validation.first_name.max_length",
|
||||||
"required" => "Users.validation.first_name.required",
|
"required" => "Users.validation.first_name.required",
|
||||||
],
|
],
|
||||||
|
|
||||||
"language" => [
|
|
||||||
"max_length" => "Users.validation.language.max_length",
|
|
||||||
"required" => "Users.validation.language.required",
|
|
||||||
],
|
|
||||||
"last_access" => [
|
|
||||||
"required" => "Users.validation.last_access.required",
|
|
||||||
"valid_date" => "Users.validation.last_access.valid_date",
|
|
||||||
],
|
|
||||||
"last_ip" => [
|
|
||||||
"max_length" => "Users.validation.last_ip.max_length",
|
|
||||||
"required" => "Users.validation.last_ip.required",
|
|
||||||
],
|
|
||||||
"last_name" => [
|
"last_name" => [
|
||||||
"max_length" => "Users.validation.last_name.max_length",
|
"max_length" => "Users.validation.last_name.max_length",
|
||||||
"required" => "Users.validation.last_name.required",
|
"required" => "Users.validation.last_name.required",
|
||||||
],
|
],
|
||||||
"mobile" => [
|
|
||||||
"max_length" => "Users.validation.mobile.max_length",
|
|
||||||
"required" => "Users.validation.mobile.required",
|
|
||||||
],
|
|
||||||
"password" => [
|
|
||||||
"max_length" => "Users.validation.password.max_length",
|
|
||||||
"required" => "Users.validation.password.required",
|
|
||||||
],
|
|
||||||
"picture" => [
|
|
||||||
"max_length" => "Users.validation.picture.max_length",
|
|
||||||
"required" => "Users.validation.picture.required",
|
|
||||||
],
|
|
||||||
"state" => [
|
|
||||||
"max_length" => "Users.validation.state.max_length",
|
|
||||||
"required" => "Users.validation.state.required",
|
|
||||||
],
|
|
||||||
"zip_code" => [
|
|
||||||
"max_length" => "Users.validation.zip_code.max_length",
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public function getGroupsTitles($user_token){
|
public function getGroupsTitles($user_token){
|
||||||
|
|||||||
@ -74,17 +74,10 @@
|
|||||||
<p><?= lang('MaquinasTarifasImpresions.negro') ?></p>
|
<p><?= lang('MaquinasTarifasImpresions.negro') ?></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 col-lg-2 px-4">
|
<div class="col-md-12 col-lg-2 px-4">
|
||||||
<input type="text" id="compPaginasNegro" name="comp_paginas_negro" placeholder="0" maxLength="5" class="form-control comp_negro_items" value="<?= isset($comp_data->bn->paginas) ? (old(0, $comp_data->bn->paginas)) : '0' ?>">
|
<input type="text" id="compPaginasNegro" name="comp_paginas_negro" placeholder="0" maxLength="5" class="form-control comp_negro_items" value="">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 col-lg-6 px-4">
|
<div class="col-md-12 col-lg-6 px-4">
|
||||||
<select id="compPapelNegro" name="comp_papel_negro" class="form-control select2bs2 comp_negro_items" style="width: 100%;">
|
<select id="compPapelNegro" name="comp_papel_negro" class="form-control select2bs2 comp_negro_items" style="width: 100%;">
|
||||||
<?php if (isset($papelGenericoNegroList) && is_array($papelGenericoNegroList) && !empty($papelGenericoNegroList)) :
|
|
||||||
foreach ($papelGenericoNegroList as $k => $v) : ?>
|
|
||||||
<option value="<?= $v->id ?>">
|
|
||||||
<?= $v->nombre ?>
|
|
||||||
</option>
|
|
||||||
<?php endforeach;
|
|
||||||
endif; ?>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 col-lg-2 px-4">
|
<div class="col-md-12 col-lg-2 px-4">
|
||||||
@ -578,161 +571,7 @@
|
|||||||
allowClear: false,
|
allowClear: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#compPapelNegro').select2({
|
|
||||||
allowClear: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#compGramajeNegro').select2({
|
|
||||||
|
|
||||||
allowClear: false,
|
|
||||||
minimumResultsForSearch: Infinity,
|
|
||||||
ajax: {
|
|
||||||
url: '<?= route_to("menuItemsOfPresupuestoAdmin") ?>',
|
|
||||||
type: 'post',
|
|
||||||
dataType: 'json',
|
|
||||||
|
|
||||||
data: function (params) {
|
|
||||||
return {
|
|
||||||
tipo: 'gramaje',
|
|
||||||
uso: 'bn',
|
|
||||||
tirada: parseInt($('#tirada').val()),
|
|
||||||
merma: parseInt($('#mermacubierta').val()),
|
|
||||||
datos: $('#compPapelNegro').select2('data')[0].text.trim() ,
|
|
||||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
|
||||||
};
|
|
||||||
},
|
|
||||||
delay: 60,
|
|
||||||
processResults: function (response) {
|
|
||||||
yeniden(response.<?= csrf_token() ?>);
|
|
||||||
return {
|
|
||||||
results: response.menu
|
|
||||||
};
|
|
||||||
},
|
|
||||||
cache: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#compPapelNegrohq').select2({
|
|
||||||
allowClear: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#compGramajeNegrohq').select2({
|
|
||||||
allowClear: false,
|
|
||||||
minimumResultsForSearch: Infinity,
|
|
||||||
ajax: {
|
|
||||||
url: '<?= route_to("menuItemsOfPresupuestoAdmin") ?>',
|
|
||||||
type: 'post',
|
|
||||||
dataType: 'json',
|
|
||||||
|
|
||||||
data: function (params) {
|
|
||||||
return {
|
|
||||||
tipo: 'gramaje',
|
|
||||||
uso: 'bnhq',
|
|
||||||
tirada: parseInt($('#tirada').val()),
|
|
||||||
merma: parseInt($('#mermacubierta').val()),
|
|
||||||
datos: $('#compPapelNegrohq').select2('data')[0].text.trim() ,
|
|
||||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
|
||||||
};
|
|
||||||
},
|
|
||||||
delay: 60,
|
|
||||||
processResults: function (response) {
|
|
||||||
yeniden(response.<?= csrf_token() ?>);
|
|
||||||
return {
|
|
||||||
results: response.menu
|
|
||||||
};
|
|
||||||
},
|
|
||||||
cache: true
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#compPapelColor').select2({
|
|
||||||
allowClear: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#compPapelColorhq').select2({
|
|
||||||
allowClear: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#compGramajeColor').select2({
|
|
||||||
allowClear: false,
|
|
||||||
minimumResultsForSearch: Infinity,
|
|
||||||
ajax: {
|
|
||||||
url: '<?= route_to("menuItemsOfPresupuestoAdmin") ?>',
|
|
||||||
type: 'post',
|
|
||||||
dataType: 'json',
|
|
||||||
|
|
||||||
data: function (params) {
|
|
||||||
return {
|
|
||||||
tipo: 'gramaje',
|
|
||||||
uso: 'color',
|
|
||||||
tirada: parseInt($('#tirada').val()),
|
|
||||||
merma: parseInt($('#mermacubierta').val()),
|
|
||||||
datos: $('#compPapelColor').select2('data')[0].text.trim() ,
|
|
||||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
|
||||||
};
|
|
||||||
},
|
|
||||||
delay: 60,
|
|
||||||
processResults: function (response) {
|
|
||||||
yeniden(response.<?= csrf_token() ?>);
|
|
||||||
return {
|
|
||||||
results: response.menu
|
|
||||||
};
|
|
||||||
},
|
|
||||||
cache: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#compGramajeColorhq').select2({
|
|
||||||
allowClear: false,
|
|
||||||
minimumResultsForSearch: Infinity,
|
|
||||||
ajax: {
|
|
||||||
url: '<?= route_to("menuItemsOfPresupuestoAdmin") ?>',
|
|
||||||
type: 'post',
|
|
||||||
|
|
||||||
data: function (params) {
|
|
||||||
return {
|
|
||||||
tipo: 'gramaje',
|
|
||||||
uso: 'colorhq',
|
|
||||||
tirada: parseInt($('#tirada').val()),
|
|
||||||
merma: parseInt($('#mermacubierta').val()),
|
|
||||||
datos: $('#compPapelColorhq').select2('data')[0].text.trim() ,
|
|
||||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
|
|
||||||
};
|
|
||||||
},
|
|
||||||
delay: 60,
|
|
||||||
processResults: function (response) {
|
|
||||||
yeniden(response.<?= csrf_token() ?>);
|
|
||||||
return {
|
|
||||||
results: response.menu
|
|
||||||
};
|
|
||||||
},
|
|
||||||
cache: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#compPapelCubierta').select2({
|
|
||||||
allowClear: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#compGramajeCubierta').select2({
|
|
||||||
allowClear: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#compPapelSobrecubierta').select2({
|
|
||||||
allowClear: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#compGramajeSobrecubierta').select2({
|
|
||||||
allowClear: false,
|
|
||||||
minimumResultsForSearch: Infinity,
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#encuadernacion').select2({
|
|
||||||
allowClear: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||||
$('#compCarasCubierta').select2({
|
$('#compCarasCubierta').select2({
|
||||||
allowClear: false,
|
allowClear: false,
|
||||||
@ -1543,6 +1382,7 @@
|
|||||||
|
|
||||||
function checkComparadorInt(is_color, is_hq, actualizarLineaPlana=false, actualizarLineaRot=false) {
|
function checkComparadorInt(is_color, is_hq, actualizarLineaPlana=false, actualizarLineaRot=false) {
|
||||||
|
|
||||||
|
/* TO-DO with select2 component
|
||||||
try{
|
try{
|
||||||
|
|
||||||
clearIntLineas(is_color);
|
clearIntLineas(is_color);
|
||||||
@ -1587,6 +1427,7 @@
|
|||||||
}catch(e){
|
}catch(e){
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -74,17 +74,17 @@
|
|||||||
<!-- Código JS de las lineas de presupuesto. -->
|
<!-- Código JS de las lineas de presupuesto. -->
|
||||||
<!------------------------------------------->
|
<!------------------------------------------->
|
||||||
<?= $this->section("additionalInlineJs") ?>
|
<?= $this->section("additionalInlineJs") ?>
|
||||||
window.papelGenericoNegroList = <?php echo json_encode($papelGenericoNegroList); ?>;
|
window.papelGenericoNegroList = [];
|
||||||
window.papelGenericoNegroHQList = <?php echo json_encode($papelGenericoNegroHQList); ?>;
|
window.papelGenericoNegroHQList = [];
|
||||||
window.papelGenericoColorList = <?php echo json_encode($papelGenericoColorList); ?>;
|
window.papelGenericoColorList = [];
|
||||||
window.papelGenericoColorHQList = <?php echo json_encode($papelGenericoColorHQList); ?>;
|
window.papelGenericoColorHQList = [];
|
||||||
window.papelGenericoCubiertaList = <?php echo json_encode($papelGenericoCubiertaList); ?>;
|
window.papelGenericoCubiertaList = [];
|
||||||
window.papelGenericoSobrecubiertaList = <?php echo json_encode($papelGenericoSobrecubiertaList); ?>;
|
window.papelGenericoSobrecubiertaList = [];
|
||||||
window.papelGenericoRotativaNegroList = <?php echo json_encode($papelGenericoRotativaNegroList); ?>;
|
window.papelGenericoRotativaNegroList = [];
|
||||||
window.papelGenericoRotativaColorList = <?php echo json_encode($papelGenericoRotativaColorList); ?>;
|
window.papelGenericoRotativaColorList = [];
|
||||||
|
|
||||||
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
<?php if($tipo_impresion_id == 1 || $tipo_impresion_id == 3 || $tipo_impresion_id == 5 || $tipo_impresion_id == 7): ?>
|
||||||
window.papelGenericoGuardasList = <?php echo json_encode($papelGenericoGuardasList); ?>;
|
window.papelGenericoGuardasList = [];
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
window.lineasPresupuestoList = <?php echo json_encode($lineasPresupuesto); ?>;
|
window.lineasPresupuestoList = <?php echo json_encode($lineasPresupuesto); ?>;
|
||||||
@ -95,8 +95,11 @@ window.routes_lp = {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
fill_lp_from_bbdd()
|
fill_lp_from_bbdd()
|
||||||
|
|
||||||
checkPaginasPresupuesto()
|
checkPaginasPresupuesto()
|
||||||
|
*/
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -309,7 +309,7 @@
|
|||||||
<script src="<?= site_url('js_loader/presupuestos_js') ?>"></script>
|
<script src="<?= site_url('js_loader/presupuestos_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/comparadorPresupuestoAdmin_js') ?>"></script>
|
<script src="<?= site_url('js_loader/comparadorPresupuestoAdmin_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/previsualizador_js') ?>"></script>
|
<script src="<?= site_url('js_loader/previsualizador_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/lineasPresupuesto_js') ?>"></script>
|
<!---<script src="<?= site_url('js_loader/lineasPresupuesto_js') ?>"></script> -->
|
||||||
<script src="<?= site_url('js_loader/tiradasAlternativas_js') ?>"></script>
|
<script src="<?= site_url('js_loader/tiradasAlternativas_js') ?>"></script>
|
||||||
<script src="<?= site_url('js_loader/datosServicios_js') ?>"></script>
|
<script src="<?= site_url('js_loader/datosServicios_js') ?>"></script>
|
||||||
<script src="<?= site_url('themes/vuexy/vendor/libs/two/two.js') ?>"></script>
|
<script src="<?= site_url('themes/vuexy/vendor/libs/two/two.js') ?>"></script>
|
||||||
|
|||||||
@ -79,6 +79,7 @@ class PresupuestoAdminEdit {
|
|||||||
|
|
||||||
self.datosGenerales.cargarDatos(response.data.datosGenerales);
|
self.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||||
self.datosLibro.cargarDatos(response.data.datosLibro);
|
self.datosLibro.cargarDatos(response.data.datosLibro);
|
||||||
|
self.comparador.cargarDatos(response.data.comparador);
|
||||||
|
|
||||||
/*self.direcciones.handleChangeCliente();
|
/*self.direcciones.handleChangeCliente();
|
||||||
|
|
||||||
|
|||||||
@ -15,20 +15,29 @@ class Comparador {
|
|||||||
|
|
||||||
this.paginasNegro = $('#compPaginasNegro');
|
this.paginasNegro = $('#compPaginasNegro');
|
||||||
this.papelNegro = new ClassSelect($('#compPapelNegro'),
|
this.papelNegro = new ClassSelect($('#compPapelNegro'),
|
||||||
'/papelesgenericos/getpapelcliente', 'Seleccione papel', false,
|
'/presupuestoadmin/papelgenerico', 'Seleccione papel', false,
|
||||||
{
|
{
|
||||||
[this.csrf_token]: this.csrf_hash,
|
[this.csrf_token]: this.csrf_hash,
|
||||||
|
tipo_impresion: this.tipo_impresion.val(),
|
||||||
tirada: $('#tirada').val(),
|
tirada: $('#tirada').val(),
|
||||||
tipo: 'negro',
|
tipo: 'negro',
|
||||||
cubierta: 0,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.gramajeNegro = $('#compGramajeNegro');
|
this.gramajeNegro = new ClassSelect($('#compGramajeNegro'),
|
||||||
|
'/presupuestoadmin/papelgramaje', 'Seleccione gramaje', false,
|
||||||
|
{
|
||||||
|
[this.csrf_token]: this.csrf_hash,
|
||||||
|
papel_generico: this.papelNegro.getVal(),
|
||||||
|
tipo_impresion: this.tipo_impresion.val(),
|
||||||
|
tirada: $('#tirada').val(),
|
||||||
|
tipo: 'negro',
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.papelNegro.init();
|
this.papelNegro.init();
|
||||||
|
this.gramajeNegro.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
cargarDatos(datos) {
|
cargarDatos(datos) {
|
||||||
@ -36,7 +45,11 @@ class Comparador {
|
|||||||
this.tipo_impresion.val(datos.tipo_impresion);
|
this.tipo_impresion.val(datos.tipo_impresion);
|
||||||
this.comparador_json.val(JSON.stringify(datos.json_data));
|
this.comparador_json.val(JSON.stringify(datos.json_data));
|
||||||
|
|
||||||
//if (datos.json_data.bn)
|
if (datos.json_data.bn){
|
||||||
|
this.paginasNegro.val(datos.json_data.bn.paginas);
|
||||||
|
this.papelNegro.setOption(datos.json_data.bn.papel_id, datos.json_data.bn.papel_nombre);
|
||||||
|
this.gramajeNegro.setOption(datos.json_data.bn.gramaje, datos.json_data.bn.gramaje);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user