feat delete portada and remove loader

This commit is contained in:
amazuecos
2025-03-30 19:30:30 +02:00
parent 053ce49279
commit 4991642d48
9 changed files with 169 additions and 10 deletions

View File

@ -253,6 +253,22 @@ class Ordentrabajo extends BaseController
return $this->response->setJSON(["message" => "Portada error", "error" => $th->getMessage()])->setStatusCode($th->getCode());
}
}
public function delete_orden_trabajo_portada($orden_trabajo_id)
{
try {
helper('filesystem');
$otEntity = $this->otModel->find($orden_trabajo_id);
$pathActualFile = $otEntity->portada_path;
$fullPath = WRITEPATH . 'uploads/' . $pathActualFile;
if(file_exists($fullPath)){
delete_files($fullPath);
}
$r = $this->otModel->update($otEntity->id, ["portada_path" => null]);
return $this->response->setJSON(["message" => "Portada eliminada", "data" => $r]);
} catch (\Throwable $th) {
return $this->response->setStatusCode(500)->setJSON(["message" => "Portada error", "error" => $th->getMessage()]);
}
}
public function get_portada_img($orden_trabajo_id)
{
$ot = $this->otModel->find($orden_trabajo_id);
@ -287,4 +303,25 @@ class Ordentrabajo extends BaseController
->add("action", fn($q) => $q)
->toJson(true);
}
public function select_maquina_planning_rot(){
$q = $this->request->getGet('q');
$result = $this->produccionService->querySelectMaquinaPlanningRotativa($q);
return $this->response->setJSON($result);
}
public function select_papel_planning_rot(){
$q = $this->request->getGet('q');
$result = $this->produccionService->querySelectPapelPlanningRot($q);
return $this->response->setJSON($result);
}
public function select_maquina_planning_plana(){
$q = $this->request->getGet('q');
$result = $this->produccionService->querySelectMaquinaPlanningPlana($q);
return $this->response->setJSON($result);
}
public function select_papel_planning_plana(){
$q = $this->request->getGet('q');
$result = $this->produccionService->querySelectPapelPlanningPlana($q);
return $this->response->setJSON($result);
}
}