feat(templates): importar de otro proyecto con tabla Rappasoft + selección múltiple

Sustituye el modal (proyecto + checkboxes) por una tabla Rappasoft:
- ImportTemplatesTable lista todas las plantillas de proyectos accesibles (excluye el
  destino), con filtros en cabecera (nombre, proyecto) y checkbox de selección (bulk).
- Acción masiva "Importar seleccionadas" copia al proyecto destino (dedupe por nombre)
  y avisa a TemplateManager por evento (templates-imported) para refrescar/cerrar.
- TemplateManager: eliminada la lógica vieja (importProjectId/importableTemplates/
  selectedImportTemplateIds/importFromProject); el modal embebe la tabla.

Tests: TemplateImportTest adaptado (selección+import, excluye destino). Suite 92 passing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-25 17:00:35 +02:00
co-authored by Claude Opus 4.8
parent 1697c16136
commit 7256c87182
4 changed files with 155 additions and 109 deletions
@@ -281,45 +281,18 @@
@if($showImportProjectModal)
<div class="fixed inset-0 z-40 bg-black/50" wire:click="$set('showImportProjectModal', false)"></div>
<div class="fixed inset-0 z-50 flex items-center justify-center p-4">
<div class="bg-base-100 rounded-box shadow-2xl w-full max-w-lg max-h-[90vh] overflow-y-auto">
<div class="bg-base-100 rounded-box shadow-2xl w-full max-w-4xl max-h-[90vh] overflow-y-auto">
<div class="flex items-center justify-between p-4 border-b border-base-300">
<h3 class="font-bold">{{ __('Import from another project') }}</h3>
<div>
<h3 class="font-bold">{{ __('Import from another project') }}</h3>
<p class="text-xs text-base-content/60">{{ __('Mark the templates and use "Import selected".') }}</p>
</div>
<button wire:click="$set('showImportProjectModal', false)" class="btn btn-sm btn-ghost btn-circle">
<x-heroicon-o-x-mark class="w-4 h-4" />
</button>
</div>
<div class="p-4 space-y-3">
<div class="form-control">
<label class="label"><span class="label-text font-medium">{{ __('Project') }}</span></label>
<select wire:model.live="importProjectId" class="select select-bordered w-full">
<option value="">{{ __('Select project...') }}</option>
@foreach($availableProjects as $p)
<option value="{{ $p->id }}">{{ $p->name }}</option>
@endforeach
</select>
</div>
@if($importProjectId)
@if(count($importableTemplates))
<div class="border border-base-300 rounded-box p-2 space-y-1 max-h-64 overflow-y-auto">
@foreach($importableTemplates as $t)
<label class="flex items-center gap-2 p-1 hover:bg-base-200 rounded cursor-pointer">
<input type="checkbox" wire:model="selectedImportTemplateIds" value="{{ $t->id }}" class="checkbox checkbox-sm" />
<span class="text-sm">{{ $t->name }}</span>
<span class="text-xs text-base-content/50">({{ count($t->fields ?? []) }} {{ __('fields') }})</span>
</label>
@endforeach
</div>
@else
<p class="text-sm text-base-content/40 py-2">{{ __('This project has no templates.') }}</p>
@endif
@endif
</div>
<div class="flex justify-end gap-2 p-4 border-t border-base-300">
<button wire:click="$set('showImportProjectModal', false)" class="btn btn-ghost btn-sm">{{ __('Cancel') }}</button>
<button wire:click="importFromProject" class="btn btn-primary btn-sm" @disabled(empty($selectedImportTemplateIds))>
{{ __('Import selected') }}
</button>
<div class="p-4">
<livewire:projects.import-templates-table :project-id="$project->id" :key="'import-tpl-'.$project->id" />
</div>
</div>
</div>