terminado envio de ferros

This commit is contained in:
2025-04-27 12:12:52 +02:00
parent a0b5f3b4df
commit b1932e6f85
6 changed files with 240 additions and 49 deletions

View File

@ -101,7 +101,14 @@ class LogisticaController extends BaseController
{
if ($this->request->isAJAX()) {
$query = LogisticaService::findForNewEnvio();
$tipo_envio = $this->request->getGet('tipo_envio') ?? 'estandar';
if($tipo_envio == 'ferro_prototipo'){
$query = LogisticaService::findForNewEnvioFerro();
} else {
$query = LogisticaService::findForNewEnvio();
}
if ($this->request->getGet("q")) {
$query->groupStart()
->orLike("id", $this->request->getGet("q"))
@ -121,12 +128,12 @@ class LogisticaController extends BaseController
public function selectDireccionForEnvio(){
if ($this->request->isAJAX()) {
$pedido_id = $this->request->getGet('pedido_id');
if($pedido_id == null || $pedido_id == 0){
$ot = $this->request->getGet('ot_id');
if($ot == null || $ot == 0){
return [];
}
$searchVal = $this->request->getGet("q") ?? "";
$result = LogisticaService::findDireccionesNewEnvio($pedido_id, $searchVal);
$result = LogisticaService::findDireccionesNewEnvio($ot, $searchVal);
return $this->response->setJSON($result);
} else {
@ -140,9 +147,22 @@ class LogisticaController extends BaseController
{
if ($this->request->isAJAX()) {
$pedido_id = $this->request->getPost('pedido_id');
$direccion = $this->request->getPost('direccion');
$result = LogisticaService::generateEnvio($pedido_id, $direccion);
$ot_id = $this->request->getPost('ot_id');
$direccion = $this->request->getPost('direccion') ?? "";
$result = LogisticaService::generateEnvio($ot_id, $direccion);
return $this->response->setJSON($result);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function generarEnvioFerro()
{
if ($this->request->isAJAX()) {
$ot_id = $this->request->getPost('ot_id');
$result = LogisticaService::generateEnvioFerro($ot_id);
return $this->response->setJSON($result);
} else {
return $this->failUnauthorized('Invalid request', 403);
@ -387,7 +407,7 @@ class LogisticaController extends BaseController
)->edit(
"unidadesEnvio",
function ($row, $meta) {
if($row->finalizado == 1){
if($row->finalizado == 1 || $row->tipo_envio == 'ferro_prototipo'){
return $row->unidadesEnvio;
}
return '<input type="number" class="form-control input-lineas input-unidades text-center"