mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Compare commits
2 Commits
feat/tipo_
...
ee594effcf
| Author | SHA1 | Date | |
|---|---|---|---|
| ee594effcf | |||
| e0190fa03c |
@ -36,7 +36,7 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
|
||||
$routes->post('allmenuitems', 'Papelesgenericos::allItemsSelect', ['as' => 'select2ItemsOfPapelesGenericos']);
|
||||
$routes->post('menuitems', 'Papelesgenericos::menuItems', ['as' => 'menuItemsOfPapelesGenericos']);
|
||||
$routes->get('getpapelcliente', 'Papelesgenericos::getPapelCliente', ['as' => 'getPapelCliente']);
|
||||
$routes->get('gettipopapel', 'Papelesgenericos::getTipoPapelCliente');
|
||||
$routes->get('selectpapelespecial', 'Papelesgenericos::selectPapelEspecial', ['as' => 'selectPapelEspecial']);
|
||||
});
|
||||
|
||||
/* Papeles impresion */
|
||||
@ -53,7 +53,6 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
|
||||
$routes->post('duplicate/(:num)', 'Papelesimpresion::duplicate/$1', ['as' => 'duplicatePapelImpresion']);
|
||||
$routes->get('select', 'Papelesimpresion::papel_impresion_select', ['as' => 'papelImpresionSelect']);
|
||||
$routes->get('show/(:num)', 'Papelesimpresion::papel_impresion_find/$1', ['as' => 'showPapelImpresion']);
|
||||
$routes->get('getgramajecliente', 'Papelesimpresion::getGramajeCliente', ['as' => 'getGramajeCliente']);
|
||||
});
|
||||
|
||||
/* Maquinas */
|
||||
|
||||
@ -38,6 +38,7 @@ class ConfigVariables extends BaseResourceController
|
||||
|
||||
public function index()
|
||||
{
|
||||
checkPermission('variables-sistema.menu');
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
@ -60,6 +61,8 @@ class ConfigVariables extends BaseResourceController
|
||||
}
|
||||
public function updateVariable(int $config_variable_id)
|
||||
{
|
||||
checkPermission('variables-sistema.edit');
|
||||
|
||||
$reqData = [];
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
@ -42,11 +42,16 @@ class FestivoController extends BaseController
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
checkPermission('festivos.menu');
|
||||
|
||||
return view($this->viewPath . $this->indexRoute);
|
||||
}
|
||||
|
||||
public function store_festivo_date()
|
||||
{
|
||||
checkPermission('festivos.edit');
|
||||
|
||||
$bodyData = $this->request->getPost();
|
||||
$date = $bodyData['date'];
|
||||
$count = $this->model->where('date',$date)->countAllResults();
|
||||
|
||||
@ -305,36 +305,114 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getTipoPapelCliente(){
|
||||
|
||||
if($this->request->isAJAX()) {
|
||||
|
||||
$data_input = $this->request->getGet();
|
||||
$result = $this->papelService->getTiposPalelGenerico((object)$data_input);
|
||||
|
||||
foreach ($result as $key => $value) {
|
||||
$result[$key]->texto = strtoupper(lang('PapelGenerico.' . $value->nombre));
|
||||
}
|
||||
|
||||
return $this->respond($result);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getPapelCliente()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$data_input = $this->request->getGet();
|
||||
$result = $this->papelService->getPapelGenerico((object)$data_input);
|
||||
|
||||
return $this->respond($result);
|
||||
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
||||
$POD = null;
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||
$selected_papel = goSanitize($this->request->getGet('papel'))[0] ?? null;
|
||||
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
||||
$tapa_dura = goSanitize($this->request->getGet('tapa_dura'))[0] ?? null;
|
||||
$sobrecubierta = goSanitize($this->request->getGet('sobrecubierta'))[0] ?? 0;
|
||||
$guardas = goSanitize($this->request->getGet('guardas'))[0] ?? 0;
|
||||
|
||||
$ancho = floatval($this->request->getGet('ancho') ?? 0);
|
||||
$alto = floatval($this->request->getGet('alto') ?? 0);
|
||||
$solapas = floatval($this->request->getGet('solapas') ?? 0);
|
||||
$lomo = floatval($this->request->getGet('lomo') ?? 0);
|
||||
|
||||
$forSelect2 = intval($this->request->getGet('forSelect2') ?? 0);
|
||||
|
||||
$anchoLibro = $ancho;
|
||||
|
||||
if(intval($cubierta) == 1 || intval($sobrecubierta) == 1){
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
}
|
||||
|
||||
$menu = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, $guardas, $selected_papel, $tapa_dura, false, $POD, $anchoLibro, $alto, $tirada);
|
||||
$menu2 = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, $guardas, $selected_papel, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
|
||||
|
||||
if ($forSelect2) {
|
||||
$menu = array_map(function ($item) {
|
||||
if (isset($item->id)) {
|
||||
return [
|
||||
'id' => $item->id,
|
||||
'name' => $item->nombre
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'id' => $item->gramaje,
|
||||
'name' => $item->gramaje
|
||||
];
|
||||
}
|
||||
}, $menu);
|
||||
|
||||
return $this->respond($menu);
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'papeles' => $menu,
|
||||
'papeles_especiales' => $menu2,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function selectPapelEspecial()
|
||||
{
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$tirada = goSanitize($this->request->getGet('tirada'))[0] ?? null;
|
||||
$POD = null;
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = goSanitize($this->request->getGet('tipo'))[0];
|
||||
$cubierta = goSanitize($this->request->getGet('cubierta'))[0] ?? 0;
|
||||
$sobrecubierta = goSanitize($this->request->getGet('sobrecubierta'))[0] ?? 0;
|
||||
|
||||
$ancho = floatval($this->request->getGet('ancho') ?? 0);
|
||||
$alto = floatval($this->request->getGet('alto') ?? 0);
|
||||
$solapas = floatval($this->request->getGet('solapas') ?? 0);
|
||||
$lomo = floatval($this->request->getGet('lomo') ?? 0);
|
||||
|
||||
$tapa_dura = $this->request->getGet('tapa_dura') ?? 0;
|
||||
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
|
||||
$items = $this->model->getPapelCliente($tipo, $cubierta, $sobrecubierta, false, null, $tapa_dura, true, $POD, $anchoLibro, $alto, $tirada);
|
||||
$items = array_map(function ($item) {
|
||||
return [
|
||||
'id' => $item->id,
|
||||
'name' => $item->nombre
|
||||
];
|
||||
}, $items);
|
||||
return $this->response->setJSON($items);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,8 +72,6 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
$this->tpModel = new PapelImpresionTipologiaModel();
|
||||
$this->validation = service("validation");
|
||||
|
||||
$this->papelService = service('papel');
|
||||
|
||||
// Breadcrumbs
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_configuration"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
@ -475,22 +473,6 @@ class Papelesimpresion extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getGramajeCliente(){
|
||||
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$data_input = $this->request->getGet();
|
||||
$result = $this->papelService->getGramajes((object)$data_input);
|
||||
|
||||
return $this->respond($result);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function papel_impresion_select()
|
||||
{
|
||||
$q = $this->request->getGet('q');
|
||||
|
||||
@ -3452,37 +3452,31 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$return_data['interior']['negro']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id);
|
||||
$return_data['interior']['negro']['papel']['id'] = $linea->papel_id;
|
||||
$return_data['interior']['negro']['gramaje'] = $linea->gramaje;
|
||||
$return_data['interior']['negro']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_color' || $linea->tipo == 'lp_colorhq' || $linea->tipo == 'lp_rot_color') {
|
||||
$return_data['interior']['color']['tipo'] = $linea->tipo == 'lp_color' || $linea->tipo == 'lp_rot_color' ? 'colorEstandar' : 'colorPremium';
|
||||
$return_data['interior']['color']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id);
|
||||
$return_data['interior']['color']['papel']['id'] = $linea->papel_id;
|
||||
$return_data['interior']['color']['gramaje'] = $linea->gramaje;
|
||||
$return_data['interior']['color']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_cubierta') {
|
||||
$return_data['cubierta']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id);
|
||||
$return_data['cubierta']['papel']['id'] = $linea->papel_id;
|
||||
$return_data['cubierta']['gramaje'] = $linea->gramaje;
|
||||
$return_data['cubierta']['paginas'] = $linea->paginas;
|
||||
$return_data['cubierta']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_sobrecubierta') {
|
||||
$return_data['sobrecubierta']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id)['nombre'];
|
||||
$return_data['sobrecubierta']['papel_id'] = $linea->papel_id;
|
||||
$return_data['sobrecubierta']['gramaje'] = $linea->gramaje;
|
||||
$return_data['sobrecubierta']['paginas'] = $linea->paginas;
|
||||
$return_data['sobrecubierta']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_faja') {
|
||||
$return_data['faja']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id)['nombre'];
|
||||
$return_data['faja']['papel_id'] = $linea->papel_id;
|
||||
$return_data['faja']['gramaje'] = $linea->gramaje;
|
||||
$return_data['faja']['paginas'] = $linea->paginas;
|
||||
$return_data['faja']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
} else if ($linea->tipo == 'lp_guardas') {
|
||||
$return_data['guardas']['papel'] = $modelPapelGenerico->getNombre($linea->papel_id)['nombre'];
|
||||
$return_data['guardas']['papel_id'] = $linea->papel_id;
|
||||
$return_data['guardas']['gramaje'] = $linea->gramaje;
|
||||
$return_data['guardas']['paginas'] = $linea->paginas;
|
||||
$return_data['guardas']['tipo_papel'] = $modelPapelGenerico->find($linea->papel_id)->tipo_papel_generico_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ class ClienteEntity extends \CodeIgniter\Entity\Entity
|
||||
"user_created_id" => 1,
|
||||
"user_update_id" => 1,
|
||||
"no_envio_base" => 0,
|
||||
"forzar_rotativa_pod" => false,
|
||||
"forzar_rotativa_pod" => 0,
|
||||
];
|
||||
protected $casts = [
|
||||
"comunidad_autonoma_id" => "?int",
|
||||
|
||||
@ -58,8 +58,12 @@ return [
|
||||
'papelImpresionSection' => 'Papel impresión',
|
||||
'usuariosSection' => 'Usuarios',
|
||||
'rolesPermisosSection' => 'Roles y permisos',
|
||||
'tareasMaquinaSection' => 'Tareas de Máquina',
|
||||
'imposicionesSection' => 'Imposiciones',
|
||||
'ubicacionesSection' => 'Ubicaciones',
|
||||
'seriesFacturasSection' => 'Series facturas',
|
||||
'variablesSistemaSection' => 'Variables de sistema',
|
||||
'festivosSection' => 'Días Festivos',
|
||||
'ajustesSection' => 'Ajustes',
|
||||
'actividadSection' => 'Accesos',
|
||||
'backupSection' => 'Backups',
|
||||
|
||||
@ -120,7 +120,6 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get resource data.
|
||||
*
|
||||
@ -573,109 +572,4 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
$query = $this->db->getLastQuery();
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getPapelGenericoCliente($data)
|
||||
{
|
||||
/*
|
||||
1.-> Tipo impresion
|
||||
2.-> Maquina
|
||||
3.-> Papeles impresion asociados a esa maquina
|
||||
4.-> papeles genericos que aparecen en esos papeles impresion
|
||||
*/
|
||||
|
||||
if ($data->POD == true && ($data->tipo == 'color')) {
|
||||
if ($data->tipo == 'color')
|
||||
$data->tipo = 'colorhq';
|
||||
else if ($data->tipo == 'negro')
|
||||
$data->tipo = 'negrohq';
|
||||
}
|
||||
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"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"
|
||||
)
|
||||
->join("lg_papel_impresion t2", "t2.papel_generico_id = t1.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t2.id", "inner")
|
||||
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "inner")
|
||||
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "inner")
|
||||
|
||||
->where("t1.is_deleted", 0)
|
||||
->where("t1.show_in_client", 1)
|
||||
->where("t1.tipo_papel_generico_id", $data->tipo_papel_generico_id)
|
||||
->where("t2.is_deleted", 0)
|
||||
->where("t2.isActivo", 1)
|
||||
->where("t2.use_in_client", 1)
|
||||
->where("t3.active", 1)
|
||||
->where("t4.is_deleted", 0)
|
||||
->where("t4.min <= ", $data->tirada)
|
||||
->where("t4.max >= ", $data->tirada)
|
||||
->where("t4.tipo", "impresion")
|
||||
->where("t5.is_deleted", 0)
|
||||
->where("t5.tipo", $data->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);
|
||||
});
|
||||
|
||||
$builder->groupStart()
|
||||
->groupStart()
|
||||
->where("t4.ancho_impresion >", $data->ancho)
|
||||
->where("t4.alto_impresion >", $data->alto)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t4.ancho_impresion >", $data->alto)
|
||||
->where("t4.alto_impresion >", $data->ancho)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t4.ancho_impresion >", $data->alto)
|
||||
->where("t4.is_rotativa", 1)
|
||||
->groupEnd()
|
||||
->groupEnd();
|
||||
|
||||
if ($data->cubierta == true) {
|
||||
$builder->where("t2.cubierta", 1);
|
||||
$builder->where("t5.uso", 'cubierta');
|
||||
if ($data->tapa_dura == true) {
|
||||
$builder->where("t2.use_for_tapa_dura", 1);
|
||||
}
|
||||
} else if ($data->sobrecubierta == true) {
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
$builder->where("t5.uso", 'sobrecubierta');
|
||||
} else if ($data->guardas == true) {
|
||||
$builder->where("t2.guardas", 1);
|
||||
$builder->where("t5.uso", 'interior');
|
||||
} else {
|
||||
$builder->where("t2.interior", 1);
|
||||
$builder->where("t5.uso", 'interior');
|
||||
if ($data->tipo == 'negro' || $data->tipo == 'negrohq')
|
||||
$builder->where("t2.bn", 1);
|
||||
else if ($data->tipo == 'color' || $data->tipo == 'colorhq')
|
||||
$builder->where("t2.color", 1);
|
||||
}
|
||||
|
||||
if ($data->tipo == 'colorhq' || $data->tipo == 'negrohq') {
|
||||
$builder->where("t2.rotativa", 0);
|
||||
} else {
|
||||
if ($data->POD == false) {
|
||||
$builder->where("t2.rotativa", 1);
|
||||
} else if ($data->POD == true) {
|
||||
$builder->where("t2.rotativa", 0);
|
||||
}
|
||||
}
|
||||
|
||||
$data = $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
|
||||
//$query = $this->db->getLastQuery(); // DEBUG
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -390,7 +390,7 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
|
||||
public function querySelect(?string $query)
|
||||
{
|
||||
$q = $this->builder()->select([
|
||||
$q = $this->builder()->select([
|
||||
"id",
|
||||
"nombre as name",
|
||||
]);
|
||||
@ -400,104 +400,4 @@ class PapelImpresionModel extends \App\Models\BaseModel
|
||||
return $q;
|
||||
}
|
||||
|
||||
public function getGramajeCliente($data) {
|
||||
/*
|
||||
1.-> Tipo impresion
|
||||
2.-> Maquina
|
||||
3.-> Papeles impresion asociados a esa maquina
|
||||
4.-> papeles genericos que aparecen en esos papeles impresion
|
||||
*/
|
||||
|
||||
if ($data->POD == true && ($data->tipo == 'color')) {
|
||||
if ($data->tipo == 'color')
|
||||
$data->tipo = 'colorhq';
|
||||
else if ($data->tipo == 'negro')
|
||||
$data->tipo = 'negrohq';
|
||||
}
|
||||
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.gramaje as gramaje",
|
||||
// for debug, t1.nombre AS nombre_papel_impresion, t4.nombre AS maquina_nombre, t5.uso AS tarifa_uso, t5.tipo AS tarifa_tipo"
|
||||
)
|
||||
->join("lg_papel_generico t2", "t1.papel_generico_id = t2.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t3", "t3.papel_impresion_id = t1.id", "inner")
|
||||
->join("lg_maquinas t4", "t3.maquina_id = t4.id", "inner")
|
||||
->join("lg_maquinas_tarifas_impresion t5", "t5.maquina_id = t4.id", "inner")
|
||||
|
||||
->where("t2.is_deleted", 0)
|
||||
->where("t2.show_in_client", 1)
|
||||
->where("t1.is_deleted", 0)
|
||||
->where("t1.isActivo", 1)
|
||||
->where("t1.use_in_client", 1)
|
||||
->where("t3.active", 1)
|
||||
->where("t4.is_deleted", 0)
|
||||
->where("t4.min <= ", $data->tirada)
|
||||
->where("t4.max >= ", $data->tirada)
|
||||
->where("t4.tipo", "impresion")
|
||||
->where("t5.is_deleted", 0)
|
||||
->where("t5.tipo", $data->tipo)
|
||||
->where("t2.id", $data->papel_id ?? null)
|
||||
->distinct('t1.id');
|
||||
|
||||
// Validación adicional para asegurar que t2.id esté presente en las combinaciones con t3.active = 1
|
||||
$builder->whereIn("t2.id", function ($subQuery) {
|
||||
$subQuery->select("t2_inner.id")
|
||||
->from("lg_papel_generico t2_inner")
|
||||
->join("lg_papel_impresion t1_inner", "t1_inner.papel_generico_id = t2_inner.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t3_inner", "t3_inner.papel_impresion_id = t1_inner.id", "inner")
|
||||
->where("t3_inner.active", 1);
|
||||
});
|
||||
|
||||
$builder->groupStart()
|
||||
->groupStart()
|
||||
->where("t4.ancho_impresion >", $data->ancho)
|
||||
->where("t4.alto_impresion >", $data->alto)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t4.ancho_impresion >", $data->alto)
|
||||
->where("t4.alto_impresion >", $data->ancho)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t4.ancho_impresion >", $data->alto)
|
||||
->where("t4.is_rotativa", 1)
|
||||
->groupEnd()
|
||||
->groupEnd();
|
||||
|
||||
if ($data->cubierta == true) {
|
||||
$builder->where("t1.cubierta", 1);
|
||||
$builder->where("t5.uso", 'cubierta');
|
||||
if ($data->tapa_dura == true) {
|
||||
$builder->where("t1.use_for_tapa_dura", 1);
|
||||
}
|
||||
} else if ($data->sobrecubierta == true) {
|
||||
$builder->where("t1.sobrecubierta", 1);
|
||||
$builder->where("t5.uso", 'sobrecubierta');
|
||||
} else if ($data->guardas == true) {
|
||||
$builder->where("t1.guardas", 1);
|
||||
$builder->where("t5.uso", 'interior');
|
||||
} else {
|
||||
$builder->where("t1.interior", 1);
|
||||
$builder->where("t5.uso", 'interior');
|
||||
if ($data->tipo == 'negro' || $data->tipo == 'negrohq')
|
||||
$builder->where("t1.bn", 1);
|
||||
else if ($data->tipo == 'color' || $data->tipo == 'colorhq')
|
||||
$builder->where("t1.color", 1);
|
||||
}
|
||||
|
||||
if ($data->tipo == 'colorhq' || $data->tipo == 'negrohq') {
|
||||
$builder->where("t1.rotativa", 0);
|
||||
} else {
|
||||
if ($data->POD == false) {
|
||||
$builder->where("t1.rotativa", 1);
|
||||
} else if ($data->POD == true) {
|
||||
$builder->where("t1.rotativa", 0);
|
||||
}
|
||||
}
|
||||
|
||||
$data = $builder->orderBy("t1.gramaje", "asc")->get()->getResultObject();
|
||||
$query = $this->db->getLastQuery();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,96 +18,5 @@ class TipoPapelGenericoModel extends \App\Models\BaseModel
|
||||
];
|
||||
protected $returnType = "App\Entities\Configuracion\TipoPapelGenerico";
|
||||
|
||||
public function getTiposPapelCliente($data)
|
||||
{
|
||||
if (!isset($data) || empty($data)) {
|
||||
return [];
|
||||
}
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id as id, t1.clave 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_generico t2", "t2.tipo_papel_generico_id = t1.id", "inner")
|
||||
->join("lg_papel_impresion t3", "t3.papel_generico_id = t2.id", "inner")
|
||||
->join("lg_maquina_papel_impresion t4", "t4.papel_impresion_id = t3.id", "inner")
|
||||
->join("lg_maquinas t5", "t4.maquina_id = t5.id", "inner")
|
||||
->join("lg_maquinas_tarifas_impresion t6", "t6.maquina_id = t5.id", "inner")
|
||||
|
||||
->where("t2.is_deleted", 0)
|
||||
->where("t2.show_in_client", 1)
|
||||
->where("t3.is_deleted", 0)
|
||||
->where("t3.isActivo", 1)
|
||||
->where("t3.use_in_client", 1)
|
||||
->where("t4.active", 1)
|
||||
->where("t5.is_deleted", 0)
|
||||
->where("t5.min <= ", $data->tirada ?? 0)
|
||||
->where("t5.max >= ", $data->tirada ?? 0)
|
||||
->where("t5.tipo", "impresion")
|
||||
->where("t6.is_deleted", 0)
|
||||
->where("t6.tipo", $data->tipo ?? null)
|
||||
->distinct('t1.id');
|
||||
|
||||
// Validación adicional para asegurar que t1.id esté presente en las combinaciones con t3.active = 1
|
||||
$builder->whereIn("t2.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);
|
||||
});
|
||||
|
||||
$builder->groupStart()
|
||||
->groupStart()
|
||||
->where("t5.ancho_impresion >", $data->ancho ?? 0)
|
||||
->where("t5.alto_impresion >", $data->alto ?? 0)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t5.ancho_impresion >", $data->alto ?? 0)
|
||||
->where("t5.alto_impresion >", $data->ancho ?? 0)
|
||||
->groupEnd()
|
||||
->orGroupStart()
|
||||
->where("t5.ancho_impresion >", $data->alto ?? 0)
|
||||
->where("t5.is_rotativa", 1)
|
||||
->groupEnd()
|
||||
->groupEnd();
|
||||
|
||||
if ($data->cubierta == true) {
|
||||
$builder->where("t3.cubierta", 1);
|
||||
$builder->where("t6.uso", 'cubierta');
|
||||
if ($data->tapa_dura == true) {
|
||||
$builder->where("t3.use_for_tapa_dura", 1);
|
||||
}
|
||||
} else if ($data->sobrecubierta == true) {
|
||||
$builder->where("t3.sobrecubierta", 1);
|
||||
$builder->where("t6.uso", 'sobrecubierta');
|
||||
} else if ($data->guardas == true) {
|
||||
$builder->where("t3.guardas", 1);
|
||||
$builder->where("t6.uso", 'interior');
|
||||
} else {
|
||||
$builder->where("t3.interior", 1);
|
||||
$builder->where("t6.uso", 'interior');
|
||||
if ($data->tipo == 'negro' || $data->tipo == 'negrohq')
|
||||
$builder->where("t3.bn", 1);
|
||||
else if ($data->tipo == 'color' || $data->tipo == 'colorhq')
|
||||
$builder->where("t3.color", 1);
|
||||
}
|
||||
|
||||
if ($data->tipo == 'colorhq' || $data->tipo == 'negrohq') {
|
||||
$builder->where("t3.rotativa", 0);
|
||||
} else {
|
||||
if ($data->POD == false || $data->forzar_rotativa_POD) {
|
||||
$builder->where("t3.rotativa", 1);
|
||||
} else if ($data->POD == true) {
|
||||
$builder->where("t3.rotativa", 0);
|
||||
}
|
||||
}
|
||||
|
||||
$return_data = $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
$query = $this->db->getLastQuery();
|
||||
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,25 +2,16 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
use App\Models\Configuracion\PapelImpresionModel;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
use App\Models\Configuracion\TipoPapelGenericoModel;
|
||||
use App\Models\Configuracion\PapelGenericoModel;
|
||||
|
||||
class PapelService extends BaseService
|
||||
{
|
||||
protected TipoPapelGenericoModel $tipoPapelGenericoModel;
|
||||
protected PapelGenericoModel $papelGenericoModel;
|
||||
protected PapelImpresionModel $papelImpresionModel;
|
||||
protected ClienteModel $clienteModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->tipoPapelGenericoModel = model(TipoPapelGenericoModel::class);
|
||||
$this->papelGenericoModel = model(PapelGenericoModel::class);
|
||||
$this->papelImpresionModel = model(PapelImpresionModel::class);
|
||||
$this->clienteModel = model(ClienteModel::class);
|
||||
}
|
||||
|
||||
public function getTipoPapelGenerico()
|
||||
@ -33,212 +24,4 @@ class PapelService extends BaseService
|
||||
|
||||
return $tipoPapelGenericoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtencion de los tipos de papel genérico dependiendo del uso
|
||||
* @param object $data
|
||||
* @return array
|
||||
*/
|
||||
public function getTiposPalelGenerico($data)
|
||||
{
|
||||
|
||||
if (!isset($data) || empty($data)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$tirada = (int) $data->tirada ?? null;
|
||||
$POD = null;
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = $data->tipo;
|
||||
$cubierta = $data->cubierta ?? 0;
|
||||
$tapa_dura = $data->tapa_dura ?? null;
|
||||
$sobrecubierta = $data->sobrecubierta ?? 0;
|
||||
$guardas = $data->guardas ?? 0;
|
||||
|
||||
$ancho = $data->ancho ?? 0;
|
||||
$alto = $data->alto ?? 0;
|
||||
$solapas = $data->solapas ?? 0;
|
||||
$lomo = $data->lomo ?? 0;
|
||||
|
||||
$anchoLibro = $ancho;
|
||||
|
||||
$cliente_id = $data->cliente_id ?? null;
|
||||
$forzar_rotativa_POD = false;
|
||||
if (isset($cliente_id) && !is_null($cliente_id)) {
|
||||
$cliente = $this->clienteModel->find($cliente_id);
|
||||
if ($cliente && isset($cliente->forzar_rotativa_pod)) {
|
||||
$forzar_rotativa_POD = boolval($cliente->forzar_rotativa_pod);
|
||||
}
|
||||
}
|
||||
|
||||
if (intval($cubierta) == 1 || intval($sobrecubierta) == 1) {
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
}
|
||||
|
||||
$data_output = (object)
|
||||
[
|
||||
'tipo' => $tipo,
|
||||
'cubierta' => $cubierta,
|
||||
'tapa_dura' => $tapa_dura,
|
||||
'sobrecubierta' => $sobrecubierta,
|
||||
'guardas' => $guardas,
|
||||
'ancho' => $anchoLibro,
|
||||
'alto' => $alto,
|
||||
'solapas' => $solapas,
|
||||
'lomo' => $lomo,
|
||||
'anchoLibro' => $anchoLibro,
|
||||
'tirada' => $tirada,
|
||||
'POD' => $POD,
|
||||
'forzar_rotativa_POD' => $forzar_rotativa_POD
|
||||
];
|
||||
|
||||
$list = $this->tipoPapelGenericoModel->getTiposPapelCliente($data_output);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtencion de los tipos de papel genérico dependiendo del uso para un tipo de papel específico
|
||||
* @param object $data
|
||||
* @return array
|
||||
*/
|
||||
public function getPapelGenerico($data)
|
||||
{
|
||||
|
||||
if (!isset($data) || empty($data)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$tirada = (int) $data->tirada ?? null;
|
||||
$POD = null;
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = $data->tipo;
|
||||
$cubierta = $data->cubierta ?? 0;
|
||||
$tapa_dura = $data->tapa_dura ?? null;
|
||||
$sobrecubierta = $data->sobrecubierta ?? 0;
|
||||
$guardas = $data->guardas ?? 0;
|
||||
|
||||
$ancho = $data->ancho ?? 0;
|
||||
$alto = $data->alto ?? 0;
|
||||
$solapas = $data->solapas ?? 0;
|
||||
$lomo = $data->lomo ?? 0;
|
||||
|
||||
$tipo_papel_generico_id = $data->tipo_papel_generico_id ?? null;
|
||||
|
||||
$anchoLibro = $ancho;
|
||||
|
||||
if (intval($cubierta) == 1 || intval($sobrecubierta) == 1) {
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
}
|
||||
|
||||
$data_output = (object)
|
||||
[
|
||||
'tipo' => $tipo,
|
||||
'tipo_papel_generico_id' => $tipo_papel_generico_id,
|
||||
'cubierta' => $cubierta,
|
||||
'tapa_dura' => $tapa_dura,
|
||||
'sobrecubierta' => $sobrecubierta,
|
||||
'guardas' => $guardas,
|
||||
'ancho' => $anchoLibro,
|
||||
'alto' => $alto,
|
||||
'solapas' => $solapas,
|
||||
'lomo' => $lomo,
|
||||
'anchoLibro' => $anchoLibro,
|
||||
'tirada' => $tirada,
|
||||
'POD' => $POD
|
||||
];
|
||||
|
||||
if (isset($data->selected_tipo_id)) {
|
||||
$data_output->selected_tipo_id = $data->selected_tipo_id;
|
||||
}
|
||||
|
||||
$list = $this->papelGenericoModel->getPapelGenericoCliente($data_output);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtencion de los tipos de papel genérico dependiendo del uso para un tipo de papel específico
|
||||
* @param object $data
|
||||
* @return array
|
||||
*/
|
||||
public function getGramajes($data)
|
||||
{
|
||||
|
||||
if (!isset($data) || empty($data)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$tirada = (int) $data->tirada ?? null;
|
||||
$POD = null;
|
||||
if ($tirada != null) {
|
||||
$POD_value = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('POD')->value;
|
||||
if (intval($tirada) <= intval($POD_value)) {
|
||||
$POD = true;
|
||||
} else {
|
||||
$POD = false;
|
||||
}
|
||||
}
|
||||
$tipo = $data->tipo;
|
||||
$cubierta = $data->cubierta ?? 0;
|
||||
$tapa_dura = $data->tapa_dura ?? null;
|
||||
$sobrecubierta = $data->sobrecubierta ?? 0;
|
||||
$guardas = $data->guardas ?? 0;
|
||||
|
||||
$ancho = $data->ancho ?? 0;
|
||||
$alto = $data->alto ?? 0;
|
||||
$solapas = $data->solapas ?? 0;
|
||||
$lomo = $data->lomo ?? 0;
|
||||
|
||||
|
||||
$forzar_rotativa_POD = $data->forzar_rotativa_POD ?? false;
|
||||
|
||||
|
||||
$papel_id = $data->papel_id ?? null;
|
||||
|
||||
$anchoLibro = $ancho;
|
||||
|
||||
if (intval($cubierta) == 1 || intval($sobrecubierta) == 1) {
|
||||
$anchoLibro = 2 * $ancho + 2 * $solapas + $lomo;
|
||||
}
|
||||
|
||||
$data_output = (object)
|
||||
[
|
||||
'tipo' => $tipo,
|
||||
'papel_id' => $papel_id,
|
||||
'cubierta' => $cubierta,
|
||||
'tapa_dura' => $tapa_dura,
|
||||
'sobrecubierta' => $sobrecubierta,
|
||||
'guardas' => $guardas,
|
||||
'ancho' => $anchoLibro,
|
||||
'alto' => $alto,
|
||||
'solapas' => $solapas,
|
||||
'lomo' => $lomo,
|
||||
'anchoLibro' => $anchoLibro,
|
||||
'tirada' => $tirada,
|
||||
'POD' => $POD
|
||||
];
|
||||
|
||||
if (isset($data->selected_tipo_id)) {
|
||||
$data_output->selected_tipo_id = $data->selected_tipo_id;
|
||||
}
|
||||
|
||||
$list = $this->papelImpresionModel->getGramajeCliente($data_output);
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
@ -113,6 +113,7 @@
|
||||
</div><!-- //.card -->
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section('additionalInlineJs') ?>
|
||||
|
||||
@ -11,27 +11,29 @@
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<!-- Role cards -->
|
||||
<div class="row g-4">
|
||||
<div class="col-xl-4 col-lg-6 col-md-6">
|
||||
<div class="card h-100">
|
||||
<div class="row h-100">
|
||||
<div class="col-sm-5">
|
||||
<div class="d-flex align-items-end h-100 justify-content-center mt-sm-0 mt-3">
|
||||
<img src="<?= site_url('themes/vuexy/img/illustrations/add-new-roles.png') ?>"
|
||||
class="img-fluid mt-sm-4 mt-md-0" alt="add-new-roles" width="83" />
|
||||
<?php if (auth()->user()->can('roles-permisos.create')): ?>
|
||||
<div class="col-xl-4 col-lg-6 col-md-6">
|
||||
<div class="card h-100">
|
||||
<div class="row h-100">
|
||||
<div class="col-sm-5">
|
||||
<div class="d-flex align-items-end h-100 justify-content-center mt-sm-0 mt-3">
|
||||
<img src="<?= site_url('themes/vuexy/img/illustrations/add-new-roles.png') ?>"
|
||||
class="img-fluid mt-sm-4 mt-md-0" alt="add-new-roles" width="83" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<div class="card-body text-sm-end text-center ps-sm-0">
|
||||
<button onclick="window.location='<?= route_to('newGroup') ?>'"
|
||||
class="btn btn-primary mb-2 text-nowrap add-new-role">
|
||||
<?= lang('Basic.global.addNew') ?>
|
||||
</button>
|
||||
<p class="mb-0 mt-1"><?= lang("RolesPermisos.addRol") ?></p>
|
||||
<div class="col-sm-7">
|
||||
<div class="card-body text-sm-end text-center ps-sm-0">
|
||||
<button onclick="window.location='<?= route_to('newGroup') ?>'"
|
||||
class="btn btn-primary mb-2 text-nowrap add-new-role">
|
||||
<?= lang('Basic.global.addNew') ?>
|
||||
</button>
|
||||
<p class="mb-0 mt-1"><?= lang("RolesPermisos.addRol") ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($userGroupList as $item): ?>
|
||||
<?php $item->users = $model->getUsersByRol($item->keyword); ?>
|
||||
@ -44,25 +46,29 @@
|
||||
<?= lang("RolesPermisos.totalUsers") ?>
|
||||
</h6>
|
||||
<ul class="list-unstyled d-flex align-items-center avatar-group mb-0">
|
||||
<?php foreach ($item->users as $user): ?>
|
||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom" data-bs-placement="top"
|
||||
title="<?= esc($user->first_name . ' ' . $user->last_name) ?>"
|
||||
class="avatar avatar-sm pull-up">
|
||||
<img class="rounded-circle" src="<?= gravatar_url($user->email, 30) ?>"
|
||||
alt="<?= esc($user->email) ?>" />
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ($item->users as $user): ?>
|
||||
<li data-bs-toggle="tooltip" data-popup="tooltip-custom"
|
||||
data-bs-placement="top"
|
||||
title="<?= esc($user->first_name . ' ' . $user->last_name) ?>"
|
||||
class="avatar avatar-sm pull-up">
|
||||
<img class="rounded-circle" src="<?= gravatar_url($user->email, 30) ?>"
|
||||
alt="<?= esc($user->email) ?>" />
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-end mt-1">
|
||||
<div class="role-heading">
|
||||
<h4 class="mb-1"><?= esc($item->title) ?></h4>
|
||||
<a href="<?= route_to('editGroup', $item->id) ?>">
|
||||
<span><?= lang('Basic.global.edit') ?></span>
|
||||
</a>
|
||||
<?php if (auth()->user()->can('roles-permisos.edit')): ?>
|
||||
<a href="<?= route_to('editGroup', $item->id) ?>">
|
||||
<span><?= lang('Basic.global.edit') ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?=
|
||||
anchor(
|
||||
<?php
|
||||
if (auth()->user()->can('roles-permisos.delete')) {
|
||||
echo anchor(
|
||||
'#confirm2delete',
|
||||
"<i class='ti ti-trash ti-md'></i>",
|
||||
[
|
||||
@ -72,6 +78,7 @@
|
||||
'data-bs-target' => '#confirm2delete'
|
||||
]
|
||||
);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -240,34 +240,34 @@
|
||||
<div class="row justify-content-center">
|
||||
<div id="fresado"
|
||||
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/fresado.jpg") ?>"
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/fresado.png") ?>"
|
||||
alt="Fresado">
|
||||
<div class="form-text text-center">A partir de 32 páginas</div>
|
||||
<div class="form-text text-center">Fresado (a partir de 32 páginas)</div>
|
||||
</div>
|
||||
<div id="cosido"
|
||||
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/cosido.jpg") ?>"
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/cosido.png") ?>"
|
||||
alt="Cosido">
|
||||
<div class="form-text text-center">A partir de 32 páginas</div>
|
||||
<div class="form-text text-center">Cosido (a partir de 32 páginas)</div>
|
||||
</div>
|
||||
<div id="grapado"
|
||||
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/grapado.jpg") ?>"
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/grapado.png") ?>"
|
||||
alt="Grapado">
|
||||
<div class="form-text text-center">Entre 12 y 40 páginas</div>
|
||||
<div class="form-text text-center">Grapado (entre 12 y 40 páginas)</div>
|
||||
</div>
|
||||
<div id="espiral"
|
||||
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/espiral.jpg") ?>"
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/espiral.png") ?>"
|
||||
alt="Espiral">
|
||||
<div class="form-text text-center">A partir de 20 páginas</div>
|
||||
<div class="form-text text-center">Espiral (a partir de 20 páginas)</div>
|
||||
</div>
|
||||
|
||||
<div id="wireo"
|
||||
class="col-12 col-md-4 text-center mb-4 tipo-libro imagen-selector image-container">
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/wire-o.jpg") ?>"
|
||||
<img class="image-presupuesto" src="<?= site_url("assets/img/presupuestoCliente/wire-o.png") ?>"
|
||||
alt="Wire-O">
|
||||
<div class="form-text text-center">A partir de 20 páginas</div>
|
||||
<div class="form-text text-center">Wire-O (a partir de 20 páginas)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -49,23 +49,27 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-8 mb-3 d-flex flex-column align-items-center d-none texto-papel-interior">
|
||||
<div id="textoPapelInterior" class="col-sm-8 mb-3 d-flex flex-column align-items-center d-none">
|
||||
<h3 class="mb-1 fw-bold"> Papel interior </h3>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<h5 id="textoTipoPapelInterior" class="mb-1 fw-bold">Tipo</h5>
|
||||
<div id="divTipoPapelInterior" name="div_tipo_papel_interior" class="row col-sm-10 mb-1 justify-content-center">
|
||||
|
||||
</div>
|
||||
|
||||
<h5 class="mb-1 fw-bold texto-papel-interior">Papel</h5>
|
||||
<div id="divPapelInterior" name="div_papel_interior" class="row col-sm-10 mb-1 justify-content-center">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="divPapelEspecialInterior" name="div_papel_especial_interior"
|
||||
class="row col-sm-10 mb-3 justify-content-center d-none">
|
||||
<div class="col-sm-5 mb-0">
|
||||
<label for="titulo" class="form-label">
|
||||
Seleccione el papel especial
|
||||
</label>
|
||||
<select id="papelEspecialInterior" name="papel_especial_interior"
|
||||
class="form-control select2bs2 calcular-solapas calcular-presupuesto col-5 mb-0">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5 id="textoGramajeInterior" class="mb-1 fw-bold">Gramaje</h5>
|
||||
<div id="divGramajeInterior" name="div_gramaje_interior" class="row col-sm-10 mb-3 justify-content-center d-none">
|
||||
</div>
|
||||
|
||||
@ -98,4 +102,34 @@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="textoPapelInteriorColor" class="col-sm-8 mb-3 d-flex flex-column align-items-center interior-color d-none">
|
||||
<h3 class="mb-1 fw-bold"> Papel interior color</h3>
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
|
||||
<div id="divPapelInteriorColor" name="div_papel_interior_color"
|
||||
class="row col-sm-10 mb-5 interior-color justify-content-center interior-color d-none">
|
||||
|
||||
</div>
|
||||
|
||||
<div id="divPapelEspecialInteriorColor" name="div_papel_especial_interior_color"
|
||||
class="row col-sm-10 mb-3 justify-content-center d-none">
|
||||
<div class="col-sm-5 mb-0">
|
||||
<label for="titulo" class="form-label">
|
||||
Seleccione el papel especial
|
||||
</label>
|
||||
<select id="papelEspecialInteriorColor" name="papel_especial_interior_color"
|
||||
class="form-control select2bs2 calcular-solapas calcular-presupuesto col-5 mb-0">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="divGramajeInteriorColor" name="div_gramaje_interior_color"
|
||||
class="row col-sm-10 mb-3 justify-content-center d-none">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -14,7 +14,10 @@ if (
|
||||
auth()->user()->can('roles-permisos.menu') ||
|
||||
auth()->user()->can('proveedores.menu') ||
|
||||
auth()->user()->can('ubicaciones.menu') ||
|
||||
auth()->user()->can('series-facturas.menu')
|
||||
auth()->user()->can('series-facturas.menu') ||
|
||||
auth()->user()->can('tareas-maquina.menu') ||
|
||||
auth()->user()->can('festivos.menu') ||
|
||||
auth()->user()->can('variables-sistema.menu')
|
||||
) {
|
||||
?>
|
||||
<li class="menu-item">
|
||||
@ -66,14 +69,14 @@ if (
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||
<?php if (auth()->user()->can('tareas-maquina.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to("maquinaTareaList") ?>" class="menu-link">
|
||||
<div> <?= lang("App.menu_maquina_tareas") ?></div>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||
<?php if (auth()->user()->can('imposiciones.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to("imposicionList") ?>" class="menu-link">
|
||||
<div> <?= lang("App.menu_imposiciones") ?></div>
|
||||
@ -122,7 +125,7 @@ if (
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||
<?php if (auth()->user()->can('variables-sistema.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to('variablesIndex') ?>" class="menu-link">
|
||||
<div> <?= lang("App.menu_variables") ?></div>
|
||||
@ -136,7 +139,7 @@ if (
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||
<?php if (auth()->user()->can('festivos.menu')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to('festivosList') ?>" class="menu-link">
|
||||
<div> <?= lang("App.menu_config_holidays") ?></div>
|
||||
|
||||
BIN
httpdocs/assets/img/presupuestoCliente/cosido.png
Normal file
BIN
httpdocs/assets/img/presupuestoCliente/cosido.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
httpdocs/assets/img/presupuestoCliente/espiral.png
Normal file
BIN
httpdocs/assets/img/presupuestoCliente/espiral.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
BIN
httpdocs/assets/img/presupuestoCliente/fresado.png
Normal file
BIN
httpdocs/assets/img/presupuestoCliente/fresado.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
httpdocs/assets/img/presupuestoCliente/grapado.png
Normal file
BIN
httpdocs/assets/img/presupuestoCliente/grapado.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.9 KiB |
BIN
httpdocs/assets/img/presupuestoCliente/wire-o.png
Normal file
BIN
httpdocs/assets/img/presupuestoCliente/wire-o.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
@ -1062,14 +1062,14 @@ class DisenioCubierta {
|
||||
this.divGramajeCubierta.removeClass('is-invalid');
|
||||
this.divPapelEspecial.removeClass('is-invalid');
|
||||
|
||||
if (response.length > 0) {
|
||||
if (response.papeles.length > 0) {
|
||||
this.textoPapelCubierta.removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
this.textoPapelCubierta.addClass("d-none");
|
||||
}
|
||||
|
||||
response.forEach(papel => {
|
||||
response.papeles.forEach(papel => {
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-papel-cubierta d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
@ -1102,7 +1102,7 @@ class DisenioCubierta {
|
||||
}
|
||||
});
|
||||
|
||||
if (response.length > 0) {
|
||||
if (response.papeles_especiales.length > 0) {
|
||||
this.divPapelCubierta.removeClass('d-none');
|
||||
|
||||
var container = $('<div>', {
|
||||
@ -1124,7 +1124,7 @@ class DisenioCubierta {
|
||||
|
||||
radioButton.on('click', this.#handleGramajeCubierta.bind(this));
|
||||
|
||||
response.forEach(papel => {
|
||||
response.papeles_especiales.forEach(papel => {
|
||||
if (papel.id == this.papelCubierta) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
@ -1201,11 +1201,11 @@ class DisenioCubierta {
|
||||
this.divGramajeCubierta.empty()
|
||||
let showGramaje = false;
|
||||
|
||||
if (response.length <= 0 && response.length <= 0) {
|
||||
if (response.papeles.length <= 0 && response.papeles_especiales.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
let papel = response.length > 0 ? response : response;
|
||||
let papel = response.papeles.length > 0 ? response.papeles : response.papeles_especiales;
|
||||
|
||||
papel.forEach(valor => {
|
||||
|
||||
|
||||
@ -18,12 +18,15 @@ class DisenioInterior {
|
||||
this.validatorStepper = validatorStepper;
|
||||
|
||||
this.disenioInterior = this.domItem.find(".disenio-interior");
|
||||
this.divTipoPapelInterior = this.domItem.find("#divTipoPapelInterior");
|
||||
this.textoTipoPapelInterior = this.domItem.find("#textoTipoPapelInterior");
|
||||
this.divPapelInterior = this.domItem.find("#divPapelInterior");
|
||||
this.textoPapelInterior = this.domItem.find(".texto-papel-interior");
|
||||
this.textoPapelInterior = this.domItem.find("#textoPapelInterior");
|
||||
this.textoPapelInteriorColor = this.domItem.find("#textoPapelInteriorColor");
|
||||
this.divPapelInteriorColor = this.domItem.find("#divPapelInteriorColor");
|
||||
this.divPapelEspecialInterior = this.domItem.find("#divPapelEspecialInterior");
|
||||
this.divPapelEspecialInteriorColor = this.domItem.find("#divPapelEspecialInteriorColor");
|
||||
this.papelEspecialInterior = this.domItem.find("#papelEspecialInterior");
|
||||
this.divGramajeInterior = this.domItem.find("#divGramajeInterior");
|
||||
this.textoGramajeInterior = this.domItem.find("#textoGramajeInterior");
|
||||
this.divGramajeInteriorColor = this.domItem.find("#divGramajeInteriorColor");
|
||||
|
||||
this.negroEstandar = this.domItem.find("#negroEstandar");
|
||||
this.negroPremium = this.domItem.find("#negroPremium");
|
||||
@ -46,10 +49,42 @@ class DisenioInterior {
|
||||
this.rl_papel_interior = $("#rl_papel_interior");
|
||||
this.rl_papel_interior_color = $("#rl_papel_interior_color");
|
||||
|
||||
this.papelEspecial = new ClassSelect($("#papelEspecialInterior"),
|
||||
'/configuracion/papelesgenericos/selectpapelespecial',
|
||||
window.translations["selectPapel"],
|
||||
false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo: () => { return this.getTipoImpresion() },
|
||||
tirada: () => { { return this.presupuestoCliente.datosGenerales.getTiradas()[0] } },
|
||||
ancho: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho },
|
||||
alto: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto },
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
}
|
||||
);
|
||||
this.papelEspecialColor = new ClassSelect($("#papelEspecialInteriorColor"),
|
||||
'/configuracion/papelesgenericos/selectpapelespecial',
|
||||
window.translations["selectPapel"],
|
||||
false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo: () => { return this.getTipoImpresion() },
|
||||
tirada: () => { { return this.presupuestoCliente.datosGenerales.getTiradas()[0] } },
|
||||
ancho: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho },
|
||||
alto: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto },
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
}
|
||||
);
|
||||
|
||||
this.papelInteriorDiferente = false;
|
||||
this.tipoPapel = null;
|
||||
this.papelInterior = null;
|
||||
this.gramaje = null;
|
||||
this.papelInteriorColor = null;
|
||||
this.gramajeColor = null;
|
||||
|
||||
this.cargando = true;
|
||||
|
||||
@ -67,75 +102,75 @@ class DisenioInterior {
|
||||
|
||||
const self = this;
|
||||
|
||||
this.papelEspecial.init();
|
||||
$('#papelEspecialInterior').on("change", this.#handlePapelInteriorEspecial.bind(this));
|
||||
this.papelEspecialColor.init();
|
||||
$('#papelEspecialInteriorColor').on("change", this.#handlePapelInteriorEspecialColor.bind(this));
|
||||
|
||||
// Eventos
|
||||
this.disenioInterior.on('click', this.#handleDisenioInterior.bind(this));
|
||||
this.disenioInterior_color.on('click', this.#handleDisenioInterior.bind(this));
|
||||
|
||||
}
|
||||
|
||||
updateTiposPapeles() {
|
||||
|
||||
this.textoTipoPapelInterior.addClass('d-none');
|
||||
this.divTipoPapelInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
this.textoGramajeInterior.addClass("d-none");
|
||||
this.textoPapelInterior.addClass("d-none");
|
||||
|
||||
new Ajax('/configuracion/papelesgenericos/gettipopapel',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => this.getTipoImpresion(),
|
||||
cliente_id: () => this.presupuestoCliente.datosGenerales.getCliente(),
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { this.fillTiposPapeles(response); },
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
|
||||
updatePapeles() {
|
||||
updatePapeles(papeles = null) {
|
||||
|
||||
const context = this;
|
||||
|
||||
this.divGramajeInterior.empty();
|
||||
this.textoGramajeInterior.addClass("d-none");
|
||||
if (papeles == 'color') {
|
||||
this.divGramajeInteriorColor.empty();
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => this.getTipoImpresion(),
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { this.fillPapelesColor(response); },
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
|
||||
if (papeles == 'negro' || papeles == null) {
|
||||
this.divGramajeInterior.empty();
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => this.getTipoImpresion(),
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { this.fillPapeles(response); },
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => this.getTipoImpresion(),
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { this.fillPapeles(response); },
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
|
||||
|
||||
fillPapeles(response) {
|
||||
|
||||
this.divPapelInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
|
||||
if (response.length > 0) {
|
||||
if (response.papeles.length > 0) {
|
||||
this.textoPapelInterior.removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
this.textoPapelInterior.addClass("d-none");
|
||||
}
|
||||
|
||||
response.forEach(papel => {
|
||||
response.papeles.forEach(papel => {
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-papel d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
@ -164,50 +199,117 @@ class DisenioInterior {
|
||||
}
|
||||
});
|
||||
|
||||
if (response.papeles_especiales.length > 0) {
|
||||
this.divPapelInterior.removeClass('d-none');
|
||||
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-papel d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
|
||||
var radioButton = $('<input>', {
|
||||
type: 'radio',
|
||||
name: 'calcular-presupuesto papel-interior',
|
||||
id: 'papelEspecialInterior',
|
||||
value: 'option1'
|
||||
});
|
||||
|
||||
// Crear una etiqueta para el radio button
|
||||
var label = $('<label>', {
|
||||
for: 'papelEspecialInterior',
|
||||
text: 'PAPEL ESPECIAL'
|
||||
});
|
||||
|
||||
radioButton.on('click', this.#handlePapelInterior.bind(this));
|
||||
|
||||
response.papeles_especiales.forEach(papel => {
|
||||
if (papel.id == this.papelInterior) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
|
||||
this.papelEspecial.setOption(papel.id, papel.nombre);
|
||||
}
|
||||
});
|
||||
|
||||
container.append(radioButton).append(label);
|
||||
$('#divPapelInterior').append(container);
|
||||
}
|
||||
}
|
||||
|
||||
fillPapelesColor(response) {
|
||||
|
||||
fillTiposPapeles(response) {
|
||||
this.divPapelInteriorColor.empty()
|
||||
this.divGramajeInteriorColor.empty();
|
||||
|
||||
this.divPapelInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
|
||||
if(response.length <= 0) {
|
||||
this.textoTipoPapelInterior.addClass('d-none');
|
||||
return;
|
||||
if (response.papeles.length > 0) {
|
||||
this.textoPapelInteriorColor.removeClass('d-none');
|
||||
}
|
||||
else {
|
||||
this.textoPapelInteriorColor.addClass("d-none");
|
||||
}
|
||||
|
||||
this.textoTipoPapelInterior.removeClass('d-none');
|
||||
|
||||
response.forEach(papel => {
|
||||
response.papeles.forEach(papel => {
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-tipo-papel d-flex flex-column align-items-center justify-content-center'
|
||||
class: 'custom-selector custom-selector-papel-color d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
|
||||
var radioButton = $('<input>', {
|
||||
type: 'radio', // Tipo de input
|
||||
name: 'tipo-papel-interior',
|
||||
id: 'tipoPapel_' + papel.id, // ID único
|
||||
name: 'calcular-presupuesto papel-interior-color',
|
||||
id: 'papelColor_' + papel.id, // ID único
|
||||
value: 'option1' // Valor del radio button
|
||||
});
|
||||
|
||||
// Crear una etiqueta para el radio button
|
||||
var label = $('<label>', {
|
||||
for: 'tipoPapel_' + papel.id,
|
||||
text: papel.texto
|
||||
for: 'papelColor_' + papel.id,
|
||||
text: papel.nombre
|
||||
});
|
||||
|
||||
radioButton.on('click', this.#handleTipoPapelInterior.bind(this));
|
||||
radioButton.on('click', this.#handlePapelInteriorColor.bind(this));
|
||||
|
||||
container.append(radioButton).append(label);
|
||||
this.divTipoPapelInterior.append(container);
|
||||
$('#divPapelInteriorColor').append(container);
|
||||
|
||||
if (this.tipoPapel == papel.id) {
|
||||
if (this.papelInteriorColor == papel.id) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
}
|
||||
});
|
||||
|
||||
if (response.papeles_especiales.length > 0) {
|
||||
this.divPapelInterior.removeClass('d-none');
|
||||
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-papel-color d-flex flex-column align-items-center justify-content-center'
|
||||
});
|
||||
|
||||
var radioButton = $('<input>', {
|
||||
type: 'radio',
|
||||
name: 'calcular-presupuesto papel-interior-color',
|
||||
id: 'papelEspecialInterior',
|
||||
value: 'option1'
|
||||
});
|
||||
|
||||
// Crear una etiqueta para el radio button
|
||||
var label = $('<label>', {
|
||||
for: 'papelEspecialInterior',
|
||||
text: 'PAPEL ESPECIAL'
|
||||
});
|
||||
|
||||
radioButton.on('click', this.#handlePapelInteriorColor.bind(this));
|
||||
|
||||
response.papeles_especiales.forEach(papel => {
|
||||
if (papel.id == this.papelInteriorColor) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
|
||||
this.papelEspecialColor.setOption(papel.id, papel.nombre);
|
||||
}
|
||||
});
|
||||
|
||||
container.append(radioButton).append(label);
|
||||
$('#divPapelInteriorColor').append(container);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -215,35 +317,63 @@ class DisenioInterior {
|
||||
|
||||
this.papelInteriorDiferente = papelInteriorDiferente;
|
||||
|
||||
this.papelInteriorColor = null;
|
||||
this.gramajeColor = null;
|
||||
if (papelInteriorDiferente) {
|
||||
|
||||
if (datos.negro) {
|
||||
if (datos.negro.tipo.includes("Premium")) {
|
||||
this.negroPremium.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.negroEstandar.addClass('selected');
|
||||
}
|
||||
|
||||
this.papelInterior = datos.negro.papel.id;
|
||||
this.gramaje = datos.negro.gramaje;
|
||||
|
||||
if (datos.color) {
|
||||
if (datos.color.tipo.includes("Premium")) {
|
||||
this.colorPremium.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.colorEstandar.addClass('selected');
|
||||
if (datos.color) {
|
||||
if (datos.color.tipo.includes("Premium")) {
|
||||
this.colorPremium_color.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.colorEstandar_color.addClass('selected');
|
||||
}
|
||||
|
||||
this.papelInteriorColor = datos.color.papel.id;
|
||||
this.gramajeColor = datos.color.gramaje;
|
||||
}
|
||||
this.papelInterior = datos.color.papel.id;
|
||||
this.gramaje = datos.color.gramaje;
|
||||
this.tipoPapel = datos.color.tipo_papel;
|
||||
}
|
||||
else {
|
||||
if (datos.negro.tipo.includes("Premium")) {
|
||||
this.negroPremium.addClass('selected');
|
||||
this.papelInteriorColor = null;
|
||||
this.gramajeColor = null;
|
||||
|
||||
if (datos.color) {
|
||||
if (datos.color.tipo.includes("Premium")) {
|
||||
this.colorPremium.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.colorEstandar.addClass('selected');
|
||||
}
|
||||
this.papelInterior = datos.color.papel.id;
|
||||
this.gramaje = datos.color.gramaje;
|
||||
}
|
||||
else {
|
||||
this.negroEstandar.addClass('selected');
|
||||
if (datos.negro.tipo.includes("Premium")) {
|
||||
this.negroPremium.addClass('selected');
|
||||
}
|
||||
else {
|
||||
this.negroEstandar.addClass('selected');
|
||||
}
|
||||
|
||||
this.papelInterior = datos.negro.papel.id;
|
||||
this.gramaje = datos.negro.gramaje;
|
||||
}
|
||||
|
||||
this.papelInterior = datos.negro.papel.id;
|
||||
this.gramaje = datos.negro.gramaje;
|
||||
this.tipoPapel = datos.negro.tipo_papel;
|
||||
}
|
||||
if (datos.paginasColorConsecutivas)
|
||||
this.updatePapeles();
|
||||
else
|
||||
this.updatePapeles('negro');
|
||||
|
||||
this.updateTiposPapeles();
|
||||
this.updatePapeles();
|
||||
}
|
||||
|
||||
|
||||
@ -303,11 +433,21 @@ class DisenioInterior {
|
||||
|
||||
const papelSeleccionado = $('.custom-selector-papel input[type="radio"]:checked');
|
||||
if (papelSeleccionado.length > 0) {
|
||||
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
return true;
|
||||
|
||||
|
||||
if (!$('#divPapelEspecialInterior').hasClass("d-none")) {
|
||||
if ($('#papelEspecialInterior').select2('data').length == 0) {
|
||||
$('#divPapelInterior').addClass('is-invalid');
|
||||
this.errores.push(window.translations["validation"].papel_interior_especial);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
$('#divPapelInterior').addClass('is-invalid');
|
||||
this.errores.push(window.translations["validation"].papel_interior);
|
||||
@ -343,6 +483,16 @@ class DisenioInterior {
|
||||
return tipo;
|
||||
}
|
||||
|
||||
getTipoImpresionColor() {
|
||||
|
||||
let tipo = 'colorhq';
|
||||
if (this.colorEstandar_color.hasClass('selected'))
|
||||
tipo = 'color';
|
||||
|
||||
return tipo;
|
||||
}
|
||||
|
||||
|
||||
getIsHq() {
|
||||
|
||||
try {
|
||||
@ -424,18 +574,72 @@ class DisenioInterior {
|
||||
|
||||
if (this.papelInterior != null && checkedPapel != null && checkedPapel.length > 0) {
|
||||
|
||||
if (this.divPapelInteriorColor.hasClass('d-none')) {
|
||||
|
||||
if (forResumen) {
|
||||
if (forResumen) {
|
||||
|
||||
if (checkedPapel.length == 0)
|
||||
return null;
|
||||
let radioButtonId = checkedPapel[0].id;
|
||||
if (checkedPapel.length == 0)
|
||||
return null;
|
||||
let radioButtonId = checkedPapel[0].id;
|
||||
if (radioButtonId == 'papelEspecialInterior')
|
||||
return capitalizeFirstLetter(this.papelEspecial.getText());
|
||||
else {
|
||||
let associatedLabel = $('label[for="' + radioButtonId + '"]');
|
||||
return capitalizeFirstLetter($(associatedLabel[0]).text().toLocaleLowerCase());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.divPapelEspecialInterior.hasClass('d-none'))
|
||||
return this.papelInterior;
|
||||
else {
|
||||
return this.papelEspecial.getVal();
|
||||
}
|
||||
}
|
||||
|
||||
let associatedLabel = $('label[for="' + radioButtonId + '"]');
|
||||
return capitalizeFirstLetter($(associatedLabel[0]).text().toLocaleLowerCase());
|
||||
}
|
||||
else {
|
||||
return this.papelInterior;
|
||||
let checkedPapelColor = $('.custom-selector-papel-color input[type="radio"]:checked');
|
||||
|
||||
if (checkedPapelColor == null || checkedPapelColor.length == 0 || checkedPapel == null || checkedPapel.length == 0)
|
||||
return null;
|
||||
|
||||
let papelNegro = 0;
|
||||
let papelColor = 0;
|
||||
|
||||
if (forResumen) {
|
||||
|
||||
let radioButtonIdNegro = checkedPapel[0].id;
|
||||
if (radioButtonIdNegro == 'papelEspecialInterior')
|
||||
papelNegro = capitalizeFirstLetter(this.papelEspecial.getText());
|
||||
else {
|
||||
let associatedLabel = $('label[for="' + radioButtonIdNegro + '"]');
|
||||
papelNegro = capitalizeFirstLetter($(associatedLabel[0]).text().toLocaleLowerCase());
|
||||
}
|
||||
let radioButtonIdColor = checkedPapelColor[0].id;
|
||||
if (radioButtonIdColor == 'papelEspecialInteriorColor')
|
||||
papelColor = capitalizeFirstLetter(this.papelEspecialColor.getText());
|
||||
else {
|
||||
let associatedLabel = $('label[for="' + radioButtonIdColor + '"]');
|
||||
papelColor = capitalizeFirstLetter($(associatedLabel[0]).text().toLocaleLowerCase());
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if (this.divPapelEspecialInterior.hasClass('d-none'))
|
||||
papelNegro = this.papelInterior;
|
||||
else {
|
||||
papelNegro = this.papelEspecial.getVal();
|
||||
}
|
||||
if (this.divPapelEspecialInteriorColor.hasClass('d-none'))
|
||||
papelColor = this.papelInteriorColor;
|
||||
else {
|
||||
papelColor = this.papelEspecialColor.getVal();
|
||||
}
|
||||
}
|
||||
return {
|
||||
negro: papelNegro,
|
||||
color: papelColor,
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -503,6 +707,10 @@ class DisenioInterior {
|
||||
let class2Find = '.disenio-interior';
|
||||
if (element[0].closest('.image-container').id.includes('Color')) {
|
||||
this.divGramajeInteriorColor.empty();
|
||||
this.divPapelEspecialInteriorColor.addClass("d-none");
|
||||
$('#papelEspecialInteriorColor').off("change");
|
||||
this.papelEspecialColor.empty();
|
||||
$('#papelEspecialInteriorColor').on("change", this.#handlePapelInteriorEspecialColor.bind(this));
|
||||
this.papelInteriorColor = null;
|
||||
this.gramajeColor = null;
|
||||
class2Find = '.disenio-interior-color';
|
||||
@ -511,6 +719,10 @@ class DisenioInterior {
|
||||
}
|
||||
else {
|
||||
this.divGramajeInterior.empty();
|
||||
this.divPapelEspecialInterior.addClass("d-none");
|
||||
$('#papelEspecialInterior').off("change");
|
||||
this.papelEspecial.empty();
|
||||
$('#papelEspecialInterior').on("change", this.#handlePapelInteriorEspecial.bind(this));
|
||||
this.papelInterior = null;
|
||||
this.gramaje = null;
|
||||
this.divPapelInterior.empty();
|
||||
@ -530,15 +742,11 @@ class DisenioInterior {
|
||||
// Para recalcular el presupuesto
|
||||
element.trigger('change');
|
||||
|
||||
if(element.closest(class2Find).parent().find(class2Find).hasClass('selected'))
|
||||
this.updateTiposPapeles();
|
||||
else{
|
||||
this.divTipoPapelInterior.empty();
|
||||
this.textoTipoPapelInterior.addClass('d-none');
|
||||
this.divGramajeInterior.empty();
|
||||
this.textoGramajeInterior.addClass('d-none');
|
||||
this.divPapelInterior.empty();
|
||||
this.textoPapelInterior.addClass('d-none');
|
||||
if ($('.disenio-interior.selected').length != 0) {
|
||||
if (class2Find == '.disenio-interior-color')
|
||||
this.updatePapeles('color');
|
||||
else
|
||||
this.updatePapeles();
|
||||
}
|
||||
|
||||
if (this.validateDisenioInterior()) {
|
||||
@ -574,24 +782,37 @@ class DisenioInterior {
|
||||
|
||||
let tipo = this.getTipoImpresion();
|
||||
|
||||
this.divGramajeInterior.empty();
|
||||
new Ajax('/configuracion/papelesimpresion/getgramajecliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel_id: papel,
|
||||
tipo: tipo,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillGramajes.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
if (element[0].id == 'papelEspecialInterior') {
|
||||
|
||||
if (!this.cargando)
|
||||
this.gramaje = null;
|
||||
this.divGramajeInterior.empty();
|
||||
this.divPapelEspecialInterior.removeClass("d-none");
|
||||
this.papelEspecialInterior.empty();
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
this.divPapelEspecialInterior.addClass("d-none");
|
||||
this.papelEspecialInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel: papel,
|
||||
tipo: tipo,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillGramajes.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
if (!this.cargando) {
|
||||
this.gramaje = null;
|
||||
if (this.validatePapelInterior()) {
|
||||
@ -614,34 +835,23 @@ class DisenioInterior {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#handleTipoPapelInterior(event) {
|
||||
#handlePapelInteriorEspecial() {
|
||||
|
||||
const context = this;
|
||||
|
||||
this.divTipoPapelInterior.removeClass('is-invalid');
|
||||
this.divPapelInterior.removeClass('is-invalid');
|
||||
this.divGramajeInterior.removeClass('is-invalid');
|
||||
this.textoGramajeInterior.addClass("d-none");
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
|
||||
// Accede al ID del elemento que disparó el evento
|
||||
const element = $(event.target);
|
||||
const papel = element[0].id.split('_')[1];
|
||||
this.tipoPapel = papel;
|
||||
|
||||
$('#' + papel).prop('checked', true);
|
||||
this.papelInterior = this.papelEspecial.getVal();
|
||||
|
||||
let tipo = this.getTipoImpresion();
|
||||
|
||||
this.divPapelInterior.empty();
|
||||
this.divGramajeInterior.empty();
|
||||
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel: this.papelInterior,
|
||||
tipo: tipo,
|
||||
tipo_papel_generico_id: papel,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
@ -649,12 +859,95 @@ class DisenioInterior {
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillPapeles.bind(context),
|
||||
this.fillGramajes.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
|
||||
}
|
||||
|
||||
#handlePapelInteriorColor(event) {
|
||||
|
||||
const context = this;
|
||||
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
|
||||
// Accede al ID del elemento que disparó el evento
|
||||
const element = $(event.target);
|
||||
const papel = element[0].id.split('_')[1];
|
||||
this.papelInteriorColor = papel;
|
||||
if (!this.cargando)
|
||||
this.gramajeColor = null;
|
||||
else {
|
||||
this.cargandoColor = false;
|
||||
}
|
||||
|
||||
$('#' + papel).prop('checked', true);
|
||||
|
||||
let tipo = this.getTipoImpresionColor();
|
||||
|
||||
if (element[0].id == 'papelEspecialInteriorColor') {
|
||||
|
||||
this.gramajeColor = null;
|
||||
this.divGramajeInteriorColor.empty();
|
||||
this.divPapelEspecialInteriorColor.removeClass("d-none");
|
||||
this.divPapelEspecialInteriorColor.empty();
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
this.divPapelEspecialInteriorColor.addClass("d-none");
|
||||
this.divPapelEspecialInteriorColor.empty();
|
||||
this.divGramajeInteriorColor.empty();
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel: papel,
|
||||
tipo: tipo,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillGramajesColor.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#handlePapelInteriorEspecialColor() {
|
||||
|
||||
const context = this;
|
||||
|
||||
$('#divPapelInterior').removeClass('is-invalid');
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
|
||||
this.papelInteriorColor = this.papelEspecialColor.getVal();
|
||||
|
||||
let tipo = this.getTipoImpresionColor();
|
||||
|
||||
new Ajax('/configuracion/papelesgenericos/getpapelcliente',
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
papel: this.papelInterior,
|
||||
tipo: tipo,
|
||||
ancho: this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: this.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
this.fillGramajesColor.bind(context),
|
||||
(response) => { console.log(response); }
|
||||
).get();
|
||||
|
||||
}
|
||||
|
||||
|
||||
fillGramajes(response) {
|
||||
@ -664,13 +957,11 @@ class DisenioInterior {
|
||||
this.divGramajeInterior.empty()
|
||||
let showGramaje = false;
|
||||
|
||||
if (response.length <= 0 && response.length <= 0) {
|
||||
if (response.papeles.length <= 0 && response.papeles_especiales.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.textoGramajeInterior.removeClass('d-none');
|
||||
|
||||
let papel = response.length > 0 ? response : response;
|
||||
let papel = response.papeles.length > 0 ? response.papeles : response.papeles_especiales;
|
||||
|
||||
papel.forEach(valor => {
|
||||
|
||||
@ -737,6 +1028,65 @@ class DisenioInterior {
|
||||
}
|
||||
}
|
||||
|
||||
fillGramajesColor(response) {
|
||||
|
||||
$('#divGramajeInterior').removeClass('is-invalid');
|
||||
|
||||
this.divGramajeInteriorColor.empty()
|
||||
let showGramaje = false;
|
||||
|
||||
if (response.papeles.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
response.papeles.forEach(valor => {
|
||||
|
||||
var container = $('<div>', {
|
||||
class: 'custom-selector custom-selector-gramaje-color d-flex flex-column align-items-center justify-content-center gramaje-interior',
|
||||
});
|
||||
|
||||
var radioButton = $('<input>', {
|
||||
type: 'radio', // Tipo de input
|
||||
name: ' calcular-solapas calcular-presupuesto gramaje-interior-color',
|
||||
id: 'gramajeColor_' + valor.gramaje, // ID único
|
||||
value: 'option1' // Valor del radio button
|
||||
});
|
||||
|
||||
// Crear una etiqueta para el radio button
|
||||
var label = $('<label>', {
|
||||
for: "gramajeColor_" + valor.gramaje,
|
||||
text: valor.gramaje + " gr"
|
||||
});
|
||||
|
||||
radioButton.on('click', (event) => {
|
||||
const element = $(event.target);
|
||||
const gramaje = element[0].id;
|
||||
|
||||
this.presupuestoCliente.calcularSolapas(event);
|
||||
this.presupuestoCliente.checkForm(event);
|
||||
});
|
||||
|
||||
|
||||
container.append(radioButton).append(label);
|
||||
$('#divGramajeInteriorColor').append(container);
|
||||
|
||||
if (this.gramaje != null) {
|
||||
if (this.gramaje == valor.gramaje) {
|
||||
radioButton.prop('checked', true);
|
||||
radioButton.trigger('click');
|
||||
}
|
||||
}
|
||||
|
||||
showGramaje = true;
|
||||
});
|
||||
|
||||
if ($("#divGramajeInteriorColor").hasClass("d-none") && showGramaje) {
|
||||
$("#divGramajeInteriorColor").removeClass("d-none");
|
||||
}
|
||||
else if (!showGramaje) {
|
||||
$("#divGramajeInteriorColor").addClass("d-none");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user