otModel = model(OrdenTrabajoModel::class); $this->produccionService = new ProductionService(); parent::initController($request, $response, $logger); } public function index() { // Breadcrumbs $this->viewData['breadcrumb'] = [ ['title' => lang("Produccion.ot"), 'route' => "javascript:void(0);", 'active' => false], ['title' => lang("Produccion.ots"), 'route' => site_url('produccion/ordentrabajo'), 'active' => true] ]; return view(static::$viewPath . $this->indexRoute, $this->viewData); } public function delete() { } public function get_orden_trabajo_summary($orden_trabajo_id){ $summary = $this->produccionService->init($orden_trabajo_id)->getSummary(); return $this->response->setJSON($summary); } public function add() { } public function edit($orden_trabajo_id) { // Breadcrumbs $this->viewData['breadcrumb'] = [ ['title' => lang("Produccion.ot"), 'route' => "javascript:void(0);", 'active' => false], ['title' => $this->otModel->find($orden_trabajo_id)->pedido()->presupuesto()->titulo, 'route' => site_url('produccion/ordentrabajo/edit/'.$orden_trabajo_id), 'active' => true] ]; $this->viewData["modelId"] = $orden_trabajo_id; $this->produccionService->init($orden_trabajo_id); $this->viewData["presupuesto"] = $this->produccionService->getPresupuesto(); $this->viewData["cliente"] = $this->produccionService->getCliente(); $this->viewData["ot"] = $this->produccionService->getOrdenTrabajo(); return view(static::$viewPath . $this->editRoute, $this->viewData); } public function datatable(){ $q = $this->otModel->getDatatableQuery(); // return $this->response->setJSON($q->get()->getResultArray()); return DataTable::of($q) ->add("action" ,fn($q) => $q->id) ->toJson(true); } }