Merge branch 'feat/errores_presupuestos' into 'dev/presu_cliente_v2'

Feat/errores presupuestos

See merge request jjimenez/safekat!348
This commit is contained in:
Alvaro
2024-10-19 07:34:00 +00:00
14 changed files with 7569 additions and 133 deletions

View File

@ -1,6 +1,7 @@
<?php
use CodeIgniter\Router\RouteCollection;
/**
* @var RouteCollection $routes
*/
@ -51,7 +52,6 @@ $routes->group('tarifas', ['namespace' => 'App\Controllers\Tarifas'], function (
$routes->get('delete/(:num)', 'TarifaAcabadosLineas::delete/$1', ['as' => 'tarifaAcabadoLineasDelete']);
});
});
});
/* Rutas para configuraciones */
@ -65,7 +65,6 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
$routes->match(['get', 'post'], 'edit/(:num)', 'Ubicaciones::edit/$1', ['as' => 'ubicacionesEdit']);
$routes->get('delete/(:num)', 'Ubicaciones::delete/$1', ['as' => 'ubicacionesDelete']);
$routes->post('datatable', 'Ubicaciones::datatable', ['as' => 'ubicacionesDT']);
});
/* Series Factura */
@ -86,14 +85,20 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
$routes->get('delete/(:num)', 'FormasPago::delete/$1', ['as' => 'formasPagoDelete']);
$routes->post('datatable', 'FormasPago::datatable', ['as' => 'formasPagoDT']);
});
$routes->group("variables",["namespace" => 'App\Controllers\Configuracion'],function($routes){
$routes->group("variables", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
$routes->get('', 'ConfigVariables::index', ['as' => 'variablesIndex']);
$routes->get('find/(:num)', 'ConfigVariables::get/$1', ['as' => 'variablesFind']);
$routes->post('edit/(:num)', 'ConfigVariables::updateVariable/$1', ['as' => 'updateVariable']);
$routes->delete('delete/(:num)', 'ConfigVariables::delete/$1', ['as' => 'deleteVariable']);
$routes->get('datatable', 'ConfigVariables::datatable', ['as' => 'datatableVariables']);
});
$routes->group("errores-presupuesto", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
$routes->get('', 'ConfigErrores::index', ['as' => 'erroresPresupuestoIndex']);
$routes->get('edit/(:num)', 'ConfigErrores::viewForm/$1', ['as' => 'erroresPresupuestoViewForm']);
$routes->get('get/(:num)', 'ConfigErrores::get_error_presupuesto/$1', ['as' => 'erroresPresupuestoGetErrorPresupuesto']);
$routes->get('datatable', 'ConfigErrores::datatable', ['as' => 'erroresPresupuestoDatatable']);
$routes->post('edit/(:num)', 'ConfigErrores::update_error_presupuesto/$1', ['as' => 'erroresPresupuestoUpdate']);
});
});
@ -373,7 +378,6 @@ $routes->group('clientes', ['namespace' => 'App\Controllers\Clientes'], function
$routes->post('menuitems', 'Cliente::menuItems', ['as' => 'menuItemsOfClientes']);
$routes->get('getSelect2', 'Cliente::getSelect2', ['as' => 'getListaSelect2']);
});
});
@ -567,7 +571,7 @@ $routes->group('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos
$routes->resource('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Cosidotapablanda', 'except' => 'show,new,create,update']);
$routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->get('list', 'Presupuestocliente::list', ['as' => 'listaPresupuestos']);
$routes->get('list', 'Presupuestocliente::list', ['as' => 'listaPresupuestos']);
$routes->post('datatable', 'Presupuestocliente::datatable', ['as' => 'datatableOfPresupuestos']);
$routes->get('add', 'Presupuestocliente::add', ['as' => 'nuevoPresupuestoCliente']);
$routes->post('add', 'Presupuestocliente::add', ['as' => 'crearPresupuestoCliente']);
@ -595,7 +599,6 @@ $routes->group('serviciosencuadernaciones', ['namespace' => 'App\Controllers\Pre
$routes->post('menuitems', 'Presupuestoencuadernaciones::menuItems', ['as' => 'menuItemsOfPresupuestoEncuadernaciones']);
$routes->get('delete/(:num)', 'Presupuestoencuadernaciones::delete/$1', ['as' => 'deletePresupuestoencuadernaciones']);
$routes->post('edit/(:num)', 'Presupuestoencuadernaciones::edit/$1', ['as' => 'updatePresupuestoencuadernaciones']);
});
$routes->group('serviciosmanipulados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
@ -621,13 +624,13 @@ $routes->group('presupuestodirecciones', ['namespace' => 'App\Controllers\Presup
$routes->group('presupuestotiradasalternativas', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->post('datatable', 'Presupuestotiradasalternativas::datatable', ['as' => 'dataTableOfPresupuestoTiradasAlternativas']);
$routes->post('datatable_2', 'Presupuestotiradasalternativas::datatable_2', ['as' => 'getTiradaData']);
});
});
$routes->group('pedidos', ['namespace' => 'App\Controllers\Pedidos'], function ($routes) {
$routes->get('list', 'Pedido::todos', ['as' => 'listaPresupuestos']);
$routes->get('listActivos', 'Pedido::activos', ['as' => 'listaPresupuestosActivos']);
$routes->get('listFinalizados', 'Pedido::finalizados', ['as' => 'listaFinalizados']);
$routes->get('listCancelados', 'Pedido::cancelados', ['as' => 'listaCancelados']);
$routes->get('listActivos', 'Pedido::activos', ['as' => 'listaPresupuestosActivos']);
$routes->get('listFinalizados', 'Pedido::finalizados', ['as' => 'listaFinalizados']);
$routes->get('listCancelados', 'Pedido::cancelados', ['as' => 'listaCancelados']);
$routes->post('datatable', 'Pedido::datatable', ['as' => 'dataTableOfPedidos']);
$routes->get('add', 'Pedido::add', ['as' => 'nuevoPedido']);
$routes->post('add', 'Pedido::add', ['as' => 'crearPedido']);
@ -635,9 +638,7 @@ $routes->group('pedidos', ['namespace' => 'App\Controllers\Pedidos'], function (
$routes->post('getlineas', 'Pedido::getLineas', ['as' => 'tablaLineasPedido']);
$routes->post('cambiarestado', 'Pedido::cambiarEstado', ['as' => 'cambiarEstadoPedido']);
$routes->post('update/(:any)', 'Pedido::update/$1', ['as' => 'actualizarPedido']);
$routes->get('xml/(:num)', 'Pedido::get_xml_pedido/$1',['as' => 'getXMLPedido']);
$routes->get('xml/(:num)', 'Pedido::get_xml_pedido/$1', ['as' => 'getXMLPedido']);
});
$routes->resource('pedidos', ['namespace' => 'App\Controllers\Pedidos', 'controller' => 'Pedido', 'except' => 'show,new,create,update']);
@ -724,7 +725,10 @@ $routes->group(
}
);
$routes->group('buscadorpresupuestos', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
$routes->group(
'buscadorpresupuestos',
['namespace' => 'App\Controllers\Presupuestos'],
function ($routes) {
$routes->get('', 'Buscador::list', ['as' => 'buscadorPresupuestosList']);
$routes->post('datatable', 'Buscador::datatable', ['as' => 'dataTableOfBuscador']);
}
@ -732,7 +736,10 @@ $routes->group('buscadorpresupuestos', ['namespace' => 'App\Controllers\Presupue
$routes->resource('buscadorpresupuestos', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Buscador', 'except' => 'show,new,create,update']);
$routes->group('papel-formato', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
$routes->group(
'papel-formato',
['namespace' => 'App\Controllers\Configuracion'],
function ($routes) {
$routes->post('menuitems', 'Papelformato::menuitems', ['as' => 'menuitems']);
$routes->get('getSelect2', 'Papelformato::getSelect2', ['as' => 'getSelect2']);
}
@ -753,9 +760,7 @@ $routes->group('mensajes', ['namespace' => 'App\Controllers\Mensajeria'], functi
$routes->match(['get', 'post'], 'edit/(:num)', 'TarifaAcabados::edit/$1', ['as' => 'tarifaAcabadoEdit']);
$routes->get('delete/(:num)', 'TarifaAcabados::delete/$1', ['as' => 'tarifaAcabadoDelete']);
$routes->post('datatable', 'TarifaAcabados::datatable', ['as' => 'tarifaAcabadoDT']);*/
});
});
$routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($routes) {
$routes->get('departments', 'ChatController::get_chat_departments', ['as' => 'getChatDepartments']);
@ -779,14 +784,9 @@ $routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($route
$routes->post('hebra/pedido', 'ChatController::store_hebra_pedido', ['as' => 'storeHebraPedido']);
$routes->post('hebra/factura', 'ChatController::store_hebra_factura', ['as' => 'storeHebraFactura']);
$routes->post('hebra/(:num)', 'ChatController::update_hebra/$1', ['as' => 'updateHebra']);
$routes->get('hebra/presupuesto/(:num)',"ChatController::get_hebra_presupuesto/$1",["as" => "getHebraPresupuesto"]);
$routes->get('hebra/pedido/(:num)',"ChatController::get_hebra_pedido/$1",["as" => "getHebraPedido"]);
$routes->get('hebra/factura/(:num)',"ChatController::get_hebra_factura/$1",["as" => "getHebraFactura"]);
$routes->get('hebra/presupuesto/(:num)', "ChatController::get_hebra_presupuesto/$1", ["as" => "getHebraPresupuesto"]);
$routes->get('hebra/pedido/(:num)', "ChatController::get_hebra_pedido/$1", ["as" => "getHebraPedido"]);
$routes->get('hebra/factura/(:num)', "ChatController::get_hebra_factura/$1", ["as" => "getHebraFactura"]);
});
@ -828,4 +828,4 @@ $routes->resource('translate', ['namespace' => 'App\Controllers', 'controller' =
*/
if (file_exists(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace App\Controllers\Configuracion;
use App\Controllers\BaseResourceController;
use App\Models\Collection;
use App\Models\Presupuestos\ErrorPresupuesto as ErrorPresupuestoModel;
use CodeIgniter\HTTP\Response;
use Hermawan\DataTables\DataTable;
class ConfigErrores extends BaseResourceController
{
protected ErrorPresupuestoModel $errorPresupuestoModel;
protected $format = 'json';
protected array $viewData = [];
protected static $viewPath = 'themes/vuexy/form/configuracion/error_presupuesto/';
protected static $controllerSlug = "errores-presupuesto";
protected $indexRoute = 'viewErrorPresupuestoList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->errorPresupuestoModel = model(ErrorPresupuestoModel::class);
}
public function index()
{
return view(static::$viewPath . $this->indexRoute, $this->viewData);
}
public function viewForm(int $error_presupuesto_id)
{
$this->errorPresupuestoModel->update($error_presupuesto_id, [
"last_user_id" => auth()->user()->id
]);
return view(static::$viewPath . 'viewErrorPresupuestoForm', ["error_presupuesto_id" => $error_presupuesto_id]);
}
public function store()
{
$data = [];
$variableCreated = $this->errorPresupuestoModel->store($data);
return $this->response->setJSON($variableCreated);
}
public function get_error_presupuesto(int $error_presupuesto_id)
{
$data = $this->errorPresupuestoModel->getQueryDatatable()
->where("presupuesto_errores.id", $error_presupuesto_id)->get()->getResultObject()[0];
return $this->response->setJSON(["data" => $data]);
}
public function update_error_presupuesto(int $error_presupuesto_id)
{
$bodyData = $this->request->getPost();
$this->errorPresupuestoModel->updateComment($error_presupuesto_id, $bodyData["comments"]);
return $this->response->setJSON(["message" => "Comentario actualizado", "status" => true]);
}
public function datatable()
{
$query = $this->errorPresupuestoModel->getQueryDatatable();
return DataTable::of($query)
->add("action", fn($q) => $q->id)
->toJson(true);
}
}

View File

@ -33,7 +33,6 @@ class ConfigVariables extends BaseResourceController
parent::initController($request, $response, $logger);
$this->configVariableModel = model(ConfigVariableModel::class);
}
@ -48,45 +47,46 @@ class ConfigVariables extends BaseResourceController
return view(static::$viewPath . $this->indexRoute, $viewData);
}
public function store(){
public function store()
{
$data = [];
$variableCreated = $this->configVariableModel->store($data);
return $this->response->setJSON($variableCreated);
}
public function get(int $config_variable_id){
public function get(int $config_variable_id)
{
$data = $this->configVariableModel->find($config_variable_id);
return $this->response->setJSON($data);
}
public function updateVariable(int $config_variable_id){
public function updateVariable(int $config_variable_id)
{
$reqData = [];
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
$status = $this->configVariableModel->update($config_variable_id,$reqData);
$status = $this->configVariableModel->update($config_variable_id, $reqData);
return $this->response->setJSON([
"message" => "Variable actualizada correctamente",
"status" => $status
]);
}
else {
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function deleteVariable(int $config_variable_id): Response
{
return $this->response->setJSON([]);
}
public function datatable(){
public function datatable()
{
$query = $this->configVariableModel->builder()->select([
"id",
"name",
"value",
"description"])->orderBy("name","asc");
"description"
])->orderBy("name", "asc");
return DataTable::of($query)
->add("action",fn($q) => $q->id)
->toJson(true);
->add("action", fn($q) => $q->id)
->toJson(true);
}
}

View File

@ -684,6 +684,7 @@ return [
"menu_configuration" => "Configuración",
"menu_variables" => "Variables sistema",
"menu_error_presupuesto" => "Errores presupuesto",
"menu_calendario" => "Calendario",
"menu_paises" => "Paises",
"menu_correo" => "Correo",

View File

@ -0,0 +1,21 @@
<?php
return [
"cardTitle" => "Errores presupuesto",
"datatable" =>
[
"columns" => [
"usuario" => "Usuario presupuesto",
"last_user_id" => "Último accesso",
"visto" => "Visto",
"created_at" => "Creado"
]
],
"form" =>
[
"name" => "Nombre",
"value" => "Valor",
"description" => "Descripción",
]
];

View File

@ -0,0 +1,96 @@
<?php
namespace App\Models\Presupuestos;
use CodeIgniter\Database\BaseBuilder;
use CodeIgniter\Model;
class ErrorPresupuesto extends Model
{
protected $table = 'presupuesto_errores';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'object';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = [
"presupuesto_id",
"presupuesto_user_id",
"error",
"datos_presupuesto",
"visto",
"last_user_id",
"comment",
"created_at",
"updated_at",
"deleted_at",
];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = false;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
public function insertError(int $presupuesto_id, int $presupuesto_user_id, string $error, mixed $datos)
{
$this->insert([
"presupuesto_id" => $presupuesto_id,
"presupuesto_user_id" => $presupuesto_user_id,
"error" => $error,
"datos_presupuesto" => json_encode($datos)
]);
}
public function updateComment(int $error_presupuesto_id, string $comment): bool
{
$updated = $this->update($error_presupuesto_id, [
"comment" => $comment
]);
return $updated;
}
public function getQueryDatatable(): BaseBuilder
{
$query = $this->builder()
->select([
"presupuesto_errores.id",
"presupuestos.id as presupuestoId",
"CONCAT(t1.first_name,' ',t1.last_name) as presupuestoUser",
"CONCAT(t2.first_name,' ',t2.last_name) as lastUser",
"presupuesto_errores.created_at",
"presupuesto_errores.datos_presupuesto",
"presupuesto_errores.error",
"presupuesto_errores.visto",
"presupuesto_errores.comment",
])
->join("users t1", "t1.id = presupuesto_errores.presupuesto_user_id", "left")
->join("users t2", "t2.id = presupuesto_errores.last_user_id", "left")
->join("presupuestos", "presupuestos.id = presupuesto_errores.presupuesto_id", "left")
->where("presupuesto_errores.deleted_at", null);
return $query;
}
}

View File

@ -0,0 +1,83 @@
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title">Error presupuesto</h3>
</div>
<!--//.card-header -->
<div class="card-body" id="error-presupuesto-container">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<form id="error-presupuesto-form">
<input id="error-presupuesto-id" value="<?= $error_presupuesto_id ?>" hidden>
<div class="row justify-content-start align-items-end mb-3">
<div class="col-md-10 overflow-hidden w-20">
<label for="presupuesto-user-id">Usuario presupuesto</label>
<input name="presupuesto_user_id" type="text" class="form-control" id="presupuesto-user-id"
disabled>
</div>
<div class="col-md-2 overflow-hidden w-20">
<label class="switch switch-square switch-lg">
<input type="checkbox" class="switch-input" id="error-presupuesto-visto" name="visto" disabled>
<span class="switch-toggle-slider">
<span class="switch-on">
<i class="ti ti-eye"></i>
</span>
<span class="switch-off">
<i class="ti ti-eye-off"></i>
</span>
</span>
<span class="switch-label">Visto</span>
</label>
</div>
</div>
<div class="row">
<div class="col-md-6 mb-3 overflow-hidden">
<label for="datos-presupuesto">Datos</label>
<textarea rows="10" class="form-control" id="datos-presupuesto"
placeholder="Datos presupuesto" disabled></textarea>
</div>
<div class="col-md-6 mb-3 overflow-hidden">
<label for="error-presupuesto">Error</label>
<textarea rows="10" class="form-control" id="error-presupuesto"
placeholder="Error" disabled></textarea>
</div>
<div class="col-md-12 mb-3 overflow-hidden">
<label for="comments-presupuesto">Comentarios</label>
<textarea rows="10" class="form-control" id="comments-presupuesto"
placeholder="Comentarios"></textarea>
</div>
<div class="col-md-12">
<button class="btn btn-primary button-update-comment w-100" type="button">
<span class="ti ti-sm ti-send me-1" id="update-button-icon"></span>
<span class="spinner-border me-1" role="status" aria-hidden="true" id="update-button-loader" hidden></span>
<?= lang("App.global_save") ?></button>
</div>
</div>
</form>
</div>
</div>
<!--//.card-body -->
<div class="card-footer">
</div>
<!--//.card-footer -->
</div>
<!--//.card -->
</div>
<!--//.col -->
<!--//.row -->
<?= $this->endSection() ?>
<?= $this->section("additionalExternalJs") ?>
<script type="module" src="<?= site_url('assets/js/safekat/pages/configuracion/error_presupuesto/indexForm.js') ?>">
</script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,50 @@
<?= $this->include('themes/_commonPartialsBs/select2bs5') ?>
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?= lang('ErrorPresupuesto.cardTitle') ?></h3>
</div>
<!--//.card-header -->
<div class="card-body" id="errorPresupuestoCard">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableErrorPresupuesto" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th>ID Presupuesto</th>
<th><?= lang('ErrorPresupuesto.datatable.columns.usuario') ?></th>
<th><?= lang('ErrorPresupuesto.datatable.columns.last_user_id') ?></th>
<th><?= lang('ErrorPresupuesto.datatable.columns.visto') ?></th>
<th><?= lang('ErrorPresupuesto.datatable.columns.created_at') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<!--//.card-body -->
<div class="card-footer">
</div>
<!--//.card-footer -->
</div>
<!--//.card -->
</div>
<!--//.col -->
</div>
<!--//.row -->
<?= $this->endSection() ?>
<?= $this->section("additionalExternalJs") ?>
<script type="module" src="<?= site_url('assets/js/safekat/pages/configuracion/error_presupuesto/indexView.js') ?>">
</script>
<?= $this->endSection() ?>

View File

@ -14,97 +14,104 @@ if (
auth()->user()->can('roles-permisos.menu')
) {
?>
<li class="menu-item">
<a href="javascript:void(0);" class="menu-link menu-toggle">
<i class="menu-icon tf-icons ti ti-adjustments-horizontal"></i>
<?= lang("App.menu_configuration") ?>
</a>
<ul class="menu-sub">
<li class="menu-item">
<a href="javascript:void(0);" class="menu-link menu-toggle">
<i class="menu-icon tf-icons ti ti-adjustments-horizontal"></i>
<?= lang("App.menu_configuration") ?>
</a>
<ul class="menu-sub">
<?php if (auth()->user()->can('paises.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to('paisList') ?>" class="menu-link">
<?= lang("App.menu_paises") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('formas-pago.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to('formasPagoList') ?>" class="menu-link">
<?= lang("App.menu_formas_pago") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('papel-generico.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/papelesgenericos") ?>" class="menu-link">
<?= lang("App.menu_papelgenerico") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('papel-impresion.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/papelesimpresion") ?>" class="menu-link">
<?= lang("App.menu_papelimpresion") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('maquinas.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/maquinas") ?>" class="menu-link">
<?= lang("App.menu_maquina") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('maquinas-defecto.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/maquinasdefecto") ?>" class="menu-link">
<?= lang("App.menu_maquina_defecto") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('usuarios.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/users") ?>" class="menu-link">
<?= lang("App.menu_users") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('roles-permisos.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/group") ?>" class="menu-link">
<?= lang("App.menu_permission_group") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('proveedores.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to("proveedorList") ?>" class="menu-link">
<?= lang("App.menu_proveedores") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('ubicaciones.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to("ubicacionesList") ?>" class="menu-link">
<?= lang("App.menu_ubicaciones") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('series-facturas.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to("seriesFacturasList") ?>" class="menu-link">
<?= lang("App.menu_series_facturas") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
<li class="menu-item">
<a href="<?= route_to('variablesIndex') ?>" class="menu-link">
<?= lang("App.menu_variables") ?>
</a>
</li>
<?php } ?>
</ul>
</li>
<?php if (auth()->user()->can('paises.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to('paisList') ?>" class="menu-link">
<?= lang("App.menu_paises") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('formas-pago.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to('formasPagoList') ?>" class="menu-link">
<?= lang("App.menu_formas_pago") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('papel-generico.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/papelesgenericos") ?>" class="menu-link">
<?= lang("App.menu_papelgenerico") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('papel-impresion.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/papelesimpresion") ?>" class="menu-link">
<?= lang("App.menu_papelimpresion") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('maquinas.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/maquinas") ?>" class="menu-link">
<?= lang("App.menu_maquina") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('maquinas-defecto.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/maquinasdefecto") ?>" class="menu-link">
<?= lang("App.menu_maquina_defecto") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('usuarios.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/users") ?>" class="menu-link">
<?= lang("App.menu_users") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('roles-permisos.menu')) { ?>
<li class="menu-item">
<a href="<?= site_url("configuracion/group") ?>" class="menu-link">
<?= lang("App.menu_permission_group") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('proveedores.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to("proveedorList") ?>" class="menu-link">
<?= lang("App.menu_proveedores") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('ubicaciones.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to("ubicacionesList") ?>" class="menu-link">
<?= lang("App.menu_ubicaciones") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->can('series-facturas.menu')) { ?>
<li class="menu-item">
<a href="<?= route_to("seriesFacturasList") ?>" class="menu-link">
<?= lang("App.menu_series_facturas") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
<li class="menu-item">
<a href="<?= route_to('erroresPresupuestoIndex') ?>" class="menu-link">
<?= lang("App.menu_error_presupuesto") ?>
</a>
</li>
<?php } ?>
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
<li class="menu-item">
<a href="<?= route_to('variablesIndex') ?>" class="menu-link">
<?= lang("App.menu_variables") ?>
</a>
</li>
<?php } ?>
</ul>
</li>
<?php } ?>

View File

@ -0,0 +1,46 @@
class ErrorPresupuestoView {
constructor(domItem) {
this.item = domItem
this.datatableItem = this.item.find("#tableErrorPresupuesto")
this.datatableColumns = [
{ data: 'presupuestoId', searchable: true, sortable: false },
{ data: 'presupuestoUser',searchable: true, sortable: false },
{ data: 'lastUser', searchable: true, sortable: false },
{ data: 'visto', searchable: false, sortable: false ,
render : (d,t) => {
const iconClass = d ? "ti ti-sm ti-check" : "ti ti-sm ti-x"
return `<span class="${iconClass}"</span>`
}
},
{ data: 'created_at', searchable: false, sortable: true },
{
data: 'action', sortable: false, searchable: false,
render: (d, t) => {
return `
<div class="btn-group btn-group-sm">
<a href="/configuracion/errores-presupuesto/edit/${d}" data-id="${d}" class="edit-error-presupuesto"><i class="ti ti-eye ti-sm mx-2"></i></a>
</div>
`
}
},
]
}
init() {
this.datatable = this.datatableItem.DataTable({
processing: true,
dom: 'Brtip',
serverSide: true,
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
columns: this.datatableColumns,
ajax: '/configuracion/errores-presupuesto/datatable'
});
}
}
export default ErrorPresupuestoView;

View File

@ -0,0 +1,75 @@
import Ajax from "../../../components/ajax.js";
import ajax from "../../../components/ajax.js"
class ErrorPresupuestoForm {
constructor(domItem) {
this.item = domItem
this.form = this.item.find("#error-presupuesto-form")
this.inputPresupuestoUserId = this.item.find("#presupuesto-user-id")
this.inputDatos = this.item.find("#datos-presupuesto")
this.inputComments = this.item.find("#comments-presupuesto")
this.errorPresupuestoId = this.item.find("#error-presupuesto-id").attr("value")
this.updateBtnIcon = this.item.find(".button-update-comment")
this.checkVisto = this.item.find("#error-presupuesto-visto")
this.loader = this.item.find("#update-button-loader")
this.btnIcon = this.item.find("#update-button-icon")
}
init() {
this.item.on("click",".button-update-comment",this.handlePostErrorPresupuesto.bind(this))
this.handleGetErrorPresupuesto()
}
handleGetErrorPresupuesto()
{
const ajax = new Ajax(
`/configuracion/errores-presupuesto/get/${this.errorPresupuestoId}`,
null,
null,
this.handleGetErrorPresupuestoSuccess.bind(this),
this.handleGetErrorPresupuestoError.bind(this)
)
ajax.get()
}
handleGetErrorPresupuestoSuccess(data){
this.inputPresupuestoUserId.val(data.data.presupuestoUser)
this.inputDatos.val(data.data.datos)
this.inputComments.val(data.data.comment)
this.updateBtnIcon.prop("disabled",false)
this.checkVisto.prop("checked",parseInt(data.data.visto) == 1 ? true : false)
this.setLoader(false)
}
setLoader(state = true){
this.loader.prop("hidden",!state)
this.btnIcon.prop("hidden",state)
}
handleGetErrorPresupuestoError(){}
handlePostErrorPresupuesto()
{
let data =
{
"comments" : this.inputComments.val()
}
this.updateBtnIcon.prop("disabled",true)
this.setLoader()
const ajax = new Ajax(
`/configuracion/errores-presupuesto/edit/${this.errorPresupuestoId}`,
data,
null,
this.handlePostErrorPresupuestoSuccess.bind(this),
this.handlePostErrorPresupuestoError.bind(this)
)
ajax.post()
}
handlePostErrorPresupuestoSuccess(){
this.handleGetErrorPresupuesto()
}
handlePostErrorPresupuestoError(error){}
}
export default ErrorPresupuestoForm;

View File

@ -0,0 +1,6 @@
import ErrorPresupuestoForm from "./errorPresupuestoForm.js";
$(document).ready(() => {
const errorPresupuestoForm = new ErrorPresupuestoForm($("#error-presupuesto-container"))
errorPresupuestoForm.init()
})

View File

@ -0,0 +1,6 @@
import ErrorPresupuestoView from "./errorPresupuesto.js";
$(document).ready(()=>{
const errorPresupuesto = new ErrorPresupuestoView($("#errorPresupuestoCard"))
errorPresupuesto.init()
})

File diff suppressed because it is too large Load Diff