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:
@@ -3,6 +3,7 @@
|
||||
namespace App\Livewire\Projects;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\Project;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Livewire\Attributes\On;
|
||||
@@ -18,20 +19,20 @@ class ProjectCompaniesTable extends DataTableComponent
|
||||
|
||||
/** role_in_project => label */
|
||||
public const ROLES = [
|
||||
'owner' => 'Promotor',
|
||||
'constructor' => 'Constructor',
|
||||
'owner' => 'Promotor',
|
||||
'constructor' => 'Constructor',
|
||||
'subcontractor' => 'Subcontratista',
|
||||
'consultant' => 'Consultor',
|
||||
'supplier' => 'Proveedor',
|
||||
'other' => 'Otro',
|
||||
'consultant' => 'Consultor',
|
||||
'supplier' => 'Proveedor',
|
||||
'other' => 'Otro',
|
||||
];
|
||||
|
||||
public function configure(): void
|
||||
{
|
||||
$this->setPrimaryKey('id')
|
||||
->setDefaultSort('companies.name', 'asc')
|
||||
->setSortingPillsEnabled(false)
|
||||
->setAdditionalSelects(['companies.id as id', 'company_project.role_in_project as role_in_project']);
|
||||
->setDefaultSort('companies.name', 'asc')
|
||||
->setSortingPillsEnabled(false)
|
||||
->setAdditionalSelects(['companies.id as id', 'company_project.role_in_project as role_in_project']);
|
||||
}
|
||||
|
||||
#[On('project-companies-changed')]
|
||||
@@ -51,48 +52,51 @@ class ProjectCompaniesTable extends DataTableComponent
|
||||
{
|
||||
return [
|
||||
Column::make('Empresa', 'name')
|
||||
->sortable()
|
||||
->searchable()
|
||||
->format(function ($value, $row) {
|
||||
$initial = strtoupper(mb_substr($value ?? '?', 0, 1));
|
||||
$html = '<div class="flex items-center gap-2">
|
||||
->sortable()
|
||||
->searchable()
|
||||
->format(function ($value, $row) {
|
||||
$initial = strtoupper(mb_substr($value ?? '?', 0, 1));
|
||||
$html = '<div class="flex items-center gap-2">
|
||||
<span class="w-7 h-7 rounded-full bg-primary text-primary-content flex items-center justify-center text-xs font-bold shrink-0">'.$initial.'</span>
|
||||
<div><span class="font-medium">'.e($value).'</span>';
|
||||
if ($row->tax_id) {
|
||||
$html .= '<div class="text-xs text-base-content/50">'.e($row->tax_id).'</div>';
|
||||
}
|
||||
$html .= '</div></div>';
|
||||
return $html;
|
||||
})
|
||||
->html(),
|
||||
if ($row->tax_id) {
|
||||
$html .= '<div class="text-xs text-base-content/50">'.e($row->tax_id).'</div>';
|
||||
}
|
||||
$html .= '</div></div>';
|
||||
|
||||
return $html;
|
||||
})
|
||||
->html(),
|
||||
|
||||
Column::make('Rol', 'role_in_project')
|
||||
->label(function ($row) {
|
||||
$current = $row->role_in_project;
|
||||
if (! Auth::user()->can('assign companies')) {
|
||||
return '<span class="badge badge-sm">'.(self::ROLES[$current] ?? ucfirst((string) $current)).'</span>';
|
||||
}
|
||||
$opts = '';
|
||||
foreach (self::ROLES as $val => $label) {
|
||||
$opts .= '<option value="'.$val.'"'.($current === $val ? ' selected' : '').'>'.$label.'</option>';
|
||||
}
|
||||
return '<select wire:change="changeRole('.$row->id.', $event.target.value)" class="select select-bordered select-xs">'.$opts.'</select>';
|
||||
})
|
||||
->html(),
|
||||
->label(function ($row) {
|
||||
$current = $row->role_in_project;
|
||||
if (! Auth::user()->can('assign companies')) {
|
||||
return '<span class="badge badge-sm">'.(self::ROLES[$current] ?? ucfirst((string) $current)).'</span>';
|
||||
}
|
||||
$opts = '';
|
||||
foreach (self::ROLES as $val => $label) {
|
||||
$opts .= '<option value="'.$val.'"'.($current === $val ? ' selected' : '').'>'.$label.'</option>';
|
||||
}
|
||||
|
||||
return '<select wire:change="changeRole('.$row->id.', $event.target.value)" class="select select-bordered select-xs">'.$opts.'</select>';
|
||||
})
|
||||
->html(),
|
||||
|
||||
Column::make('Acciones')
|
||||
->label(function ($row) {
|
||||
if (! Auth::user()->can('assign companies')) {
|
||||
return '';
|
||||
}
|
||||
return '<div class="flex justify-end">
|
||||
->label(function ($row) {
|
||||
if (! Auth::user()->can('assign companies')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return '<div class="flex justify-end">
|
||||
<button wire:click="removeCompany('.$row->id.')" wire:confirm="¿Quitar a '.e($row->name).' del proyecto?"
|
||||
class="btn btn-xs btn-error btn-outline" title="Quitar del proyecto">
|
||||
<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="M6 18L18 6M6 6l12 12"/></svg>
|
||||
</button>
|
||||
</div>';
|
||||
})
|
||||
->html(),
|
||||
})
|
||||
->html(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -111,7 +115,7 @@ class ProjectCompaniesTable extends DataTableComponent
|
||||
if (! array_key_exists($role, self::ROLES)) {
|
||||
return;
|
||||
}
|
||||
\App\Models\Project::findOrFail($this->projectId)
|
||||
Project::findOrFail($this->projectId)
|
||||
->companies()->updateExistingPivot($companyId, ['role_in_project' => $role]);
|
||||
$this->dispatch('project-companies-changed');
|
||||
$this->dispatch('notify', 'Rol actualizado.');
|
||||
@@ -120,7 +124,7 @@ class ProjectCompaniesTable extends DataTableComponent
|
||||
public function removeCompany($companyId): void
|
||||
{
|
||||
abort_unless(Auth::user()->can('assign companies'), 403);
|
||||
\App\Models\Project::findOrFail($this->projectId)->companies()->detach($companyId);
|
||||
Project::findOrFail($this->projectId)->companies()->detach($companyId);
|
||||
$this->dispatch('project-companies-changed');
|
||||
$this->dispatch('notify', 'Empresa eliminada del proyecto.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user