Modificado el controlador

This commit is contained in:
unknown
2025-04-02 15:53:30 +02:00
parent c960fd8539
commit 4872e498a5

View File

@ -2,69 +2,30 @@
namespace App\Controllers\Logistica;
use App\Models\Sistema\SettingsModel;
use CodeIgniter\Controller;
use App\Controllers\BaseController;
use App\Services\ImpresoraEtiquetaService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Models\Collection;
class Logisticacontroller extends \App\Controllers\BaseResourceController
class LogisticaController extends BaseController
{
protected $modelName = TicketModel::class;
protected $format = 'json';
protected ImpresoraEtiquetaService $impresoraEtiquetaService;
protected string $locale;
protected array $viewData;
protected static $singularObjectNameCc = 'logistica';
protected static $singularObjectName = 'Logistica';
protected static $pluralObjectName = 'Logistica';
protected static $controllerSlug = 'logistica';
protected static $viewPath = 'themes/vuexy/form/logistica/';
protected $indexRoute = 'panel';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
$this->viewData['pageTitle'] = lang('Logistica.logistica');
// Breadcrumbs
$this->viewData['breadcrumb'] = [
['title' => lang("App.menu_logistica"), 'route' => "javascript:void(0);", 'active' => false],
];
$this->impresoraEtiquetaService = service('impresora_etiqueta');
$this->locale = session()->get('lang');
parent::initController($request, $response, $logger);
}
public function index()
public function print_test_label()
{
//checkPermission('tickets.menu');
/*$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Tickets.tickets')]),
'usingServerSideDataTable' => true,
'userType' => auth()->user()->can('tickets.edit') ? 1 : 0,
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath . 'viewTicketList', $viewData);*/
}
public function panel()
{
//checkPermission('tickets.menu');
$viewData = [
'currentModule' => static::$controllerSlug,
'boxTitle' => lang('Logistica.panel'),
'pageSubTitle' => 'Panel',
'usingServerSideDataTable' => true,
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath . 'viewPanelLogistica', $viewData);
$etiquetaData = $this->impresoraEtiquetaService->test();
$responseMessage = $etiquetaData["status"] ? "OK" : "ERROR";
return $this->response->setJSON(["message" => $responseMessage, "data" => $etiquetaData, "status" => $etiquetaData["status"]]);
}
}