add: filtro por tag_number en consultaV

This commit is contained in:
Juan Felipe Zapata Moreno 2025-12-29 13:41:10 -06:00
parent 30c0b8f587
commit e9fd55aa3b
3 changed files with 8 additions and 2 deletions

View File

@ -4,6 +4,7 @@
use App\Http\Controllers\Controller;
use App\Http\Requests\Repuve\CancelConstanciaRequest;
use App\Models\CatalogCancellationReason;
use Illuminate\Validation\ValidationException;
use App\Models\Record;
use App\Models\Tag;
@ -280,7 +281,7 @@ public function cancelarTagNoAsignado(Request $request)
$observations = $request->cancellation_observations;
// Verificar que existe el motivo de cancelación ANTES de crear el log
$cancellationReason = \App\Models\CatalogCancellationReason::find($request->cancellation_reason_id);
$cancellationReason = CatalogCancellationReason::find($request->cancellation_reason_id);
if (!$cancellationReason) {
DB::rollBack();
return ApiResponse::BAD_REQUEST->response([

View File

@ -292,6 +292,7 @@ public function searchRecord(Request $request)
'folio' => 'nullable|string',
'placa' => 'nullable|string',
'vin' => 'nullable|string',
'tag_number' => 'nullable|string',
'module_id' => 'nullable|integer|exists:modules,id',
'action_type' => 'nullable|string|in:inscripcion,actualizacion,sustitucion,cancelacion',
'status' => 'nullable|string',
@ -351,6 +352,11 @@ public function searchRecord(Request $request)
$q->where('niv', 'LIKE', '%' . $request->input('vin') . '%');
});
}
if ($request->filled('tag_number')) {
$records->whereHas('vehicle.tag', function ($q) use ($request) {
$q->where('tag_number', 'LIKE', '%' . $request->input('tag_number') . '%');
});
}
// Filtro por módulo
if ($request->filled('module_id')) {
$records->where('module_id', $request->input('module_id'));

View File

@ -81,7 +81,6 @@ private function consultarPadron(string $tipo, string $valor): array
// Parsear la respuesta
return $this->parsearRespuesta($response);
} finally {
// Liberar recursos del CurlHandle (PHP 8.0+)
unset($ch);
}
}