mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
96 lines
3.4 KiB
PHP
96 lines
3.4 KiB
PHP
<?php namespace App\Controllers\Configuracion;
|
|
|
|
|
|
use App\Controllers\GoBaseResourceController;
|
|
|
|
use App\Models\Collection;
|
|
|
|
use App\Entities\Configuracion\MaquinasPapelesImpresionEntity;
|
|
|
|
use App\Models\Configuracion\MaquinasPapelesImpresionModel;
|
|
|
|
use App\Models\Configuracion\MaquinaModel;
|
|
|
|
use
|
|
DataTables\Editor,
|
|
DataTables\Database,
|
|
DataTables\Editor\Field,
|
|
DataTables\Editor\Format,
|
|
DataTables\Editor\Mjoin,
|
|
DataTables\Editor\Options,
|
|
DataTables\Editor\Upload,
|
|
DataTables\Editor\Validate,
|
|
DataTables\Editor\ValidateOptions;
|
|
|
|
class Maquinaspapelesimpresion extends \App\Controllers\GoBaseResourceController {
|
|
|
|
|
|
protected $modelName = MaquinasPapelesImpresionModel::class;
|
|
protected $format = 'json';
|
|
|
|
protected static $singularObjectName = 'Maquinas Papel Impresion';
|
|
protected static $singularObjectNameCc = 'maquinasPapelImpresion';
|
|
protected static $pluralObjectName = 'Maquinas Papeles Impresion';
|
|
protected static $pluralObjectNameCc = 'maquinasPapelesImpresion';
|
|
|
|
protected static $controllerSlug = 'maquinaspapelesimpresion';
|
|
|
|
protected static $viewPath = 'themes/backend/vuexy/form/configuracion/maquinas/';
|
|
|
|
protected $indexRoute = '';
|
|
|
|
|
|
|
|
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
|
|
$this->viewData['pageTitle'] = '';
|
|
$this->viewData['usingSweetAlert'] = true;
|
|
parent::initController($request, $response, $logger);
|
|
}
|
|
|
|
|
|
public function index() {
|
|
|
|
$viewData = [
|
|
'currentModule' => static::$controllerSlug,
|
|
'pageSubTitle' => '',
|
|
'maquinasTarifasImpresion' => new Maquinaspapelesimpresion(),
|
|
'usingServerSideDataTable' => true,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
public function datatable() {
|
|
if ($this->request->isAJAX()) {
|
|
$reqData = $this->request->getPost();
|
|
if (!isset($reqData['draw']) || !isset($reqData['columns']) ) {
|
|
$errstr = 'No data available in response to this specific request.';
|
|
$response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr);
|
|
return $response;
|
|
}
|
|
$start = $reqData['start'] ?? 0;
|
|
$length = $reqData['length'] ?? 5;
|
|
$search = $reqData['search']['value'];
|
|
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
|
|
$order = MaquinasPapelesImpresionModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
|
|
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
|
|
|
// el primer dato representa el uso y el segundo el tipo
|
|
//$tarifas = $reqData['tarifas'] ?? [];
|
|
// Para saber si el papel que se tiene que mostrar es para rotativa
|
|
$isRotativa= $reqData['isRotativa'] ?? 0;
|
|
|
|
$resourceData = $this->model->getResource("", $isRotativa)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
|
|
|
return $this->respond(Collection::datatable(
|
|
$resourceData,
|
|
$this->model->getResource()->countAllResults(),
|
|
$this->model->getResource($search, $isRotativa)->countAllResults()
|
|
));
|
|
} else {
|
|
return $this->failUnauthorized('Invalid request', 403);
|
|
}
|
|
}
|
|
|
|
}
|