trabajando en albaranes. Voy a quitar las cajas

This commit is contained in:
2025-04-20 20:02:14 +02:00
parent 65c9b34f56
commit 61abcb3dbd
18 changed files with 345 additions and 1654 deletions

View File

@ -164,7 +164,7 @@ class LogisticaController extends BaseController
return redirect()->to(base_url('logistica/selectEnvios/simple'))->with('error', lang('Logistica.errors.noEnvio'));
}
$envioEntity->nextCaja = model('App\Models\Logistica\EnvioLineaModel')->getMaxCaja();
$viewData = [
'currentModule' => static::$controllerSlug,
'boxTitle' => '<i class="ti ti-truck ti-xl"></i>' . ' ' . lang('Logistica.envio') . ' [' . $envioEntity->id . ']: ' . $envioEntity->direccion,
@ -190,14 +190,6 @@ class LogisticaController extends BaseController
return '<input type="checkbox" class="form-check-input checkbox-linea-envio" name="row_selected[]" value="' . $q->id . '">';
}
)
->add("action", callback: function ($q) {
return '
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="' . $q->id . '"></i></a>
</div>
';
})
->edit(
"pedido",
function ($row, $meta) {
@ -209,7 +201,23 @@ class LogisticaController extends BaseController
function ($row, $meta) {
return '<a href="' . base_url('presupuestoadmin/edit/' . $row->presupuesto) . '" target="_blank">' . $row->presupuesto . '</a>';
}
);;
)
->edit(
"cajas",
function ($row, $meta) {
return '<input type="number" class="form-control input-lineas input-cajas text-center"
data-id="'. $row->id.'" data-name="cajas" value="' . $row->cajas . '">';
}
)->edit(
"unidadesEnvio",
function ($row, $meta) {
return '<input type="number" class="form-control input-lineas input-unidades text-center"
data-id="'. $row->id.'" data-name="unidades_envio" value="' . $row->unidadesEnvio . '">';
}
)
->edit('cajasRaw', function ($row) {
return is_null($row->cajas) ? '__SIN__ASIGNAR__' : $row->cajas;
});
return $result->toJson(returnAsObject: true);
}
@ -248,12 +256,13 @@ class LogisticaController extends BaseController
}
}
public function updateUnidadesEnvio()
public function updateLineaEnvio()
{
$id = $this->request->getPost('id');
$unidades = $this->request->getPost('unidades_envio');
$fieldName = $this->request->getPost('name');
$fieldValue = $this->request->getPost('value');
if (!$id || !$unidades || intval($unidades) <= 0) {
if (!$id || !$fieldName || ($fieldName=='unidades_envio' && !$fieldValue)) {
return $this->response->setJSON([
'status' => false,
'message' => 'Datos inválidos'
@ -262,7 +271,7 @@ class LogisticaController extends BaseController
$model = model('App\Models\Logistica\EnvioLineaModel');
$updated = $model->update($id, [
'unidades_envio' => $unidades,
"" . $fieldName => $fieldValue==""? null: $fieldValue,
]);
return $this->response->setJSON([