voy a añadir grupos de cajas

This commit is contained in:
2025-04-18 10:36:06 +02:00
parent 3949607a3c
commit 15f6d0d675
5 changed files with 125 additions and 56 deletions

View File

@ -80,14 +80,14 @@ class LogisticaController extends BaseController
];
return $this->response->setJSON($result);
}
$result = LogisticaService::findPedidoOrISBN($search, $envio_id);
$result = LogisticaService::findPedidoOrISBN($search);
return $this->response->setJSON($result);
}
public function selectAddEnvioLinea(){
if ($this->request->isAJAX()) {
$query = LogisticaService::findLineaEnvio($this->request->getGet('direccion'))->orderBy("nombre", "asc");
$query = LogisticaService::findLineaEnvioPorEnvio($this->request->getGet('envio'))->orderBy("name", "asc");
if ($this->request->getGet("q")) {
$query->groupStart()
->orLike("pedidos.id", $this->request->getGet("q"))
@ -95,7 +95,24 @@ class LogisticaController extends BaseController
->groupEnd();
}
return $this->response->setJSON($query->get()->getResultObject());
$result = $query->get()->getResultObject();
return $this->response->setJSON($result);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function addEnvioLinea(){
if ($this->request->isAJAX()) {
$pedido_id = $this->request->getGet('pedido_id');
$envio_id = $this->request->getGet('envio_id');
$envioModel = model('App\Models\Logistica\EnvioModel');
$direccion = $envioModel->find($envio_id)->direccion;
$result = LogisticaService::addLineaEnvio($envio_id, $pedido_id, $direccion);
return $this->response->setJSON($result);
} else {
return $this->failUnauthorized('Invalid request', 403);
}