feat(templates): tabla Rappasoft con filtros para el catálogo global
- Nueva InspectionTemplatesTable (DataTableComponent): columnas Plantilla,
Descripción, Campos, Proyectos (uso) y Acciones; filtros en cabecera por nombre,
descripción y uso (en uso / sin uso). Gateada por manage templates.
- GlobalTemplateManager: el listado HTML se sustituye por la tabla embebida.
Acciones Editar/Borrar viajan por eventos (template-edit/template-delete);
el manager emite templates-changed al guardar/borrar/importar para que la tabla
se refresque (#[On('templates-changed')]).
Tests: GlobalTemplatesTest amplía con tabla (render + permiso, evento edit). Suite 91 passing.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Livewire\Inspections;
|
||||
use App\Models\InspectionTemplate;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Attributes\On;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithFileUploads;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
@@ -60,6 +61,7 @@ class GlobalTemplateManager extends Component
|
||||
$this->showForm = true;
|
||||
}
|
||||
|
||||
#[On('template-edit')]
|
||||
public function editTemplate($id)
|
||||
{
|
||||
$template = InspectionTemplate::findOrFail($id);
|
||||
@@ -135,12 +137,15 @@ class GlobalTemplateManager extends Component
|
||||
|
||||
$this->cancelForm();
|
||||
$this->loadTemplates();
|
||||
$this->dispatch('templates-changed');
|
||||
}
|
||||
|
||||
#[On('template-delete')]
|
||||
public function deleteTemplate($id)
|
||||
{
|
||||
InspectionTemplate::findOrFail($id)->delete();
|
||||
$this->loadTemplates();
|
||||
$this->dispatch('templates-changed');
|
||||
$this->dispatch('notify', 'Plantilla eliminada');
|
||||
}
|
||||
|
||||
@@ -203,6 +208,7 @@ class GlobalTemplateManager extends Component
|
||||
$this->importTemplateName = '';
|
||||
$this->importFile = null;
|
||||
$this->loadTemplates();
|
||||
$this->dispatch('templates-changed');
|
||||
$this->dispatch('notify', 'Plantilla importada');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user