mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
error presupuestos
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use CodeIgniter\Router\RouteCollection;
|
use CodeIgniter\Router\RouteCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var RouteCollection $routes
|
* @var RouteCollection $routes
|
||||||
*/
|
*/
|
||||||
@ -51,7 +52,6 @@ $routes->group('tarifas', ['namespace' => 'App\Controllers\Tarifas'], function (
|
|||||||
$routes->get('delete/(:num)', 'TarifaAcabadosLineas::delete/$1', ['as' => 'tarifaAcabadoLineasDelete']);
|
$routes->get('delete/(:num)', 'TarifaAcabadosLineas::delete/$1', ['as' => 'tarifaAcabadoLineasDelete']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Rutas para configuraciones */
|
/* 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->match(['get', 'post'], 'edit/(:num)', 'Ubicaciones::edit/$1', ['as' => 'ubicacionesEdit']);
|
||||||
$routes->get('delete/(:num)', 'Ubicaciones::delete/$1', ['as' => 'ubicacionesDelete']);
|
$routes->get('delete/(:num)', 'Ubicaciones::delete/$1', ['as' => 'ubicacionesDelete']);
|
||||||
$routes->post('datatable', 'Ubicaciones::datatable', ['as' => 'ubicacionesDT']);
|
$routes->post('datatable', 'Ubicaciones::datatable', ['as' => 'ubicacionesDT']);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Series Factura */
|
/* Series Factura */
|
||||||
@ -86,20 +85,20 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
|
|||||||
$routes->get('delete/(:num)', 'FormasPago::delete/$1', ['as' => 'formasPagoDelete']);
|
$routes->get('delete/(:num)', 'FormasPago::delete/$1', ['as' => 'formasPagoDelete']);
|
||||||
$routes->post('datatable', 'FormasPago::datatable', ['as' => 'formasPagoDT']);
|
$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('', 'ConfigVariables::index', ['as' => 'variablesIndex']);
|
||||||
$routes->get('find/(:num)', 'ConfigVariables::get/$1', ['as' => 'variablesFind']);
|
$routes->get('find/(:num)', 'ConfigVariables::get/$1', ['as' => 'variablesFind']);
|
||||||
$routes->post('edit/(:num)', 'ConfigVariables::updateVariable/$1', ['as' => 'updateVariable']);
|
$routes->post('edit/(:num)', 'ConfigVariables::updateVariable/$1', ['as' => 'updateVariable']);
|
||||||
$routes->delete('delete/(:num)', 'ConfigVariables::delete/$1', ['as' => 'deleteVariable']);
|
$routes->delete('delete/(:num)', 'ConfigVariables::delete/$1', ['as' => 'deleteVariable']);
|
||||||
$routes->get('datatable', 'ConfigVariables::datatable', ['as' => 'datatableVariables']);
|
$routes->get('datatable', 'ConfigVariables::datatable', ['as' => 'datatableVariables']);
|
||||||
});
|
});
|
||||||
$routes->group("errores-presupuesto",["namespace" => 'App\Controllers\Configuracion'],function($routes){
|
$routes->group("errores-presupuesto", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
|
||||||
$routes->get('', 'ErrorPresupuestoController::index', ['as' => 'errorPresupuestoIndex']);
|
$routes->get('', 'ConfigErrores::index', ['as' => 'erroresPresupuestoIndex']);
|
||||||
$routes->get('edit', 'ErrorPresupuestoController::viewForm/$1', ['as' => 'errorPresupuestoFormIndex']);
|
$routes->get('edit/(:num)', 'ConfigErrores::viewForm/$1', ['as' => 'erroresPresupuestoViewForm']);
|
||||||
$routes->get('datatable', 'ErrorPresupuestoController::datatable', ['as' => 'errorPresupuestoDatatable']);
|
$routes->get('get/(:num)', 'ConfigErrores::get_error_presupuesto/$1', ['as' => 'erroresPresupuestoGetErrorPresupuesto']);
|
||||||
$routes->post('edit/(:num)', 'ErrorPresupuestoController::update_error_presupuesto/$1', ['as' => 'updateErrorPresupuesto']);
|
$routes->get('datatable', 'ConfigErrores::datatable', ['as' => 'erroresPresupuestoDatatable']);
|
||||||
|
$routes->post('edit/(:num)', 'ConfigErrores::update_error_presupuesto/$1', ['as' => 'erroresPresupuestoUpdate']);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -379,7 +378,6 @@ $routes->group('clientes', ['namespace' => 'App\Controllers\Clientes'], function
|
|||||||
$routes->post('menuitems', 'Cliente::menuItems', ['as' => 'menuItemsOfClientes']);
|
$routes->post('menuitems', 'Cliente::menuItems', ['as' => 'menuItemsOfClientes']);
|
||||||
$routes->get('getSelect2', 'Cliente::getSelect2', ['as' => 'getListaSelect2']);
|
$routes->get('getSelect2', 'Cliente::getSelect2', ['as' => 'getListaSelect2']);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -600,7 +598,6 @@ $routes->group('serviciosencuadernaciones', ['namespace' => 'App\Controllers\Pre
|
|||||||
$routes->post('menuitems', 'Presupuestoencuadernaciones::menuItems', ['as' => 'menuItemsOfPresupuestoEncuadernaciones']);
|
$routes->post('menuitems', 'Presupuestoencuadernaciones::menuItems', ['as' => 'menuItemsOfPresupuestoEncuadernaciones']);
|
||||||
$routes->get('delete/(:num)', 'Presupuestoencuadernaciones::delete/$1', ['as' => 'deletePresupuestoencuadernaciones']);
|
$routes->get('delete/(:num)', 'Presupuestoencuadernaciones::delete/$1', ['as' => 'deletePresupuestoencuadernaciones']);
|
||||||
$routes->post('edit/(:num)', 'Presupuestoencuadernaciones::edit/$1', ['as' => 'updatePresupuestoencuadernaciones']);
|
$routes->post('edit/(:num)', 'Presupuestoencuadernaciones::edit/$1', ['as' => 'updatePresupuestoencuadernaciones']);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->group('serviciosmanipulados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
$routes->group('serviciosmanipulados', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) {
|
||||||
@ -640,9 +637,7 @@ $routes->group('pedidos', ['namespace' => 'App\Controllers\Pedidos'], function (
|
|||||||
$routes->post('getlineas', 'Pedido::getLineas', ['as' => 'tablaLineasPedido']);
|
$routes->post('getlineas', 'Pedido::getLineas', ['as' => 'tablaLineasPedido']);
|
||||||
$routes->post('cambiarestado', 'Pedido::cambiarEstado', ['as' => 'cambiarEstadoPedido']);
|
$routes->post('cambiarestado', 'Pedido::cambiarEstado', ['as' => 'cambiarEstadoPedido']);
|
||||||
$routes->post('update/(:any)', 'Pedido::update/$1', ['as' => 'actualizarPedido']);
|
$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']);
|
$routes->resource('pedidos', ['namespace' => 'App\Controllers\Pedidos', 'controller' => 'Pedido', 'except' => 'show,new,create,update']);
|
||||||
|
|
||||||
@ -729,7 +724,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->get('', 'Buscador::list', ['as' => 'buscadorPresupuestosList']);
|
||||||
$routes->post('datatable', 'Buscador::datatable', ['as' => 'dataTableOfBuscador']);
|
$routes->post('datatable', 'Buscador::datatable', ['as' => 'dataTableOfBuscador']);
|
||||||
}
|
}
|
||||||
@ -737,7 +735,10 @@ $routes->group('buscadorpresupuestos', ['namespace' => 'App\Controllers\Presupue
|
|||||||
$routes->resource('buscadorpresupuestos', ['namespace' => 'App\Controllers\Presupuestos', 'controller' => 'Buscador', 'except' => 'show,new,create,update']);
|
$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->post('menuitems', 'Papelformato::menuitems', ['as' => 'menuitems']);
|
||||||
$routes->get('getSelect2', 'Papelformato::getSelect2', ['as' => 'getSelect2']);
|
$routes->get('getSelect2', 'Papelformato::getSelect2', ['as' => 'getSelect2']);
|
||||||
}
|
}
|
||||||
@ -758,9 +759,7 @@ $routes->group('mensajes', ['namespace' => 'App\Controllers\Mensajeria'], functi
|
|||||||
$routes->match(['get', 'post'], 'edit/(:num)', 'TarifaAcabados::edit/$1', ['as' => 'tarifaAcabadoEdit']);
|
$routes->match(['get', 'post'], 'edit/(:num)', 'TarifaAcabados::edit/$1', ['as' => 'tarifaAcabadoEdit']);
|
||||||
$routes->get('delete/(:num)', 'TarifaAcabados::delete/$1', ['as' => 'tarifaAcabadoDelete']);
|
$routes->get('delete/(:num)', 'TarifaAcabados::delete/$1', ['as' => 'tarifaAcabadoDelete']);
|
||||||
$routes->post('datatable', 'TarifaAcabados::datatable', ['as' => 'tarifaAcabadoDT']);*/
|
$routes->post('datatable', 'TarifaAcabados::datatable', ['as' => 'tarifaAcabadoDT']);*/
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
$routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($routes) {
|
$routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($routes) {
|
||||||
$routes->get('departments', 'ChatController::get_chat_departments', ['as' => 'getChatDepartments']);
|
$routes->get('departments', 'ChatController::get_chat_departments', ['as' => 'getChatDepartments']);
|
||||||
@ -784,14 +783,9 @@ $routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($route
|
|||||||
$routes->post('hebra/pedido', 'ChatController::store_hebra_pedido', ['as' => 'storeHebraPedido']);
|
$routes->post('hebra/pedido', 'ChatController::store_hebra_pedido', ['as' => 'storeHebraPedido']);
|
||||||
$routes->post('hebra/factura', 'ChatController::store_hebra_factura', ['as' => 'storeHebraFactura']);
|
$routes->post('hebra/factura', 'ChatController::store_hebra_factura', ['as' => 'storeHebraFactura']);
|
||||||
$routes->post('hebra/(:num)', 'ChatController::update_hebra/$1', ['as' => 'updateHebra']);
|
$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/presupuesto/(:num)', "ChatController::get_hebra_presupuesto/$1", ["as" => "getHebraPresupuesto"]);
|
||||||
$routes->get('hebra/pedido/(:num)',"ChatController::get_hebra_pedido/$1",["as" => "getHebraPedido"]);
|
$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/factura/(:num)', "ChatController::get_hebra_factura/$1", ["as" => "getHebraFactura"]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
69
ci4/app/Controllers/Configuracion/ConfigErrores.php
Normal file
69
ci4/app/Controllers/Configuracion/ConfigErrores.php
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?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)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -33,7 +33,6 @@ class ConfigVariables extends BaseResourceController
|
|||||||
|
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
$this->configVariableModel = model(ConfigVariableModel::class);
|
$this->configVariableModel = model(ConfigVariableModel::class);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -48,45 +47,46 @@ class ConfigVariables extends BaseResourceController
|
|||||||
|
|
||||||
return view(static::$viewPath . $this->indexRoute, $viewData);
|
return view(static::$viewPath . $this->indexRoute, $viewData);
|
||||||
}
|
}
|
||||||
public function store(){
|
public function store()
|
||||||
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
$variableCreated = $this->configVariableModel->store($data);
|
$variableCreated = $this->configVariableModel->store($data);
|
||||||
return $this->response->setJSON($variableCreated);
|
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);
|
$data = $this->configVariableModel->find($config_variable_id);
|
||||||
return $this->response->setJSON($data);
|
return $this->response->setJSON($data);
|
||||||
}
|
}
|
||||||
public function updateVariable(int $config_variable_id){
|
public function updateVariable(int $config_variable_id)
|
||||||
|
{
|
||||||
$reqData = [];
|
$reqData = [];
|
||||||
if ($this->request->isAJAX()) {
|
if ($this->request->isAJAX()) {
|
||||||
$reqData = $this->request->getPost();
|
$reqData = $this->request->getPost();
|
||||||
$status = $this->configVariableModel->update($config_variable_id,$reqData);
|
$status = $this->configVariableModel->update($config_variable_id, $reqData);
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
"message" => "Variable actualizada correctamente",
|
"message" => "Variable actualizada correctamente",
|
||||||
"status" => $status
|
"status" => $status
|
||||||
]);
|
]);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return $this->failUnauthorized('Invalid request', 403);
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function deleteVariable(int $config_variable_id): Response
|
public function deleteVariable(int $config_variable_id): Response
|
||||||
{
|
{
|
||||||
return $this->response->setJSON([]);
|
return $this->response->setJSON([]);
|
||||||
|
|
||||||
}
|
}
|
||||||
public function datatable(){
|
public function datatable()
|
||||||
|
{
|
||||||
|
|
||||||
$query = $this->configVariableModel->builder()->select([
|
$query = $this->configVariableModel->builder()->select([
|
||||||
"id",
|
"id",
|
||||||
"name",
|
"name",
|
||||||
"value",
|
"value",
|
||||||
"description"])->orderBy("name","asc");
|
"description"
|
||||||
|
])->orderBy("name", "asc");
|
||||||
return DataTable::of($query)
|
return DataTable::of($query)
|
||||||
->add("action",fn($q) => $q->id)
|
->add("action", fn($q) => $q->id)
|
||||||
->toJson(true);
|
->toJson(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,80 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controllers\Configuracion;
|
|
||||||
|
|
||||||
use App\Controllers\BaseResourceController;
|
|
||||||
use App\Models\Collection;
|
|
||||||
use App\Models\Presupuestos\ErrorPresupuesto;
|
|
||||||
use CodeIgniter\HTTP\Response;
|
|
||||||
use Hermawan\DataTables\DataTable;
|
|
||||||
|
|
||||||
class ErrorPresupuestoController extends BaseResourceController
|
|
||||||
{
|
|
||||||
|
|
||||||
protected ErrorPresupuesto $errorPresupuestoModel;
|
|
||||||
protected $format = 'json';
|
|
||||||
protected array $viewData = [];
|
|
||||||
|
|
||||||
|
|
||||||
protected static $controllerSlug = 'error-presupuesto';
|
|
||||||
|
|
||||||
protected static $viewPath = 'themes/vuexy/form/configuracion/error_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(ErrorPresupuesto::class);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
|
|
||||||
$viewData = [
|
|
||||||
'currentModule' => static::$controllerSlug,
|
|
||||||
];
|
|
||||||
|
|
||||||
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
|
||||||
|
|
||||||
return view(static::$viewPath . $this->indexRoute, $viewData);
|
|
||||||
}
|
|
||||||
public function viewForm(int $error_presupuesto_id)
|
|
||||||
{
|
|
||||||
|
|
||||||
$viewData = [
|
|
||||||
'currentModule' => static::$controllerSlug,
|
|
||||||
'errorPresupuesto' => $this->errorPresupuestoModel->find($error_presupuesto_id),
|
|
||||||
];
|
|
||||||
|
|
||||||
return view(static::$viewPath . $this->indexRoute, $viewData);
|
|
||||||
|
|
||||||
}
|
|
||||||
public function store(){
|
|
||||||
$data = [];
|
|
||||||
$variableCreated = $this->errorPresupuestoModel->store($data);
|
|
||||||
return $this->response->setJSON($variableCreated);
|
|
||||||
}
|
|
||||||
public function get(int $error_presupuesto_id){
|
|
||||||
$data = $this->errorPresupuestoModel->find($error_presupuesto_id);
|
|
||||||
return $this->response->setJSON($data);
|
|
||||||
}
|
|
||||||
public function updateErrorPresupuesto(int $error_presupuesto_id){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function datatable(){
|
|
||||||
|
|
||||||
$query = $this->errorPresupuestoModel->getQueryDatatable();
|
|
||||||
return DataTable::of($query)
|
|
||||||
->add("action",fn($q) => $q->id)
|
|
||||||
->toJson(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -6,8 +6,8 @@ return [
|
|||||||
"datatable" =>
|
"datatable" =>
|
||||||
[
|
[
|
||||||
"columns" => [
|
"columns" => [
|
||||||
"presupuesto_user "=> "Usuario presupuesto",
|
"usuario" => "Usuario presupuesto",
|
||||||
"last_user_id" => "Último usuario",
|
"last_user_id" => "Último accesso",
|
||||||
"visto" => "Visto",
|
"visto" => "Visto",
|
||||||
"created_at" => "Creado"
|
"created_at" => "Creado"
|
||||||
]
|
]
|
||||||
|
|||||||
@ -10,7 +10,7 @@ class ErrorPresupuesto extends Model
|
|||||||
protected $table = 'presupuesto_errores';
|
protected $table = 'presupuesto_errores';
|
||||||
protected $primaryKey = 'id';
|
protected $primaryKey = 'id';
|
||||||
protected $useAutoIncrement = true;
|
protected $useAutoIncrement = true;
|
||||||
protected $returnType = 'array';
|
protected $returnType = 'object';
|
||||||
protected $useSoftDeletes = false;
|
protected $useSoftDeletes = false;
|
||||||
protected $protectFields = true;
|
protected $protectFields = true;
|
||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
@ -20,6 +20,7 @@ class ErrorPresupuesto extends Model
|
|||||||
"datos_presupuesto",
|
"datos_presupuesto",
|
||||||
"visto",
|
"visto",
|
||||||
"last_user_id",
|
"last_user_id",
|
||||||
|
"comment",
|
||||||
"created_at",
|
"created_at",
|
||||||
"updated_at",
|
"updated_at",
|
||||||
"deleted_at",
|
"deleted_at",
|
||||||
@ -55,7 +56,7 @@ class ErrorPresupuesto extends Model
|
|||||||
protected $beforeDelete = [];
|
protected $beforeDelete = [];
|
||||||
protected $afterDelete = [];
|
protected $afterDelete = [];
|
||||||
|
|
||||||
public function insertError(int $presupuesto_id,int $presupuesto_user_id,string $error,mixed $datos)
|
public function insertError(int $presupuesto_id, int $presupuesto_user_id, string $error, mixed $datos)
|
||||||
{
|
{
|
||||||
$this->insert([
|
$this->insert([
|
||||||
"presupuesto_id" => $presupuesto_id,
|
"presupuesto_id" => $presupuesto_id,
|
||||||
@ -63,24 +64,32 @@ class ErrorPresupuesto extends Model
|
|||||||
"error" => $error,
|
"error" => $error,
|
||||||
"datos" => json_encode($datos)
|
"datos" => json_encode($datos)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
public function getQueryDatatable() : BaseBuilder
|
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()
|
$query = $this->builder()
|
||||||
->select([
|
->select([
|
||||||
"presupuesto_errores.id",
|
"presupuesto_errores.id",
|
||||||
"CONCAT(t1.first_name,' ',t1.last_name) as presupuestoUser",
|
"presupuestos.id as presupuestoId",
|
||||||
"CONCAT(t2.first_name,' ',t2.last_name) as lastUser",
|
"CONCAT(t1.first_name,' ',t1.last_name) as presupuestoUser",
|
||||||
"presupuestos.titulo as presupuestoTitulo",
|
"CONCAT(t2.first_name,' ',t2.last_name) as lastUser",
|
||||||
"presupuesto_errores.created_at",
|
"presupuesto_errores.created_at",
|
||||||
"presupuesto_errores.datos",
|
"presupuesto_errores.datos",
|
||||||
"presupuesto_errores.visto",
|
"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")
|
->join("users t1", "t1.id = presupuesto_errores.presupuesto_user_id", "left")
|
||||||
->where("presupuesto_errores.deleted_at",null);
|
->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;
|
return $query;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9,44 +9,68 @@
|
|||||||
|
|
||||||
<div class="card card-info">
|
<div class="card card-info">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title">[<?= $errorPresupuesto->id ?>]Error presupuesto</h3>
|
<h3 class="card-title">Error presupuesto</h3>
|
||||||
</div><!--//.card-header -->
|
</div>
|
||||||
<div class="card-body">
|
<!--//.card-header -->
|
||||||
|
<div class="card-body" id="error-presupuesto-container">
|
||||||
|
|
||||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||||
<div class="mb-3">
|
<form id="error-presupuesto-form">
|
||||||
|
<input id="error-presupuesto-id" value="<?= $error_presupuesto_id ?>" hidden>
|
||||||
<form action="POST" class="form-control">
|
<div class="row justify-content-start align-items-end mb-3">
|
||||||
<div class="row">
|
<div class="col-md-10 overflow-hidden w-20">
|
||||||
<div class="col-md-4">
|
<label for="presupuesto-user-id">Usuario presupuesto</label>
|
||||||
</div>
|
<input name="presupuesto_user_id" type="text" class="form-control" id="presupuesto-user-id"
|
||||||
<div class="col-md-4"></div>
|
disabled>
|
||||||
<div class="col-md-4"></div>
|
</div>
|
||||||
|
<div class="col-md-2 overflow-hidden w-20">
|
||||||
|
<label class="switch switch-square switch-lg">
|
||||||
|
<input type="checkbox" class="switch-input" 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>
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
|
|
||||||
<label for="error-presupuesto-form-datos" class="form-label">Datos</label>
|
<div class="col-md-6 mb-3 overflow-hidden">
|
||||||
<input
|
<label for="comments-presupuesto">Comentarios</label>
|
||||||
type="text"
|
<div class="input-group mb-3">
|
||||||
name="datos"
|
<textarea rows="10" class="form-control" id="comments-presupuesto"
|
||||||
id="error-presupuesto-form-datos"
|
placeholder="Comentarios"></textarea>
|
||||||
class="form-control"
|
<button class="btn btn-primary button-update-comment" type="button"><span
|
||||||
placeholder="Datos presupuesto" />
|
class="ti ti-md ti-send" id="update-button-icon"></span></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div><!--//.card-body -->
|
</div>
|
||||||
|
<!--//.card-body -->
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
|
|
||||||
</div><!--//.card-footer -->
|
</div>
|
||||||
</div><!--//.card -->
|
<!--//.card-footer -->
|
||||||
</div><!--//.col -->
|
</div>
|
||||||
</div><!--//.row -->
|
<!--//.card -->
|
||||||
|
</div>
|
||||||
|
<!--//.col -->
|
||||||
|
<!--//.row -->
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
<?= $this->section("additionalExternalJs") ?>
|
<?= $this->section("additionalExternalJs") ?>
|
||||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/configuracion/errorPresupuestoForm.js') ?>"></script>
|
<script type="module" src="<?= site_url('assets/js/safekat/pages/configuracion/error_presupuesto/indexForm.js') ?>">
|
||||||
|
</script>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -10,7 +10,8 @@
|
|||||||
<div class="card card-info">
|
<div class="card card-info">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title"><?= lang('ErrorPresupuesto.cardTitle') ?></h3>
|
<h3 class="card-title"><?= lang('ErrorPresupuesto.cardTitle') ?></h3>
|
||||||
</div><!--//.card-header -->
|
</div>
|
||||||
|
<!--//.card-header -->
|
||||||
<div class="card-body" id="errorPresupuestoCard">
|
<div class="card-body" id="errorPresupuestoCard">
|
||||||
|
|
||||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||||
@ -18,9 +19,8 @@
|
|||||||
<table id="tableErrorPresupuesto" class="table table-striped table-hover" style="width: 100%;">
|
<table id="tableErrorPresupuesto" class="table table-striped table-hover" style="width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
<th>ID Presupuesto</th>
|
||||||
<th>Presupuesto</th>
|
<th><?= lang('ErrorPresupuesto.datatable.columns.usuario') ?></th>
|
||||||
<th>Usuario</th>
|
|
||||||
<th><?= lang('ErrorPresupuesto.datatable.columns.last_user_id') ?></th>
|
<th><?= lang('ErrorPresupuesto.datatable.columns.last_user_id') ?></th>
|
||||||
<th><?= lang('ErrorPresupuesto.datatable.columns.visto') ?></th>
|
<th><?= lang('ErrorPresupuesto.datatable.columns.visto') ?></th>
|
||||||
<th><?= lang('ErrorPresupuesto.datatable.columns.created_at') ?></th>
|
<th><?= lang('ErrorPresupuesto.datatable.columns.created_at') ?></th>
|
||||||
@ -31,14 +31,20 @@
|
|||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div><!--//.card-body -->
|
</div>
|
||||||
|
<!--//.card-body -->
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
|
|
||||||
</div><!--//.card-footer -->
|
</div>
|
||||||
</div><!--//.card -->
|
<!--//.card-footer -->
|
||||||
</div><!--//.col -->
|
</div>
|
||||||
</div><!--//.row -->
|
<!--//.card -->
|
||||||
|
</div>
|
||||||
|
<!--//.col -->
|
||||||
|
</div>
|
||||||
|
<!--//.row -->
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
<?= $this->section("additionalExternalJs") ?>
|
<?= $this->section("additionalExternalJs") ?>
|
||||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/configuracion/error_presupuesto/indexView.js') ?>"></script>
|
<script type="module" src="<?= site_url('assets/js/safekat/pages/configuracion/error_presupuesto/indexView.js') ?>">
|
||||||
|
</script>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -14,104 +14,104 @@ if (
|
|||||||
auth()->user()->can('roles-permisos.menu')
|
auth()->user()->can('roles-permisos.menu')
|
||||||
) {
|
) {
|
||||||
?>
|
?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="javascript:void(0);" class="menu-link menu-toggle">
|
<a href="javascript:void(0);" class="menu-link menu-toggle">
|
||||||
<i class="menu-icon tf-icons ti ti-adjustments-horizontal"></i>
|
<i class="menu-icon tf-icons ti ti-adjustments-horizontal"></i>
|
||||||
<?= lang("App.menu_configuration") ?>
|
<?= lang("App.menu_configuration") ?>
|
||||||
</a>
|
</a>
|
||||||
<ul class="menu-sub">
|
<ul class="menu-sub">
|
||||||
|
|
||||||
<?php if (auth()->user()->can('paises.menu')) { ?>
|
<?php if (auth()->user()->can('paises.menu')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= route_to('paisList') ?>" class="menu-link">
|
<a href="<?= route_to('paisList') ?>" class="menu-link">
|
||||||
<?= lang("App.menu_paises") ?>
|
<?= lang("App.menu_paises") ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('formas-pago.menu')) { ?>
|
<?php if (auth()->user()->can('formas-pago.menu')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= route_to('formasPagoList') ?>" class="menu-link">
|
<a href="<?= route_to('formasPagoList') ?>" class="menu-link">
|
||||||
<?= lang("App.menu_formas_pago") ?>
|
<?= lang("App.menu_formas_pago") ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('papel-generico.menu')) { ?>
|
<?php if (auth()->user()->can('papel-generico.menu')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= site_url("configuracion/papelesgenericos") ?>" class="menu-link">
|
<a href="<?= site_url("configuracion/papelesgenericos") ?>" class="menu-link">
|
||||||
<?= lang("App.menu_papelgenerico") ?>
|
<?= lang("App.menu_papelgenerico") ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('papel-impresion.menu')) { ?>
|
<?php if (auth()->user()->can('papel-impresion.menu')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= site_url("configuracion/papelesimpresion") ?>" class="menu-link">
|
<a href="<?= site_url("configuracion/papelesimpresion") ?>" class="menu-link">
|
||||||
<?= lang("App.menu_papelimpresion") ?>
|
<?= lang("App.menu_papelimpresion") ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('maquinas.menu')) { ?>
|
<?php if (auth()->user()->can('maquinas.menu')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= site_url("configuracion/maquinas") ?>" class="menu-link">
|
<a href="<?= site_url("configuracion/maquinas") ?>" class="menu-link">
|
||||||
<?= lang("App.menu_maquina") ?>
|
<?= lang("App.menu_maquina") ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('maquinas-defecto.menu')) { ?>
|
<?php if (auth()->user()->can('maquinas-defecto.menu')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= site_url("configuracion/maquinasdefecto") ?>" class="menu-link">
|
<a href="<?= site_url("configuracion/maquinasdefecto") ?>" class="menu-link">
|
||||||
<?= lang("App.menu_maquina_defecto") ?>
|
<?= lang("App.menu_maquina_defecto") ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('usuarios.menu')) { ?>
|
<?php if (auth()->user()->can('usuarios.menu')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= site_url("configuracion/users") ?>" class="menu-link">
|
<a href="<?= site_url("configuracion/users") ?>" class="menu-link">
|
||||||
<?= lang("App.menu_users") ?>
|
<?= lang("App.menu_users") ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('roles-permisos.menu')) { ?>
|
<?php if (auth()->user()->can('roles-permisos.menu')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= site_url("configuracion/group") ?>" class="menu-link">
|
<a href="<?= site_url("configuracion/group") ?>" class="menu-link">
|
||||||
<?= lang("App.menu_permission_group") ?>
|
<?= lang("App.menu_permission_group") ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('proveedores.menu')) { ?>
|
<?php if (auth()->user()->can('proveedores.menu')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= route_to("proveedorList") ?>" class="menu-link">
|
<a href="<?= route_to("proveedorList") ?>" class="menu-link">
|
||||||
<?= lang("App.menu_proveedores") ?>
|
<?= lang("App.menu_proveedores") ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('ubicaciones.menu')) { ?>
|
<?php if (auth()->user()->can('ubicaciones.menu')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= route_to("ubicacionesList") ?>" class="menu-link">
|
<a href="<?= route_to("ubicacionesList") ?>" class="menu-link">
|
||||||
<?= lang("App.menu_ubicaciones") ?>
|
<?= lang("App.menu_ubicaciones") ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->can('series-facturas.menu')) { ?>
|
<?php if (auth()->user()->can('series-facturas.menu')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= route_to("seriesFacturasList") ?>" class="menu-link">
|
<a href="<?= route_to("seriesFacturasList") ?>" class="menu-link">
|
||||||
<?= lang("App.menu_series_facturas") ?>
|
<?= lang("App.menu_series_facturas") ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
|
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= route_to('variablesIndex') ?>" class="menu-link">
|
<a href="<?= route_to('erroresPresupuestoIndex') ?>" class="menu-link">
|
||||||
<?= lang("App.menu_variables") ?>
|
<?= lang("App.menu_error_presupuesto") ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
|
<?php if (auth()->user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?>
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
<a href="<?= route_to('errorPresupuestoIndex') ?>" class="menu-link">
|
<a href="<?= route_to('variablesIndex') ?>" class="menu-link">
|
||||||
<?= lang("App.menu_error_presupuesto") ?>
|
<?= lang("App.menu_variables") ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@ -4,8 +4,7 @@ class ErrorPresupuestoView {
|
|||||||
this.item = domItem
|
this.item = domItem
|
||||||
this.datatableItem = this.item.find("#tableErrorPresupuesto")
|
this.datatableItem = this.item.find("#tableErrorPresupuesto")
|
||||||
this.datatableColumns = [
|
this.datatableColumns = [
|
||||||
{ data: 'id', name: "id", searchable: true, sortable: false },
|
{ data: 'presupuestoId', searchable: true, sortable: false },
|
||||||
{ data: 'presupuestoTitulo',searchable: true, sortable: false },
|
|
||||||
{ data: 'presupuestoUser',searchable: true, sortable: false },
|
{ data: 'presupuestoUser',searchable: true, sortable: false },
|
||||||
{ data: 'lastUser', searchable: true, sortable: false },
|
{ data: 'lastUser', searchable: true, sortable: false },
|
||||||
{ data: 'visto', searchable: false, sortable: false ,
|
{ data: 'visto', searchable: false, sortable: false ,
|
||||||
|
|||||||
@ -1,44 +1,68 @@
|
|||||||
import Ajax from "../../../components/ajax.js"
|
|
||||||
|
|
||||||
|
|
||||||
|
import Ajax from "../../../components/ajax.js";
|
||||||
|
import ajax from "../../../components/ajax.js"
|
||||||
|
|
||||||
class ErrorPresupuestoView {
|
class ErrorPresupuestoForm {
|
||||||
constructor(domItem) {
|
constructor(domItem) {
|
||||||
this.item = domItem
|
this.item = domItem
|
||||||
this.datatableItem = this.item.find("#tableErrorPresupuesto")
|
this.form = this.item.find("#error-presupuesto-form")
|
||||||
this.datatableColumns = [
|
this.inputPresupuestoUserId = this.item.find("#presupuesto-user-id")
|
||||||
{ data: 'id', searchable: true, sortable: false },
|
this.inputDatos = this.item.find("#datos-presupuesto")
|
||||||
{ data: 'presupuestoTitulo', searchable: true, sortable: false },
|
this.inputComments = this.item.find("#comments-presupuesto")
|
||||||
{ data: 'presupuestoUser', searchable: true, sortable: false },
|
this.errorPresupuestoId = this.item.find("#error-presupuesto-id").attr("value")
|
||||||
{ data: 'visto', searchable: false, sortable: false },
|
this.updateBtnIcon = this.item.find("#update-button-icon")
|
||||||
{ data: 'lastUser', searchable: true, sortable: false },
|
|
||||||
{
|
|
||||||
data: 'action', sortable: false, searchable: false,
|
|
||||||
render: (d, t) => {
|
|
||||||
return `
|
|
||||||
<div class="btn-group btn-group-sm">
|
|
||||||
<a href="javascript:void(0)" data-id="${d}" class="edit-error-presupuesto"><i class="ti ti-eye ti-sm mx-2"></i></a>
|
|
||||||
</div>
|
|
||||||
`
|
|
||||||
}
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
init() {
|
init() {
|
||||||
this.datatable = this.datatableItem.DataTable({
|
this.item.on("click",".button-update-comment",this.handlePostErrorPresupuesto.bind(this))
|
||||||
processing: true,
|
this.handleGetErrorPresupuesto()
|
||||||
dom: 'Brtip',
|
}
|
||||||
serverSide: true,
|
handleGetErrorPresupuesto()
|
||||||
|
{
|
||||||
language: {
|
const ajax = new Ajax(
|
||||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
`/configuracion/errores-presupuesto/get/${this.errorPresupuestoId}`,
|
||||||
},
|
null,
|
||||||
columns: this.datatableColumns,
|
null,
|
||||||
ajax: '/configuracion/errores-presupuesto/datatable'
|
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.removeClass()
|
||||||
|
this.updateBtnIcon.addClass("ti ti-md ti-send")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
handleGetErrorPresupuestoError(){}
|
||||||
|
handlePostErrorPresupuesto()
|
||||||
|
{
|
||||||
|
let data =
|
||||||
|
{
|
||||||
|
"comments" : this.inputComments.val()
|
||||||
|
}
|
||||||
|
this.updateBtnIcon.removeClass()
|
||||||
|
this.updateBtnIcon.addClass("spinner-border spinner-border-lg text-secondary")
|
||||||
|
const ajax = new Ajax(
|
||||||
|
`/configuracion/errores-presupuesto/edit/${this.errorPresupuestoId}`,
|
||||||
|
data,
|
||||||
|
null,
|
||||||
|
this.handlePostErrorPresupuestoSuccess.bind(this),
|
||||||
|
this.handlePostErrorPresupuestoError.bind(this)
|
||||||
|
)
|
||||||
|
ajax.post()
|
||||||
|
}
|
||||||
|
handlePostErrorPresupuestoSuccess(){
|
||||||
|
this.updateBtnIcon.removeClass()
|
||||||
|
this.updateBtnIcon.addClass("ti ti-md ti-check")
|
||||||
|
|
||||||
|
this.handleGetErrorPresupuesto()
|
||||||
|
}
|
||||||
|
handlePostErrorPresupuestoError(error){}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ErrorPresupuestoView;
|
export default ErrorPresupuestoForm;
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
import ErrorPresupuestoForm from "./errorPresupuestoForm.js";
|
||||||
|
|
||||||
|
$(document).ready(() => {
|
||||||
|
const errorPresupuestoForm = new ErrorPresupuestoForm($("#error-presupuesto-container"))
|
||||||
|
errorPresupuestoForm.init()
|
||||||
|
})
|
||||||
6998
xdebug.log
6998
xdebug.log
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user