chore: cleanup dead code + format with Pint
- Remove unused FeaturesController (empty stubs, no routes) - Remove ConvertSpatialFile CLI command (unused; service used in LayerManager) - Remove MigrateGeojsonToFeatures CLI command (one-shot migration, not referenced) - Remove .claude/worktrees/ (11 old agent worktrees from June) - Apply Laravel Pint formatting across 219 files (style only, no functional changes) Tests: 101 passing (319 assertions) API routes: unchanged (8 routes intact)
This commit is contained in:
@@ -22,16 +22,16 @@ class InspectionTable extends DataTableComponent
|
||||
public function configure(): void
|
||||
{
|
||||
$this->setPrimaryKey('id')
|
||||
->setDefaultSort('inspections.created_at', 'desc')
|
||||
->setSortingPillsEnabled(false)
|
||||
->setSecondaryHeaderEnabled()
|
||||
->setAdditionalSelects([
|
||||
'inspections.id as id',
|
||||
'inspections.created_at as created_at',
|
||||
'inspections.feature_id as feature_id',
|
||||
'inspections.template_id as template_id',
|
||||
'inspections.user_id as user_id',
|
||||
]);
|
||||
->setDefaultSort('inspections.created_at', 'desc')
|
||||
->setSortingPillsEnabled(false)
|
||||
->setSecondaryHeaderEnabled()
|
||||
->setAdditionalSelects([
|
||||
'inspections.id as id',
|
||||
'inspections.created_at as created_at',
|
||||
'inspections.feature_id as feature_id',
|
||||
'inspections.template_id as template_id',
|
||||
'inspections.user_id as user_id',
|
||||
]);
|
||||
}
|
||||
|
||||
public function builder(): Builder
|
||||
@@ -52,58 +52,57 @@ class InspectionTable extends DataTableComponent
|
||||
{
|
||||
return [
|
||||
Column::make('Fecha', 'created_at')
|
||||
->sortable()
|
||||
->secondaryHeaderFilter('fecha')
|
||||
->format(fn ($value, $row) => $row->created_at?->format('d/m/Y') ?? '—'),
|
||||
->sortable()
|
||||
->secondaryHeaderFilter('fecha')
|
||||
->format(fn ($value, $row) => $row->created_at?->format('d/m/Y') ?? '—'),
|
||||
|
||||
Column::make('Elemento')
|
||||
->secondaryHeaderFilter('elemento')
|
||||
->label(fn ($row) => $row->feature?->name
|
||||
? '<span class="font-medium">' . e($row->feature->name) . '</span>'
|
||||
: '<span class="text-base-content/30 text-xs">—</span>')
|
||||
->html(),
|
||||
->secondaryHeaderFilter('elemento')
|
||||
->label(fn ($row) => $row->feature?->name
|
||||
? '<span class="font-medium">'.e($row->feature->name).'</span>'
|
||||
: '<span class="text-base-content/30 text-xs">—</span>')
|
||||
->html(),
|
||||
|
||||
Column::make('Plantilla')
|
||||
->label(fn ($row) => e($row->template?->name ?? '—')),
|
||||
->label(fn ($row) => e($row->template?->name ?? '—')),
|
||||
|
||||
Column::make('Resultado', 'result')
|
||||
->sortable()
|
||||
->secondaryHeaderFilter('resultado')
|
||||
->format(fn ($value) => $value
|
||||
? '<span class="badge badge-sm badge-outline">' . e($value) . '</span>'
|
||||
: '<span class="text-base-content/30 text-xs">—</span>')
|
||||
->html(),
|
||||
->sortable()
|
||||
->secondaryHeaderFilter('resultado')
|
||||
->format(fn ($value) => $value
|
||||
? '<span class="badge badge-sm badge-outline">'.e($value).'</span>'
|
||||
: '<span class="text-base-content/30 text-xs">—</span>')
|
||||
->html(),
|
||||
|
||||
Column::make('Usuario')
|
||||
->secondaryHeaderFilter('usuario')
|
||||
->label(fn ($row) => e($row->user?->name ?? '—')),
|
||||
->secondaryHeaderFilter('usuario')
|
||||
->label(fn ($row) => e($row->user?->name ?? '—')),
|
||||
|
||||
Column::make('Fotos')
|
||||
->label(fn ($row) => $this->renderPhotosColumn($row))
|
||||
->html(),
|
||||
->label(fn ($row) => $this->renderPhotosColumn($row))
|
||||
->html(),
|
||||
|
||||
Column::make('Acciones')
|
||||
->label(fn ($row) =>
|
||||
'<div class="flex justify-end gap-1">'
|
||||
. '<button wire:click="$dispatch(\'map-view-inspection\', ' . $row->id . ')"'
|
||||
. 'class="btn btn-xs btn-ghost" title="Ver inspección">'
|
||||
. '<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>'
|
||||
. '</button>'
|
||||
. '@can("edit inspections")'
|
||||
. '<button wire:click="$dispatch(\'edit-inspection\', ' . $row->id . ')"'
|
||||
. 'class="btn btn-xs btn-ghost" title="Editar inspección">'
|
||||
. '<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/></svg>'
|
||||
. '</button>'
|
||||
. '@endcan'
|
||||
. '@can("delete inspections")'
|
||||
. '<button wire:click="$dispatch(\'delete-inspection\', ' . $row->id . ')"'
|
||||
. 'class="btn btn-xs btn-ghost btn-error" title="Eliminar inspección"'
|
||||
. 'onclick="return confirm(\'¿Eliminar esta inspección? No se puede deshacer.\');">'
|
||||
. '<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16\"/></svg>'
|
||||
. '</button>'
|
||||
. '@endcan'
|
||||
. '</div>')
|
||||
->html(),
|
||||
->label(fn ($row) => '<div class="flex justify-end gap-1">'
|
||||
.'<button wire:click="$dispatch(\'map-view-inspection\', '.$row->id.')"'
|
||||
.'class="btn btn-xs btn-ghost" title="Ver inspección">'
|
||||
.'<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>'
|
||||
.'</button>'
|
||||
.'@can("edit inspections")'
|
||||
.'<button wire:click="$dispatch(\'edit-inspection\', '.$row->id.')"'
|
||||
.'class="btn btn-xs btn-ghost" title="Editar inspección">'
|
||||
.'<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/></svg>'
|
||||
.'</button>'
|
||||
.'@endcan'
|
||||
.'@can("delete inspections")'
|
||||
.'<button wire:click="$dispatch(\'delete-inspection\', '.$row->id.')"'
|
||||
.'class="btn btn-xs btn-ghost btn-error" title="Eliminar inspección"'
|
||||
.'onclick="return confirm(\'¿Eliminar esta inspección? No se puede deshacer.\');">'
|
||||
.'<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16\"/></svg>'
|
||||
.'</button>'
|
||||
.'@endcan'
|
||||
.'</div>')
|
||||
->html(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -116,15 +115,14 @@ class InspectionTable extends DataTableComponent
|
||||
return '<span class="text-base-content/30 text-xs">—</span>';
|
||||
}
|
||||
|
||||
$thumbnails = $images->take(3)->map(fn ($m) =>
|
||||
'<a href="' . $m->url . '" target="_blank" class="inline-block mr-1">'
|
||||
. '<img src="' . $m->url . '" class="w-8 h-8 object-cover rounded border border-base-300" alt="' . e($m->name) . '" loading="lazy" />'
|
||||
. '</a>'
|
||||
$thumbnails = $images->take(3)->map(fn ($m) => '<a href="'.$m->url.'" target="_blank" class="inline-block mr-1">'
|
||||
.'<img src="'.$m->url.'" class="w-8 h-8 object-cover rounded border border-base-300" alt="'.e($m->name).'" loading="lazy" />'
|
||||
.'</a>'
|
||||
)->implode('');
|
||||
|
||||
$more = $count > 3 ? '<span class="text-xs text-base-content/50 ml-1">+' . ($count - 3) . '</span>' : '';
|
||||
$more = $count > 3 ? '<span class="text-xs text-base-content/50 ml-1">+'.($count - 3).'</span>' : '';
|
||||
|
||||
return '<div class="flex items-center">' . $thumbnails . $more . '</div>';
|
||||
return '<div class="flex items-center">'.$thumbnails.$more.'</div>';
|
||||
}
|
||||
|
||||
public function filters(): array
|
||||
@@ -134,7 +132,7 @@ class InspectionTable extends DataTableComponent
|
||||
->pluck('result', 'result')->toArray();
|
||||
|
||||
$users = User::whereIn('id', Inspection::where('project_id', $this->projectId)
|
||||
->whereNotNull('user_id')->distinct()->pluck('user_id'))
|
||||
->whereNotNull('user_id')->distinct()->pluck('user_id'))
|
||||
->orderBy('name')->pluck('name', 'id')->toArray();
|
||||
|
||||
return [
|
||||
@@ -143,7 +141,7 @@ class InspectionTable extends DataTableComponent
|
||||
|
||||
TextFilter::make('Elemento', 'elemento')
|
||||
->config(['placeholder' => 'Buscar elemento…'])
|
||||
->filter(fn (Builder $query, string $value) => $query->whereHas('feature', fn ($f) => $f->where('name', 'like', '%' . $value . '%'))),
|
||||
->filter(fn (Builder $query, string $value) => $query->whereHas('feature', fn ($f) => $f->where('name', 'like', '%'.$value.'%'))),
|
||||
|
||||
SelectFilter::make('Resultado', 'resultado')
|
||||
->options(['' => 'Todos'] + $results)
|
||||
@@ -154,4 +152,4 @@ class InspectionTable extends DataTableComponent
|
||||
->filter(fn (Builder $query, string $value) => $query->where('inspections.user_id', $value)),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user