mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'add/view_logistica_principal' of https://git.imnavajas.es/jjimenez/safekat into add/view_logistica_principal
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
<?php namespace App\Controllers\Configuracion;
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Configuracion;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
@ -56,7 +58,7 @@ class Imposiciones extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
@ -130,7 +132,7 @@ class Imposiciones extends \App\Controllers\BaseResourceController
|
||||
return $this->redirect2listView('sweet-error', $message);
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
@ -279,6 +281,9 @@ class Imposiciones extends \App\Controllers\BaseResourceController
|
||||
];
|
||||
return $orientacionOptions;
|
||||
}
|
||||
|
||||
|
||||
public function selectImposicion()
|
||||
{
|
||||
$data = $this->model->querySelect($this->request->getGet('q'));
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,7 +118,26 @@ class Ordentrabajo extends BaseController
|
||||
return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400);
|
||||
}
|
||||
}
|
||||
|
||||
public function update_orden_trabajo_pedido_date()
|
||||
{
|
||||
try {
|
||||
$bodyData = $this->request->getPost();
|
||||
$r = $this->produccionService->init($bodyData["orden_trabajo_id"])->updateOrdenTrabajoPedidoDate($bodyData);
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r["status"], "user" => $r["user"], "data" => $bodyData]);
|
||||
} catch (\Throwable $th) {
|
||||
return $this->response->setJSON(["errors" => $th->getMessage(), "status" => false])->setStatusCode(500);
|
||||
}
|
||||
}
|
||||
public function update_orden_trabajo_pedido()
|
||||
{
|
||||
try {
|
||||
$bodyData = $this->request->getPost();
|
||||
$r = $this->produccionService->init($bodyData["orden_trabajo_id"])->updateOrdenTrabajoPedido($bodyData);
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r,"data" => $bodyData]);
|
||||
} catch (\Throwable $th) {
|
||||
return $this->response->setJSON(["errors" => $th->getMessage(), "status" => false])->setStatusCode(500);
|
||||
}
|
||||
}
|
||||
public function edit($orden_trabajo_id)
|
||||
{
|
||||
// Breadcrumbs
|
||||
@ -131,6 +150,9 @@ class Ordentrabajo extends BaseController
|
||||
$this->viewData["presupuesto"] = $this->produccionService->getPresupuesto();
|
||||
$this->viewData["cliente"] = $this->produccionService->getCliente();
|
||||
$this->viewData["ot"] = $this->produccionService->getOrdenTrabajo();
|
||||
$this->viewData["user_dates"] = $this->produccionService->userDates();
|
||||
$this->viewData["pedido_user_dates"] = $this->produccionService->pedidoUserDates();
|
||||
|
||||
return view(static::$viewPath . $this->editRoute, $this->viewData);
|
||||
}
|
||||
|
||||
@ -141,7 +163,7 @@ class Ordentrabajo extends BaseController
|
||||
$q = $this->otModel->getDatatableQuery()->where("ordenes_trabajo.estado", "F");
|
||||
// return $this->response->setJSON($q->get()->getResultArray());
|
||||
return DataTable::of($q)
|
||||
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name])
|
||||
->edit(
|
||||
"fecha_encuadernado_at",
|
||||
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||
@ -156,7 +178,7 @@ class Ordentrabajo extends BaseController
|
||||
$q = $this->otModel->getDatatableQuery()->whereIn("ordenes_trabajo.estado", ["I", "PM"]);
|
||||
// return $this->response->setJSON($q->get()->getResultArray());
|
||||
return DataTable::of($q)
|
||||
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name])
|
||||
->edit(
|
||||
"fecha_encuadernado_at",
|
||||
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||
@ -171,7 +193,7 @@ class Ordentrabajo extends BaseController
|
||||
$q = $this->otModel->getDatatableQuery()->where("ferro_ok_at", null);
|
||||
// return $this->response->setJSON($q->get()->getResultArray());
|
||||
return DataTable::of($q)
|
||||
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name])
|
||||
->edit(
|
||||
"fecha_encuadernado_at",
|
||||
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||
@ -186,7 +208,7 @@ class Ordentrabajo extends BaseController
|
||||
$q = $this->otModel->getDatatableQuery()->where("ferro_ok_at is NOT NULL", NULL, FALSE);
|
||||
// return $this->response->setJSON($q->get()->getResultArray());
|
||||
return DataTable::of($q)
|
||||
->add("logo", fn($q) => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)))
|
||||
->add("logo", fn($q) => ["logo" => site_url($logo->get_logo_path($q->presupuesto_linea_tipo)), "imposicion" => $q->imposicion_name])
|
||||
->edit(
|
||||
"fecha_encuadernado_at",
|
||||
fn($q) => $q->fecha_encuadernado_at ? Time::createFromFormat("Y-m-d", $q->fecha_encuadernado_at)->format("d/m/Y") : ""
|
||||
@ -232,6 +254,7 @@ class Ordentrabajo extends BaseController
|
||||
->edit("tiempo_estimado", fn($q) => float_seconds_to_hhmm_string($q->tiempo_estimado))
|
||||
->edit("tiempo_real", fn($q) => float_seconds_to_hhmm_string($q->tiempo_real))
|
||||
->edit("maquina_tarea", fn($q) => ["id" => $q->id, "maquina_id" => $q->maquina_tarea, "maquina_name" => $q->maquina_nombre])
|
||||
->add("imposicion", fn($q) => ["id" => $q->id, "imposicion_id" => $q->imposicion_id, "name" => $q->imposicion_name, "is_presupuesto_linea" => $q->presupuesto_linea_id ? true : false])
|
||||
->toJson(true);
|
||||
}
|
||||
public function get_pdf($orden_trabajo_id)
|
||||
@ -241,7 +264,6 @@ class Ordentrabajo extends BaseController
|
||||
public function upload_orden_trabajo_portada()
|
||||
{
|
||||
try {
|
||||
//code...
|
||||
$file = $this->request->getFile("portada_file");
|
||||
$bodyData = $this->request->getPost();
|
||||
$id = $bodyData["orden_trabajo_id"];
|
||||
@ -249,6 +271,12 @@ class Ordentrabajo extends BaseController
|
||||
$fullpath = null;
|
||||
if ($file->isValid() && !$file->hasMoved()) {
|
||||
$fullpath = $file->store('ordenes_trabajo_portadas');
|
||||
$otEntity = $this->otModel->find($id);
|
||||
if ($otEntity->portada_path) {
|
||||
if (file_exists($otEntity->full_path)) {
|
||||
unlink($otEntity->full_path);
|
||||
}
|
||||
}
|
||||
$r = $this->otModel->update($id, ["portada_path" => $fullpath]);
|
||||
}
|
||||
return $this->response->setJSON(["message" => "Portada subida", "data" => $r]);
|
||||
@ -256,7 +284,7 @@ class Ordentrabajo extends BaseController
|
||||
if ($fullpath) {
|
||||
delete_files($fullpath);
|
||||
}
|
||||
return $this->response->setJSON(["message" => "Portada error", "error" => $th->getMessage()])->setStatusCode($th->getCode());
|
||||
return $this->response->setJSON(["message" => "Portada error", "error" => $th->getMessage()])->setStatusCode(500);
|
||||
}
|
||||
}
|
||||
public function delete_orden_trabajo_portada($orden_trabajo_id)
|
||||
@ -280,7 +308,7 @@ class Ordentrabajo extends BaseController
|
||||
try {
|
||||
$ot = $this->otModel->find($orden_trabajo_id);
|
||||
if ($ot->portada_path) {
|
||||
$filePath = WRITEPATH . 'uploads/' . $ot->portada_path;
|
||||
$filePath = $ot->full_path;
|
||||
if (file_exists($filePath)) {
|
||||
|
||||
$mimeType = mime_content_type($filePath);
|
||||
@ -296,7 +324,6 @@ class Ordentrabajo extends BaseController
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->response->setJSON(["message" => "Portada error", "error" => $th->getMessage()])->setStatusCode(500);
|
||||
|
||||
}
|
||||
}
|
||||
public function planning_rotativa_datatable()
|
||||
|
||||
Reference in New Issue
Block a user