viewData['pageTitle'] = lang('Pedidos.moduleTitle'); // Se indica que este controlador trabaja con soft_delete $this->viewData = ['usingServerSideDataTable' => true]; // Breadcrumbs $this->viewData['breadcrumb'] = [ ['title' => lang("App.menu_pedidos"), 'route' => "javascript:void(0);", 'active' => false], ]; parent::initController($request, $response, $logger); } public function index() { $this->viewData['usingClientSideDataTable'] = true; $this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Tarifaextra.tarifaextra')]); parent::index(); } public function list() { $viewData = [ 'currentModule' => static::$controllerSlug, 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Pedidos.pedido')]), 'usingServerSideDataTable' => true, 'pageTitle' => lang('Facturas.facturas'), 'estadoPedidos' => 'todos', ['title' => lang("App.menu_facturas"), 'route' => site_url('facturas/list'), 'active' => true] ]; $viewData['breadcrumb'] = [ ['title' => lang("App.menu_facturas"), 'route' => "javascript:void(0);", 'active' => false], ['title' => lang("Facturas.facturaList"), 'route' => "javascript:void(0);", 'active' => true] ]; return view(static::$viewPath . 'viewFacturasList', $viewData); } 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'] ?? 0; $order = FacturaModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 0]; $dir = $reqData['order']['0']['dir'] ?? 'asc'; $resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); return $this->respond(Collection::datatable( $resourceData, $model_linea->getResource("")->countAllResults(), $model_linea->getResource($search)->countAllResults() )); } else { return $this->failUnauthorized('Invalid request', 403); } } }