cambiado ael añadir envios

This commit is contained in:
2025-04-24 23:44:07 +02:00
parent f16654f4ad
commit 5c68334e9a
8 changed files with 200 additions and 109 deletions

View File

@ -69,6 +69,46 @@ class LogisticaController extends BaseController
return view(static::$viewPath . 'viewLogisticaSelectEnvios', $viewData);
}
public function findPedidosNewEnvio()
{
if ($this->request->isAJAX()) {
$query = LogisticaService::findPedidosNewEnvio();
if ($this->request->getGet("q")) {
$query->groupStart()
->orLike("id", $this->request->getGet("q"))
->orLike("name", $this->request->getGet("q"))
->groupEnd();
}
$result = $query->orderBy("name", "asc")->get()->getResultObject();
return $this->response->setJSON($result);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function selectDireccionForEnvio(){
if ($this->request->isAJAX()) {
$pedido_id = $this->request->getGet('pedido_id');
if($pedido_id == null || $pedido_id == 0){
return [];
}
$searchVal = $this->request->getGet("q") ?? "";
$result = LogisticaService::findDireccionesNewEnvio($pedido_id, $searchVal);
return $this->response->setJSON($result);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function searchPedidoOrISBN($search = "", $envio_id = null)
{