mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Compare commits
5 Commits
mod/permis
...
ca2aeacd84
| Author | SHA1 | Date | |
|---|---|---|---|
| ca2aeacd84 | |||
| 9d6647548c | |||
| 40b53dc1e3 | |||
| 7bb6329783 | |||
| ad8e0ac75b |
@ -37,6 +37,7 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
|
||||
$routes->post('menuitems', 'Papelesgenericos::menuItems', ['as' => 'menuItemsOfPapelesGenericos']);
|
||||
$routes->get('getpapelcliente', 'Papelesgenericos::getPapelCliente', ['as' => 'getPapelCliente']);
|
||||
$routes->get('selectpapelespecial', 'Papelesgenericos::selectPapelEspecial', ['as' => 'selectPapelEspecial']);
|
||||
$routes->get('gettipopapel', 'Papelesgenericos::getTipoPapelCliente');
|
||||
});
|
||||
|
||||
/* Papeles impresion */
|
||||
|
||||
@ -38,7 +38,6 @@ class ConfigVariables extends BaseResourceController
|
||||
|
||||
public function index()
|
||||
{
|
||||
checkPermission('variables-sistema.menu');
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
@ -61,8 +60,6 @@ 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,16 +42,11 @@ 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,6 +305,22 @@ 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);
|
||||
|
||||
|
||||
return $this->respond($result);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getPapelCliente()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
@ -58,12 +58,8 @@ 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',
|
||||
|
||||
@ -18,5 +18,96 @@ 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) {
|
||||
$builder->where("t3.rotativa", 1);
|
||||
} else if ($data->POD == true) {
|
||||
$builder->where("t3.rotativa", 0);
|
||||
}
|
||||
}
|
||||
|
||||
$return_data = $builder->orderBy("t1.clave", "asc")->get()->getResultObject();
|
||||
//$query = $this->db->getLastQuery();
|
||||
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,14 +4,17 @@ namespace App\Services;
|
||||
|
||||
use CodeIgniter\Config\BaseService;
|
||||
use App\Models\Configuracion\TipoPapelGenericoModel;
|
||||
use App\Models\Configuracion\PapelGenericoModel;
|
||||
|
||||
class PapelService extends BaseService
|
||||
{
|
||||
protected TipoPapelGenericoModel $tipoPapelGenericoModel;
|
||||
protected PapelGenericoModel $papelGenericoModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->tipoPapelGenericoModel = model(TipoPapelGenericoModel::class);
|
||||
$this->papelGenericoModel = model(PapelGenericoModel::class);
|
||||
}
|
||||
|
||||
public function getTipoPapelGenerico()
|
||||
@ -24,4 +27,75 @@ 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;
|
||||
|
||||
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
|
||||
];
|
||||
|
||||
$list = $this->tipoPapelGenericoModel->getTiposPapelCliente($data_output);
|
||||
|
||||
return $list;
|
||||
|
||||
|
||||
/*
|
||||
$values = $this->papelGenericoModel->where('uso', $uso)->findAll();
|
||||
$tipoPapelGenericoList = [];
|
||||
foreach ($values as $value) {
|
||||
$tipoPapelGenericoList[$value->id] = lang('PapelGenerico.' . $value->clave);
|
||||
}
|
||||
|
||||
return $tipoPapelGenericoList;
|
||||
*/
|
||||
}
|
||||
}
|
||||
@ -113,7 +113,6 @@
|
||||
</div><!-- //.card -->
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section('additionalInlineJs') ?>
|
||||
|
||||
@ -11,29 +11,27 @@
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<!-- Role cards -->
|
||||
<div class="row g-4">
|
||||
<?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 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 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 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>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php foreach ($userGroupList as $item): ?>
|
||||
<?php $item->users = $model->getUsersByRol($item->keyword); ?>
|
||||
@ -46,29 +44,25 @@
|
||||
<?= 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>
|
||||
<?php if (auth()->user()->can('roles-permisos.edit')): ?>
|
||||
<a href="<?= route_to('editGroup', $item->id) ?>">
|
||||
<span><?= lang('Basic.global.edit') ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<a href="<?= route_to('editGroup', $item->id) ?>">
|
||||
<span><?= lang('Basic.global.edit') ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
if (auth()->user()->can('roles-permisos.delete')) {
|
||||
echo anchor(
|
||||
<?=
|
||||
anchor(
|
||||
'#confirm2delete',
|
||||
"<i class='ti ti-trash ti-md'></i>",
|
||||
[
|
||||
@ -78,7 +72,6 @@
|
||||
'data-bs-target' => '#confirm2delete'
|
||||
]
|
||||
);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -14,10 +14,7 @@ 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('tareas-maquina.menu') ||
|
||||
auth()->user()->can('festivos.menu') ||
|
||||
auth()->user()->can('variables-sistema.menu')
|
||||
auth()->user()->can('series-facturas.menu')
|
||||
) {
|
||||
?>
|
||||
<li class="menu-item">
|
||||
@ -69,14 +66,14 @@ if (
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->can('tareas-maquina.menu')) { ?>
|
||||
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||
<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()->can('imposiciones.menu')) { ?>
|
||||
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to("imposicionList") ?>" class="menu-link">
|
||||
<div> <?= lang("App.menu_imposiciones") ?></div>
|
||||
@ -125,7 +122,7 @@ if (
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->can('variables-sistema.menu')) { ?>
|
||||
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to('variablesIndex') ?>" class="menu-link">
|
||||
<div> <?= lang("App.menu_variables") ?></div>
|
||||
@ -139,7 +136,7 @@ if (
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (auth()->user()->can('festivos.menu')) { ?>
|
||||
<?php if (auth()->user()->inGroup('root')) { ?>
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to('festivosList') ?>" class="menu-link">
|
||||
<div> <?= lang("App.menu_config_holidays") ?></div>
|
||||
|
||||
@ -111,6 +111,29 @@ class DisenioInterior {
|
||||
this.disenioInterior.on('click', this.#handleDisenioInterior.bind(this));
|
||||
this.disenioInterior_color.on('click', this.#handleDisenioInterior.bind(this));
|
||||
|
||||
// test
|
||||
$(document).on('keydown', function (e) {
|
||||
if (e.ctrlKey && e.key === '.') {
|
||||
e.preventDefault(); // Evita comportamiento por defecto si es necesario
|
||||
console.log('Se pulsó Control + .');
|
||||
new Ajax('/configuracion/papelesgenericos/gettipopapel',
|
||||
{
|
||||
[self.csrf_token]: self.csrf_hash,
|
||||
tirada: $('#tirada').val(),
|
||||
tipo: () => self.getTipoImpresion(),
|
||||
ancho: self.presupuestoCliente.datosGenerales.getDimensionLibro().ancho,
|
||||
alto: self.presupuestoCliente.datosGenerales.getDimensionLibro().alto,
|
||||
solapas: 0,
|
||||
lomo: 0,
|
||||
cubierta: 0,
|
||||
},
|
||||
{},
|
||||
(response) => { console.log(response); },
|
||||
(response) => { console.error(response); }
|
||||
).get();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user