mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
add errores presupuesto
This commit is contained in:
@ -0,0 +1,80 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user