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:
@@ -6,6 +6,7 @@ use App\Models\Phase;
|
||||
use App\Models\Project;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Attributes\On;
|
||||
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
||||
use Rappasoft\LaravelLivewireTables\Views\Column;
|
||||
@@ -19,9 +20,9 @@ class PhaseTable extends DataTableComponent
|
||||
public function configure(): void
|
||||
{
|
||||
$this->setPrimaryKey('id')
|
||||
->setDefaultSort('order', 'asc')
|
||||
->setSortingPillsEnabled(false)
|
||||
->setAdditionalSelects(['phases.id as id', 'phases.order as order']);
|
||||
->setDefaultSort('order', 'asc')
|
||||
->setSortingPillsEnabled(false)
|
||||
->setAdditionalSelects(['phases.id as id', 'phases.order as order']);
|
||||
}
|
||||
|
||||
/** Re-render when the parent (PhaseList) creates/edits a phase. */
|
||||
@@ -49,64 +50,65 @@ class PhaseTable extends DataTableComponent
|
||||
Column::make('Orden', 'order')->sortable(),
|
||||
|
||||
Column::make('Nombre', 'name')
|
||||
->sortable()
|
||||
->searchable()
|
||||
->format(function ($value, $row) {
|
||||
$html = '<span class="font-medium">'.e($value).'</span>';
|
||||
if ($row->description) {
|
||||
$html .= '<div class="text-xs text-base-content/50 truncate max-w-xs">'.e(\Illuminate\Support\Str::limit($row->description, 60)).'</div>';
|
||||
}
|
||||
return $html;
|
||||
})
|
||||
->html(),
|
||||
->sortable()
|
||||
->searchable()
|
||||
->format(function ($value, $row) {
|
||||
$html = '<span class="font-medium">'.e($value).'</span>';
|
||||
if ($row->description) {
|
||||
$html .= '<div class="text-xs text-base-content/50 truncate max-w-xs">'.e(Str::limit($row->description, 60)).'</div>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
})
|
||||
->html(),
|
||||
|
||||
Column::make('Progreso', 'progress_percent')
|
||||
->sortable()
|
||||
->format(fn ($value) =>
|
||||
'<div class="flex items-center gap-2 min-w-[110px]">
|
||||
->sortable()
|
||||
->format(fn ($value) => '<div class="flex items-center gap-2 min-w-[110px]">
|
||||
<progress class="progress progress-primary w-24 h-2" value="'.(int) $value.'" max="100"></progress>
|
||||
<span class="text-xs text-base-content/60 w-8 text-right">'.(int) $value.'%</span>
|
||||
</div>')
|
||||
->html(),
|
||||
->html(),
|
||||
|
||||
Column::make('Fechas')
|
||||
->label(function ($row) {
|
||||
$ps = $row->planned_start?->format('d/m/Y');
|
||||
$pe = $row->planned_end?->format('d/m/Y');
|
||||
if (! $ps && ! $pe) {
|
||||
return '<span class="text-base-content/30 text-xs">—</span>';
|
||||
}
|
||||
return '<span class="text-xs">'.($ps ?: '?').' → '.($pe ?: '?').'</span>';
|
||||
})
|
||||
->html(),
|
||||
->label(function ($row) {
|
||||
$ps = $row->planned_start?->format('d/m/Y');
|
||||
$pe = $row->planned_end?->format('d/m/Y');
|
||||
if (! $ps && ! $pe) {
|
||||
return '<span class="text-base-content/30 text-xs">—</span>';
|
||||
}
|
||||
|
||||
return '<span class="text-xs">'.($ps ?: '?').' → '.($pe ?: '?').'</span>';
|
||||
})
|
||||
->html(),
|
||||
|
||||
Column::make('Color', 'color')
|
||||
->format(fn ($value) =>
|
||||
'<div class="w-6 h-6 rounded border border-base-300" style="background:'.e($value).'" title="'.e($value).'"></div>')
|
||||
->html(),
|
||||
->format(fn ($value) => '<div class="w-6 h-6 rounded border border-base-300" style="background:'.e($value).'" title="'.e($value).'"></div>')
|
||||
->html(),
|
||||
|
||||
Column::make('Acciones')
|
||||
->label(function ($row) {
|
||||
$user = Auth::user();
|
||||
$progress = route('phases.progress', $row->id);
|
||||
->label(function ($row) {
|
||||
$user = Auth::user();
|
||||
$progress = route('phases.progress', $row->id);
|
||||
|
||||
$html = '<div class="flex items-center justify-end gap-1">';
|
||||
$html .= '<a href="'.$progress.'" class="btn btn-xs btn-outline btn-info" title="Actualizar progreso" wire:navigate>
|
||||
$html = '<div class="flex items-center justify-end gap-1">';
|
||||
$html .= '<a href="'.$progress.'" class="btn btn-xs btn-outline btn-info" title="Actualizar progreso" wire:navigate>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"/></svg>
|
||||
</a>';
|
||||
if ($user->can('manage phases')) {
|
||||
$html .= '<button wire:click="$dispatch(\'phase-edit\', { id: '.$row->id.' })" class="btn btn-xs btn-ghost" title="Editar">
|
||||
if ($user->can('manage phases')) {
|
||||
$html .= '<button wire:click="$dispatch(\'phase-edit\', { id: '.$row->id.' })" class="btn btn-xs btn-ghost" title="Editar">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-3.5 h-3.5" 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>';
|
||||
$html .= '<button wire:click="deletePhase('.$row->id.')" wire:confirm="¿Eliminar la fase \''.e($row->name).'\'? Esta acción no se puede deshacer."
|
||||
$html .= '<button wire:click="deletePhase('.$row->id.')" wire:confirm="¿Eliminar la fase \''.e($row->name).'\'? Esta acción no se puede deshacer."
|
||||
class="btn btn-xs btn-error btn-outline" title="Eliminar">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-3.5 h-3.5" 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>';
|
||||
}
|
||||
$html .= '</div>';
|
||||
return $html;
|
||||
})
|
||||
->html(),
|
||||
}
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
})
|
||||
->html(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user