trabajando

This commit is contained in:
2025-04-16 18:24:48 +02:00
parent 6a4e9b611e
commit 3ada529b6e
5 changed files with 173 additions and 24 deletions

View File

@ -8,6 +8,7 @@ use App\Services\LogisticaService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use Hermawan\DataTables\DataTable;
class LogisticaController extends BaseController
{
@ -69,16 +70,45 @@ class LogisticaController extends BaseController
return view(static::$viewPath . 'viewLogisticaSelectEnvios', $viewData);
}
public function searchPedidoOrISBN($search = ""){
public function searchPedidoOrISBN($search = "")
{
if(empty($search)){
if (empty($search)) {
$result = [
'status' => false,
'message' => lang('Logistica.errors.noDataToFind'),
];
return $this->response->setJSON($result);
return $this->response->setJSON($result);
}
$result = LogisticaService::findPedidoOrISBN($search);
return $this->response->setJSON($result);
return $this->response->setJSON($result);
}
public function datatable_envios()
{
$model = model('App\Models\Logistica\EnvioModel');
$q = $model->getDatatableQuery();
$result = DataTable::of($q)
->edit(
"finalizado",
function ($row, $meta) {
if ($row->finalizado == 1)
return '<i class="ti ti-check"></i>';
else
return '<i class="ti ti-x"></i>';
}
)
->add("action", callback: function ($q) {
return '
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-eye ti-sm btn-edit mx-2" data-id="' . $q->id . '"></i></a>
</div>
';
});
return $result->toJson(returnAsObject: true);
}
}